Skip to content

DrawMesh<Hexahedron> does not check the consistency of the topology #6151

Description

@fredroy

Problem

When using a SparseGrid and something drawing the associated hexahedra using DrawMesh (for example HexahedronFEMForcefield and rendering the FEM), then it is crashing because it is expecting having the associated quads composing the hexahedra. It seems that SparseGrid does only create the hexahedra.

Steps to reproduce
Simple Scene:

<Node name="root" gravity="0 0 0"  dt="0.04">
    <Node name="plugins" >
        <RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
        <RequiredPlugin pluginName="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
        <RequiredPlugin pluginName="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
        <RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
        <RequiredPlugin pluginName="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
        <RequiredPlugin pluginName="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
        <RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
        <RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [HexahedronFEMForceField] -->
        <RequiredPlugin pluginName="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
        <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [SparseGridTopology] -->
        <RequiredPlugin pluginName="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    </Node>

    <DefaultAnimationLoop />

    <Node name="DynamicStuff" >
        <EulerImplicitSolver name="cg_odesolver"  />
        <CGLinearSolver name="linear solver" iterations="25" tolerance="1e-15" threshold="1e-15" />

        <Node name="Cylinder" >
            <SparseGridTopology name="grid" n="6 10 6" filename="mesh/cylinder.obj" />
            <MechanicalObject name="mechanicalDofs" />
            <UniformMass  totalMass="1" />
            <HexahedronFEMForceField template="Vec3d" name="FEM" method="large" poissonRatio="0.3" youngModulus="3000" />
            <BoxROI name="bbox" drawBoxes="true" box="-1.05 -0.5 -1.05  1.05 0.5 1.05
                                                      -1.05 9.5 -1.05  1.05 10.5 1.05"  />
            <FixedConstraint  name="FixedConstraint" indices="@bbox.indices" />

            <Node name="Visual" >
                <MeshOBJLoader name="loader" filename="mesh/cylinder.obj" triangulate="true"/>
                <OglModel src="@loader" color="1.0 0.8 0.8"/>
                <BarycentricMapping  />
            </Node>
        </Node>
    </Node>
</Node>

Expected behavior
Drawing the hexahedric FEM and not crashing...

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bug (minor)Bug affecting only some users or with no major impact on the framework

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions