#include <SparseGridTopology.h>


Public Types | |
| enum | Type { OUTSIDE, INSIDE, BOUNDARY } |
| enum | { UP, DOWN, RIGHT, LEFT, BEFORE, BEHIND, NUM_CONNECTED_NODES } |
| typedef fixed_array< Vector3, 8 > | CubeCorners |
| typedef Vec< 3, int > | Vec3i |
| typedef std::map< Vector3, int > | MapBetweenCornerPositionAndIndice |
| a vertex indice for a given vertex position in space | |
| typedef std::vector < fixed_array< int, 8 > > | HierarchicalCubeMap |
| connexion between several coarsened levels | |
| typedef helper::vector< int > | InverseHierarchicalCubeMap |
| a fine cube indice -> corresponding coarser cube indice | |
| typedef std::map< int, float > | AHierarchicalPointMap |
| typedef helper::vector < AHierarchicalPointMap > | HierarchicalPointMap |
| a point indice -> corresponding 27 child indices on the potential _finerSparseGrid with corresponding weight | |
| typedef helper::vector < AHierarchicalPointMap > | InverseHierarchicalPointMap |
| a fine point indice -> corresponding some parent points for interpolation | |
| typedef helper::vector< int > | PointMap |
| typedef helper::vector < helper::fixed_array< int, NUM_CONNECTED_NODES > > | NodeAdjacency |
| a node -> its 6 neighboors | |
| typedef helper::vector < helper::vector< int > > | NodeCubesAdjacency |
| a node -> its 8 neighboor cells | |
| typedef helper::vector < helper::vector< int > > | NodeCornersAdjacency |
| a node -> its 8 corners of neighboor cells | |
Public Member Functions | |
| SparseGridTopology (bool _isVirtual=false) | |
| bool | load (const char *filename) |
| Load the topology from a file. | |
| virtual void | init () |
| Initialization method called at graph modification, during bottom-up traversal. | |
| void | buildAsFinest () |
| building from a mesh file | |
| void | buildFromFiner () |
| building by condensating a finer sparse grid (used if setFinerSparseGrid has initializated _finerSparseGrid before calling init() ) | |
| void | buildVirtualFinerLevels () |
| building eventual virtual finer levels (cf _nbVirtualFinerLevels) | |
| Vec< 3, int > | getN () const |
| int | getNx () const |
| int | getNy () const |
| int | getNz () const |
| void | setN (Vec3i _n) |
| void | setNx (int _n) |
| void | setNy (int _n) |
| void | setNz (int _n) |
| int | getNbVirtualFinerLevels () const |
| void | setNbVirtualFinerLevels (int n) |
| void | setMin (Vector3 val) |
| void | setXmin (SReal val) |
| void | setYmin (SReal val) |
| void | setZmin (SReal val) |
| void | setMax (Vector3 val) |
| void | setXmax (SReal val) |
| void | setYmax (SReal val) |
| void | setZmax (SReal val) |
| Vector3 | getMin () |
| SReal | getXmin () |
| SReal | getYmin () |
| SReal | getZmin () |
| Vector3 | getMax () |
| SReal | getXmax () |
| SReal | getYmax () |
| SReal | getZmax () |
| bool | hasPos () const |
| virtual int | findCube (const Vector3 &pos, SReal &fx, SReal &fy, SReal &fz) |
| return the cube containing the given point (or -1 if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e. | |
| virtual int | findNearestCube (const Vector3 &pos, SReal &fx, SReal &fy, SReal &fz) |
| return the cube containing the given point (or -1 if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e. | |
| virtual helper::fixed_array < int, 6 > | findneighboorCubes (int indice) |
| return indices of 6 neighboor cubes | |
| virtual Type | getType (int i) |
| return the type of the i-th cube | |
| SparseGridTopology * | getFinerSparseGrid () const |
| void | setFinerSparseGrid (SparseGridTopology *fsp) |
| SparseGridTopology * | getCoarserSparseGrid () const |
| void | setCoarserSparseGrid (SparseGridTopology *csp) |
| void | updateMesh () |
| Vector3 | getPointPos (int i) |
| void | getMesh (sofa::helper::io::Mesh &m) |
| void | setDimVoxels (int a, int b, int c) |
| void | setSizeVoxel (float a, float b, float c) |
| bool | getVoxel (unsigned int x, unsigned int y, unsigned int z) |
| bool | getVoxel (unsigned int index) const |
| virtual const SeqCubes & | getHexas () |
| virtual int | getNbPoints () const |
| virtual int | getNbHexas () |
Data Fields | |
| HierarchicalCubeMap | _hierarchicalCubeMap |
| InverseHierarchicalCubeMap | _inverseHierarchicalCubeMap |
| HierarchicalPointMap | _hierarchicalPointMap |
| InverseHierarchicalPointMap | _inverseHierarchicalPointMap |
| PointMap | _pointMap |
| a coarse point indice -> corresponding point in finer level | |
| PointMap | _inversePointMap |
| a fine point indice -> corresponding point in coarser level | |
| NodeAdjacency | _nodeAdjacency |
| NodeCubesAdjacency | _nodeCubesAdjacency |
| NodeCornersAdjacency | _nodeCornersAdjacency |
| helper::vector < SparseGridTopology * > | _virtualFinerLevels |
| saving the virtual levels (cf _nbVirtualFinerLevels) | |
| RegularGridTopology | _regularGrid |
| based on a corresponding RegularGrid | |
| vector< int > | _indicesOfRegularCubeInSparseGrid |
| to redirect an indice of a cube in the regular grid to its indice in the sparse grid | |
| vector< int > | _indicesOfCubeinRegularGrid |
| to redirect an indice of a cube in the sparse grid to its indice in the regular grid | |
Static Public Attributes | |
| static const float | WEIGHT27 [8][27] |
| static const int | cornerIndicesFromFineToCoarse [8][8] |
Protected Member Functions | |
| virtual void | updateEdges () |
| virtual void | updateQuads () |
| virtual void | updateHexas () |
| void | propagateFrom (const int i, const int j, const int k, RegularGridTopology ®ularGrid, vector< Type > ®ularGridTypes, vector< bool > &alreadyTested) const |
| start from a seed cell (i,j,k) the OUTSIDE filling is propagated to neighboor cells until meet a BOUNDARY cell (this function is called from all border cells of the RegularGrid) | |
| void | computeBoundingBox (const helper::vector< Vector3 > &vertices, SReal &xmin, SReal &xmax, SReal &ymin, SReal &ymax, SReal &zmin, SReal &zmax) const |
| void | voxelizeTriangleMesh (helper::io::Mesh *mesh, RegularGridTopology ®ularGrid, vector< Type > ®ularGridTypes) const |
| void | buildFromTriangleMesh (const std::string &filename) |
| void | buildFromRegularGridTypes (RegularGridTopology ®ularGrid, const vector< Type > ®ularGridTypes) |
| void | buildFromVoxelFile (const std::string &filename) |
| Create a sparse grid from a .voxel file .voxel file format (ascii): 512 // num voxels x 512 // num voxels y 246 // num voxels z 0.7 // voxels size x [mm] 0.7 // voxels size y [mm] 2 // voxels size z [mm] 0 0 255 0 0 . | |
| void | buildFromRawVoxelFile (const std::string &filename) |
| template<class T > | |
| void | constructCollisionModels (const sofa::helper::vector< sofa::core::componentmodel::topology::BaseMeshTopology * > &list_mesh, const sofa::helper::vector< sofa::helper::vector< Vec< 3, T > > * > &list_X) const |
| void | setVoxel (int index, unsigned char value) |
Protected Attributes | |
| bool | isVirtual |
| Data< Vec< 3, int > > | n |
| cutting number in all directions | |
| Data< Vector3 > | _min |
| Data< Vector3 > | _max |
| Data< int > | _nbVirtualFinerLevels |
| create virtual (not in the animation tree) finer sparse grids in order to dispose of finest information (usefull to compute better mechanical properties for example) | |
| Data< Vec3i > | dataResolution |
| Data< Vector3 > | voxelSize |
| Data< unsigned int > | marchingCubeStep |
| Data< unsigned int > | convolutionSize |
| MarchingCubeUtility | marchingCubes |
| Data< vector< unsigned char > > | dataVoxels |
| bool | _usingMC |
| sofa::helper::vector< Type > | _types |
| BOUNDARY or FULL filled cells. | |
| SparseGridTopology * | _finerSparseGrid |
| an eventual finer sparse grid that can be used to built this coarser sparse grid | |
| SparseGridTopology * | _coarserSparseGrid |
| an eventual coarser sparse grid | |
| bool | _alreadyInit |
Like a sparse FFD building from the bounding box of the object. Starting from a RegularGrid, only valid cells containing matter (ie intersecting the original surface mesh or totally inside the object) are considered. Valid cells are tagged by a Type BOUNDARY or INSIDE WARNING: the corresponding node in the XML file has to be placed BEFORE the MechanicalObject node, in order to excute its init() before the MechanicalObject one in order to be able to give dofs
Definition at line 53 of file SparseGridTopology.h.
| typedef std::map<int,float> sofa::component::topology::SparseGridTopology::AHierarchicalPointMap |
Definition at line 84 of file SparseGridTopology.h.
| typedef fixed_array<Vector3,8> sofa::component::topology::SparseGridTopology::CubeCorners |
Definition at line 57 of file SparseGridTopology.h.
| typedef std::vector<fixed_array<int,8> > sofa::component::topology::SparseGridTopology::HierarchicalCubeMap |
connexion between several coarsened levels
a cube indice -> corresponding 8 child indices on the potential _finerSparseGrid
Definition at line 79 of file SparseGridTopology.h.
| typedef helper::vector< AHierarchicalPointMap > sofa::component::topology::SparseGridTopology::HierarchicalPointMap |
a point indice -> corresponding 27 child indices on the potential _finerSparseGrid with corresponding weight
Definition at line 86 of file SparseGridTopology.h.
| typedef helper::vector<int> sofa::component::topology::SparseGridTopology::InverseHierarchicalCubeMap |
a fine cube indice -> corresponding coarser cube indice
Definition at line 81 of file SparseGridTopology.h.
| typedef helper::vector< AHierarchicalPointMap > sofa::component::topology::SparseGridTopology::InverseHierarchicalPointMap |
a fine point indice -> corresponding some parent points for interpolation
Definition at line 88 of file SparseGridTopology.h.
| typedef std::map<Vector3,int> sofa::component::topology::SparseGridTopology::MapBetweenCornerPositionAndIndice |
a vertex indice for a given vertex position in space
Definition at line 76 of file SparseGridTopology.h.
| typedef helper::vector< helper::fixed_array<int,NUM_CONNECTED_NODES> > sofa::component::topology::SparseGridTopology::NodeAdjacency |
Definition at line 90 of file SparseGridTopology.h.
Definition at line 60 of file SparseGridTopology.h.
| anonymous enum |
Definition at line 95 of file SparseGridTopology.h.
| sofa::component::topology::SparseGridTopology::SparseGridTopology | ( | bool | _isVirtual = false |
) |
Definition at line 101 of file SparseGridTopology.cpp.
References _alreadyInit, _coarserSparseGrid, _finerSparseGrid, _usingMC, and isVirtual.
Referenced by buildVirtualFinerLevels().
| void sofa::component::topology::SparseGridTopology::buildAsFinest | ( | ) |
building from a mesh file
Definition at line 216 of file SparseGridTopology.cpp.
References _usingMC, buildFromRawVoxelFile(), buildFromTriangleMesh(), buildFromVoxelFile(), sofa::core::componentmodel::topology::BaseMeshTopology::d_filename, sofa::helper::system::DataRepository, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by init().
| void sofa::component::topology::SparseGridTopology::buildFromFiner | ( | ) |
building by condensating a finer sparse grid (used if setFinerSparseGrid has initializated _finerSparseGrid before calling init() )
Definition at line 756 of file SparseGridTopology.cpp.
References _coarserSparseGrid, _finerSparseGrid, _hierarchicalCubeMap, _hierarchicalPointMap, _indicesOfCubeinRegularGrid, _indicesOfRegularCubeInSparseGrid, _inverseHierarchicalCubeMap, _inverseHierarchicalPointMap, _inversePointMap, _pointMap, _regularGrid, _types, sofa::core::objectmodel::Data< T >::beginEdit(), BOUNDARY, cornerIndicesFromFineToCoarse, sofa::component::topology::GridTopology::cube(), sofa::core::objectmodel::Data< T >::endEdit(), sofa::helper::vector< T, Alloc >::fill(), sofa::component::topology::RegularGridTopology::getDx(), sofa::component::topology::RegularGridTopology::getDy(), sofa::component::topology::RegularGridTopology::getDz(), sofa::component::topology::MeshTopology::getHexa(), sofa::component::topology::GridTopology::getHexaCopy(), getMin(), sofa::component::topology::GridTopology::getNbHexas(), getNx(), getNy(), getNz(), sofa::component::topology::RegularGridTopology::getPoint(), getType(), sofa::core::objectmodel::Data< T >::getValue(), getXmax(), getXmin(), getYmax(), getYmin(), getZmax(), getZmin(), INSIDE, sofa::component::topology::MeshTopology::nbPoints, sofa::component::topology::MeshTopology::seqHexas, sofa::component::topology::MeshTopology::seqPoints, setMin(), setNx(), setNy(), setNz(), sofa::component::topology::RegularGridTopology::setPos(), sofa::component::topology::GridTopology::setSize(), setXmax(), setYmax(), setZmax(), and WEIGHT27.
Referenced by init().
| void sofa::component::topology::SparseGridTopology::buildFromRawVoxelFile | ( | const std::string & | filename | ) | [protected] |
Definition at line 336 of file SparseGridTopology.cpp.
References _indicesOfRegularCubeInSparseGrid, _max, _min, _regularGrid, sofa::core::objectmodel::Data< T >::beginEdit(), buildFromRegularGridTypes(), dataResolution, dataVoxels, sofa::component::topology::GridTopology::getNbHexas(), getNx(), getNy(), getNz(), sofa::core::objectmodel::Data< T >::getValue(), getXmax(), getXmin(), getYmax(), getYmin(), getZmax(), getZmin(), INSIDE, isVirtual, OUTSIDE, sofa::component::topology::RegularGridTopology::setPos(), sofa::component::topology::GridTopology::setSize(), sofa::core::objectmodel::Data< T >::setValue(), setVoxel(), updateMesh(), and voxelSize.
Referenced by buildAsFinest().
| void sofa::component::topology::SparseGridTopology::buildFromRegularGridTypes | ( | RegularGridTopology & | regularGrid, | |
| const vector< Type > & | regularGridTypes | |||
| ) | [protected] |
Definition at line 657 of file SparseGridTopology.cpp.
References _indicesOfCubeinRegularGrid, _indicesOfRegularCubeInSparseGrid, _regularGrid, _types, sofa::core::objectmodel::Data< T >::beginEdit(), BOUNDARY, sofa::core::objectmodel::Data< T >::endEdit(), sofa::component::topology::GridTopology::getHexaCopy(), sofa::component::topology::GridTopology::getNbHexas(), sofa::component::topology::RegularGridTopology::getPoint(), INSIDE, sofa::component::topology::MeshTopology::nbPoints, sofa::component::topology::MeshTopology::seqHexas, and sofa::component::topology::MeshTopology::seqPoints.
Referenced by buildFromRawVoxelFile(), buildFromTriangleMesh(), and buildFromVoxelFile().
| void sofa::component::topology::SparseGridTopology::buildFromTriangleMesh | ( | const std::string & | filename | ) | [protected] |
Definition at line 503 of file SparseGridTopology.cpp.
References _max, _min, _regularGrid, buildFromRegularGridTypes(), computeBoundingBox(), sofa::helper::io::Mesh::Create(), getNx(), getNy(), getNz(), sofa::core::objectmodel::Data< T >::getValue(), sofa::helper::io::Mesh::getVertices(), getXmax(), getXmin(), getYmax(), getYmin(), getZmax(), getZmin(), sofa::component::topology::RegularGridTopology::setPos(), sofa::component::topology::GridTopology::setSize(), sofa::core::objectmodel::Data< T >::setValue(), and voxelizeTriangleMesh().
Referenced by buildAsFinest().
| void sofa::component::topology::SparseGridTopology::buildFromVoxelFile | ( | const std::string & | filename | ) | [protected] |
Create a sparse grid from a .voxel file .voxel file format (ascii): 512 // num voxels x 512 // num voxels y 246 // num voxels z 0.7 // voxels size x [mm] 0.7 // voxels size y [mm] 2 // voxels size z [mm] 0 0 255 0 0 .
.. // data
Definition at line 255 of file SparseGridTopology.cpp.
References _indicesOfRegularCubeInSparseGrid, _max, _min, _regularGrid, sofa::core::objectmodel::Data< T >::beginEdit(), buildFromRegularGridTypes(), dataVoxels, sofa::component::topology::GridTopology::getNbHexas(), getNx(), getNy(), getNz(), sofa::core::objectmodel::Data< T >::getValue(), getXmax(), getXmin(), getYmax(), getYmin(), getZmax(), getZmin(), INSIDE, n, OUTSIDE, sofa::component::topology::RegularGridTopology::setPos(), sofa::component::topology::GridTopology::setSize(), sofa::core::objectmodel::Data< T >::setValue(), and setVoxel().
Referenced by buildAsFinest().
| void sofa::component::topology::SparseGridTopology::buildVirtualFinerLevels | ( | ) |
building eventual virtual finer levels (cf _nbVirtualFinerLevels)
Definition at line 1012 of file SparseGridTopology.cpp.
References _nbVirtualFinerLevels, _virtualFinerLevels, sofa::core::componentmodel::topology::BaseMeshTopology::d_filename, sofa::core::objectmodel::Base::getName(), sofa::core::objectmodel::Data< T >::getValue(), n, setFinerSparseGrid(), and SparseGridTopology().
Referenced by init().
| void sofa::component::topology::SparseGridTopology::computeBoundingBox | ( | const helper::vector< Vector3 > & | vertices, | |
| SReal & | xmin, | |||
| SReal & | xmax, | |||
| SReal & | ymin, | |||
| SReal & | ymax, | |||
| SReal & | zmin, | |||
| SReal & | zmax | |||
| ) | const [protected] |
Referenced by buildFromTriangleMesh().
| void sofa::component::topology::SparseGridTopology::constructCollisionModels | ( | const sofa::helper::vector< sofa::core::componentmodel::topology::BaseMeshTopology * > & | list_mesh, | |
| const sofa::helper::vector< sofa::helper::vector< Vec< 3, T > > * > & | list_X | |||
| ) | const [inline, protected] |
Definition at line 469 of file SparseGridTopology.cpp.
References dataVoxels, sofa::core::objectmodel::Data< T >::getValue(), marchingCubes, and sofa::helper::MarchingCubeUtility::run().
Referenced by updateMesh().
| virtual int sofa::component::topology::SparseGridTopology::findCube | ( | const Vector3 & | pos, | |
| SReal & | fx, | |||
| SReal & | fy, | |||
| SReal & | fz | |||
| ) | [virtual] |
return the cube containing the given point (or -1 if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e.
barycentric coordinates).
Referenced by sofa::component::mapping::BarycentricMapperSparseGridTopology< In, Out >::init().
| virtual int sofa::component::topology::SparseGridTopology::findNearestCube | ( | const Vector3 & | pos, | |
| SReal & | fx, | |||
| SReal & | fy, | |||
| SReal & | fz | |||
| ) | [virtual] |
return the cube containing the given point (or -1 if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e.
barycentric coordinates).
Referenced by sofa::component::mapping::BarycentricMapperSparseGridTopology< In, Out >::init().
| helper::fixed_array< int, 6 > sofa::component::topology::SparseGridTopology::findneighboorCubes | ( | int | indice | ) | [virtual] |
return indices of 6 neighboor cubes
Definition at line 1132 of file SparseGridTopology.cpp.
References _indicesOfCubeinRegularGrid, _indicesOfRegularCubeInSparseGrid, _regularGrid, sofa::component::topology::RegularGridTopology::getCubeCoordinate(), sofa::component::topology::RegularGridTopology::getCubeIndex(), getNx(), getNy(), and getNz().
| SparseGridTopology* sofa::component::topology::SparseGridTopology::getCoarserSparseGrid | ( | ) | const [inline] |
| SparseGridTopology* sofa::component::topology::SparseGridTopology::getFinerSparseGrid | ( | ) | const [inline] |
| virtual const SeqCubes& sofa::component::topology::SparseGridTopology::getHexas | ( | ) | [inline, virtual] |
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 319 of file SparseGridTopology.h.
References _alreadyInit, and init().
Referenced by getNbHexas().
| Vector3 sofa::component::topology::SparseGridTopology::getMax | ( | ) | [inline] |
Definition at line 137 of file SparseGridTopology.h.
References _max, and sofa::core::objectmodel::Data< T >::getValue().
| void sofa::component::topology::SparseGridTopology::getMesh | ( | sofa::helper::io::Mesh & | m | ) |
Definition at line 462 of file SparseGridTopology.cpp.
References dataVoxels, sofa::core::objectmodel::Data< T >::getValue(), marchingCubes, and sofa::helper::MarchingCubeUtility::run().
| Vector3 sofa::component::topology::SparseGridTopology::getMin | ( | ) | [inline] |
Definition at line 132 of file SparseGridTopology.h.
References _min, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by buildFromFiner().
| virtual int sofa::component::topology::SparseGridTopology::getNbHexas | ( | ) | [inline, virtual] |
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 331 of file SparseGridTopology.h.
References getHexas().
| virtual int sofa::component::topology::SparseGridTopology::getNbPoints | ( | ) | const [inline, virtual] |
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 325 of file SparseGridTopology.h.
References _alreadyInit, and init().
| int sofa::component::topology::SparseGridTopology::getNbVirtualFinerLevels | ( | ) | const [inline] |
Definition at line 117 of file SparseGridTopology.h.
References _nbVirtualFinerLevels, and sofa::core::objectmodel::Data< T >::getValue().
| int sofa::component::topology::SparseGridTopology::getNx | ( | ) | const [inline] |
Definition at line 108 of file SparseGridTopology.h.
References n.
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), buildFromVoxelFile(), and findneighboorCubes().
| int sofa::component::topology::SparseGridTopology::getNy | ( | ) | const [inline] |
Definition at line 109 of file SparseGridTopology.h.
References n.
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), buildFromVoxelFile(), and findneighboorCubes().
| int sofa::component::topology::SparseGridTopology::getNz | ( | ) | const [inline] |
Definition at line 110 of file SparseGridTopology.h.
References n.
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), buildFromVoxelFile(), and findneighboorCubes().
Definition at line 170 of file SparseGridTopology.h.
References sofa::component::topology::MeshTopology::seqPoints.
| SparseGridTopology::Type sofa::component::topology::SparseGridTopology::getType | ( | int | i | ) | [virtual] |
return the type of the i-th cube
Definition at line 1150 of file SparseGridTopology.cpp.
References _types.
Referenced by sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::accumulateForceLarge(), sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::accumulateForcePolar(), buildFromFiner(), sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::draw(), sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::initLarge(), and sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::initPolar().
Definition at line 183 of file SparseGridTopology.h.
References dataVoxels, and sofa::core::objectmodel::Data< T >::getValue().
| SReal sofa::component::topology::SparseGridTopology::getXmax | ( | ) | [inline] |
Definition at line 138 of file SparseGridTopology.h.
References _max, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), and buildFromVoxelFile().
| SReal sofa::component::topology::SparseGridTopology::getXmin | ( | ) | [inline] |
Definition at line 133 of file SparseGridTopology.h.
References _min, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), and buildFromVoxelFile().
| SReal sofa::component::topology::SparseGridTopology::getYmax | ( | ) | [inline] |
Definition at line 139 of file SparseGridTopology.h.
References _max, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), and buildFromVoxelFile().
| SReal sofa::component::topology::SparseGridTopology::getYmin | ( | ) | [inline] |
Definition at line 134 of file SparseGridTopology.h.
References _min, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), and buildFromVoxelFile().
| SReal sofa::component::topology::SparseGridTopology::getZmax | ( | ) | [inline] |
Definition at line 140 of file SparseGridTopology.h.
References _max, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), and buildFromVoxelFile().
| SReal sofa::component::topology::SparseGridTopology::getZmin | ( | ) | [inline] |
Definition at line 135 of file SparseGridTopology.h.
References _min, and sofa::core::objectmodel::Data< T >::getValue().
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromTriangleMesh(), and buildFromVoxelFile().
| bool sofa::component::topology::SparseGridTopology::hasPos | ( | ) | const [inline, virtual] |
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 142 of file SparseGridTopology.h.
| void sofa::component::topology::SparseGridTopology::init | ( | void | ) | [virtual] |
Initialization method called at graph modification, during bottom-up traversal.
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 131 of file SparseGridTopology.cpp.
References _alreadyInit, _finerSparseGrid, _nbVirtualFinerLevels, _nodeAdjacency, _nodeCubesAdjacency, BEFORE, BEHIND, buildAsFinest(), buildFromFiner(), buildVirtualFinerLevels(), DOWN, sofa::core::objectmodel::Data< T >::getValue(), sofa::component::topology::MeshTopology::invalidate(), LEFT, n, RIGHT, sofa::component::topology::MeshTopology::seqHexas, sofa::component::topology::MeshTopology::seqPoints, and UP.
Referenced by getHexas(), and getNbPoints().
| bool sofa::component::topology::SparseGridTopology::load | ( | const char * | filename | ) | [virtual] |
Load the topology from a file.
The default implementation supports the following formats: obj, gmsh, mesh (custom simple text file), xs3 (deprecated description of mass-springs networks).
Reimplemented from sofa::core::componentmodel::topology::BaseMeshTopology.
Definition at line 120 of file SparseGridTopology.cpp.
References sofa::core::componentmodel::topology::BaseMeshTopology::d_filename, sofa::helper::system::DataRepository, and sofa::core::objectmodel::Data< T >::setValue().
| void sofa::component::topology::SparseGridTopology::propagateFrom | ( | const int | i, | |
| const int | j, | |||
| const int | k, | |||
| RegularGridTopology & | regularGrid, | |||
| vector< Type > & | regularGridTypes, | |||
| vector< bool > & | alreadyTested | |||
| ) | const [protected] |
start from a seed cell (i,j,k) the OUTSIDE filling is propagated to neighboor cells until meet a BOUNDARY cell (this function is called from all border cells of the RegularGrid)
Definition at line 1297 of file SparseGridTopology.cpp.
References BOUNDARY, sofa::component::topology::GridTopology::cube(), sofa::component::topology::GridTopology::getNx(), sofa::component::topology::GridTopology::getNy(), sofa::component::topology::GridTopology::getNz(), and OUTSIDE.
Referenced by voxelizeTriangleMesh().
| void sofa::component::topology::SparseGridTopology::setCoarserSparseGrid | ( | SparseGridTopology * | csp | ) | [inline] |
| void sofa::component::topology::SparseGridTopology::setFinerSparseGrid | ( | SparseGridTopology * | fsp | ) | [inline] |
Definition at line 160 of file SparseGridTopology.h.
References _finerSparseGrid.
Referenced by buildVirtualFinerLevels().
| void sofa::component::topology::SparseGridTopology::setMax | ( | Vector3 | val | ) | [inline] |
Definition at line 126 of file SparseGridTopology.h.
References _min, and sofa::core::objectmodel::Data< T >::setValue().
| void sofa::component::topology::SparseGridTopology::setMin | ( | Vector3 | val | ) | [inline] |
Definition at line 120 of file SparseGridTopology.h.
References _min, and sofa::core::objectmodel::Data< T >::setValue().
Referenced by buildFromFiner().
| void sofa::component::topology::SparseGridTopology::setN | ( | Vec3i | _n | ) | [inline] |
| void sofa::component::topology::SparseGridTopology::setNbVirtualFinerLevels | ( | int | n | ) | [inline] |
Definition at line 118 of file SparseGridTopology.h.
References _nbVirtualFinerLevels, and sofa::core::objectmodel::Data< T >::setValue().
| void sofa::component::topology::SparseGridTopology::setNx | ( | int | _n | ) | [inline] |
| void sofa::component::topology::SparseGridTopology::setNy | ( | int | _n | ) | [inline] |
| void sofa::component::topology::SparseGridTopology::setNz | ( | int | _n | ) | [inline] |
| void sofa::component::topology::SparseGridTopology::setSizeVoxel | ( | float | a, | |
| float | b, | |||
| float | c | |||
| ) | [inline] |
Definition at line 176 of file SparseGridTopology.h.
References sofa::core::objectmodel::Data< T >::setValue(), and voxelSize.
| void sofa::component::topology::SparseGridTopology::setVoxel | ( | int | index, | |
| unsigned char | value | |||
| ) | [inline, protected] |
Definition at line 253 of file SparseGridTopology.h.
References sofa::core::objectmodel::Data< T >::beginEdit(), and dataVoxels.
Referenced by buildFromRawVoxelFile(), and buildFromVoxelFile().
| void sofa::component::topology::SparseGridTopology::setXmax | ( | SReal | val | ) | [inline] |
Definition at line 128 of file SparseGridTopology.h.
References _max, sofa::core::objectmodel::Data< T >::getValue(), and sofa::core::objectmodel::Data< T >::setValue().
Referenced by buildFromFiner().
| void sofa::component::topology::SparseGridTopology::setXmin | ( | SReal | val | ) | [inline] |
Definition at line 121 of file SparseGridTopology.h.
References _min, sofa::core::objectmodel::Data< T >::getValue(), and sofa::core::objectmodel::Data< T >::setValue().
| void sofa::component::topology::SparseGridTopology::setYmax | ( | SReal | val | ) | [inline] |
Definition at line 129 of file SparseGridTopology.h.
References _max, sofa::core::objectmodel::Data< T >::getValue(), and sofa::core::objectmodel::Data< T >::setValue().
Referenced by buildFromFiner().
| void sofa::component::topology::SparseGridTopology::setYmin | ( | SReal | val | ) | [inline] |
Definition at line 122 of file SparseGridTopology.h.
References _min, sofa::core::objectmodel::Data< T >::getValue(), and sofa::core::objectmodel::Data< T >::setValue().
| void sofa::component::topology::SparseGridTopology::setZmax | ( | SReal | val | ) | [inline] |
Definition at line 130 of file SparseGridTopology.h.
References _max, sofa::core::objectmodel::Data< T >::getValue(), and sofa::core::objectmodel::Data< T >::setValue().
Referenced by buildFromFiner().
| void sofa::component::topology::SparseGridTopology::setZmin | ( | SReal | val | ) | [inline] |
Definition at line 123 of file SparseGridTopology.h.
References _min, sofa::core::objectmodel::Data< T >::getValue(), and sofa::core::objectmodel::Data< T >::setValue().
| void sofa::component::topology::SparseGridTopology::updateEdges | ( | ) | [protected, virtual] |
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 1161 of file SparseGridTopology.cpp.
References sofa::core::objectmodel::Data< T >::getValue(), sofa::component::topology::MeshTopology::seqEdges, and sofa::component::topology::MeshTopology::seqHexas.
| void sofa::component::topology::SparseGridTopology::updateHexas | ( | ) | [protected, virtual] |
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 1223 of file SparseGridTopology.cpp.
| void sofa::component::topology::SparseGridTopology::updateMesh | ( | ) |
Definition at line 396 of file SparseGridTopology.cpp.
References _max, _min, _usingMC, sofa::core::objectmodel::Data< T >::beginEdit(), constructCollisionModels(), convolutionSize, dataResolution, dataVoxels, sofa::core::objectmodel::BaseContext::get(), sofa::core::objectmodel::BaseObject::getContext(), sofa::core::objectmodel::Data< T >::getValue(), sofa::component::MechanicalObject< DataTypes >::getX(), marchingCubes, marchingCubeStep, sofa::core::objectmodel::BaseContext::SearchDown, sofa::helper::MarchingCubeUtility::setConvolutionSize(), sofa::helper::MarchingCubeUtility::setDataResolution(), sofa::helper::MarchingCubeUtility::setDataVoxelSize(), sofa::helper::MarchingCubeUtility::setStep(), sofa::core::objectmodel::Data< T >::setValue(), and voxelSize.
Referenced by buildFromRawVoxelFile().
| void sofa::component::topology::SparseGridTopology::updateQuads | ( | ) | [protected, virtual] |
Reimplemented from sofa::component::topology::MeshTopology.
Definition at line 1193 of file SparseGridTopology.cpp.
References sofa::core::objectmodel::Data< T >::getValue(), sofa::component::topology::MeshTopology::seqHexas, and sofa::component::topology::MeshTopology::seqQuads.
| void sofa::component::topology::SparseGridTopology::voxelizeTriangleMesh | ( | helper::io::Mesh * | mesh, | |
| RegularGridTopology & | regularGrid, | |||
| vector< Type > & | regularGridTypes | |||
| ) | const [protected] |
Definition at line 538 of file SparseGridTopology.cpp.
References BOUNDARY, sofa::helper::polygon_cube_intersection::fast_polygon_intersects_cube(), sofa::helper::polygon_cube_intersection::get_polygon_normal(), sofa::helper::io::Mesh::getFacets(), sofa::component::topology::GridTopology::getHexaCopy(), sofa::component::topology::GridTopology::getNbHexas(), sofa::component::topology::GridTopology::getNx(), sofa::component::topology::GridTopology::getNy(), sofa::component::topology::GridTopology::getNz(), sofa::component::topology::RegularGridTopology::getPoint(), sofa::helper::io::Mesh::getVertices(), INSIDE, and propagateFrom().
Referenced by buildFromTriangleMesh().
Definition at line 264 of file SparseGridTopology.h.
Referenced by getHexas(), getNbPoints(), init(), and SparseGridTopology().
an eventual coarser sparse grid
Definition at line 251 of file SparseGridTopology.h.
Referenced by buildFromFiner(), getCoarserSparseGrid(), setCoarserSparseGrid(), and SparseGridTopology().
an eventual finer sparse grid that can be used to built this coarser sparse grid
Definition at line 250 of file SparseGridTopology.h.
Referenced by buildFromFiner(), getFinerSparseGrid(), init(), setFinerSparseGrid(), and SparseGridTopology().
to redirect an indice of a cube in the sparse grid to its indice in the regular grid
Definition at line 168 of file SparseGridTopology.h.
Referenced by buildFromFiner(), buildFromRegularGridTypes(), and findneighboorCubes().
to redirect an indice of a cube in the regular grid to its indice in the sparse grid
Definition at line 167 of file SparseGridTopology.h.
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromRegularGridTypes(), buildFromVoxelFile(), and findneighboorCubes().
a fine point indice -> corresponding point in coarser level
Definition at line 92 of file SparseGridTopology.h.
Referenced by buildFromFiner().
Data< Vector3 > sofa::component::topology::SparseGridTopology::_max [protected] |
Definition at line 196 of file SparseGridTopology.h.
Referenced by buildFromRawVoxelFile(), buildFromTriangleMesh(), buildFromVoxelFile(), getMax(), getXmax(), getYmax(), getZmax(), setXmax(), setYmax(), setZmax(), and updateMesh().
Data< Vector3 > sofa::component::topology::SparseGridTopology::_min [protected] |
Definition at line 195 of file SparseGridTopology.h.
Referenced by buildFromRawVoxelFile(), buildFromTriangleMesh(), buildFromVoxelFile(), getMin(), getXmin(), getYmin(), getZmin(), setMax(), setMin(), setXmin(), setYmin(), setZmin(), and updateMesh().
create virtual (not in the animation tree) finer sparse grids in order to dispose of finest information (usefull to compute better mechanical properties for example)
Definition at line 197 of file SparseGridTopology.h.
Referenced by buildVirtualFinerLevels(), getNbVirtualFinerLevels(), init(), and setNbVirtualFinerLevels().
Definition at line 101 of file SparseGridTopology.h.
a coarse point indice -> corresponding point in finer level
Definition at line 91 of file SparseGridTopology.h.
Referenced by buildFromFiner().
based on a corresponding RegularGrid
Definition at line 166 of file SparseGridTopology.h.
Referenced by buildFromFiner(), buildFromRawVoxelFile(), buildFromRegularGridTypes(), buildFromTriangleMesh(), buildFromVoxelFile(), and findneighboorCubes().
BOUNDARY or FULL filled cells.
Definition at line 212 of file SparseGridTopology.h.
Referenced by buildFromFiner(), buildFromRegularGridTypes(), and getType().
Definition at line 210 of file SparseGridTopology.h.
Referenced by buildAsFinest(), SparseGridTopology(), and updateMesh().
| helper::vector<SparseGridTopology*> sofa::component::topology::SparseGridTopology::_virtualFinerLevels |
saving the virtual levels (cf _nbVirtualFinerLevels)
Definition at line 104 of file SparseGridTopology.h.
Referenced by buildVirtualFinerLevels().
Data< unsigned int > sofa::component::topology::SparseGridTopology::convolutionSize [protected] |
Initial value:
{
{ 0, 9, 3, 12, 1, 10, 4, 13},
{ 9, 18, 12, 21, 10, 19, 13, 22},
{ 3, 12, 6, 15, 4, 13, 7, 16},
{ 12, 21, 15, 24, 13, 22, 16, 25},
{ 1, 10, 4, 13, 2, 11, 5, 14},
{ 10, 19, 13, 22, 11, 20, 14, 23},
{ 4, 13, 7, 16, 5, 14, 8, 17},
{ 13, 22, 16, 25, 14, 23, 17, 26}
}
Definition at line 68 of file SparseGridTopology.h.
Referenced by buildFromFiner().
Definition at line 199 of file SparseGridTopology.h.
Referenced by buildFromRawVoxelFile(), getVoxel(), setDimVoxels(), and updateMesh().
Data< vector< unsigned char > > sofa::component::topology::SparseGridTopology::dataVoxels [protected] |
Definition at line 209 of file SparseGridTopology.h.
Referenced by buildFromRawVoxelFile(), buildFromVoxelFile(), constructCollisionModels(), getMesh(), getVoxel(), setVoxel(), and updateMesh().
Definition at line 188 of file SparseGridTopology.h.
Referenced by buildFromRawVoxelFile(), and SparseGridTopology().
Definition at line 208 of file SparseGridTopology.h.
Referenced by constructCollisionModels(), getMesh(), and updateMesh().
Data< unsigned int > sofa::component::topology::SparseGridTopology::marchingCubeStep [protected] |
Data< Vec<3, int> > sofa::component::topology::SparseGridTopology::n [protected] |
cutting number in all directions
Definition at line 194 of file SparseGridTopology.h.
Referenced by buildFromVoxelFile(), buildVirtualFinerLevels(), getN(), getNx(), getNy(), getNz(), init(), setN(), setNx(), setNy(), and setNz().
Data< Vector3 > sofa::component::topology::SparseGridTopology::voxelSize [protected] |
Definition at line 200 of file SparseGridTopology.h.
Referenced by buildFromRawVoxelFile(), setSizeVoxel(), and updateMesh().
const float sofa::component::topology::SparseGridTopology::WEIGHT27 [static] |
Initial value:
{
{1.0, 0.5, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 0.25, 0.125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 0.25, 0.125, 0.0, 0.0, 0.0, 0.0, 1.0, 0.5, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 1.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.25, 0.125, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.125, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 1.0, 0.5, 0.0},
{0.0, 0.5, 1.0, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.125, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.125, 0.25, 0.0, 0.0, 0.0, 0.0, 0.5, 1.0, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.25, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.25, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.5, 1.0}
}
Definition at line 67 of file SparseGridTopology.h.
Referenced by buildFromFiner().
1.5.7.1