artisynth.core.femmodels
Class FemFactory

java.lang.Object
  extended by artisynth.core.femmodels.FemFactory

public class FemFactory
extends java.lang.Object


Nested Class Summary
static class FemFactory.FemElementType
           
static class FemFactory.FemElemType
           
static class FemFactory.FemShapingType
           
 
Constructor Summary
FemFactory()
           
 
Method Summary
static void addFem(FemModel3d fem0, FemModel3d fem1)
          Adds a copy of the nodes, elements, markers and attachments from fem1 to fem0.
static void addFem(FemModel3d fem0, FemModel3d fem1, double nodeMergeDist)
          Adds a copy of the nodes, elements, markers and attachments from fem1 to fem0.
static FemModel3d createEllipsoid(FemModel3d mod, double rl, double rs1, double rs2, int nt, int nl, int ns)
           
static FemModel3d createExtrusion(FemModel3d model, FemFactory.FemElementType type, int n, double d, PolygonalMesh surface)
           
static FemModel3d createExtrusion(FemModel3d model, FemFactory.FemElemType type, int n, double d, PolygonalMesh surface)
           
static void createFromElementList(FemModel3d out, java.util.Collection<FemElement3d> elemList)
          Creates a new model by duplicating nodes and elements
static FemModel3d createFromMesh(FemModel3d model, PolygonalMesh surface, double quality)
          Creates a tetrahedral FEM model from a triangular surface mesh.
static FemModel3d createFromMeshAndPoints(FemModel3d model, PolygonalMesh surface, double quality, Point3d[] pnts)
          Constrained Delaunay, including the supplied list of points if they fall inside the surface
static FemModel3d createGrid(FemModel3d model, FemFactory.FemElementType type, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createGrid(FemModel3d model, FemFactory.FemElemType type, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createHexExtrusion(FemModel3d model, int n, double d, PolygonalMesh surface)
           
static FemModel3d createHexGrid(FemModel3d mod, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createHexTorus(FemModel3d mod, double R, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createHexTube(FemModel3d mod, double l, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createHexWedgeCylinder(FemModel3d mod, double l, double r, int nt, int nl, int nr)
           
static FemModel3d createHexWedgeExtrusion(FemModel3d model, int n, double d, PolygonalMesh surface)
           
static FemModel3d createPyramidGrid(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
          Create a regular pyramidal grid centered on the origin, with specified widths and grid resolutions along each axis.
static FemModel3d createQuadhexExtrusion(FemModel3d model, int n, double d, PolygonalMesh surface)
           
static FemModel3d createQuadhexGrid(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createQuadhexTorus(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createQuadhexTube(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createQuadpyramidGrid(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createQuadraticModel(FemModel3d quadMod, FemModel3d linMod)
          Takes a FemModel3d containing linear elements, and creates a quadratic model whose elements are the corresponding quadratic elements, with new nodes inserted along the edges as required.
static FemModel3d createQuadraticTorus(FemModel3d mod, double R, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createQuadraticTube(FemModel3d mod, double l, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createQuadtetExtrusion(FemModel3d model, int n, double d, PolygonalMesh surface)
           
static FemModel3d createQuadtetGrid(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createQuadtetTorus(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createQuadtetTube(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createQuadwedgeGrid(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d createTetExtrusion(FemModel3d model, int n, double d, PolygonalMesh surface)
           
static FemModel3d createTetGrid(FemModel3d model, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
          Create a regular tetrahedral grid centered on the origin, with specified widths and grid resolutions along each axis.
static FemModel3d createTetTorus(FemModel3d mod, double R, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createTetTube(FemModel3d mod, double l, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createTorus(FemModel3d model, FemFactory.FemElementType type, double R, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createTorus(FemModel3d model, FemFactory.FemElemType type, double R, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createTube(FemModel3d model, FemFactory.FemElementType type, double l, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createTube(FemModel3d model, FemFactory.FemElemType type, double l, double rin, double rout, int nt, int nl, int nr)
           
static FemModel3d createWedgeGrid(FemModel3d mod, double widthX, double widthY, double widthZ, int numX, int numY, int numZ)
           
static FemModel3d mergeCollapsedNodes(FemModel3d mod, FemModel3d orig, double epsilon)
           
static FemModel3d refineFem(FemModel3d out, FemModel3d in, double quality)
           
static FemModel3d refineFem(FemModel3d out, FemModel3d in, double quality, Point3d[] pnts)
           
static FemModel3d subdivideFem(FemModel3d femr, FemModel3d fem0)
          Creates a subdvided FEM model by subdividing all the elements of an existing model into eight sub-elements, adding additional nodes as required.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FemFactory

public FemFactory()
Method Detail

createTetGrid

public static FemModel3d createTetGrid(FemModel3d model,
                                       double widthX,
                                       double widthY,
                                       double widthZ,
                                       int numX,
                                       int numY,
                                       int numZ)
Create a regular tetrahedral grid centered on the origin, with specified widths and grid resolutions along each axis.


createPyramidGrid

public static FemModel3d createPyramidGrid(FemModel3d model,
                                           double widthX,
                                           double widthY,
                                           double widthZ,
                                           int numX,
                                           int numY,
                                           int numZ)
Create a regular pyramidal grid centered on the origin, with specified widths and grid resolutions along each axis.


createHexGrid

public static FemModel3d createHexGrid(FemModel3d mod,
                                       double widthX,
                                       double widthY,
                                       double widthZ,
                                       int numX,
                                       int numY,
                                       int numZ)

createWedgeGrid

public static FemModel3d createWedgeGrid(FemModel3d mod,
                                         double widthX,
                                         double widthY,
                                         double widthZ,
                                         int numX,
                                         int numY,
                                         int numZ)

mergeCollapsedNodes

public static FemModel3d mergeCollapsedNodes(FemModel3d mod,
                                             FemModel3d orig,
                                             double epsilon)

createEllipsoid

public static FemModel3d createEllipsoid(FemModel3d mod,
                                         double rl,
                                         double rs1,
                                         double rs2,
                                         int nt,
                                         int nl,
                                         int ns)

createHexWedgeCylinder

public static FemModel3d createHexWedgeCylinder(FemModel3d mod,
                                                double l,
                                                double r,
                                                int nt,
                                                int nl,
                                                int nr)

createHexTube

public static FemModel3d createHexTube(FemModel3d mod,
                                       double l,
                                       double rin,
                                       double rout,
                                       int nt,
                                       int nl,
                                       int nr)

createTetTube

public static FemModel3d createTetTube(FemModel3d mod,
                                       double l,
                                       double rin,
                                       double rout,
                                       int nt,
                                       int nl,
                                       int nr)

createHexTorus

public static FemModel3d createHexTorus(FemModel3d mod,
                                        double R,
                                        double rin,
                                        double rout,
                                        int nt,
                                        int nl,
                                        int nr)

createTetTorus

public static FemModel3d createTetTorus(FemModel3d mod,
                                        double R,
                                        double rin,
                                        double rout,
                                        int nt,
                                        int nl,
                                        int nr)

createQuadraticTube

public static FemModel3d createQuadraticTube(FemModel3d mod,
                                             double l,
                                             double rin,
                                             double rout,
                                             int nt,
                                             int nl,
                                             int nr)

createQuadraticTorus

public static FemModel3d createQuadraticTorus(FemModel3d mod,
                                              double R,
                                              double rin,
                                              double rout,
                                              int nt,
                                              int nl,
                                              int nr)

createQuadraticModel

public static FemModel3d createQuadraticModel(FemModel3d quadMod,
                                              FemModel3d linMod)
Takes a FemModel3d containing linear elements, and creates a quadratic model whose elements are the corresponding quadratic elements, with new nodes inserted along the edges as required. The new quadratic model will have straight edges in the rest position.

Parameters:
linMod - A FemModel3d previously inialized with only linear elements.

createQuadtetGrid

public static FemModel3d createQuadtetGrid(FemModel3d model,
                                           double widthX,
                                           double widthY,
                                           double widthZ,
                                           int numX,
                                           int numY,
                                           int numZ)

createQuadtetTube

public static FemModel3d createQuadtetTube(FemModel3d model,
                                           double widthX,
                                           double widthY,
                                           double widthZ,
                                           int numX,
                                           int numY,
                                           int numZ)

createQuadtetTorus

public static FemModel3d createQuadtetTorus(FemModel3d model,
                                            double widthX,
                                            double widthY,
                                            double widthZ,
                                            int numX,
                                            int numY,
                                            int numZ)

createQuadtetExtrusion

public static FemModel3d createQuadtetExtrusion(FemModel3d model,
                                                int n,
                                                double d,
                                                PolygonalMesh surface)

createQuadhexGrid

public static FemModel3d createQuadhexGrid(FemModel3d model,
                                           double widthX,
                                           double widthY,
                                           double widthZ,
                                           int numX,
                                           int numY,
                                           int numZ)

createQuadwedgeGrid

public static FemModel3d createQuadwedgeGrid(FemModel3d model,
                                             double widthX,
                                             double widthY,
                                             double widthZ,
                                             int numX,
                                             int numY,
                                             int numZ)

createQuadpyramidGrid

public static FemModel3d createQuadpyramidGrid(FemModel3d model,
                                               double widthX,
                                               double widthY,
                                               double widthZ,
                                               int numX,
                                               int numY,
                                               int numZ)

createQuadhexTube

public static FemModel3d createQuadhexTube(FemModel3d model,
                                           double widthX,
                                           double widthY,
                                           double widthZ,
                                           int numX,
                                           int numY,
                                           int numZ)

createQuadhexTorus

public static FemModel3d createQuadhexTorus(FemModel3d model,
                                            double widthX,
                                            double widthY,
                                            double widthZ,
                                            int numX,
                                            int numY,
                                            int numZ)

createQuadhexExtrusion

public static FemModel3d createQuadhexExtrusion(FemModel3d model,
                                                int n,
                                                double d,
                                                PolygonalMesh surface)

createHexExtrusion

public static FemModel3d createHexExtrusion(FemModel3d model,
                                            int n,
                                            double d,
                                            PolygonalMesh surface)

createHexWedgeExtrusion

public static FemModel3d createHexWedgeExtrusion(FemModel3d model,
                                                 int n,
                                                 double d,
                                                 PolygonalMesh surface)

createTetExtrusion

public static FemModel3d createTetExtrusion(FemModel3d model,
                                            int n,
                                            double d,
                                            PolygonalMesh surface)

createGrid

public static FemModel3d createGrid(FemModel3d model,
                                    FemFactory.FemElementType type,
                                    double widthX,
                                    double widthY,
                                    double widthZ,
                                    int numX,
                                    int numY,
                                    int numZ)

createGrid

public static FemModel3d createGrid(FemModel3d model,
                                    FemFactory.FemElemType type,
                                    double widthX,
                                    double widthY,
                                    double widthZ,
                                    int numX,
                                    int numY,
                                    int numZ)

createTube

public static FemModel3d createTube(FemModel3d model,
                                    FemFactory.FemElementType type,
                                    double l,
                                    double rin,
                                    double rout,
                                    int nt,
                                    int nl,
                                    int nr)

createTube

public static FemModel3d createTube(FemModel3d model,
                                    FemFactory.FemElemType type,
                                    double l,
                                    double rin,
                                    double rout,
                                    int nt,
                                    int nl,
                                    int nr)

createTorus

public static FemModel3d createTorus(FemModel3d model,
                                     FemFactory.FemElementType type,
                                     double R,
                                     double rin,
                                     double rout,
                                     int nt,
                                     int nl,
                                     int nr)

createTorus

public static FemModel3d createTorus(FemModel3d model,
                                     FemFactory.FemElemType type,
                                     double R,
                                     double rin,
                                     double rout,
                                     int nt,
                                     int nl,
                                     int nr)

createExtrusion

public static FemModel3d createExtrusion(FemModel3d model,
                                         FemFactory.FemElementType type,
                                         int n,
                                         double d,
                                         PolygonalMesh surface)

createExtrusion

public static FemModel3d createExtrusion(FemModel3d model,
                                         FemFactory.FemElemType type,
                                         int n,
                                         double d,
                                         PolygonalMesh surface)

createFromMesh

public static FemModel3d createFromMesh(FemModel3d model,
                                        PolygonalMesh surface,
                                        double quality)
Creates a tetrahedral FEM model from a triangular surface mesh. The tetrahedra will be added to either an existing model (supplied through the argument model), or a newly created FemModel3d (if model is null).

The tessellation is done using tetgen, which is called through a JNI interface. The tessellation quality is controlled using the quality variable. If quality is 0, then only the mesh nodes will be used to form the tessellation. However, this may result in highly degenerate tetrahedra. Otherwise, if quality is > 0, tetgen will add additional nodes to ensure that the minimum edge-radius ratio does not exceed quality. A good default value for quality is 2. If set too small (such as less then 1), then tetgen may not terminate.

Parameters:
model - model to which the tetrahedra should be added, or null if the model is to be created from scratch.
surface - triangular surface mesh used to define the tessellation.
quality - quality parameter passed to tetgen.
Returns:
the FEM model

createFromMeshAndPoints

public static FemModel3d createFromMeshAndPoints(FemModel3d model,
                                                 PolygonalMesh surface,
                                                 double quality,
                                                 Point3d[] pnts)
Constrained Delaunay, including the supplied list of points if they fall inside the surface


refineFem

public static FemModel3d refineFem(FemModel3d out,
                                   FemModel3d in,
                                   double quality,
                                   Point3d[] pnts)

refineFem

public static FemModel3d refineFem(FemModel3d out,
                                   FemModel3d in,
                                   double quality)

addFem

public static void addFem(FemModel3d fem0,
                          FemModel3d fem1)
Adds a copy of the nodes, elements, markers and attachments from fem1 to fem0. Nodes in fem1 are merged with nodes in fem0 that are within TOL distance of each other, where TOL is 1e-8 times the maximum radius of fem0 and fem1. For precise control of node merging, use addFem(FemModel3d,FemModel3d,double).

Parameters:
fem0 - FEM model to which components should be added
fem1 - FEM model providing components

addFem

public static void addFem(FemModel3d fem0,
                          FemModel3d fem1,
                          double nodeMergeDist)
Adds a copy of the nodes, elements, markers and attachments from fem1 to fem0.

Parameters:
fem0 - FEM model to which components should be added
fem1 - FEM model providing components
nodeMergeDist - If >= 0, causes nearby nodes of fem1 and fem0 to be merged: any node of fem1 that is within nodeMergeDist of a node in fem0 is replaced by the nearest node in fem0.

subdivideFem

public static FemModel3d subdivideFem(FemModel3d femr,
                                      FemModel3d fem0)
Creates a subdvided FEM model by subdividing all the elements of an existing model into eight sub-elements, adding additional nodes as required. The existing model is not modified. At present, this is supported only for models composed of tetrahedra, hexahedra, and wedges. Markers in the original mesh are copied, but attachments (T-junction connections) are not. Likewise, if the original FEM is a FemMuscleModel, the muscle group information is not copied either.

Parameters:
femr - model in which refined FEM is to be constructed, or null if the model is to be created from scratch.
fem0 - existing FEM model to be refined.
Returns:
refined FEM model (which will be femr if femr is not null).

createFromElementList

public static void createFromElementList(FemModel3d out,
                                         java.util.Collection<FemElement3d> elemList)
Creates a new model by duplicating nodes and elements

Parameters:
out - model to fill
elemList - elements to build model from