Search in sources :

Example 36 with FemNode3d

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

the class HydrostatModel method createAndAddMarker.

private Point createAndAddMarker(Point3d pnt) {
    numCreatedMarkers++;
    // add the marker to the model
    FemElement3d elem = findContainingElement(pnt);
    if (elem == null) {
        /*
          * project pnt to nearest fem element -- not used b/c of styloglossus
          * System.out.println("containing element null"); Point3d newLoc = new
          * Point3d(); elem = tongue.findNearestElement (newLoc, pnt); pnt.set
          * (newLoc); FemMarker marker = new FemMarker (elem, pnt);
          * tongue.addMarker (marker, elem); return marker;
          */
        FemNode3d fixedNode = new FemNode3d(pnt);
        fixedNode.setDynamic(false);
        addNode(fixedNode);
        return fixedNode;
    } else {
        FemMarker marker = new FemMarker(elem, pnt);
        addMarker(marker, elem);
        return marker;
    }
}
Also used : FemElement3d(artisynth.core.femmodels.FemElement3d) FemNode3d(artisynth.core.femmodels.FemNode3d) FemMarker(artisynth.core.femmodels.FemMarker)

Example 37 with FemNode3d

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

the class SpongeModel method createGeometry.

public void createGeometry(String name, double widthX, double widthY, double widthZ, int numX, int numY, int numZ, double nodeMass) {
    if (numX < 1 || numY < 1 || numZ < 1) {
        throw new IllegalArgumentException("number of elements in each direction must be >= 1");
    }
    // create all the particles
    double dx = 1.0 / numX;
    double dy = 1.0 / numY;
    double dz = 1.0 / numZ;
    Point3d p = new Point3d();
    for (int k = 0; k <= numZ; k++) {
        for (int j = 0; j <= numY; j++) {
            for (int i = 0; i <= numX; i++) {
                p.x = widthX * (-0.5 + i * dx);
                p.y = widthY * (-0.5 + j * dy);
                p.z = widthZ * (-0.5 + k * dz);
                addNode(new FemNode3d(p));
            // getNode(numNodes()-1).setName(Integer.toString(numNodes()-1));
            }
        }
    }
    // PolygonalMesh mesh = new PolygonalMesh();
    // create all the elements
    int wk = (numX + 1) * (numY + 1);
    int wj = (numX + 1);
    FemNode3d n0, n1, n2, n3, n4, n5, n6, n7;
    for (int i = 0; i < numX; i++) {
        for (int j = 0; j < numY; j++) {
            for (int k = 0; k < numZ; k++) {
                n0 = getNodes().get((k + 1) * wk + j * wj + i);
                n1 = getNodes().get((k + 1) * wk + j * wj + i + 1);
                n2 = getNodes().get((k + 1) * wk + (j + 1) * wj + i + 1);
                n3 = getNodes().get((k + 1) * wk + (j + 1) * wj + i);
                n4 = getNodes().get(k * wk + j * wj + i);
                n5 = getNodes().get(k * wk + j * wj + i + 1);
                n6 = getNodes().get(k * wk + (j + 1) * wj + i + 1);
                n7 = getNodes().get(k * wk + (j + 1) * wj + i);
                TetElement[] elems = TetElement.createCubeTesselation(n0, n1, n2, n3, n4, n5, n6, n7, /* even= */
                (i + j + k) % 2 == 0);
                // HexElement he = new HexElement (n0, n1, n2, n3, n4, n5, n6, n7);
                for (FemElement3d e : elems) {
                    addElement(e);
                // he.addTetElement ((TetElement)e);
                }
            // add hex element
            // he.setTetElements(elems);
            // hexElements.add (he);
            }
        }
    }
    // TODO create outer Mesh here.
    // mesh.setFixed(false);
    // setSurfaceMesh(mesh);
    RenderProps.setShading(this, Renderer.Shading.SMOOTH);
    RenderProps.setFaceStyle(this, Renderer.FaceStyle.FRONT_AND_BACK);
    RenderProps.setFaceColor(this, Color.BLUE);
    RenderProps.setAlpha(this, 0.9);
    RenderProps.setVisible(this, true);
    invalidateStressAndStiffness();
}
Also used : FemElement3d(artisynth.core.femmodels.FemElement3d) TetElement(artisynth.core.femmodels.TetElement) Point3d(maspack.matrix.Point3d) FemNode3d(artisynth.core.femmodels.FemNode3d)

Example 38 with FemNode3d

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

the class QuadraticLockingDemo method setModelProperties.

private void setModelProperties(FemModel3d mod) {
    mod.setDensity(DENSITY);
    setRenderProperties(mod, LENGTH);
    mod.setMaterial(new MooneyRivlinMaterial(2000, 0, 0, 0, 0, 5000000));
    for (FemNode3d n : mod.getNodes()) {
        if (Math.abs(n.getPosition().z - LENGTH / 2) < EPS) {
            n.setDynamic(false);
        }
    }
}
Also used : MooneyRivlinMaterial(artisynth.core.materials.MooneyRivlinMaterial) FemNode3d(artisynth.core.femmodels.FemNode3d)

Aggregations

FemNode3d (artisynth.core.femmodels.FemNode3d)38 FemModel3d (artisynth.core.femmodels.FemModel3d)12 Point3d (maspack.matrix.Point3d)12 RigidTransform3d (maspack.matrix.RigidTransform3d)9 FemElement3d (artisynth.core.femmodels.FemElement3d)8 MechModel (artisynth.core.mechmodels.MechModel)8 Point (artisynth.core.mechmodels.Point)7 RigidBody (artisynth.core.mechmodels.RigidBody)7 Vector3d (maspack.matrix.Vector3d)6 ArrayList (java.util.ArrayList)5 FemMarker (artisynth.core.femmodels.FemMarker)4 IntegrationPoint3d (artisynth.core.femmodels.IntegrationPoint3d)4 VectorNd (maspack.matrix.VectorNd)4 TetElement (artisynth.core.femmodels.TetElement)3 RevoluteJoint (artisynth.core.mechmodels.RevoluteJoint)3 LinkedList (java.util.LinkedList)3 FemNode (artisynth.core.femmodels.FemNode)2 HexElement (artisynth.core.femmodels.HexElement)2 PointFem3dAttachment (artisynth.core.femmodels.PointFem3dAttachment)2 PyramidElement (artisynth.core.femmodels.PyramidElement)2