Search in sources :

Example 6 with IntegrationData3d

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

the class MFreeModel3d method computeJacobianAndGradient.

private void computeJacobianAndGradient(FemElement3d region) {
    IntegrationPoint3d[] ipnts = region.getIntegrationPoints();
    IntegrationData3d[] idata = region.getIntegrationData();
    region.setInverted(false);
    for (int i = 0; i < ipnts.length; i++) {
        IntegrationPoint3d ipnt = ipnts[i];
        IntegrationData3d idat = idata[i];
        ipnt.computeJacobianAndGradient(region.getNodes(), idat.getInvJ0());
        double detJ = ipnt.computeInverseJacobian();
        if (detJ < myMinDetJ) {
            myMinDetJ = detJ;
            myMinDetJElement = region;
        }
        if (detJ <= 0) {
            region.setInverted(true);
            myNumInverted++;
        }
    }
}
Also used : IntegrationPoint3d(artisynth.core.femmodels.IntegrationPoint3d) IntegrationData3d(artisynth.core.femmodels.IntegrationData3d) Point(artisynth.core.mechmodels.Point)

Example 7 with IntegrationData3d

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

the class MFreeMuscleModel method renderElementDirection.

protected void renderElementDirection(Renderer renderer, RenderProps props, FemElement3d elem, float[] coords0, float[] coords1, Matrix3d F, Vector3d dir, double len) {
    IntegrationData3d[] idata = elem.getIntegrationData();
    elem.computeRenderCoordsAndGradient(F, coords0);
    int ndirs = 0;
    dir.setZero();
    for (int i = 0; i < idata.length; i++) {
        Matrix3d Frame = idata[i].getFrame();
        if (Frame != null) {
            dir.x += Frame.m00;
            dir.y += Frame.m10;
            dir.z += Frame.m20;
            ndirs++;
        }
    }
    if (ndirs > 0) {
        dir.normalize();
        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) IntegrationData3d(artisynth.core.femmodels.IntegrationData3d)

Example 8 with IntegrationData3d

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

the class MFreeElement3d method isInvertedAtRest.

public boolean isInvertedAtRest() {
    MFreeIntegrationPoint3d[] ipnts = getIntegrationPoints();
    IntegrationData3d[] idata = getIntegrationData();
    for (int i = 0; i < ipnts.length; i++) {
        MFreeIntegrationPoint3d ipnt = ipnts[i];
        IntegrationData3d idat = idata[i];
        ipnt.computeJacobianAndGradient(idat.getInvJ0());
        if (ipnt.getDetF() < 0) {
            return true;
        }
    }
    return false;
}
Also used : IntegrationData3d(artisynth.core.femmodels.IntegrationData3d)

Example 9 with IntegrationData3d

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

the class MFreeElement3d method setIntegrationPoints.

public void setIntegrationPoints(ArrayList<MFreeIntegrationPoint3d> points, ArrayList<IntegrationData3d> data) {
    myIntegrationPoints = new DynamicArray<>(MFreeIntegrationPoint3d.class, points.size());
    for (int i = 0; i < points.size(); i++) {
        IntegrationData3d idata = null;
        if (data != null) {
            idata = data.get(i);
        }
        addIntegrationPoint(points.get(i), idata, points.get(i).getWeight(), false);
    }
    updateAllVolumes();
    myNodalExtrapolationMatrix = null;
}
Also used : IntegrationData3d(artisynth.core.femmodels.IntegrationData3d)

Example 10 with IntegrationData3d

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

the class MFreeFactory method distributeIPointsFromMap.

// public static void distributePairedIPoints(MFreeElement3d[] elemList,
// 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 =
// findPairedElementsContaining(ipnt.getPosition(), elemTree, tol);
// for (MFreeElement3d elem : celems) {
// elem.addIntegrationPoint(ipnt, idat, ipnt.getWeight(), false);
// }
// }
// 
// for (MFreeElement3d elem : elemList) {
// elem.updateAllVolumes();
// }
// 
// }
private static void distributeIPointsFromMap(HashMap<MFreeIntegrationPoint3d, MFreeElement3d> pntMap) {
    for (MFreeIntegrationPoint3d ipnt : pntMap.keySet()) {
        IntegrationData3d idat = new IntegrationData3d();
        idat.setRestInverseJacobian(new Matrix3d(Matrix3d.IDENTITY), 1);
        MFreeElement3d elem = pntMap.get(ipnt);
        elem.addIntegrationPoint(ipnt, idat, ipnt.getWeight(), false);
    }
    for (MFreeElement3d elem : pntMap.values()) {
        elem.updateAllVolumes();
    }
}
Also used : Matrix3d(maspack.matrix.Matrix3d) IntegrationData3d(artisynth.core.femmodels.IntegrationData3d)

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