public class EmbeddedFem
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SAMPLES |
Constructor and Description |
---|
EmbeddedFem() |
Modifier and Type | Method and Description |
---|---|
static void |
adjustMassAndStiffness(FemModel3d fem,
PolygonalMesh surface)
Adjusts mass and stiffness of a FEM model based on
a given surface mesh.
|
static void |
adjustMassAndStiffness(FemModel3d fem,
PolygonalMesh surface,
int nSamplesPerElement)
Adjusts mass and stiffness of a FEM model based on
a given surface mesh.
|
static ScalarNodalField |
computeNodalField(FemModel3d fem,
Function3x1 func,
FemElementSampler sampler,
int nSamplesPerElement)
Computes a best-fitting scalar nodal field, computing node values by minimizing the squared error between
a sampled function, and the one interpolated via nodes and shape functions.
|
static ScalarSubElemField |
computeSubElemField(FemModel3d fem,
Function3x1 func)
Compute a field by simply evaluating the function at integration points
|
static ScalarSubElemField |
computeSubElemField(FemModel3d fem,
Function3x1 func,
FemElementSampler sampler,
int nSamplesPerElement)
Compute a field by sampling a function over the FEM model and using
least-squares to fit the FEM element shape functions
independently over each element.
|
static FemModel3d |
createBoundingFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
int minRes,
double maxElemWidth)
Creates a regular finite element grid that bounds a supplied surface
|
static FemModel3d |
createBoundingFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
int minRes,
double maxElemWidth,
double margin)
Creates a FEM model that bounds a given surface
|
static FemModel3d |
createBoundingFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
Vector3i res)
Creates a FEM model that bounds a given surface
|
static FemModel3d |
createBoundingFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
Vector3i res,
double margin)
Creates a FEM model that bounds a given surface
|
static MaterialBundle |
createMaterialBundle(FemModel3d fem,
FemMaterial mat,
ScalarFieldComponent density)
Creates a material bundle based on a supplied
material and a volume density function.
|
static FemModel3d |
createVoxelizedFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
int minRes,
double maxElemWidth)
Creates a FEM model that surrounds a given surface, using a
lego-brick-like pattern (like voxels).
|
static FemModel3d |
createVoxelizedFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
int minRes,
double maxElemWidth,
double margin)
Creates a FEM model that surrounds a given surface, using a
lego-brick-like pattern (like voxels).
|
static FemModel3d |
createVoxelizedFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
Vector3i res)
Creates a FEM model that surrounds a given surface, using a
lego-brick-like pattern (like voxels).
|
static FemModel3d |
createVoxelizedFem(FemModel3d fem,
PolygonalMesh mesh,
RigidTransform3d trans,
Vector3i res,
double margin)
Creates a FEM model that surrounds a given surface, using a
lego-brick-like pattern (like voxels).
|
static java.lang.Class<? extends DirectSolver> |
getSolverClass()
Check sparse matrix solver type for use in computing best-fitting node values
|
static void |
removeFractionalElements(FemModel3d fem,
DistanceGrid dq,
double margin,
double frac)
Removes elements containing less than the given fraction of volume
|
static void |
removeOutsideElements(FemModel3d fem,
PolygonalMesh mesh,
double margin)
Removes elements outside a given mesh plus margin
|
static void |
removeOutsideElements(FemModel3d fem,
PolygonalMesh mesh,
int nsamples,
double margin)
Removes elements outside a given mesh plus margin
|
static void |
restoreFaceCompatibility(FemModel3d fem)
Restores element face-face compatibility by inserting pyramid and tet elements
|
static void |
setMasses(FemModel3d fem,
Function3x1 density,
FemElementIntegrator integrator)
Numerically integrates the density function over each element to compute
masses concentrated at the nodes.
|
static void |
setMasses(FemModel3d fem,
ScalarFemField density,
double scale)
Sets node and element masses based on a supplied density function by integrating over each
element to compute masses concentrated at the nodes.
|
static void |
setSolverClass(java.lang.Class<? extends DirectSolver> clazz)
Set sparse matrix solver for use in computing best-fitting node values
|
static void |
trimBoundaryHexes(FemModel3d fem,
DistanceGrid sd,
double margin)
Divide boundary hex elements and remove portions unused
|
static void |
trimBoundaryHexes(FemModel3d fem,
PolygonalMesh mesh,
double margin)
Divide boundary hex elements and remove portions unused
|
public static void setSolverClass(java.lang.Class<? extends DirectSolver> clazz)
clazz
- solver class typepublic static java.lang.Class<? extends DirectSolver> getSolverClass()
public static void setMasses(FemModel3d fem, Function3x1 density, FemElementIntegrator integrator)
fem
- modeldensity
- density functionintegrator
- integrator object for integrating density over elementspublic static void setMasses(FemModel3d fem, ScalarFemField density, double scale)
fem
- modeldensity
- density functionscale
- scale for density functionpublic static MaterialBundle createMaterialBundle(FemModel3d fem, FemMaterial mat, ScalarFieldComponent density)
fem
- modelmat
- material to use for bundledensity
- density functionpublic static ScalarNodalField computeNodalField(FemModel3d fem, Function3x1 func, FemElementSampler sampler, int nSamplesPerElement)
fem
- model containing nodesfunc
- function to samplesampler
- method of sampling from elementsnSamplesPerElement
- number of samples per elementpublic static ScalarSubElemField computeSubElemField(FemModel3d fem, Function3x1 func, FemElementSampler sampler, int nSamplesPerElement)
fem
- finite element model over which to create fieldfunc
- function to samplesampler
- sampling objectnSamplesPerElement
- number of samples to take per elementpublic static ScalarSubElemField computeSubElemField(FemModel3d fem, Function3x1 func)
fem
- finite element model over which to create fieldfunc
- function to samplepublic static void adjustMassAndStiffness(FemModel3d fem, PolygonalMesh surface, int nSamplesPerElement)
fem
- model to adjustsurface
- surface-mesh for determining inside-outsidenSamplesPerElement
- number of samples per element for numerical
integrationpublic static void adjustMassAndStiffness(FemModel3d fem, PolygonalMesh surface)
fem
- model to adjust integrationpublic static FemModel3d createBoundingFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, int minRes, double maxElemWidth)
fem
- model to populated, created if nullmesh
- surface to boundtrans
- orientation of gridminRes
- minimum number of elements along each dimensionmaxElemWidth
- maximum element width along any dimensionpublic static FemModel3d createBoundingFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, int minRes, double maxElemWidth, double margin)
fem
- model to populate, one is created if nullmesh
- surface to boundtrans
- orientation of bounding model (or uses OBB of mesh if null)minRes
- minimum number of elements along any directionmaxElemWidth
- maximum width of an element along any directionmargin
- extra space in model to surround meshpublic static FemModel3d createBoundingFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, Vector3i res)
fem
- model to populate, one is created if nullmesh
- surface to boundtrans
- orientation of bounding model (or uses OBB of mesh if null)res
- element resolutionpublic static FemModel3d createBoundingFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, Vector3i res, double margin)
fem
- model to populate, one is created if nullmesh
- surface to boundtrans
- orientation of bounding model (or uses OBB of mesh if null)res
- element resolutionmargin
- extra space in model to surround meshpublic static FemModel3d createVoxelizedFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, int minRes, double maxElemWidth)
adjustMassAndStiffness(FemModel3d, PolygonalMesh, int)
fem
- model to populate (one is created if null)mesh
- mesh to surround/voxelizetrans
- orientation for voxels (uses OBB of mesh if null)minRes
- minimum number of elements along any directionmaxElemWidth
- maximum element with along any directionpublic static FemModel3d createVoxelizedFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, int minRes, double maxElemWidth, double margin)
adjustMassAndStiffness(FemModel3d, PolygonalMesh, int)
fem
- model to populate (one is created if null)mesh
- mesh to surround/voxelizetrans
- orientation for voxels (uses OBB of mesh if null)minRes
- minimum number of elements along any directionmaxElemWidth
- maximum element with along any directionmargin
- margin for surrounding meshpublic static FemModel3d createVoxelizedFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, Vector3i res)
adjustMassAndStiffness(FemModel3d, PolygonalMesh, int)
fem
- model to populate (one is created if null)mesh
- mesh to surround/voxelizetrans
- orientation for voxels (uses OBB of mesh if null)res
- element resolution for original gridpublic static FemModel3d createVoxelizedFem(FemModel3d fem, PolygonalMesh mesh, RigidTransform3d trans, Vector3i res, double margin)
adjustMassAndStiffness(FemModel3d, PolygonalMesh, int)
fem
- model to populate (one is created if null)mesh
- mesh to surround/voxelizetrans
- orientation for voxels (uses OBB of mesh if null)res
- element resolution for original gridmargin
- margin for surrounding meshpublic static void removeOutsideElements(FemModel3d fem, PolygonalMesh mesh, double margin)
fem
- model to remove elements frommesh
- surface outside which to remove elementsmargin
- margin distance outside mesh to consider (if < 0
,
once is computed based on a half element size)public static void removeOutsideElements(FemModel3d fem, PolygonalMesh mesh, int nsamples, double margin)
fem
- model to remove elements frommesh
- surface outside which to remove elementsnsamples
- number of samples to choose from within the elementmargin
- margin distance outside mesh to consider (if < 0
,
once is computed based on a half element size)public static void removeFractionalElements(FemModel3d fem, DistanceGrid dq, double margin, double frac)
fem
- model to modifydq
- distance gridmargin
- margin to keep outside distance fieldfrac
- fraction below which to remove elementspublic static void trimBoundaryHexes(FemModel3d fem, PolygonalMesh mesh, double margin)
fem
- model to trimmesh
- surface for determining inside/outsidemargin
- margin to preserve around modelpublic static void trimBoundaryHexes(FemModel3d fem, DistanceGrid sd, double margin)
fem
- model to trimsd
- signed-distance field for determining inside/outsidemargin
- margin to preserve around modelpublic static void restoreFaceCompatibility(FemModel3d fem)
fem
- model to fix