Search in sources :

Example 11 with IntegrationData3d

use of artisynth.core.femmodels.IntegrationData3d in project artisynth_core by artisynth.

the class MFreeFactory method addWarpingPoints.

// public static void distributePartitionedIPoints(
// DirectedGraph<MFreeElement3d,MFreeNode3d> connectivity,
// MFreeIntegrationPoint3d[] ipnts,
// IntegrationData3d[] idata, BVTree elemTree, double tol) {
// 
// for (int i = 0; i < ipnts.length; i++) {
// MFreeIntegrationPoint3d ipnt = ipnts[i];
// IntegrationData3d idat = null;
// if (idata != null) {
// idat = idata[i];
// } else {
// idat = new IntegrationData3d();
// idat.setRestInverseJacobian(new Matrix3d(Matrix3d.IDENTITY), 1);
// }
// 
// ArrayList<MFreeElement3d> celems =
// findPartitionedElementsContaining(
// ipnt.getPosition(), connectivity, elemTree, tol);
// for (MFreeElement3d elem : celems) {
// elem.addIntegrationPoint(ipnt, idat, ipnt.getWeight(), false);
// }
// }
// 
// for (Vertex<MFreeElement3d,MFreeNode3d> vtx : connectivity.getVertices()) {
// MFreeElement3d elem = vtx.getData();
// if (elem != null) {
// elem.updateAllVolumes();
// }
// }
// 
// }
private static void addWarpingPoints(List<MFreeElement3d> elems, BVTree nodeTree) {
    for (MFreeElement3d elem : elems) {
        MFreeIntegrationPoint3d wpnt = createWarpingPoint(elem, null, nodeTree);
        IntegrationData3d wdat = new IntegrationData3d();
        wdat.setRestInverseJacobian(new Matrix3d(Matrix3d.IDENTITY), 1);
        elem.setWarpingPoint(wpnt, wdat);
    }
}
Also used : Matrix3d(maspack.matrix.Matrix3d) IntegrationData3d(artisynth.core.femmodels.IntegrationData3d)

Example 12 with IntegrationData3d

use of artisynth.core.femmodels.IntegrationData3d 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;
}
Also used : FemElement3d(artisynth.core.femmodels.FemElement3d) SparseMatrixNd(maspack.matrix.SparseMatrixNd) IntegrationPoint3d(artisynth.core.femmodels.IntegrationPoint3d) VectorNd(maspack.matrix.VectorNd) IntegrationData3d(artisynth.core.femmodels.IntegrationData3d) Point(artisynth.core.mechmodels.Point)

Example 13 with IntegrationData3d

use of artisynth.core.femmodels.IntegrationData3d 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);
        }
    }
}
Also used : Matrix3d(maspack.matrix.Matrix3d) SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) IntegrationPoint3d(artisynth.core.femmodels.IntegrationPoint3d) IntegrationData3d(artisynth.core.femmodels.IntegrationData3d)

Example 14 with IntegrationData3d

use of artisynth.core.femmodels.IntegrationData3d 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));
            }
        }
    }
}
Also used : SolidDeformation(artisynth.core.materials.SolidDeformation) SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) Matrix3d(maspack.matrix.Matrix3d) IntegrationPoint3d(artisynth.core.femmodels.IntegrationPoint3d) IntegrationData3d(artisynth.core.femmodels.IntegrationData3d) Matrix6d(maspack.matrix.Matrix6d) Matrix6x1(maspack.matrix.Matrix6x1)

Aggregations

IntegrationData3d (artisynth.core.femmodels.IntegrationData3d)14 IntegrationPoint3d (artisynth.core.femmodels.IntegrationPoint3d)7 Matrix3d (maspack.matrix.Matrix3d)6 VectorNd (maspack.matrix.VectorNd)4 FemElement3d (artisynth.core.femmodels.FemElement3d)3 Point (artisynth.core.mechmodels.Point)3 SymmetricMatrix3d (maspack.matrix.SymmetricMatrix3d)3 FemMeshComp (artisynth.core.femmodels.FemMeshComp)1 FemNode (artisynth.core.femmodels.FemNode)1 FemNode3d (artisynth.core.femmodels.FemNode3d)1 PointFem3dAttachment (artisynth.core.femmodels.PointFem3dAttachment)1 SolidDeformation (artisynth.core.materials.SolidDeformation)1 DynamicComponent (artisynth.core.mechmodels.DynamicComponent)1 PointAttachment (artisynth.core.mechmodels.PointAttachment)1 PointParticleAttachment (artisynth.core.mechmodels.PointParticleAttachment)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1 Vertex3d (maspack.geometry.Vertex3d)1 Matrix6d (maspack.matrix.Matrix6d)1