![]() |
Xfem
The Xfem Plugin
|
Basic class for copying an XFEM mesh into an empty element mesh, transforming sub-elements into elements. More...
#include <xfemMeshCopier.h>

Classes | |
| struct | NewNodesData |
| Aux structure to store coordinates for newly created nodes. More... | |
| struct | SplitEdgeData |
| Type storing data for an edge incident to a node 'n'. More... | |
| struct | SplitNodeData |
| Type storing per node data for the splitting operation. More... | |
| struct | SubElementNodeData |
| Aux structure to store a node list for each sub-element in the mesh. More... | |
Public Member Functions | |
| XfemMeshCopier (const XfemMesh *srcMesh, GmElementMesh *newMesh, XfemSolver *solver, const GmLogCategory &logger) | |
| Creates the mesh copier object. Copies will be made with calls to copy(). More... | |
| virtual | ~XfemMeshCopier () |
| Destructor. | |
| bool | copy (bool splitFractures) |
| Overload of XfemMeshCopier::copy(const QStringList&, const QStringList&, bool) passing as first and second parameters lists filled with every node/cell attribute in the destination mesh. | |
| bool | copy (const QStringList &nodeAttributes, const QStringList &elementAttributes, bool createMissingAttributes, bool splitFractures) |
| Given a src mesh and an an empty element mesh, passed as parameters to the object constructor, fills the empty mesh with a copy of the source mesh where all enriched sub-elements have been transformed into elements. More... | |
Private Types | |
| typedef QPair< int, int > | SubElementId |
| Type storing an element Id + sub-element Id (or -1 for a whole element reference) | |
| typedef QPair< const XfemFracture *, int > | FractureEdgeId |
| Type stroring a reference for a fracture segment. | |
Private Member Functions | |
| bool | copyAux (const QStringList &nodeAttributes, const QStringList &elementAttributes, bool createMissingAttributes, bool splitFractures) |
| Helper function for copy() to allow for easier mesh cleanup on errors. More... | |
| bool | setupAccessors (const QStringList &nodeAttributes, const QStringList &elementAttributes, bool createMissingAttributes) |
| Grab needed accessors, filling the object accessor lists (_nodeAcList, newNodeAcList, ...) and coordinate accessors (_ccordAc and _newCoordAc). Returns true on success, false on errors. More... | |
| bool | setupNodeAccessors (const QStringList &nodeAttributes, bool createMissingAttributes) |
| Aux function to setupAccessors to grab/create if needed node data accessors. | |
| bool | setupElementAccessors (const QStringList &elementAttributes, bool createMissingAttributes) |
| Aux function to setupAccessors to grab/create if needed node data caessors. | |
| bool | setupEnrichedAccessors () |
| Setup enriched data acessors corresponding to node accessors. | |
| bool | setupPropertyMap (QList< int > &psIndex) |
| Setup psIndex, an index storing for each property set in the destination mesh its index in the source mesh. | |
| bool | buildSubElementNodeLists (QList< SubElementNodeData > &nodeDataList, QList< NewNodesData > &newNodesList) |
| Traverses sub-elements building a list with its nodes + any needed new nodes. | |
| bool | setNodeData (const QList< NewNodesData > &newNodesList, bool updateGhostNodes) |
| Copy node coordinates & values from one mesh to the other. It also initializes values for newlly created nodes. | |
| bool | setElementData (const QList< SubElementNodeData > &nodeDataList, const QList< int > &psIndex, const int *typeIndexMap) |
| Copy node coordinates & values from one mesh to the other. It also initializes values for newlly created nodes. More... | |
| bool | splitMesh (const int *typeIndexMap) |
| Splits the destination mesh along fractures. More... | |
| void | fillSplitInfoMaps (const int *typeIndexMap, QMap< int, SplitNodeData > &nodeInfo, QMap< SubElementId, int > &elementTranslationMap) const |
| Build info maps described in steps 1 & 2 for the splitMesh() function. | |
| void | fillEdgeList (int node, const QList< SubElementId > &elements, const QList< FractureEdgeId > &fractures, const QMap< SubElementId, int > &elementTranslationMap, QList< SplitEdgeData > &edges) const |
| Builds the list of incident edges to the given node, filling 'edges'. More... | |
| int | sortEdgeList (int node, QList< SplitEdgeData > &edges, int *lastEdge) const |
| Sorts the edge list according to CCW angles between adges and the first list fracture. Returns the number of fractures in the edge list. If the edge set has only one fracture, returns in the lastEdge parameter the index of the last edge to fall in the interval between the first fracture and the 180 dgerees angle. If the edge set has several fractures, lastEdge is left unchanged. | |
| void | replaceElementNode (int node, int newNode, const QList< int > &elements) |
| Replaces node by newNode in the mesh node list of the given elements. | |
| void | addEdgeInfo (int node, int srcNode, bool incoming, int elemIndex, const QList< FractureEdgeId > &fractures, QList< SplitEdgeData > &edges) const |
| Aux function to add a new edge or update an exsting edge in the 'edges' list. | |
| void | addNodeInfo (QMap< int, SplitNodeData > &nodeInfo, QMap< SubElementId, int > &elementTranslationMap, const XfemFracture *f, int fractureSegment, const XfemElement *e, int node, int nodeEdge) const |
| Aux function used by fillSplitInfoMaps() to add information about a node in a fracture segment to the info maps. | |
| const XfemElement * | segmentInfo (const XfemFracture *f, int segment, int *n1, int *n2, int *e1=NULL, int *e2=NULL) const |
| Returns element, first node and second node information about the given fracture segment. | |
| void | updateNodeAttributes (int srcNode, int newNode, const FractureEdgeId &fracture, const SubElementId *nodeElement, const SubElementId *otherElement) |
| Calculates and fills all node values associated with the given newNode. More... | |
| void | interpolateSplittedNodeValue (GmValueAccessor *ac, QList< GmValueAccessor * > eacList, int srcNode, int newNode, const FractureEdgeId &fracture, const SubElementId *nodeElement, const SubElementId *otherElement, GmVector &result) const |
| Calculates and fills all node values associated with the given newNode. More... | |
| void | interpolateInternalNodeValue (const XfemElement *e, GmValueAccessor *ac, QList< GmValueAccessor * > eacList, const GmVector &naturalCoord, GmVector &result) const |
| Fills result with the interpolated value for the ac attribute on the given new splitted node. More... | |
| void | polygonCentroid (GmMatrix polygonCoords, GmVector &Xcg) const |
| void | fillNodalLevelSetMatrix (GmMatrix X, GmMatrix Xg, GmMatrix &H) const |
| Compute levelset function (H) The minimum distance between a point(nodes or integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM. More... | |
| void | fillGaussLevelSetMatrix (GmMatrix X, GmMatrix Xg, GmMatrix &H) const |
| Compute levelset function (H) The minimum distance between a point(nodes or integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM. More... | |
| void | fillInteractingCraksNodalLevelSets (const XfemElement *e, XfemEnrichedElementData *exData, int nEnrich, int nCracks, QList< double >crackIndex, QList< GmMatrix > &nodalLevelSet) const |
| computation of Additional enrichment fuctions for cracks intersection considering element nodes and integration point | |
| void | fillInteractingCraksGaussLevelSets (const XfemElement *e, XfemEnrichedElementData *exData, int nEnrich, int nCracks, QList< double >crackIndex, QList< GmMatrix > &gaussLevelSet) const |
| computation of Additional enrichment fuctions for cracks intersection considering element nodes and integration point | |
Private Attributes | |
| const XfemMesh * | _srcMesh |
| The source mesh storing the elements to be copied. | |
| GmElementMesh * | _newMesh |
| The empty destination mesh. | |
| XfemSolver * | _solver |
| The xfem solver, needed for interpolations. | |
| const GmLogCategory & | _logger |
| The logger used to produce error messages. | |
| QList< GmValueAccessor * > | _nodeAcList |
| The set of node accessors in the source mesh. | |
| QList< QList< GmValueAccessor * > > | _enrichedAcList |
| The set of corresponding enriched node accessors for each entrie in _nodeAcList (or NULL) | |
| QList< GmValueAccessor * > | _newNodeAcList |
| The set of node accessors in the destination mesh. | |
| QList< GmCellAccessor * > | _cellAcList |
| The set of cell accessors in the source mesh. | |
| QList< GmCellAccessor * > | _newCellAcList |
| The set of cell accessors in the destination mesh. | |
| QList< GmGaussAccessor * > | _gaussAcList |
| The set of Gauss accessors in the source mesh. | |
| QList< GmGaussAccessor * > | _newGaussAcList |
| The set of Gauss accessors in the destination mesh. | |
| GmValueAccessor * | _coordAc |
| The accessor used to get node coordinates in the source mesh. | |
| GmValueAccessor * | _newCoordAc |
| The accessor used to get node coordinates in the destination mesh. | |
Basic class for copying an XFEM mesh into an empty element mesh, transforming sub-elements into elements.
| XfemMeshCopier::XfemMeshCopier | ( | const XfemMesh * | srcMesh, |
| GmElementMesh * | newMesh, | ||
| XfemSolver * | solver, | ||
| const GmLogCategory & | logger | ||
| ) |
Creates the mesh copier object. Copies will be made with calls to copy().
The destination, empty, mesh should have no nodes or cells, but it should already be filled with its basic stucture, i.e, node dimension, attributes, property sets, etc.
| srcMesh | The mesh storing the elements/values that will be copied to the destination mesh |
| newMesh | The empty mesh to be filled. Its implementation type should support adding nodes and cells. |
| solver | The xfem solver used for interpolations. Can be NULL. in which case interpolations will not consider enrichments. |
| logger | The logger used to emit error messages / warnings |
| bool XfemMeshCopier::copy | ( | const QStringList & | nodeAttributes, |
| const QStringList & | elementAttributes, | ||
| bool | createMissingAttributes, | ||
| bool | splitFractures | ||
| ) |
Given a src mesh and an an empty element mesh, passed as parameters to the object constructor, fills the empty mesh with a copy of the source mesh where all enriched sub-elements have been transformed into elements.
The destination, empty, mesh should have no nodes or cells, but it should already be filled with its basic stucture, i.e, node dimension, attributes, property sets, etc.
The new mesh will have all nodes marked as geometry nodes, and no ghost nodes.
Data values are copied according to the attribute sets passed on nodeAttributes and elementAttributes. For enriched Gauss attributes, the integration rule used by each sub-element must match the integration rule for the sub-element type on the destination empty mesh. Src mesh and destination mesh attributes can have different units provided that they are compatible.
| nodeAttributes | A list with state vars / node attribute names whose values should be copied from the current mesh to the destination mesh. |
| elementAttributes | A list with cell / gauss attribute names whose values should be copied from the current mesh to the destination mesh. |
| createMissingAttributes | When set to true, if an attribute in nodeAttributes or in elementAttributes exists in the source mesh but not in the destination mesh, a new attribute will be created. |
| splitFractures | If set to true, the mesh will be splitted along fractures so that elements that are separated by a fracture edge do not share the same nodes. |
|
private |
Helper function for copy() to allow for easier mesh cleanup on errors.
< An index storing for each property set in the destination mesh its index in the source mesh
|
private |
Builds the list of incident edges to the given node, filling 'edges'.
Finds all the edges that are incident to 'node'. An edge is represented by a structure that stores the src node and the elements that share that edge (1 or 2), with the element that has an 'incoming' half-edge first and 'outcoming' second (the incoming half-edge will be the edge where the src node comes before 'nn' in the element when traversed in CCW mode). It also stores an index to identify the fracture associated with the edge (if one exists).
|
private |
Compute levelset function (H) The minimum distance between a point(nodes or integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM.
Param X The integration point coordinates matrix (xi,yi) Param Xg The ghost nodal coordinates matrix (xi,yi) Param H The level set vector (xi,yi)
|
private |
Compute levelset function (H) The minimum distance between a point(nodes or integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM.
Param X The nodal coordinates matrix (xi,yi) Param Xg The ghost nodal coordinates matrix (xi,yi) Param H The level set vector (xi,yi)
|
private |
Fills result with the interpolated value for the ac attribute on the given new splitted node.
| ac | The accessor for the attribute to be filled |
| eac | The enriched accessor corresponding to ac or NULL if the attribute does not have an enriched part |
| srcNode | The original node in the src mesh |
| newNode | The new node that should have its attributes filled in the new mesh. Its value will be equal to srcNode when updating the values of the 'reused' node in a split process. |
| fracture | The fracture segment that caused the split |
| nodeElement | A reference to the sub-element in the src mesh that contains newNode. Can be NULL in rare situations associated with fractures along edges and non-conformant meshes ('T' junctions inside an edge without a proper sub-element). |
| otherElement | A reference to the element on the other side of the fracture. Can also be NULL in the same circumstances of nodeElement. |
| result | Vector that should be filled with the interpolation resultFills result with the interpolated value for the ac attribute on the given natural coordinate of the given element |
|
private |
Calculates and fills all node values associated with the given newNode.
When a node is splitted in the mesh to represent a fracture, this function is called for setting node values for the newlly created node. It is also called for the old node to update its values.
| srcNode | The original node in the src mesh |
| newNode | The new node that should have its attributes filled in the new mesh. Its value will be equal to srcNode when updating the values of the 'reused' node in a split process. |
| fracture | The fracture segment that caused the split |
| nodeElement | A reference to the sub-element in the src mesh that contains newNode. Can be NULL in rare situations associated with fractures along edges and non-conformant meshes ('T' junctions inside an edge without a proper sub-element). |
| otherElement | A reference to the element on the other side of the fracture. Can also be NULL in the same circumstances of nodeElement. |
Fills result with the interpolated value for the ac attribute on the given new splitted node.
| ac | The accessor for the attribute to be filled |
| eac | The enriched accessor corresponding to ac or NULL if the attribute does not have an enriched part |
| srcNode | The original node in the src mesh |
| newNode | The new node that should have its attributes filled in the new mesh. Its value will be equal to srcNode when updating the values of the 'reused' node in a split process. |
| fracture | The fracture segment that caused the split |
| nodeElement | A reference to the sub-element in the src mesh that contains newNode. Can be NULL in rare situations associated with fractures along edges and non-conformant meshes ('T' junctions inside an edge without a proper sub-element). |
| otherElement | A reference to the element on the other side of the fracture. Can also be NULL in the same circumstances of nodeElement. |
| result | Vector that should be filled with the interpolation result |
|
private |
Copy node coordinates & values from one mesh to the other. It also initializes values for newlly created nodes.
Copy element node + element property set + element values from one mesh to the other.
| nodeDataList | A vector storing, for each _srcMesh subelement, its identification + node list. Ordered by element id and by sub-elemnt id inside elements. |
| psIndex | Map returned by setupPropertyMap() relating property sets in both meshes |
| typeIndexMap | Vector with size equal to GM_NUM_CELL_TYPES storing the the index of the first cell for the given type. |
Returns true on success, false on errors.
|
private |
Grab needed accessors, filling the object accessor lists (_nodeAcList, newNodeAcList, ...) and coordinate accessors (_ccordAc and _newCoordAc). Returns true on success, false on errors.
See the copy() function documentation for a description of input parameters.
|
private |
Splits the destination mesh along fractures.
This function expects every fracture segment to be a mesh edge, so every segment is either in the mesh border or on an edge separating two mesh elements.
The applied algorithm consists on the following steps:
1 - For each node in the src mesh, collect which fracture segments start or end in that node. This is achieved by simply traversing the fracture list. For each node, collect also the <element, sub-element> pairs that includes that node. For geometry nodes this can be done by a topological query. For ghost nodes, the fracture segment contains the element. The sub-element must be found by traversing the element. Also, add an entry for the <e, se> pair into a translation map with a -1 value.
2 - By using the typeIndexMap information and traversing the mesh in element order, fill the translation map with the index of each sub-element in the new mesh.
3 - For each source node 'n' that has more than one incident fracture, do: 3.1 - Find the equivalent node number in the new mesh 'nn' 3.2 - From the element/sub-element information associated to the node and the translation map built in step 2, create a set 'nes' with the elements in the new mesh that include 'nn' 3.3 - From 'nes', find all the edges that are incident to 'nn'. An edge is represented by a structure that stores the src node and the elements that share that edge (1 or 2), with the element that has an 'incoming' half-edge first and 'outgoing' second (the incoming half-edge will be the edge where the src node comes before 'nn' in the element when traversed in CCW mode). It also stores a flag to identify if that edge is a fracture or not. 3.4 - Select the first fracture incident to 'nn' and calculate the angle between each other edge and the fracture. Order those edges in trigonometric order by that angle. 3.5 - For every element from the outgoing element of that first fracture until the ingoing element of the next fracture (and edges in between), or until finding a border (edge with only one element), replace node 'nn' by a new node. 3.6 - Repeat step 3.5 until reaching the last fracture. If node 'nn' has X incident fractures, step 3.5 will be executed X-1 times.
4 - For each node 'n' that has only one incident fracture do: 4.1 - Execute steps 3.1 to 3.4 4.2 - Virtually extending the fracture past 'nn' by a new segment, the position in which that segment would fall in the ordered segment set lies in the 180 degrees border. Apply step 3.5 for edges between the fracture and this extended segment.
| typeIndexMap | Vector with size equal to GM_NUM_CELL_TYPES storing the the index of the first cell for the given type. |
|
private |
Calculates and fills all node values associated with the given newNode.
When a node is splitted in the mesh to represent a fracture, this function is called for setting node values for the newlly created node. It is also called for the old node to update its values.
| srcNode | The original node in the src mesh |
| newNode | The new node that should have its attributes filled in the new mesh. Its value will be equal to srcNode when updating the values of the 'reused' node in a split process. |
| fracture | The fracture segment that caused the split |
| nodeElement | A reference to the sub-element in the src mesh that contains newNode. Can be NULL in rare situations associated with fractures along edges and non-conformant meshes ('T' junctions inside an edge without a proper sub-element). |
| otherElement | A reference to the element on the other side of the fracture. Can also be NULL in the same circumstances of nodeElement. |
1.8.15