bool CVXS_Bond::SetVoxels(const int V1SIndIn, const int V2SIndIn) { Vox1SInd=V1SIndIn; Vox2SInd=V2SIndIn; if (Vox1SInd == Vox2SInd) return true; //Equale voxel indices is a flag to disable a bond if (!UpdateVox1Ptr()){Vox1SInd=-1; return false;} if (!UpdateVox2Ptr()){Vox2SInd=-1; return false;} OrigDist = pVox2->GetOrigPos() - pVox1->GetOrigPos(); //original distance (world coords) HomogenousBond = (pVox1->GetMaterial() == pVox2->GetMaterial()); if (OrigDist.x == 0 && OrigDist.y == 0) ThisBondDir = BD_Z; else if (OrigDist.x == 0 && OrigDist.z == 0) ThisBondDir = BD_Y; else if (OrigDist.y == 0 && OrigDist.z == 0) ThisBondDir = BD_X; else ThisBondDir = BD_ARB; vfloat E1 = pVox1->GetEMod(), E2 = pVox2->GetEMod(); vfloat u1 = pVox1->GetPoisson(), u2 = pVox2->GetPoisson(); vfloat CTE1 = pVox1->GetCTE(), CTE2 = pVox2->GetCTE(); if (E1 == 0 || E2 == 0) {return false;} if (u1 < 0 || u1 > 0.5 || u2 < 0 || u2 > 0.5 ) {return false;} //bad poissons ratio; E = (E1*E2/(E1+E2))*2; //x2 derived from case of equal stiffness: E1*E1/(E1+E1) = 0.5*E1 if (u1==0 && u2==0) u=0; else u = (u1*u2/(u1+u2))*2; //Poissons ratio CTE = (CTE1/2+CTE2/2); //thermal expansion //for now we are only using the nominal size of the voxel, although we could change this later if needed //rotate the box dimensions into the correct refference frame of x being direction of bond switch (ThisBondType){ case B_LINEAR: L = (pVox1->GetOrigSize() + pVox2->GetOrigSize())*0.5; ToXDirBond(&L); //in X direction, so L.X is beam length, L.y, L.z are transverse dimensions L = L.Abs(); //distances strictly positive! break; case B_LINEAR_CONTACT: //X direction of L is in line with the contact... default: L.x = p_Sim->LocalVXC.GetLatticeDim(); L.y = L.x; L.z = L.x; break; } if (!UpdateConstants()) return false; ResetBond(); return true; }
CVXS_Bond& CVXS_Bond::operator=(const CVXS_Bond& Bond) { //Bond definition p_Sim = Bond.p_Sim; ThisBondType = Bond.ThisBondType; Perm = Bond.Perm; //State variables Force1 = Bond.Force1; Force2 = Bond.Force2; Moment1 = Bond.Moment1; Moment2 = Bond.Moment2; StrainEnergy = Bond.StrainEnergy; SmallAngle = Bond.SmallAngle; _Pos2=Bond._Pos2; _Angle1=Bond._Angle1; _Angle2=Bond._Angle2; _LastPos2=Bond._LastPos2; _LastAngle1=Bond._LastAngle1; _LastAngle2=Bond._LastAngle2; CurStrain = Bond.CurStrain; CurStress = Bond.CurStress; MaxStrain = Bond.MaxStrain; Yielded = Bond.Yielded; Broken = Bond.Broken; RestDist = Bond.RestDist; Vox1SInd = Bond.Vox1SInd; Vox2SInd = Bond.Vox2SInd; if (!UpdateVox1Ptr()){Vox1SInd=-1;} if (!UpdateVox2Ptr()){Vox2SInd=-1;} OrigDist = Bond.OrigDist; HomogenousBond = Bond.HomogenousBond; ThisBondDir = Bond.ThisBondDir; L = Bond.L; E = Bond.E; u = Bond.u; CTE = Bond.CTE; UpdateConstants(); return *this; }