use of artisynth.core.femmodels.IntegrationPoint3d in project artisynth_core by artisynth.
the class MFreeModel3d method computeConsistentMassMatrix.
public SparseMatrixNd computeConsistentMassMatrix() {
int nNodes = myNodes.size();
SparseMatrixNd M = new SparseMatrixNd(nNodes, nNodes);
updateJacobians();
for (FemElement3d e : myElements) {
for (int k = 0; k < e.numIntegrationPoints(); k++) {
IntegrationPoint3d ipnt = e.getIntegrationPoints()[k];
IntegrationData3d idat = e.getIntegrationData()[k];
VectorNd shapeCoords = ipnt.getShapeWeights();
for (int i = 0; i < e.numNodes(); i++) {
for (int j = i; j < e.numNodes(); j++) {
// if (e.isTermActive(i, j)) {
int bi = e.getNodes()[i].getNumber();
int bj = e.getNodes()[j].getNumber();
double m = myDensity * shapeCoords.get(i) * shapeCoords.get(j) * ipnt.getWeight() * ipnt.getDetF() * idat.getDetJ0();
M.set(bi, bj, M.get(bi, bj) + m);
if (i != j) {
M.set(bj, bi, M.get(bj, bi) + m);
}
// }
}
}
}
}
return M;
}
use of artisynth.core.femmodels.IntegrationPoint3d in project artisynth_core by artisynth.
the class MFreeMuscleModel method renderIPointDirection.
protected void renderIPointDirection(Renderer renderer, RenderProps props, FemElement3d elem, float[] coords0, float[] coords1, Matrix3d F, Vector3d dir, double len) {
IntegrationPoint3d[] ipnt = elem.getIntegrationPoints();
IntegrationData3d[] idata = elem.getIntegrationData();
for (int i = 0; i < ipnt.length; i++) {
Matrix3d Frame = idata[i].getFrame();
if (Frame != null) {
dir.x = Frame.m00;
dir.y = Frame.m10;
dir.z = Frame.m20;
ipnt[i].computeGradientForRender(F, elem.getNodes(), idata[i].getInvJ0());
ipnt[i].computeCoordsForRender(coords0, elem.getNodes());
F.mul(dir, dir);
dir.scale(len);
coords0[0] -= (float) dir.x / 2;
coords0[1] -= (float) dir.y / 2;
coords0[2] -= (float) dir.z / 2;
coords1[0] = coords0[0] + (float) dir.x;
coords1[1] = coords0[1] + (float) dir.y;
coords1[2] = coords0[2] + (float) dir.z;
props.getLineColor(myDirectionColor);
renderer.drawLine(props, coords0, coords1, myDirectionColor, /*capped=*/
false, /*highlight=*/
false);
}
}
}
use of artisynth.core.femmodels.IntegrationPoint3d in project artisynth_core by artisynth.
the class BeamBody method computeStiffnessFromIntegration.
public void computeStiffnessFromIntegration() {
int numc = numElasticCoords();
Matrix6d D = new Matrix6d();
Matrix3d DS = new Matrix3d();
Matrix6x1 Bi = new Matrix6x1();
Matrix6x1 Bj = new Matrix6x1();
Matrix6x1 Bx = new Matrix6x1();
myStiffnessMatrix.setZero();
for (int k = 0; k < myIntegrationPoints.length; k++) {
SolidDeformation def = new SolidDeformation();
IntegrationPoint3d pt = myIntegrationPoints[k];
IntegrationData3d dt = new IntegrationData3d();
pt.setF(Matrix3d.IDENTITY);
def.setF(Matrix3d.IDENTITY);
// get the tangent at the rest position
Matrix3d Q = Matrix3d.IDENTITY;
// myMaterial.computeTangent (D, pt.getStress(), pt, dt, null);
myMaterial.computeTangent(D, SymmetricMatrix3d.ZERO, def, Q, null);
double dl = (myLen / 2) * pt.getWeight();
for (int i = 0; i < numc; i++) {
getDShape(DS, i, pt.getCoords());
computeBFromDShape(Bi, DS);
for (int j = 0; j < numc; j++) {
getDShape(DS, j, pt.getCoords());
computeBFromDShape(Bj, DS);
Bx.mul(D, Bj);
myStiffnessMatrix.add(i, j, dl * Bi.dot(Bx));
}
}
}
}
Aggregations