To store and manipulate finite element meshes. More...
Public Member Functions | |
| Mesh () | |
| Default constructor (Empty mesh) | |
| Mesh (const string &file, bool bc=false, int opt=NODE_DOF) | |
| Constructor using a mesh file. | |
| Mesh (double L, size_t nb_el, size_t p=1, size_t nb_dof=1) | |
| Constructor for a 1-D mesh. The domain is the interval [0,L]. | |
| Mesh (const Grid &g, int opt=QUADRILATERAL) | |
| Constructor for a uniform finite difference grid given by and instance of class Grid. | |
| Mesh (double xL, double yL, size_t nx, size_t ny, int c1, int c2, int c3, int c4, int opt=0) | |
| Constructor for a uniform finite difference grid. | |
| Mesh (const Mesh &m, const Point< double > &x_bl, const Point< double > &x_tr) | |
| Constructor that extracts the mesh of a rectangular region from an initial mesh. | |
| Mesh (const Mesh &mesh, int opt, size_t dof1, size_t dof2, bool bc=false) | |
| Constructor that copies the input mesh and selects given degrees of freedom. | |
| Mesh (const Mesh &ms) | |
| Copy Constructor. | |
| ~Mesh () | |
| Destructor. | |
| void | setDim (size_t dim) |
| Define space dimension. Normally, between 1 and 3. | |
| void | setVerbose (int verb) |
| Define Verbose Parameter. Controls output details. | |
| void | Add (Node *nd) |
| Add a node to mesh. | |
| void | Add (Element *el) |
| Add an element to mesh. | |
| void | Add (Side *sd) |
| Add a side to mesh. | |
| void | Add (Edge *ed) |
| Add an edge to mesh. | |
| void | get (const string &mesh_file) |
| Read mesh data in file. | |
| void | setDOFSupport (int opt, int nb_nodes=1) |
| Define supports of degrees of freedom. | |
| void | setPointInDomain (Point< double > x) |
| Define a point in the domain. This function makes sense only if boundary mesh is given without internal mesh (Case of Boundary Elements) | |
| void | removeImposedDOF () |
| Eliminate equations corresponding to imposed DOF. | |
| void | EliminateImposedDOF () |
| Eliminate equations corresponding to imposed DOF. | |
| size_t | NumberEquations (size_t dof=0) |
| Renumber Equations. | |
| size_t | NumberEquations (size_t dof, int c) |
| Renumber Equations. | |
| int | getAllSides (int opt=0) |
| Determine all mesh sides. | |
| int | getNbSideNodes () const |
| Return the number of nodes on each side. | |
| int | getNbElementNodes () const |
| Return the number of nodes in each element. | |
| int | getBoundarySides () |
| Determine all boundary sides. | |
| int | createBoundarySideList () |
| Create list of boundary sides. | |
| int | getBoundaryNodes () |
| Determine all boundary nodes. | |
| int | createInternalSideList () |
| Create list of internal sides (not on the boundary). | |
| int | getAllEdges () |
| Determine all edges. | |
| void | getNodeNeighborElements () |
| Create node neighboring elements. | |
| void | getElementNeighborElements () |
| Create element neighboring elements. | |
| void | setMaterial (int code, const string &mname) |
| Associate material to code of element. | |
| void | Reorder (size_t m=1000000) |
| Renumber mesh nodes according to reverse Cuthill Mc Kee algorithm. | |
| void | Add (size_t num, double *x) |
| Add a node by giving its label and an array containing its coordinates. | |
| void | DeleteNode (size_t label) |
| Remove a node given by its label. | |
| void | DeleteElement (size_t label) |
| Remove an element given by its label. | |
| void | DeleteSide (size_t label) |
| Remove a side given by its label. | |
| void | Delete (Node *nd) |
| Remove a node given by its pointer. | |
| void | Delete (Element *el) |
| Remove a node given by its pointer. | |
| void | Delete (Side *sd) |
| Remove a side given by its pointer. | |
| void | Delete (Edge *ed) |
| Remove an edge given by its pointer. | |
| void | RenumberNode (size_t n1, size_t n2) |
| Renumber a node. | |
| void | RenumberElement (size_t n1, size_t n2) |
| Renumber an element. | |
| void | RenumberSide (size_t n1, size_t n2) |
| Renumber a side. | |
| void | RenumberEdge (size_t n1, size_t n2) |
| Renumber an edge. | |
| void | setNodeView (size_t n1, size_t n2) |
| Set viewing window for nodes. | |
| void | setElementView (size_t n1, size_t n2) |
| Set viewing window for elements. | |
| void | setSideView (size_t n1, size_t n2) |
| Set viewing window for sides. | |
| void | setEdgeView (size_t n1, size_t n2) |
| Set viewing window for edges. | |
| void | setList (const std::vector< Node * > &nl) |
| void | setList (const std::vector< Element * > &el) |
| void | setList (const std::vector< Side * > &sl) |
| int | getVerbose () const |
| Return Verbose Parameter. | |
| size_t | getDim () const |
| Return space dimension. | |
| size_t | getNbNodes () const |
| Return number of nodes. | |
| size_t | getNbMarkedNodes () const |
| Return number of marked nodes. | |
| size_t | getNbVertices () const |
| Return number of vertices. | |
| size_t | getNbDOF () const |
| Return total number of degrees of freedom (DOF) | |
| size_t | getNbEq () const |
| Return number of equations. | |
| size_t | getNbEq (int i) const |
| Return number of equations for the i-th set of degrees of freedom. | |
| size_t | getNbElements () const |
| Return number of elements. | |
| size_t | getNbSides () const |
| Return number of sides. | |
| size_t | getNbEdges () const |
| Return number of sides. | |
| size_t | getNbBoundarySides () const |
| Return number of boundary sides. | |
| size_t | getNbInternalSides () const |
| Return number of internal sides. | |
| size_t | getNbMat () const |
| Return number of materials. | |
| void | AddMidNodes (int g=0) |
| Add mid-side nodes. | |
| Point< double > | getMaxCoord () const |
| Return maximum coordinates of nodes. | |
| Point< double > | getMinCoord () const |
| Return minimum coordinates of nodes. | |
| void | set (Node *nd) |
| Replace node in the mesh. | |
| void | set (Element *el) |
| Replace element in the mesh. | |
| void | set (Side *sd) |
| Choose side in the mesh. | |
| bool | NodesAreDOF () const |
| Return information about DOF type. | |
| bool | SidesAreDOF () const |
| Return information about DOF type. | |
| bool | EdgesAreDOF () const |
| Return information about DOF type. | |
| bool | ElementsAreDOF () const |
| Return information about DOF type. | |
| int | getDOFSupport () const |
| Return information on dof support Return an integer according to enumerated values: NODE_DOF, ELEMENT_DOF SIDE_DOF. | |
| void | put (const string &mesh_file) const |
| Write mesh data on file. | |
| void | save (const string &mesh_file) const |
| Write mesh data on file in various formats. | |
| void | Bput (const string &mesh_file) const |
| Write mesh data on a binary file. | |
| bool | withImposedDOF () const |
| Return true if imposed DOF count in equations, false if not. | |
| bool | isStructured () const |
| Return true is mesh is structured, false if not. | |
| size_t | getNodeNewLabel (size_t n) const |
| Return new label of node of a renumbered node. | |
| void | getList (vector< Node * > &nl) const |
| void | getList (vector< Element * > &el) const |
| void | getList (vector< Side * > &sl) const |
| Node * | getPtrNode (size_t i) const |
| Return pointer to node with label i. | |
| Node & | getNode (size_t i) const |
| Return refenrece to node with label i. | |
| Element * | getPtrElement (size_t i) const |
| Return pointer to element with label i. | |
| Element & | getElement (size_t i) const |
| Return reference to element with label i. | |
| Side * | getPtrSide (size_t i) const |
| Return pointer to side with label i. | |
| Side & | getSide (size_t i) const |
| Return reference to side with label i. | |
| Edge * | getPtrEdge (size_t i) const |
| Return pointer to edge with label i. | |
| Edge & | getEdge (size_t i) const |
| Return reference to edge with label i. | |
| size_t | getNodeLabel (size_t i) const |
| Return label of i-th node. | |
| size_t | getElementLabel (size_t i) const |
| Return label of i-th element. | |
| size_t | getSideLabel (size_t i) const |
| Return label of i-th side. | |
| size_t | getEdgeLabel (size_t i) const |
| Return label of i-th edge. | |
| void | topNode () const |
| Reset list of nodes at its top position (Non constant version) | |
| void | topBoundaryNode () const |
| Reset list of boundary nodes at its top position (Non constant version) | |
| void | topMarkedNode () const |
| Reset list of marked nodes at its top position (Non constant version) | |
| void | topElement () const |
| Reset list of elements at its top position (Non constant version) | |
| void | topSide () const |
| Reset list of sides at its top position (Non constant version) | |
| void | topBoundarySide () const |
| Reset list of boundary sides at its top position (Non constant version) | |
| void | topInternalSide () const |
| Reset list of intrenal sides at its top position (Non constant version) | |
| void | topEdge () const |
| Reset list of edges at its top position (Non constant version) | |
| void | topBoundaryEdge () const |
| Reset list of boundary edges at its top position (Non constant version) | |
| Node * | getNode () const |
| Return pointer to current node and move to next one (Non constant version) | |
| Node * | getBoundaryNode () const |
| Return pointer to current boundary node and move to next one (Non constant version) | |
| Node * | getMarkedNode () const |
| Return pointer to current marked node and move to next one (Non constant version) | |
| Element * | getElement () const |
| Return pointer to current element and move to next one (Non constant version) | |
| Side * | getSide () const |
| Return pointer to current side and move to next one (Non constant version) | |
| Side * | getBoundarySide () const |
| Return pointer to current boundary side and move to next one (Non constant version) | |
| Side * | getInternalSide () const |
| Return pointer to current internal side and move to next one (Non constant version) | |
| Edge * | getEdge () const |
| Return pointer to current edge and move to next one (Non constant version) | |
| Edge * | getBoundaryEdge () const |
| Return pointer to current boundary edge and move to next one (Non constant version) | |
| int | getShape () const |
| Determine shape of elements Return Shape index (see enum ElementShape) if all elements have the same shape, 0 if not. | |
| Element * | operator() (size_t i) |
| Operator () : Return pointer to i-th element. | |
| Node * | operator[] (size_t i) |
| Operator [] : Return pointer to i-th node. | |
| size_t | operator() (size_t i, size_t n) |
| Operator () : Return pointer to i-th node of n-th element. | |
| Mesh & | operator= (Mesh &ms) |
| Operator = : Assign a Mesh instance. | |
Friends | |
| void | Refine (Mesh &in_mesh, Mesh &out_mesh) |
| Refine mesh. Subdivide each triangle into 4 subtriangles. This member function is valid for 2-D triangular meshes only. | |
Detailed Description
To store and manipulate finite element meshes.
Class Mesh enables defining as an object a finite element mesh. A finite element mesh is characterized by its nodes, elements and sides. Each of these types of data constitutes a class in the OFELI library.
The standard procedure to introduce the finite element mesh is to provide an input file containing its data. For this, we have defined our own mesh data file (following the XML syntax). Of course, a developer can write his own function to read his finite element mesh file using the methods in Mesh.
Constructor & Destructor Documentation
| Mesh | ( | const string & | file, |
| bool | bc = false, |
||
| int | opt = NODE_DOF |
||
| ) |
Constructor using a mesh file.
- Parameters:
-
[in] file File containing mesh data [in] bc Flag to remove (true) or not (false) imposed Degrees of Freedom [default: false] [in] opt Type of DOF support: To choose among enumerated values NODE_DOF, SIDE_DOF or ELEMENT_DOF.
Say if degrees of freedom (unknowns) are supported by nodes, sides or elements.
| Mesh | ( | double | L, |
| size_t | nb_el, | ||
| size_t | p = 1, |
||
| size_t | nb_dof = 1 |
||
| ) |
Constructor for a 1-D mesh. The domain is the interval [0,L].
- Parameters:
-
[in] L Length of the interval [in] nb_el Number of elements to generate [in] p Degree of finite element polynomial (Default = 1) [in] nb_dof Number of degrees of freedom for each node (Default = 1)
| Mesh | ( | double | xL, |
| double | yL, | ||
| size_t | nx, | ||
| size_t | ny, | ||
| int | c1, | ||
| int | c2, | ||
| int | c3, | ||
| int | c4, | ||
| int | opt = 0 |
||
| ) |
Constructor for a uniform finite difference grid.
The domain is the rectangle (0,Lx)x(0,Ly)
- Parameters:
-
[in] xL Length in the x-direction [in] yL Length in the y-direction [in] nx Number of subintervals on the x-axis [in] ny Number of subintervals on the y-axis [in] c1 Code for nodes generated on the line y=0 [in] c2 Code for nodes generated on the line x=Lx [in] c3 Code for nodes generated on the line y=Ly [in] c4 Code for nodes generated on the line x=0 [in] opt Flag to generate elements as well (if not zero) [Default: 0]. If the flag is not 0, it can take one of the enumerated values: TRIANGLE or QUADRILATERAL, with obvious meaning.
Constructor that extracts the mesh of a rectangular region from an initial mesh.
This constructor is useful for zooming purposes for instance.
- Parameters:
-
[in] m Initial mesh from which the submesh is extracted [in] x_bl Coordinate of bottom left vertex of the rectangle [in] x_tr Coordinate of top right vertex of the rectangle
Constructor that copies the input mesh and selects given degrees of freedom.
This constructor is to be used for coupled problems where each subproblem uses a choice of degrees of freedom.
- Parameters:
-
[in] mesh Initial mesh from which the submesh is extracted [in] opt Type of DOF support: To choose among enumerated values NODE_DOF, SIDE_DOF or ELEMENT_DOF. [in] dof1 Label of first degree of freedom to select to the output mesh [in] dof2 Label of last degree of freedom to select to the output mesh [in] bc Flag to remove (true) or not (false) imposed Degrees of Freedom [default: false]
Member Function Documentation
| void setDim | ( | size_t | dim | ) |
Define space dimension. Normally, between 1 and 3.
- Parameters:
-
[in] dim Space dimension to set (must be between 1 and 3)
| void setVerbose | ( | int | verb | ) |
Define Verbose Parameter. Controls output details.
- Parameters:
-
[in] verb verbosity parameter (Must be between 0 and 10)
| void get | ( | const string & | mesh_file | ) |
Read mesh data in file.
- Parameters:
-
[in] mesh_file Mesh file name
| void setDOFSupport | ( | int | opt, |
| int | nb_nodes = 1 |
||
| ) |
Define supports of degrees of freedom.
- Parameters:
-
[in] opt DOF type = - NODE_DOF, Degrees of freedom are supported by nodes
- SIDE_DOF, Degrees of freedom are supported by sides
- EDGE_DOF, Degrees of freedom are supported by edges
- ELEMENT_DOF, Degrees of freedom are supported by elements
[in] nb_nodes Number of nodes on sides or elements (default=1). This parameter is useful only if dofs are supported by sides or elements
- Note:
- This member function creates all mesh sides if the option ELEMENT_DOF or SIDE_DOF is selected. So it not necessary to call getAllSides() after
| void setPointInDomain | ( | Point< double > | x | ) |
Define a point in the domain. This function makes sense only if boundary mesh is given without internal mesh (Case of Boundary Elements)
- Parameters:
-
[in] x Coordinates of point to define
| size_t NumberEquations | ( | size_t | dof = 0 | ) |
Renumber Equations.
- Parameters:
-
[in] dof Label of degree of freedom for which numbering is performed. Default value (0) means that all degrees of freedom are taken into account
| size_t NumberEquations | ( | size_t | dof, |
| int | c | ||
| ) |
Renumber Equations.
- Parameters:
-
[in] dof Label of degree of freedom for which numbering is performed. [in] c code for which degrees of freedom are enforced.
| int getAllSides | ( | int | opt = 0 | ) |
Determine all mesh sides.
- Returns:
- Number of all sides.
| int getBoundarySides | ( | ) |
Determine all boundary sides.
- Returns:
- Number of boundary sides.
| int createBoundarySideList | ( | ) |
Create list of boundary sides.
This function is useful to loop over boundary sides without testing Once this one is called, the function getNbBoundarySides() is available. Moreover, looping over boundary sides is available via the member functions topBoundarySide() and getBoundarySide()
- Returns:
- Number of boundary sides.
| int getBoundaryNodes | ( | ) |
Determine all boundary nodes.
- Returns:
- n Number of boundary nodes.
| int createInternalSideList | ( | ) |
Create list of internal sides (not on the boundary).
This function is useful to loop over internal sides without testing Once this one is called, the function getNbInternalSides() is available. Moreover, looping over internal sides is available via the member functions topInternalSide() and getInternalSide()
- Returns:
- n Number of internal sides.
| int getAllEdges | ( | ) |
Determine all edges.
- Returns:
- Number of all edges.
| void setMaterial | ( | int | code, |
| const string & | mname | ||
| ) |
Associate material to code of element.
- Parameters:
-
[in] code Element code for which material is assigned [in] mname Name of material
| void Reorder | ( | size_t | m = 1000000 | ) |
Renumber mesh nodes according to reverse Cuthill Mc Kee algorithm.
- Parameters:
-
[in] m Memory size needed for matrix graph (default value is GRAPH_MEMORT, see OFELI_Config.h)
| void Add | ( | size_t | num, |
| double * | x | ||
| ) |
Add a node by giving its label and an array containing its coordinates.
- Parameters:
-
[in] num Label of node to add [in] x C-array of node coordinates
| void DeleteNode | ( | size_t | label | ) |
Remove a node given by its label.
This function does not release the space previously occupied
- Parameters:
-
[in] label Label of node to delete
| void DeleteElement | ( | size_t | label | ) |
Remove an element given by its label.
This function does not release the space previously occupied
- Parameters:
-
[in] label Label of element to delete
| void DeleteSide | ( | size_t | label | ) |
Remove a side given by its label.
This function does not release the space previously occupied
- Parameters:
-
[in] label Label of side to delete
Remove a node given by its pointer.
This function does not release the space previously occupied
- Parameters:
-
[in] nd Pointer to node to delete
Remove a node given by its pointer.
This function does not release the space previously occupied
- Parameters:
-
[in] el Pointer to element to delete
Remove a side given by its pointer.
This function does not release the space previously occupied
- Parameters:
-
[in] sd Pointer to side to delete
Remove an edge given by its pointer.
This function does not release the space previously occupied
- Parameters:
-
[in] ed Pointer to edge to delete
| void RenumberNode | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Renumber a node.
- Parameters:
-
[in] n1 Old label [in] n2 New label
| void RenumberElement | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Renumber an element.
- Parameters:
-
[in] n1 Old label [in] n2 New label
| void RenumberSide | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Renumber a side.
- Parameters:
-
[in] n1 Old label [in] n2 New label
| void RenumberEdge | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Renumber an edge.
- Parameters:
-
[in] n1 Old label [in] n2 New label
| void setNodeView | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Set viewing window for nodes.
- Parameters:
-
[in] n1 First node to view [in] n2 last node to view
| void setElementView | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Set viewing window for elements.
- Parameters:
-
[in] n1 First element to view [in] n2 last element to view
| void setSideView | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Set viewing window for sides.
- Parameters:
-
[in] n1 First side to view [in] n2 last side to view
| void setEdgeView | ( | size_t | n1, |
| size_t | n2 | ||
| ) |
Set viewing window for edges.
- Parameters:
-
[in] n1 First edge to view [in] n2 last edge to view
Initialize list of mesh nodes using the input vector
- Parameters:
-
[in] nl vector instance that contains the list of pointers to nodes
Initialize list of mesh elements using the input vector
- Parameters:
-
[in] sl vector instance that contains the list of pointers to elements
Initialize list of mesh sides using the input vector
- Parameters:
-
[in] sl vector instance that contains the list of pointers to sides
| size_t getNbBoundarySides | ( | ) | const |
Return number of boundary sides.
This function is valid if member function getAllSides or getBoundarySides has been invoked before
| size_t getNbInternalSides | ( | ) | const |
Return number of internal sides.
This function is valid if member functions getAllSides and createInternalSideList have been invoked before
| void AddMidNodes | ( | int | g = 0 | ) |
Add mid-side nodes.
This is function is valid for triangles only
- Parameters:
-
[in] g Option to say of barycentre node is to be added (>0) or not (=0)
Replace node in the mesh.
If the node label exists already, the existing node pointer will be replaced by the current one. If not, an error message is displayed.
- Parameters:
-
[in] nd Pointer to node
Replace element in the mesh.
If the element label exists already, the existing element pointer will be replaced by the current one. If not, an error message is displayed.
- Parameters:
-
[in] el Pointer to element
Choose side in the mesh.
If the side label exists already, the existing side pointer will be replaced by the current one. If not, an error message is displayed.
- Parameters:
-
[in] sd Pointer to side
| bool NodesAreDOF | ( | ) | const |
Return information about DOF type.
- Returns:
- true if DOF are supported by nodes, false otherwise
| bool SidesAreDOF | ( | ) | const |
Return information about DOF type.
- Returns:
- true if DOF are supported by sides, false otherwise
| bool EdgesAreDOF | ( | ) | const |
Return information about DOF type.
- Returns:
- true if DOF are supported by edges, false otherwise
| bool ElementsAreDOF | ( | ) | const |
Return information about DOF type.
- Returns:
- true if DOF are supported by elements, false otherwise
| void put | ( | const string & | mesh_file | ) | const |
Write mesh data on file.
- Parameters:
-
[in] mesh_file Mesh file name
| void save | ( | const string & | mesh_file | ) | const |
Write mesh data on file in various formats.
File format depends on the extension in file name
- Parameters:
-
[in] mesh_file Mesh file name If the extension is '.m', the output file is an OFELI file If the extension is '.gpl', the output file is a Gnuplot file If the extension is '.msh' or '.geo', the output file is a Gmsh file If the extension is '.vtk', the output file is a VTK file
| void Bput | ( | const string & | mesh_file | ) | const |
Write mesh data on a binary file.
- Parameters:
-
[in] mesh_file Mesh file name
Fill vector nl with list of pointers to nodes
- Parameters:
-
[out] nl Instance of class vector that contain on output the list
Fill vector el with list of pointers to elements
- Parameters:
-
[out] el Instance of class vector that contain on output the list
Fill vector sl with list of pointers to sides
- Parameters:
-
[out] sl Instance of class vector that contain on output the list
| size_t getNodeLabel | ( | size_t | i | ) | const |
Return label of i-th node.
- Parameters:
-
[in] i Node index
| size_t getElementLabel | ( | size_t | i | ) | const |
Return label of i-th element.
- Parameters:
-
[in] i Element index
| size_t getSideLabel | ( | size_t | i | ) | const |
Return label of i-th side.
- Parameters:
-
[in] i Side index
| size_t getEdgeLabel | ( | size_t | i | ) | const |
Return label of i-th edge.
- Parameters:
-
[in] i Edge index
Friends And Related Function Documentation
- OFELI
- Mesh