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;
}
}
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();
}
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);
}
}
}
Aggregations