![]() |
NLMech
0.1.0
|
A class for mesh data. More...
#include <mesh.h>

Public Member Functions | |
| Mesh () | |
| Constructor. | |
| Mesh (inp::MeshDeck *deck) | |
| Constructor. More... | |
| Mesh (size_t dim=0) | |
| Constructor. More... | |
| void | print (int nt=0, int lvl=0) const |
| Prints the information about the instance of the object. More... | |
| std::string | printStr (int nt=0, int lvl=0) const |
| Returns the string containing information about the instance of the object. More... | |
Accessor methods | |
| size_t | getDimension () const |
| Get the dimension of the domain. More... | |
| size_t | getNumNodes () const |
| Get the number of nodes. More... | |
| size_t | getNumElements () const |
| Get the number of elements. More... | |
| size_t | getNumDofs () const |
| Get the number of dofs. More... | |
| size_t | getElementType () const |
| Get the type of element in mesh. More... | |
| double | getMeshSize () const |
| Get the mesh size. More... | |
| util::Point3 | getNode (const size_t &i) const |
| Get coordinates of node i. More... | |
| double | getNodalVolume (const size_t &i) const |
| Get nodal volume of node i. More... | |
| const std::vector< util::Point3 > & | getNodes () const |
| Get the nodes data. More... | |
| std::vector< util::Point3 > & | getNodes () |
| const std::vector< util::Point3 > * | getNodesP () const |
| Get the pointer to nodes data. More... | |
| std::vector< util::Point3 > * | getNodesP () |
| const std::vector< uint8_t > * | getFixityP () const |
| Get the pointer to fixity data. More... | |
| std::vector< uint8_t > * | getFixityP () |
| const std::vector< uint8_t > & | getFixity () const |
| Get the reference to fixity data. More... | |
| std::vector< uint8_t > & | getFixity () |
| const std::vector< double > & | getNodalVolumes () const |
| Get the nodal volume data. More... | |
| std::vector< double > & | getNodalVolumes () |
| const std::vector< double > * | getNodalVolumesP () const |
| Get the pointer to nodal volume data. More... | |
| std::vector< double > * | getNodalVolumesP () |
| const std::vector< size_t > | getPrescribedNodes () const |
| Get the vector of indicies with prescribed values from the couplign method. More... | |
| std::vector< size_t > | getPrescribedNodes () |
| const std::vector< util::Point3 > | getPrescribedValues () const |
| Get the vector of values of the prescribed nodes from the couplign method. More... | |
| std::vector< util::Point3 > | getPrescribedValues () |
| bool | isNodeFree (const size_t &i, const unsigned int &dof) const |
| Return true if node is free. More... | |
| std::vector< size_t > | getElementConnectivity (const size_t &i) const |
| Get the connectivity of element. More... | |
| std::vector< util::Point3 > | getElementConnectivityNodes (const size_t &i) const |
| Get the vertices of element. More... | |
| const std::vector< size_t > & | getElementConnectivities () const |
| Get the reference to element-node connectivity data. More... | |
| std::vector< size_t > & | getElementConnectivities () |
| const std::vector< size_t > * | getElementConnectivitiesP () const |
| Get the pointer to element-node connectivity data. More... | |
| std::vector< size_t > * | getElementConnectivitiesP () |
| const std::pair< std::vector< double >, std::vector< double > > & | getBoundingBox () const |
| Get the bounding box of the mesh. More... | |
Setter methods | |
| void | setMeshData (const size_t &dim, std::vector< util::Point3 > &nodes, std::vector< double > &volumes) |
| Set the mesh data for finite difference simulations. More... | |
| void | setNodes (std::vector< util::Point3 > &nodes) |
| Set the nodal data of the mesh. More... | |
| void | setNodalVolumes (std::vector< double > &volumes) |
| Set the nodal volume data of the mesh. More... | |
| void | setFixity (std::vector< uint8_t > &fixity) |
| Set nodal fixity masks. More... | |
| void | setFixity (const size_t &i, const unsigned int &dof, const bool &flag) |
| Set the fixity to free (0) or fixed (1) More... | |
| void | setMeshSize (const double &h) |
| Set the mesh size. More... | |
| void | readFromFile (inp::MeshDeck *deck, const std::string &filename) |
| Reads mesh data from the file and populates other data. More... | |
| void | clearElementData () |
| Clear element-node connectivity data. | |
Private Member Functions | |
Utility methods | |
| void | createData (const std::string &filename, bool ref_config, bool is_centroid_based, bool has_coupling_data) |
| Reads mesh data from the file and populates other data. More... | |
| void | nodesAtCentroid () |
| Converts standard fem mesh to particle mesh with nodes at the center of element. | |
| void | computeVol () |
| Compute the nodal volume. More... | |
| void | computeBBox () |
| Compute the bounding box | |
| void | computeMeshSize () |
| Compute the mesh size. More... | |
Private Attributes | |
| std::pair< std::vector< double >, std::vector< double > > | d_bbox |
| Bounding box. More... | |
| size_t | d_dim |
| Dimension of the mesh. | |
| std::string | d_filename |
| Filename to read mesh data. | |
| std::vector< int > | d_gInvMap |
| Map from global id to reduced global id. More... | |
| std::vector< size_t > | d_gMap |
| Map from global reduced id to default global id. More... | |
| double | d_h |
| Mesh size. | |
| bool | d_keepElementConn |
| Specify if we keep the element connectivity data. | |
| size_t | d_numDofs |
| Number of dofs = (dimension) times (number of nodes) | |
| std::string | d_spatialDiscretization |
| Tag for spatial discretization type. More... | |
Mesh data | |
| size_t | d_numNodes |
| Number of nodes. | |
| size_t | d_numElems |
| Number of elements. | |
| size_t | d_eType |
| Element type. More... | |
| size_t | d_eNumVertex |
| Number of vertex per element. More... | |
| std::vector< util::Point3 > | d_nodes |
| Vector of initial (reference) coordinates of nodes. | |
| std::vector< size_t > | d_enc |
| Element-node connectivity data. More... | |
| std::vector< std::vector< size_t > > | d_nec |
| Node-element connectivity data. More... | |
| std::vector< uint8_t > | d_fix |
| Vector of fixity mask of each node. More... | |
| std::vector< double > | d_vol |
| Vector of volume of each node. More... | |
| std::vector< size_t > | d_prescribed_nodes |
| Vector with the indicies of all nodes with prescribed boundary data. More... | |
| std::vector< util::Point3 > | d_prescribed_values |
| Vector with the values of all nodes with prescribed boundary data. More... | |
A class for mesh data.
In this class the mesh data such as nodes, element-node connectivity, node-element connectivity are stored. The class also stores fixity mask of nodes which indicates if x-, y-, or z-dof of the node is fixed or free.
We currently only support mesh with only one type of elements, i.e. mesh can not have mix of two types of elements. For example, we can not have mesh with triangle and quadrangle elements together.
This class is used in both finite difference implementation and finite element implementation. For finite difference, we only require nodal volume. If the mesh file contains nodal volume, we skip reading element-node and node-element connectivity, however if mesh file does not have nodal volume data, we read connectivity data and compute the nodal volume.
|
explicit |
Constructor.
| dim | Dimension of the problem |
|
explicit |
Constructor.
The constructor initializes the data using input deck, performs checks on input data, and reads mesh file and populates the mesh related data. The mesh file of **.csv**, **.vtu (VTK)** and **.msh (Gmsh)** are supported.
| deck | Input deck which contains user-specified information |

|
private |
Compute the mesh size.
This method searches for minimum distance between any two mesh nodes and stores it as a mesh size.
Referenced by Mesh().


|
private |
Compute the nodal volume.
This method requires element-node connectivity data to compute the nodal volumes. Formula for volume of a node
is given by
where
is a list of elements which have node
as its vertex,
is the element domain,
is the shape function of the node
in element e.

|
private |
Reads mesh data from the file and populates other data.
This function calls reader methods in namespace rw::reader to read the mesh file. For finite difference implementation, we support **.csv** mesh file which has nodal coordinates and nodal volumes data.
However, for finite element implementation, we require either **.vtu** or **.msh** file with element-node connectivity data.
| filename | Name of the mesh file |
| ref_config | Base the mesh on reference configuration (obtain reference configuration using point data and displacement data) |
| is_centroid_based | Specify if we create node at the center of element |
| has_coupling_data | Specify if we read the additional data needed for coupling |
Referenced by Mesh().


|
inline |
Get the bounding box of the mesh.
Referenced by model::Output::Output().

|
inline |
Get the dimension of the domain.
Referenced by loading::InitialCondition::apply().

|
inline |
Get the reference to element-node connectivity data.
|
inline |
Get the pointer to element-node connectivity data.
Referenced by model::Output::Output().

|
inline |
Get the connectivity of element.
Since we store connectivity in a single vector, we use fe::Mesh::d_eNumVertex to get the connectivity of element. Given element e, the connectivity of e begins from location
upto
.
So the connectivity of e is d_enc[
], d_enc[
], ..., d_end[
]
| i | Id of an element |
|
inline |
Get the vertices of element.
| i | Id of an element |
|
inline |
Get the type of element in mesh.
Referenced by model::Output::Output().

|
inline |
Get the reference to fixity data.
|
inline |
Get the pointer to fixity data.
Referenced by model::Output::Output().

|
inline |
Get the mesh size.
Referenced by loading::FLoading::apply(), material::pd::RNPBond::RNPBond(), and geometry::VolumeCorrection::VolumeCorrection().

|
inline |
Get nodal volume of node i.
| i | Id of the node |
Referenced by model::Output::Output().

|
inline |
Get the nodal volume data.
|
inline |
Get the pointer to nodal volume data.
Referenced by model::Output::Output().

|
inline |
Get coordinates of node i.
| i | Id of the node |
Referenced by loading::FLoading::apply(), loading::ULoading::apply(), loading::InitialCondition::apply(), geometry::DampingGeom::computeDampingCoefficient(), loading::FLoading::FLoading(), and loading::ULoading::ULoading().

|
inline |
Get the nodes data.
|
inline |
Get the pointer to nodes data.
Referenced by tools::pp::Compute::Compute(), util::StateBasedHelperFunctions::dilatation(), model::Output::Output(), util::StateBasedHelperFunctions::StateBasedHelperFunctions(), and geometry::VolumeCorrection::VolumeCorrection().

|
inline |
Get the number of dofs.
|
inline |
Get the number of elements.
Referenced by model::Output::Output().

|
inline |
Get the number of nodes.
Referenced by loading::InitialCondition::apply(), tools::pp::Compute::Compute(), geometry::DampingGeom::computeDampingCoefficient(), geometry::DampingGeom::DampingGeom(), loading::FLoading::FLoading(), model::Output::Output(), and loading::ULoading::ULoading().

|
inline |
Get the vector of indicies with prescribed values from the couplign method.
Referenced by loading::ULoading::ULoading().

|
inline |
Get the vector of values of the prescribed nodes from the couplign method.
Referenced by loading::ULoading::apply().

|
inline |
Return true if node is free.
| i | Id of node |
| dof | Dof to check for |
Referenced by loading::InitialCondition::apply().

|
inline |
Prints the information about the instance of the object.
| nt | Number of tabs to append before each line of string |
| lvl | Level of information sought (higher level means more information) |

| std::string fe::Mesh::printStr | ( | int | nt = 0, |
| int | lvl = 0 |
||
| ) | const |
Returns the string containing information about the instance of the object.
| nt | Number of tabs to append before each line of string |
| lvl | Level of information sought (higher level means more information) |
Referenced by print().


| void fe::Mesh::readFromFile | ( | inp::MeshDeck * | deck, |
| const std::string & | filename | ||
| ) |
Reads mesh data from the file and populates other data.
| deck | Mesh deck |
| filename | Name of the mesh file |
| void fe::Mesh::setFixity | ( | const size_t & | i, |
| const unsigned int & | dof, | ||
| const bool & | flag | ||
| ) |
Set the fixity to free (0) or fixed (1)
| i | Id of node |
| dof | Dof which is affected |
| flag | Set fixity to fixed if true or free |
| void fe::Mesh::setFixity | ( | std::vector< uint8_t > & | fixity | ) |
Set nodal fixity masks.
| fixity | Reference to fixity of all nodes |
Referenced by loading::ULoading::ULoading().

| void fe::Mesh::setMeshData | ( | const size_t & | dim, |
| std::vector< util::Point3 > & | nodes, | ||
| std::vector< double > & | volumes | ||
| ) |
Set the mesh data for finite difference simulations.
| dim | Dimension |
| nodes | Reference to nodes reference configuration |
| volumes | Reference to nodal volumes |
| void fe::Mesh::setMeshSize | ( | const double & | h | ) |
Set the mesh size.
| h | Mesh size |
| void fe::Mesh::setNodalVolumes | ( | std::vector< double > & | volumes | ) |
Set the nodal volume data of the mesh.
| volumes | Reference to nodal volumes |
| void fe::Mesh::setNodes | ( | std::vector< util::Point3 > & | nodes | ) |
Set the nodal data of the mesh.
| nodes | Reference to nodes reference configuration |
|
private |
|
private |
Element-node connectivity data.
Structure: First d_eNumVertex data gives the connectivity of first element, and next d_eNumVertex data gives the connectivity of second element and so on and so fourth.
Referenced by getElementConnectivities(), getElementConnectivitiesP(), getElementConnectivity(), getElementConnectivityNodes(), and getNumElements().
|
private |
Number of vertex per element.
This information is useful in getting the connectivity for a given element. We assume that the mesh has only one type of elements and based on that assumption we store the element-node connectivity in a single vector.
The value for different elements are
Referenced by getElementConnectivity(), getElementConnectivityNodes(), and getNumElements().
|
private |
Element type.
We follow VTK convention to identify the elements:
Referenced by getElementType().
|
private |
Vector of fixity mask of each node.
First bit represents x-dof, second represents y-dof, and third represents z-dof. 0 represents free dof and 1 represents fixed dof.
We store data in uint8_t type which can hold 8 bit. At present we only use first 3 bits.
Referenced by getFixity(), getFixityP(), and isNodeFree().
|
private |
Map from global id to reduced global id.
This is a inverse of d_gMap
|
private |
Map from global reduced id to default global id.
We assign number to each free dof where number ranges from 0 to total number of free dofs. This is referred to set of global reduced id. This new set of ids are subset of set of global ids of all dofs, and therefore, "reduced" word is used.
d_gMap provides a map from global reduced id to global id.
|
private |
Node-element connectivity data.
At present, this data is never populated.
|
private |
Vector with the indicies of all nodes with prescribed boundary data.
For coupling with other codes, e.g. FEM or PUM, prescribed values for displacement or force are given by the local method and applied to these PD nodes.
Referenced by getPrescribedNodes().
|
private |
Vector with the values of all nodes with prescribed boundary data.
For coupling with other codes, e.g. FEM or PUM, prescribed values for displacement or force are given by the local method and applied to these PD nodes.
Referenced by getPrescribedValues().
|
private |
Tag for spatial discretization type.
List of valid values are:
Referenced by Mesh().
|
private |
Vector of volume of each node.
For uniform square mesh, the volume is simply
in 2-d and
in 3-d, where
is the mesh size. For general mesh, the volume is computed using the element-node connectivity of the mesh.
Referenced by getNodalVolume(), getNodalVolumes(), getNodalVolumesP(), and Mesh().