Example #1
0
void Matrix<T>::fromDouble(const double* t, bool rowMajor) {
	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++){
			(*this)(i, j) = t[(rowMajor ? (i - 1) * getN() + (j - 1) : (j - 1) * getM() + (i - 1))];
		}
	}
}
Example #2
0
void Matrix<T>::toDouble(double* t, bool rowMajor) const {
	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++){
			t[(rowMajor ? (i - 1) * getN() + (j - 1) : (j - 1) * getM() + (i - 1))] = (*this)(i, j).toDouble();
		}
	}
}
Example #3
0
bool VoltageGatedIonSimulator<ncs::sim::DeviceType::CUDA>::
update(ChannelUpdateParameters* parameters) {
  auto old_state_buffer = state_subscription_->pull();
  const float* neuron_voltages = parameters->voltage;
  const float* old_m = old_state_buffer->getM();
  auto new_state_buffer = this->getBlank();
  float* channel_current = parameters->current;
  float* new_m = new_state_buffer->getM();
  float dt = parameters->time_step;
  cuda::updateVoltageGatedIon(neuron_plugin_ids_,
                              neuron_voltages,
                              v_half_,
                              deactivation_scale_,
                              activation_scale_,
                              equilibrium_scale_,
                              tau_scale_factor_,
                              old_m,
                              reversal_potential_,
                              conductance_,
                              new_m,
                              channel_current,
                              dt,
                              num_channels_);
  old_state_buffer->release();
  this->publish(new_state_buffer);
  return true;
}
Example #4
0
void Matrix<T>::toTypeSum(TYPE_SUM* t, bool rowMajor) const {
	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++){
			t[(rowMajor ? (i - 1) * getN() + (j - 1) : (j - 1) * getM() + (i - 1))] = ((*this)(i, j).type == 0 ? DOUBLE_TO_TYPE_SUM(*(*this)(i, j).d) : *(*this)(i, j).s);
		}
	}
}
Example #5
0
void VarproFunction::mulZmatPerm( gsl_vector* res, const gsl_matrix *Zmatr,
                                  const gsl_matrix *perm, size_t i, size_t j ) {
  gsl_matrix subJ = gsl_matrix_const_submatrix(Zmatr, j * getM(), 0, getM(),
                         Zmatr->size2).matrix;
  setPhiPermCol(i, perm, myPhiPermCol);    
  gsl_blas_dgemv(CblasTrans, 1.0, &subJ, myPhiPermCol, 0.0, res); 
}
Example #6
0
bool VoltageGatedIonSimulator<ncs::sim::DeviceType::CPU>::
update(ChannelUpdateParameters* parameters) {
  auto old_state_buffer = state_subscription_->pull();
  const float* neuron_voltages = parameters->voltage;
  const float* old_m = old_state_buffer->getM();
  auto new_state_buffer = this->getBlank();
  float* channel_current = parameters->current;
  float* new_m = new_state_buffer->getM();
  float dt = parameters->time_step;
  ncs::sim::AtomicWriter<float> current_adder;
  for (size_t i = 0; i < num_channels_; ++i) {
    unsigned int neuron_plugin_id = neuron_plugin_ids_[i];
    float neuron_voltage = neuron_voltages[neuron_plugin_id];
    float v_half = v_half_[i];
    float d_v = neuron_voltage - v_half;
    float beta = exp(d_v * deactivation_scale_[i]);
    float alpha = exp(d_v * activation_scale_[i]);
    float tau_m = tau_scale_factor_[i] / (alpha + beta);
    float m_infinity = 1.0f / (1.0f + exp(-d_v * equilibrium_scale_[i]));
    float dt_over_tau = dt / tau_m;
    float m = old_m[i] * (1.0f - dt_over_tau) + m_infinity * dt_over_tau;
    m = std::max(0.0f, std::min(m, 1.0f));
    new_m[i] = m;
    float current = 
      conductance_[i] * m * (reversal_potential_[i] - neuron_voltage);
    current_adder.write(channel_current + neuron_plugin_id, current);
  }
  std::unique_lock<std::mutex> lock(*(parameters->write_lock));
  current_adder.commit(ncs::sim::AtomicWriter<float>::Add);
  lock.unlock();
  old_state_buffer->release();
  this->publish(new_state_buffer);
  return true;
}
Example #7
0
bool CalciumDependentSimulator<ncs::sim::DeviceType::CUDA>::
update(ChannelUpdateParameters* parameters) {
  auto old_state_buffer = state_subscription_->pull();
  const float* neuron_voltages = parameters->voltage;
  const float* neuron_calcium = parameters->calcium;
  const float* old_m = old_state_buffer->getM();
  auto new_state_buffer = this->getBlank();
  float* channel_current = parameters->current;
  float* new_m = new_state_buffer->getM();
  float dt = parameters->time_step;
  cuda::updateCalciumDependent(neuron_plugin_ids_,
                               neuron_voltages,
                               neuron_calcium,
                               forward_scale_,
                               forward_exponent_,
                               backwards_rate_,
                               tau_scale_,
                               m_power_,
                               conductance_,
                               reversal_potential_,
                               old_m,
                               new_m,
                               channel_current,
                               dt,
                               num_channels_);
  old_state_buffer->release();
  this->publish(new_state_buffer);
  return true;
}
Example #8
0
IMatrix<T>& Matrix<T>::operator=(const IMatrix<T>& M) {
	// Vérifications
	if(getM() != M.getM() || getN() != M.getN()) throw domain_error("affectation impossible");

	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++) (*this)(i, j) = M(i, j);
	}

	return *this;
}
Example #9
0
void Cmodulus::FFT(vec_long &y, const ZZX& x) const
{
  FHE_TIMER_START;
  zz_pBak bak; bak.save();
  context.restore();

  zz_pX& tmp = Cmodulus::getScratch_zz_pX();
  { FHE_NTIMER_START(FFT_remainder);
    conv(tmp,x);      // convert input to zpx format
  }

  if (!ALT_CRT && zMStar->getPow2()) {
    // special case when m is a power of 2

    long k = zMStar->getPow2();
    long phim = (1L << (k-1));
    long dx = deg(tmp);
    long p = zz_p::modulus();

    const zz_p *powers_p = (*powers).rep.elts();
    const mulmod_precon_t *powers_aux_p = powers_aux.elts();

    y.SetLength(phim);
    long *yp = y.elts();

    zz_p *tmp_p = tmp.rep.elts();

    for (long i = 0; i <= dx; i++)
      yp[i] = MulModPrecon(rep(tmp_p[i]), rep(powers_p[i]), p, powers_aux_p[i]);
    for (long i = dx+1; i < phim; i++)
      yp[i] = 0;

    FFTFwd(yp, yp, k-1, *zz_pInfo->p_info);

    return;
  }
    

  zz_p rt;
  conv(rt, root);  // convert root to zp format

  BluesteinFFT(tmp, getM(), rt, *powers, powers_aux, *Rb); // call the FFT routine

  // copy the result to the output vector y, keeping only the
  // entries corresponding to primitive roots of unity
  y.SetLength(zMStar->getPhiM());
  long i,j;
  long m = getM();
  for (i=j=0; i<m; i++)
    if (zMStar->inZmStar(i)) y[j++] = rep(coeff(tmp,i));
}
Example #10
0
int Matrix<T>::distance(const IMatrix<T>& M) const {
	// Vérifications
	if(getM() != M.getM() || getN() != M.getN()) throw domain_error("calcul de la distance impossible");

	int n = 0;

	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++){
			if(!equal((*this)(i, j).toDouble(), M(i, j).toDouble(), EPS1, EPS0)) n++;
		}
	}

	return n;
}
Example #11
0
void VarproFunction::fillZmatTmpJac( gsl_matrix *Zmatr, const gsl_vector* y,
                                     const gsl_matrix *PhiTRt, double factor ) {
  for (size_t j_1 = 0; j_1 < getM(); j_1++) {
    for (size_t j = 0; j < getD(); j++) {
      gsl_vector tJr = gsl_matrix_row(Zmatr, j_1 + j * getM()).vector;
    
      myDeriv->calcDijGammaYr(&tJr, PhiTRt, j_1, j, y);
      gsl_vector_scale(&tJr, -factor);
      for (size_t k = 0; k < getN(); k++) {  /* Convert to vector strides */
        (*gsl_vector_ptr(&tJr, j + k * getD())) +=
             gsl_matrix_get(myMatr, k, j_1);
      }  
    }
  }
}
Example #12
0
double CC_Ev::H(const PlasticFlow& plastic_flow, const stresstensor& Stre, 
                const straintensor& Stra, const MaterialParameter& material_parameter)
{    
// this is \bar{p_0}
    // Make sure f = Q = q*q - M*M*p*(po - p) = 0
    
    double p0 = getp0(material_parameter);
    double lambda = getlambda(material_parameter);
    double kappa = getkappa(material_parameter);
    double e0 = gete0(material_parameter);
    
    double e = e0 + (1.0 + e0) *Stra.Iinvariant1();

    //// One way
    //straintensor PF = plastic_flow.PlasticFlowTensor(Stre, Stra, material_parameter);
    //double d_Ev = - PF.Iinvariant1(); // note "minus"

    // Another way
    double M = getM(material_parameter);
    double p = Stre.p_hydrostatic();
//    double d_Ev = -M*M*(p0-2.0*p); // Zhao's version
//    double d_Ev = (-1.0)*M*M*(p0 - 2.0*p); // Mahdi and Boris 27April2007
   double d_Ev = M*M*(2.0*p - p0);
   
    return (1.0 + e) * p0 * d_Ev / (lambda - kappa);
}
Example #13
0
void Matrix<T>::fromTypeSum(const TYPE_SUM* t, bool rowMajor) {
	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++){
			(*this)(i, j) = TYPE_SUM_TO_DOUBLE(t[(rowMajor ? (i - 1) * getN() + (j - 1) : (j - 1) * getM() + (i - 1))]);
		}
	}
}
Example #14
0
void GeneralSylvester::solve()
{
	if (solved)
		throw SYLV_MES_EXCEPTION("Attempt to run solve() more than once.");

	mem_driver.setStackMode(true);

	clock_t start = clock();
	// multiply d
	d.multLeftITrans(bdecomp->getQ());
	d.multRightKron(cdecomp->getQ(), order);
	// convert to KronVector
	KronVector dkron(d.getData(), getM(), getN(), order);
	// solve
	sylv->solve(pars, dkron);
	// multiply d back
	d.multLeftI(bdecomp->getQ());
	d.multRightKron(cdecomp->getInvQ(), order);
	clock_t end = clock();
	pars.cpu_time = ((double)(end-start))/CLOCKS_PER_SEC;

	mem_driver.setStackMode(false);

	solved = true;
}
const Matrix&
PFEMElement2DBubble::getMass()
{

    // resize K
    int ndf = this->getNumDOF();
    K.resize(ndf, ndf);
    K.Zero();

    double m = getM();
    double mp = getMp();
    
    // mass 
    for(int a=0; a<3; a++) {
        K(numDOFs(2*a), numDOFs(2*a)) = m;          // Mxd
        K(numDOFs(2*a)+1, numDOFs(2*a)+1) = m;      // Myd

        for(int b=0; b<3; b++) {
            if(a == b) {
                K(numDOFs(2*a+1), numDOFs(2*b+1)) = 2*mp;   // Mp
            } else {
                K(numDOFs(2*a+1), numDOFs(2*b+1)) = mp;   // Mp
            }
        }
    }
    //opserr<<"M = "<<K;
    return K;
}
Example #16
0
void Cmod<type>::iFFT(zpx &x, const zzv& y)const
{
  FHE_TIMER_START;
  zpBak bak; bak.save();
  context.restore();
  zp rt;

  long m = getM();

  // convert input to zpx format, initializing only the coeffs i s.t. (i,m)=1
  x.rep.SetLength(m);
  long i,j;
  for (i=j=0; i<m; i++)
    if (zMStar->inZmStar(i)) conv(x.rep[i], y[j++]);
  x.normalize();
  conv(rt, rInv);  // convert rInv to zp format

  BluesteinFFT(x, m, rt, *ipowers, ipowers_aux, *iRb, iRb_aux, *Ra); // call the FFT routine

  // reduce the result mod (Phi_m(X),q) and copy to the output polynomial x
FHE_NTIMER_START("iFFT:division")
  rem(x, x, *phimx); // out %= (Phi_m(X),q)
FHE_NTIMER_STOP("iFFT:division")

  // normalize
  zp mm_inv;
  conv(mm_inv, m_inv);
  x *= mm_inv; 


  FHE_TIMER_STOP;
}
Example #17
0
void Cmod<zz,zp,zpx,zzv,fftrep,zpContext>::privateInit(const PAlgebra& zms,
						       const zz& rt)
{
  context.restore(); // set NTL's current modulus
  zmStar = &zms;
  q = zp::modulus();
  root = rt;

  // First find a 2m-th root of unity modulo q, if not given
  if (IsZero(root)) {
    context.restore(); // Set the current modulus to q
    zp rtp;
    unsigned e = 2*getM();
    FindPrimitiveRoot(rtp,e);
    if (IsZero(rtp)) // sanity check
      Error("Cmod::compRoots(): no 2m'th roots of unity mod q");
    root = rep(rtp);
  }
  rInv = InvMod(root,q); // set rInv = root^{-1} mod q

  // allocate memory (current modulus was defined above)
  freeSpace();  // just in case
  powers  = new zpx();
  Rb      = new fftrep();
  ipowers = new zpx();
  iRb     = new fftrep();
}
Example #18
0
void Cmodulus::FFT_aux(vec_long &y, zz_pX& tmp) const
{

  if (zMStar->getPow2()) {
    // special case when m is a power of 2

    long k = zMStar->getPow2();
    long phim = (1L << (k-1));
    long dx = deg(tmp);
    long p = zz_p::modulus();

    const zz_p *powers_p = (*powers).rep.elts();
    const mulmod_precon_t *powers_aux_p = powers_aux.elts();

    y.SetLength(phim);
    long *yp = y.elts();

    zz_p *tmp_p = tmp.rep.elts();

    for (long i = 0; i <= dx; i++)
      yp[i] = MulModPrecon(rep(tmp_p[i]), rep(powers_p[i]), p, powers_aux_p[i]);
    for (long i = dx+1; i < phim; i++)
      yp[i] = 0;

#ifdef FHE_OPENCL
    AltFFTFwd(yp, yp, k-1, *altFFTInfo);
#else
    FFTFwd(yp, yp, k-1, *zz_pInfo->p_info);
#endif

    return;
  }
    

  zz_p rt;
  conv(rt, root);  // convert root to zp format

  BluesteinFFT(tmp, getM(), rt, *powers, powers_aux, *Rb); // call the FFT routine

  // copy the result to the output vector y, keeping only the
  // entries corresponding to primitive roots of unity
  y.SetLength(zMStar->getPhiM());
  long i,j;
  long m = getM();
  for (i=j=0; i<m; i++)
    if (zMStar->inZmStar(i)) y[j++] = rep(coeff(tmp,i));
}
Example #19
0
void ModelCallList::render()
{
	glPushMatrix();
		glMultMatrixf(getM());
		glCallList(idModel);
	glPopMatrix();
	Object3D::render();
}
Example #20
0
void  Cmod<zz,zp,zpx,zzv,fftrep,zpContext>::FFT(zzv &y, const ZZX& x) const
{
  context.restore();
  zp rt;
  zpx in, out;

  conv(in,x);      // convert input to zpx format
  conv(rt, root);  // convert root to zp format

  BluesteinFFT(out, in, getM(), rt, *powers, *Rb); // call the FFT routine

  // copy the result to the output vector y, keeping only the
  // entries corresponding to primitive roots of unity
  y.SetLength(zmStar->phiM());
  unsigned i,j;
  for (i=j=0; i<getM(); i++)
    if (zmStar->inZmStar(i)) y[j++] = rep(coeff(out,i));
}
Example #21
0
/* Compute the inverse deformation field within a single cube */
static void invert_it(int x0, int x1, int x2, float *y0, float *y1, float *y2,
	int dim_f[3], float *iy0, float *iy1, float *iy2, REAL U[4][3], REAL V[4][3])
{
	int i, j, k, vox[MAXV][3], nvox;
	REAL Y0[4][3], Y[4][3], M[4][3], IM[4][3];

	/* Determine tetrahedral arrangement */
        k = (x0%2)==(x1%2)==(x2%2);
 
	for(i=0; i<5; i++) /* Five tetrahedra within a cube */
	{
		/* Find the vertices (in mm space) */
		Y0[0][0] = y0[off[k][0][i]]; Y0[0][1] = y1[off[k][0][i]]; Y0[0][2] = y2[off[k][0][i]];
		Y0[1][0] = y0[off[k][1][i]]; Y0[1][1] = y1[off[k][1][i]]; Y0[1][2] = y2[off[k][1][i]];
		Y0[2][0] = y0[off[k][2][i]]; Y0[2][1] = y1[off[k][2][i]]; Y0[2][2] = y2[off[k][2][i]];
		Y0[3][0] = y0[off[k][3][i]]; Y0[3][1] = y1[off[k][3][i]]; Y0[3][2] = y2[off[k][3][i]];

		/* Convert vertex co-ordinates to voxels */
		mulMX(Y, U, Y0);

		/* Compute affine transform mapping vertices together */
		getM(Y, ix[k][i], M, x0, x1, x2);

		if (mxIsFinite(M[0][0])) /* Prevent from bombing out when NaNs are encountered */
		{
			/* Find integer co-ordinates within tetrahedron */
			scan_tetrahedron(Y, &nvox, vox, MAXV);

			if (nvox>0)
			{
				/* Invert the affine mapping */
				invertM(M, IM);

				/* Convert the mapping from voxels to mm */
				mulMM(M, V, IM);

				/* Insert the new mappings into each voxel within the tetrahedron */
				for(j=0; j<nvox; j++)
				{
					if ((vox[j][0]>=1) && (vox[j][0]<=dim_f[0]) &&
				 	    (vox[j][1]>=1) && (vox[j][1]<=dim_f[1]) &&
					    (vox[j][2]>=1) && (vox[j][2]<=dim_f[2]))
					{
						int o  = vox[j][0]+dim_f[0]*(vox[j][1]+dim_f[1]*vox[j][2]);

						iy0[o] = M[0][0]*vox[j][0] + M[1][0]*vox[j][1] + M[2][0]*vox[j][2] + M[3][0];
						iy1[o] = M[0][1]*vox[j][0] + M[1][1]*vox[j][1] + M[2][1]*vox[j][2] + M[3][1];
						iy2[o] = M[0][2]*vox[j][0] + M[1][2]*vox[j][1] + M[2][2]*vox[j][2] + M[3][2];
					}
				}
			}
		}
	}
}
Example #22
0
int Matrix<T>::weight() const {
	int n = 0;

	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++){
			if((*this)(i, j) != 0) n++;
		}
	}

	return n;
}
Example #23
0
void Cmod<type>::FFT(zzv &y, const ZZX& x) const
{
  FHE_TIMER_START;
  zpBak bak; bak.save();
  context.restore();
  zp rt;
  zpx& tmp = getScratch();

  conv(tmp,x);      // convert input to zpx format
  conv(rt, root);  // convert root to zp format

  BluesteinFFT(tmp, getM(), rt, *powers, powers_aux, *Rb, Rb_aux, *Ra); // call the FFT routine

  // copy the result to the output vector y, keeping only the
  // entries corresponding to primitive roots of unity
  y.SetLength(zMStar->getPhiM());
  long i,j;
  long m = getM();
  for (i=j=0; i<m; i++)
    if (zMStar->inZmStar(i)) y[j++] = rep(coeff(tmp,i));
  FHE_TIMER_STOP;
}
Example #24
0
void HLayeredBlWStructure::computeVkParams() {
  size_t k, l, i, imax, sum_nl, rep;
  gsl_matrix *zk;
  gsl_matrix_view wi, zkl;

  myA = (gsl_matrix**) malloc(getMaxLag() * sizeof(gsl_matrix *));
  
  /* construct w */
  for (k = 0; k < getMaxLag(); k++) { 
    zk   = gsl_matrix_alloc(getM(), getM());
    gsl_matrix_set_zero(zk);

    for (sum_nl = 0, l = 0; l < getQ(); sum_nl += getLayerLag(l), ++l) { 
      zkl = gsl_matrix_submatrix(zk, sum_nl, sum_nl, getLayerLag(l), 
                getLayerLag(l)); 
      if (k < getLayerLag(l)) {
        gsl_vector_view diag = gsl_matrix_subdiagonal(&zkl.matrix, k);
        gsl_vector_set_all(&diag.vector, getLayerInvWeight(l)); 
      }
    }
    myA[k] = zk;
  }
}
Example #25
0
void  Cmod<zz,zp,zpx,zzv,fftrep,zpContext>::iFFT(ZZX &x, const zzv& y) const
{
  context.restore();
  zp rt;
  zpx in, out, pwrs;

  // convert input to zpx format, initializing only the coeffs i s.t. (i,m)=1
  in.SetMaxLength(getM());
  unsigned i,j;
  for (i=j=0; i<getM(); i++)
    if (zmStar->inZmStar(i)) SetCoeff(in, i, y[j++]);
  in.normalize();
  conv(rt, rInv);  // convert rInv to zp format

  BluesteinFFT(out, in, getM(), rt, *ipowers, *iRb); // call the FFT routine
  out /= getM();                                // normalization

  // reduce the result mod (Phi_m(X),q) and copy to the output polynomial x
  conv(in, zmStar->PhimX());  // convert Phi_m(X) to zpx format
  rem(out, out, in); // out %= (Phi_m(X),q)

  conv(x,out); // convert output to ZZX format
}
Example #26
0
bool CalciumDependentSimulator<ncs::sim::DeviceType::CPU>::
update(ChannelUpdateParameters* parameters) {
  auto old_state_buffer = state_subscription_->pull();
  const float* neuron_voltages = parameters->voltage;
  const float* neuron_calcium = parameters->calcium;
  const float* old_m = old_state_buffer->getM();
  auto new_state_buffer = this->getBlank();
  float* channel_current = parameters->current;
  float* new_m = new_state_buffer->getM();
  float dt = parameters->time_step;
  ncs::sim::AtomicWriter<float> current_adder;
  for (size_t i = 0; i < num_channels_; ++i) {
    unsigned int neuron_plugin_id = neuron_plugin_ids_[i];
    float neuron_voltage = neuron_voltages[neuron_plugin_id];
    float calcium = neuron_calcium[neuron_plugin_id];
    float forward_rate = 
      forward_scale_[i] * pow(calcium, forward_exponent_[i]);
    float total_rate = forward_rate + backwards_rate_[i];
    float one_over_total_rate = 1.0f / total_rate;
    float tau_m = tau_scale_[i] * one_over_total_rate;
    float m_infinity = forward_rate * one_over_total_rate;
    float dt_over_tau = dt / tau_m;
    float m = old_m[i] * (1.0f - dt_over_tau) + dt_over_tau * m_infinity;
    m = std::max(0.0f, std::min(m, 1.0f));
    new_m[i] = m;
    float current = 
      conductance_[i] * pow(m, m_power_[i]) * 
      (reversal_potential_[i] - neuron_voltage);
    current_adder.write(channel_current + neuron_plugin_id, current);
  }
  std::unique_lock<std::mutex> lock(*(parameters->write_lock));
  current_adder.commit(ncs::sim::AtomicWriter<float>::Add);
  lock.unlock();
  old_state_buffer->release();
  this->publish(new_state_buffer);
  return true;
}
Example #27
0
string Matrix<T>::toString() const {
	ostringstream oss;

	oss.precision(STREAM_PRECISION);
	oss << "[" << endl;
	for(int i = 1; i <= getM(); i++){
		for(int j = 1; j <= getN(); j++){
			oss << (*this)(i, j) << " ";
		}
		oss << endl;
	}
	oss << "]" << endl;

	return oss.str();
}
//----------------------------------------------------------------------------------
void FunctionsSingleton::coutAll() const
{
	std::cout << getD() << std::endl;
	std::cout << getF() << std::endl;
	std::cout << getG() << std::endl;
	std::cout << getM() << std::endl;
	std::cout << getN() << std::endl;
	std::cout << getP() << std::endl;
	std::cout << getQ() << std::endl;
	std::cout << getR() << std::endl;
	std::cout << getW() << std::endl;
	
	std::cout << "Alpha: " << mAlpha << std::endl;
	std::cout << "Beta: "  << mBeta  << std::endl;
	std::cout << "Gamma: " << mGamma << std::endl;
}
Example #29
0
double CC_Ev::DH_Diso(const PlasticFlow& plastic_flow, const stresstensor& Stre, 
                          const straintensor& Stra, const MaterialParameter& material_parameter)
{
// this is d \bar{p_0} / d p_0


    double M = getM(material_parameter);
    double p0 = getp0(material_parameter);
    double lambda = getlambda(material_parameter);
    double kappa = getkappa(material_parameter);
    double e0 = gete0(material_parameter);
    
    double e = e0 + (1.0 + e0) *Stra.Iinvariant1();
    double p = Stre.p_hydrostatic();

//    double scalar1 = (1.0+e)*p0*M*M*(p0-p)/(lambda-kappa); // Zhao's version
    double scalar1 = (-2.0)*(1.0+e)*p0*M*M*(p0-p)/(lambda-kappa); // Mahdi
    
    return scalar1;
}
Example #30
0
const tensor& CC_Ev::DH_Ds(const PlasticFlow& plastic_flow, const stresstensor& Stre, 
                          const straintensor& Stra, const MaterialParameter& material_parameter)
{
// this is d \bar{p_0} / d sigma_ij

    tensor I2("I", 2, def_dim_2);

    double M = getM(material_parameter);
    double p0 = getp0(material_parameter);
    double lambda = getlambda(material_parameter);
    double kappa = getkappa(material_parameter);
    double e0 = gete0(material_parameter);
    
    double e = e0 + (1.0 + e0) *Stra.Iinvariant1();

    double scalar1 = (1.0+e)*p0*M*M*(-2.0/3.0)/(lambda-kappa);

    ScalarEvolution::SE_tensorR2 = I2 * scalar1;
    
    return ScalarEvolution::SE_tensorR2;
}