SPHFluidSurfaceMapping
Mapping the surface of a Smooth Particle Hydrodynamics model.
Vec3d,Vec3d
Templates:
- Vec3d,Vec3d
 
Target: SofaSphFluid
namespace: sofa::component::mapping
parents:
- Mapping
 - MeshTopology
 
Data
| Name | Description | Default value | 
|---|---|---|
| name | object name | unnamed | 
| printLog | if true, emits extra messages at runtime. | 0 | 
| tags | list of the subsets the object belongs to | |
| bbox | this object bounding box | |
| componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined | 
| listening | if true, handle the events, otherwise ignore the events | 0 | 
| mapForces | Are forces mapped ? | 1 | 
| mapConstraints | Are constraints mapped ? | 1 | 
| mapMasses | Are masses mapped ? | 1 | 
| mapMatrices | Are matrix explicit mapped? | 0 | 
| applyRestPosition | set to true to apply this mapping to restPosition at init | 0 | 
| filename | Filename of the mesh | |
| position | List of point positions | |
| edges | List of edge indices | |
| triangles | List of triangle indices | |
| quads | List of quad indices | |
| tetrahedra | List of tetrahedron indices | |
| hexahedra | List of hexahedron indices | |
| uv | List of uv coordinates | |
| computeAllBuffers | Option to compute all crossed topology buffers at init. False by default | 0 | 
| step | Step | 0.5 | 
| radius | Radius | 2 | 
| isoValue | Iso Value | 0.5 | 
| Visualization | ||
| drawEdges | if true, draw the topology Edges | 0 | 
| drawTriangles | if true, draw the topology Triangles | 0 | 
| drawQuads | if true, draw the topology Quads | 0 | 
| drawTetrahedra | if true, draw the topology Tetrahedra | 0 | 
| drawHexahedra | if true, draw the topology hexahedra | 0 | 
Links
| Name | Description | Destination type name | 
|---|---|---|
| context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext | 
| slaves | Sub-objects used internally by this object | BaseObject | 
| master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject | 
| input | Input object to map | State<Vec3d> | 
| output | Output object to map | State<Vec3d> | 
Examples
SPHFluidSurfaceMapping.scn
<?xml version="1.0" ?>
<Node dt="0.01" gravity="0 -10 0">
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [PlaneForceField] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <RequiredPlugin name="SofaSphFluid"/> <!-- Needed to use components [SPHFluidForceField SPHFluidSurfaceMapping SpatialGridContainer] -->
    <VisualStyle displayFlags="hideBehaviorModels showForceFields hideCollisionModels" />
    <DefaultAnimationLoop/>    
    <Node name="SPHSurfaceMapping">
        <EulerImplicitSolver name="cg_odesolver" printLog="false"  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />
        <RegularGridTopology nx="5" ny="40" nz="5" xmin="-1.5" xmax="0" ymin="-3" ymax="12" zmin="-1.5" zmax="0" drawEdges="0"/>
        <MechanicalObject name="MModel" />
        <UniformMass name="M1" vertexMass="1" />
        <SpatialGridContainer cellWidth="0.75"/>
        <SPHFluidForceField radius="0.745" density="15" kernelType="1" viscosityType="2" viscosity="10" pressure="1500" surfaceTension="-1000" printLog="0" />
        <PlaneForceField normal="1 0 0" d="-4" showPlane="1"/>
        <PlaneForceField normal="-1 0 0" d="-14" showPlane="1"/>
        <PlaneForceField normal="0.3 1 0" d="-4" showPlane="1"/>
        <PlaneForceField normal="0 0 1" d="-4" showPlane="1"/>
        <PlaneForceField normal="0 0 -1" d="-4" showPlane="1"/>
        <Node id="Visual">
            <OglModel name="VModel" color="blue" />
            <SPHFluidSurfaceMapping name="MarchingCube" input="@../MModel" output="@VModel" isoValue="0.5" radius="0.75" step="0.25" />
        </Node>
    </Node>
</Node>
def createScene(root_node):
   node = root_node.addChild('node', dt="0.01", gravity="0 -10 0")
   node.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
   node.addObject('RequiredPlugin', name="Sofa.Component.Mass")
   node.addObject('RequiredPlugin', name="Sofa.Component.MechanicalLoad")
   node.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
   node.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   node.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
   node.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   node.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   node.addObject('RequiredPlugin', name="SofaSphFluid")
   node.addObject('VisualStyle', displayFlags="hideBehaviorModels showForceFields hideCollisionModels")
   node.addObject('DefaultAnimationLoop', )
   sph_surface_mapping = node.addChild('SPHSurfaceMapping')
   sph_surface_mapping.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
   sph_surface_mapping.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
   sph_surface_mapping.addObject('RegularGridTopology', nx="5", ny="40", nz="5", xmin="-1.5", xmax="0", ymin="-3", ymax="12", zmin="-1.5", zmax="0", drawEdges="0")
   sph_surface_mapping.addObject('MechanicalObject', name="MModel")
   sph_surface_mapping.addObject('UniformMass', name="M1", vertexMass="1")
   sph_surface_mapping.addObject('SpatialGridContainer', cellWidth="0.75")
   sph_surface_mapping.addObject('SPHFluidForceField', radius="0.745", density="15", kernelType="1", viscosityType="2", viscosity="10", pressure="1500", surfaceTension="-1000", printLog="0")
   sph_surface_mapping.addObject('PlaneForceField', normal="1 0 0", d="-4", showPlane="1")
   sph_surface_mapping.addObject('PlaneForceField', normal="-1 0 0", d="-14", showPlane="1")
   sph_surface_mapping.addObject('PlaneForceField', normal="0.3 1 0", d="-4", showPlane="1")
   sph_surface_mapping.addObject('PlaneForceField', normal="0 0 1", d="-4", showPlane="1")
   sph_surface_mapping.addObject('PlaneForceField', normal="0 0 -1", d="-4", showPlane="1")
   node = SPHSurfaceMapping.addChild('node', id="Visual")
   node.addObject('OglModel', name="VModel", color="blue")
   node.addObject('SPHFluidSurfaceMapping', name="MarchingCube", input="@../MModel", output="@VModel", isoValue="0.5", radius="0.75", step="0.25")