![]() |
GemaMesh
The GeMA Mesh Plugin
|
#include <uibhmTopology.h>


Classes | |
| struct | V3 |
Public Types | |
| using | HalfSide = quint32 |
| The integer type used to represent a half-side index. | |
| using | HSVT = typename Geometry::template VectorType< HalfSide > |
| Let HSVT be the same vector type used by Geometry storing a half-side value. | |
| using | IVT = typename Geometry::template VectorType< int > |
| Let IVT be the same vector type used by Geometry storing an integer. | |
Public Member Functions | |
| UibhmTopology (GmCellMesh *mesh) | |
| Basic constructor. The internal structure is built by a required call to init() that returns true or false if the operation was successful or not. | |
| virtual bool | init (bool buildEdgeMap) |
| Builds the topology structure. Returns false on errors. The flag controls whether the edge-handle map should be built for solid meshes (this is by large the biggest stored structure, and so should only be built if needed). Ignored for surface meshes. | |
| virtual bool | addNewCells () |
| Adjusts the topological structure to include the cells appended to the mesh since the last time that the topological structure was built. Assumes that those cells are connected to the mesh by previous mesh borders (or are not connected to the mesh at all). More... | |
| virtual bool | cellIsIndexed (int cellId) |
| Returns true if the cell already was indexed by the topological structure by the last call to init() or addNewCells() | |
| void | printParameters (const GmLogCategory &logger, GmLogLevel level) const |
| Prints a summary of the topological structure in a way to be integrated with the mesh printed by GmCellMesh::printParameters() | |
| void | print (const GmLogCategory &logger, GmLogLevel level) const |
| Prints the topological structure FULL information to the specified logger/level. | |
| size_t | printMemoryStatistics (const GmLogCategory &logger, GmLogLevel level) const |
| Prints memory usage for this topological structure to the given logger. Returns the used memory as reported by usedMemory() | |
| size_t | usedMemory () const |
| Returns an estimate of the used memory by the topology structure. This does not includes fixed (small) sizes like the template vector or the small matrices with template data inside each template information. | |
| void | hsBreak (HalfSide hs, int *cellId, int *side) const |
| Breaks the half-side into its components. In debug mode, checks their validity as actual cells and sides. | |
| int | linearHs (int cellId, int side) const |
| Returns the linear half-side index used to index the opposite table for the given (cell, side) pair. | |
| int | linearHs (HalfSide hs) const |
| Returns the linear half-side index used to index the opposite table. | |
| HalfSide | oppositeHs (int cellId, int side) const |
| Returns the opposite half-side to the given (cell, side) pair. | |
| HalfSide | oppositeHs (HalfSide hs) const |
| Returns the opposite half-side to the given half-side. | |
| bool | isBorderHs (int cellId, int side) const |
| Returns true if the given (cell, side) pair corresponds to a border half-side. | |
| bool | isBorderHs (HalfSide hs) const |
| Returns true if the given (valid) half-side is a border half-side. | |
| bool | isNonInterfaceBorderHs (HalfSide hs) const |
| Returns true if the given (valid) half-side is a border half-side that IS NOT an internal hole artificially created by interface element intersections. | |
| bool | isInterfaceBorderHs (HalfSide hs) const |
| Returns true if the given (valid) half-side is a border half-side that IS part of an internal hole artificially created by interface element intersections. Currently valid for SURFACE meshes only. | |
| HalfSide | firstHs (int cellId) const |
| Returns the index of the first half side for the given cell. | |
| HalfSide | nextHs (HalfSide hs) const |
| Returns the index of the next half side in the cell associated with the given half side. | |
| HalfSide | prevHs (HalfSide hs) const |
| Returns the index of the previous half side in the cell associated with the given half side. | |
| HalfSide | adjacentHf (HalfSide hf, int faceEdge) const |
| Given a half face (this method should NOT be used for surface meshes) and the local index of an edge in this half face, returns the index of the adjacent half-face, sharing the given edge, from the same element. | |
| HalfSide | radialHf (HalfSide hf, int faceEdge) const |
| Given a half face (this method should NOT be used for surface meshes) and the local index of an edge in this half face, returns the index of the adjacent half-face, sharing the given edge, from a neighbor element in such a way that successive calls to radialHf() will traverse all the elements sharing that edge (for that to be true for border edges, the starting half-face should be the border half-face). Returns GMP_UIBHM_INVALID_VALUE if the adjacent half-face is a border face. | |
Public Member Functions inherited from UibhmTopologyBase | |
| virtual | ~UibhmTopologyBase () |
| Virtual destructor. | |
Static Public Member Functions | |
| static HalfSide | hsMake (int cellId, int side) |
| Creates a half-side index from a cellId and side components. | |
| static HalfSide | hsMakeSpecial (int id, int side) |
| Creates a half-side index to represent a border or a mid surface/volume node. | |
| static int | hsCell (HalfSide hs) |
| Extracts the cellId from the half-side index. | |
| static int | hsSide (HalfSide hs) |
| Extracts the side from the half-side index. | |
| static bool | hsIsValid (HalfSide hs) |
| Returns true for a standard half-side. Returns false for special half-sides used to represent borders or mid surface/volume nodes. | |
| static bool | hsIsMidElement (HalfSide hs) |
| Returns true if the given half-side represents a special hs used to store the element for a quadratic mid surface/volume node. | |
Protected Member Functions | |
| int | buildOffsetTable () |
| Builds the side offset table from each cell's template information. Returns the number of half-sides if successfull or 0 on error. | |
| int | updateOffsetTable (int numAddedCells) |
| Updates the side offset table from each cell's template information. Returns the TOTAL number of half-sides if successfull or 0 on error. | |
| bool | buildOppositeTable () |
| Build the opposite table from the geometric data. Border sides are initialized with GMP_UIBHM_INVALID_VALUE, even for surface meshes. The border index will be updated later by buildBordersTable(). | |
| bool | updateOppositeTable (int numAddedCells) |
| Updates the opposite table assuming numAddedCells where "appended" to the mesh. See remaining assumptions on the comments for cellsAdded(). | |
| bool | buildVertexHalfSideTable () |
| Builds the VH table from the geometry data and the opposite table. | |
| bool | updateVertexHalfSideTable (int numAddedCells) |
| Updates the vertex half-side table assuming numAddedCells where "appended" to the mesh. See remaining assumptions on the comments for cellsAdded(). | |
| bool | buildEdgeHalfFaceMap () |
| Builds the EH table from the geometry data and the opposite table. | |
| bool | updateEdgeHalfFaceMap (int numAddedCells) |
| Updates the edge half-face table assuming numAddedCells where "appended" to the mesh. See remaining assumptions on the comments for cellsAdded(). | |
| bool | buildBordersTable () |
| Builds the borders table from the geometry data, the opposite table and the the Vertex Half-sides table. It also patches _O to adjust the stored GMP_UIBHM_INVALID_VALUE values to the border index. | |
| bool | updateBordersTable (int numAddedCells) |
| Updates the borer table assuming numAddedCells where "appended" to the mesh. See remaining assumptions on the comments for cellsAdded(). | |
| template<class Key , class MakeKey > | |
| void | oppositeTableTraverseCells (MakeKey makeKey, int first, int last, QMap< Key, HalfSide > &adjMap) |
| The work horse for both build & updateOppositeTable(), templated on the key type used to uniqueley identify a cell side. The function parameter should be a function able to transform the given list of cell vertices into a key. First and last define th erange of cells to be traversed and adjMap is the map used by the function to store and look for opposite sides. | |
| void | vertexHalfSideTableTraverseCells (int first, int last) |
| Workhorse for both build & updateVertexHalfSideTable() | |
| bool | edgeHalfFaceMapTraverseCells (int first, int last) |
| Workhorse for both build & updateEdgeHalfFaceMap() | |
| bool | numNodesDifferentFromNumEdges () const |
| Aux function to check, for a surface mesh, whether any of the element types has the number of nodes different from the number of edges (can happend for quadratic or for some kinds of interface elements) | |
Static Protected Member Functions | |
| static size_t | makeSurfaceKey (QVarLengthArray< int, 10 > &nodeList) |
| Creates a map key from two vertices. | |
| static V3 | makeSolidKey (QVarLengthArray< int, 10 > &nodeList) |
| Creates a map key from the 3 face vertices with smaller index. | |
Protected Attributes | |
| int | _nhalf |
| The number of half-sides in the mesh (either half-edges or half-faces) | |
| bool | _hasOffset |
| Do we have a built offset table? Equal to (!_Of.isEmpty()). Stored since linearHs() is called quite often. | |
| bool | _needsEH |
| Did the user asked for the EH map? Needed for the special case when the mesh is initialized empty and cells are added later. | |
| int | _lastAddedCells |
| The number of mesh cells added to the topology when the structure was built / last updated. | |
| HSVT | _O |
| The opposite table with _nhalf entries. For a half-side index 'hs', _O[linearHs(hs)] stores the half_side index of its opposite edge or face. If the half-side is a border side, the stored value will be a value X such that hsSide(X) is equal to GMP_UIBHM_BORDER_SIDE. For SURFACE meshes, hsCell(X) will be the index in the _B table of the border that it belongs to. For SOLID meshes, hsCell(X) will have all its bits set to 1, so X is effectively equal to GMP_UIBHM_INVALID_VALUE (-1 if taken as a signed value). Since 'strange' elements have no sides, there is no information for them in _O. | |
| IVT | _Of |
| The side offset table. ONLY EXISTS for hybrid meshes and even though might be empty for surface meshes where, sometimes, the cell offset can be used instead. When present, it has numCells() entries storing the position of the element's first half-side in _O. Each entry is the accumulated sum of the number of sides in the previous cells. For SURFACE hybrid meshes, since the number of element sides (edges) is always equal to the number of element vertices, this table can be replaced by the offset information stored in each cell. Keep in mind that this is not true if we allow the user to add bars (strange cells) to the mesh or for quadratic cells. Strange cells have a number of sides equal to 0, so its position is equal to the next common cell position. | |
| HSVT | _VH |
| The vertex half-side table with numNodes() entries. Each entry stores one half-side that contains that node. If the node belongs to the border, it is a border half-side including that node (for SURFACE meshes, the selected half-edge should start at that node). For quadratic nodes belonging to a half-side, that half-side is stored. For mid surface/volume nodes that do not belong to any side, a special value X is stored to allow for the recovery of the cell that this vertex belongs to. X is created in such a way that hsSide(X) is equal to GMP_UIBHM_MID_SIDE and hsCell(X) is the cell id. Nodes that do not belong to any half-side and are not a quadratic mid node (nodes belonging to strange cells only or not belonging to any cell at all) store the value GMP_UIBHM_INVALID_VALUE (-1 if taken as a signed value). | |
| QVector< HalfSide > | _B |
| The border table with one entry per border "curve". It stores one half-edge from this border. For SURFACE meshes only. Since we expect B to be a rather small table, which is constructed by calls to append(), we are better off using a QVector instead of our specialized Single / Dual Vector classes. | |
| QMap< size_t, HalfSide > | _EH |
| The edge half-face map. Indexed by edge id, it stores one of its incident half-faces. For SOLID meshes only. The edge id key is currently represented by a 64-bits value encoded as (v1 << 32 | v2), with v1 < v2, as defined by Geometry::encodeEdge(). If the edge is on a border, it should be the border half-face containing the v1->v2 half-edge. | |
Friends | |
| class | UibhmQuery< Geometry > |
| class | UibhmSurfaceQuery< Geometry > |
| class | UibhmSolidQuery< Geometry > |
brief The class storing topology information for the given mesh. The template parameter is the Geometry class that will be used to provide the geometric information from the mesh.
The topology info is based on the half-side (half-edge or half-face) concept. The primary information is the Opposite table storing, for each half-side, its 'twin'. We also have additional tables associating a vertex with a half-side and eventually an edge with a half-side (for solid meshes).
For surface meshes, a border description is stored. For solid meshes we currently do not store any additional information. One possibility is to store a 2d version of the whole structure to represent the mesh surface.
Differently from the adopted by the CHE/CHF & IBHM implementations, Half-side indices are not a continuous set. Instead they are formed by a 32 bit number where the lower 28 bits are used to store the cell id (for up to 256M elements) and the higher 4 bits are used to store the local face/edge number in the cell. This schema allows for direct recovery of the cell and the side from the half-side index, and is used even for homogeneous meshes.
A side value equal to 1111 is used as a special value to represent border half-sides while a side value equal to 1110 is used to reresent a mid face / volume node (and so the maximum number of sides in a cell is 14 and not 16). For surface meshes, when the side is 1111, the remaining cellId bits are used to store the border index to which that edge belongs unless that border is generated by interface element intersections. In that case tha border is not stored and the cellId bits are set to all 1s. When the side is 1110, the cellId bits store the cell that contains that mid face / volume node.
As a consequence of using non continuous half-side indices, the Opposite vector can not be indexed directly by the half-side index. The solution is to use a side offset table (as already used by IBHM). If we define the 'linearHs(hs)' function as Of[hsElement(hs)] + hsSide(hs), where hsElement(hs) extracts the element id from the lower bits of hs and hsSide(hs) extracts the local side number from the higher bits of hs, we can index O by O[linearHs(hs)].
For homogeneous meshes, the offset table does not need to be stored and each of its entries can be calculated based on the fixed number of element sides.
If a mesh has 'strange' elements, those are NOT added to the topology information. They are handled as if they have no sides at all.
|
virtual |
Adjusts the topological structure to include the cells appended to the mesh since the last time that the topological structure was built. Assumes that those cells are connected to the mesh by previous mesh borders (or are not connected to the mesh at all).
This method does NOT give support for editting the mesh (changing the node incidence of existing cells).
Implements UibhmTopologyBase.
1.8.15