Wonton::Simple_Mesh Class Reference

A very light-weight, serial, 2D/3D Cartesian mesh. More...

#include <simple_mesh.h>

Public Member Functions

 Simple_Mesh (double x0, double y0, double z0, double x1, double y1, double z1, int nx, int ny, int nz)
 Constructor for creating a serial, 3D Cartesian mesh. More...
 
 Simple_Mesh (double x0, double y0, double x1, double y1, int nx, int ny)
 Constructor for creating a serial, 2D Cartesian mesh. More...
 
Simple_Meshoperator= (const Simple_Mesh &)=delete
 Assignment operator (disabled). More...
 
 ~Simple_Mesh ()
 Destructor. More...
 
int space_dimension () const
 Spatial dimension of the mesh. More...
 
int num_entities (const Entity_kind kind, const Entity_type type) const
 Determine the number of a specific mesh entity. More...
 
void cell_get_faces_and_dirs (const ID cellid, std::vector< ID > *faces, std::vector< int > *fdirs) const
 For a given cell, get the list of faces and the direction of their normals. More...
 
void cell_get_nodes (const ID cellid, std::vector< ID > *nodes) const
 For a given cell, get the list of nodes. More...
 
void face_get_nodes (const ID faceid, std::vector< ID > *nodes) const
 For a given face, get the list of nodes. More...
 
void node_get_cells (const ID nodeid, std::vector< ID > *cells) const
 For a given node, get all the cells attached to this node. More...
 
template<int D>
void node_get_coordinates (const ID nodeid, Point< D > *pp) const
 Get the coordinates of a node. More...
 
template<int D>
void cell_get_coordinates (const ID cellid, std::vector< Point< D >> *ccoords) const
 
template<int D>
void transform (const Matrix &affine)
 Perform an affine transform on the coordinates of the mesh. More...
 
template<int D>
void node_set_coordinates (const ID nodeid, Point< D > *pp)
 Set the coordinates of a node. More...
 
template<>
void node_get_coordinates (const ID nodeid, Point< 3 > *pp) const
 Get the 2D/3D coordinates of a specific node as Wonton::Point object. More...
 
template<>
void node_get_coordinates (const ID nodeid, Point< 2 > *pp) const
 
template<>
void node_set_coordinates (const ID nodeid, Point< 3 > *pp)
 
template<>
void node_set_coordinates (const ID nodeid, Point< 2 > *pp)
 

Detailed Description

A very light-weight, serial, 2D/3D Cartesian mesh.

A Simple_Mesh is a non-distributed (i.e. serial), 2D/3D, regular Cartesian mesh. The user need only specify the domain extents and the number of cells per direction, and the mesh class will create all of the connectivity information. The cells are created in row-first order.

Simple_Mesh only knows about cells, faces, and nodes.

In a 3D mesh, each cell is a rectangular prism with 8 nodes and 6 faces. Likewise, each non-domain-boundary node is connected to 8 cells and each non-domain-boundary face is connected to two cells.

In a 2D mesh, each cell is a quadrilateral with 4 nodes and 4 faces. Likewise, each non-domain-boundary node is connected to 4 cells and each non-domain-boundary face is connected to two cells.

Nodes and faces on the domain boundary have less connections as there are no ghost mesh entities in Simple_Mesh.

Constructor & Destructor Documentation

◆ Simple_Mesh() [1/2]

Wonton::Simple_Mesh::Simple_Mesh ( double  x0,
double  y0,
double  z0,
double  x1,
double  y1,
double  z1,
int  nx,
int  ny,
int  nz 
)
inline

Constructor for creating a serial, 3D Cartesian mesh.

Parameters
[in]x0,y0,z0The minimum coordinates of the domain.
[in]x1,y1,z1The maximum coordinates of the domain.
[in]nx,ny,nzThe number of cells in each direction.

By specifying the spatial extents and number of cells in each direction, we create a Cartesian mesh in three dimensions. Connectivity information is automatically built from global IDs. This mesh class has zero ghost mesh entities.

◆ Simple_Mesh() [2/2]

Wonton::Simple_Mesh::Simple_Mesh ( double  x0,
double  y0,
double  x1,
double  y1,
int  nx,
int  ny 
)
inline

Constructor for creating a serial, 2D Cartesian mesh.

Parameters
[in]x0,y0The minimum coordinates of the domain.
[in]x1,y1The maximum coordinates of the domain.
[in]nx,nyThe number of cells in each direction.

By specifying the spatial extents and number of cells in each direction, we create a Cartesian mesh in two dimensions. Connectivity information is automatically built from global IDs. This mesh class has zero ghost mesh entities.

◆ ~Simple_Mesh()

Wonton::Simple_Mesh::~Simple_Mesh ( )
inline

Destructor.

Member Function Documentation

◆ cell_get_coordinates()

template<int D>
void Wonton::Simple_Mesh::cell_get_coordinates ( const ID  cellid,
std::vector< Point< D >> *  ccoords 
) const
inline

◆ cell_get_faces_and_dirs()

void Wonton::Simple_Mesh::cell_get_faces_and_dirs ( const ID  cellid,
std::vector< ID > *  faces,
std::vector< int > *  fdirs 
) const
inline

For a given cell, get the list of faces and the direction of their normals.

Parameters
[in]cellidThe ID of the cell.
[out]facesThe vector of face IDs corresponding to cell cellid.
[out]fdirsThe vector of face directions corresponding to each face in faces.

◆ cell_get_nodes()

void Wonton::Simple_Mesh::cell_get_nodes ( const ID  cellid,
std::vector< ID > *  nodes 
) const
inline

For a given cell, get the list of nodes.

Parameters
[in]cellidThe ID of the cell.
[out]nodesThe vector of node IDs corresponding to cell cellid.

◆ face_get_nodes()

void Wonton::Simple_Mesh::face_get_nodes ( const ID  faceid,
std::vector< ID > *  nodes 
) const
inline

For a given face, get the list of nodes.

Parameters
[in]faceidThe ID of the face.
[out]nodesThe vector of node IDs corresponding to face faceid.

◆ node_get_cells()

void Wonton::Simple_Mesh::node_get_cells ( const ID  nodeid,
std::vector< ID > *  cells 
) const
inline

For a given node, get all the cells attached to this node.

Parameters
[in]nodeidThe ID of the node.
[out]cellsThe vector of cell IDs attached to node nodeid.

◆ node_get_coordinates() [1/3]

template<int D>
void Wonton::Simple_Mesh::node_get_coordinates ( const ID  nodeid,
Point< D > *  pp 
) const
inline

Get the coordinates of a node.

Template Parameters
DDimension of the node.
Parameters
[in]nodeidThe ID of the node.
[out]ppThe Point object of dimension D containing the coordinates of node .

This is the general specification.

◆ node_get_coordinates() [2/3]

template<>
void Wonton::Simple_Mesh::node_get_coordinates ( const ID  nodeid,
Point< 3 > *  pp 
) const
inline

Get the 2D/3D coordinates of a specific node as Wonton::Point object.

Parameters
[in]nodeidThe ID of the node.
[out]ppThe Wonton::Point containing the coordinates for node nodeid.

◆ node_get_coordinates() [3/3]

template<>
void Wonton::Simple_Mesh::node_get_coordinates ( const ID  nodeid,
Point< 2 > *  pp 
) const
inline

◆ node_set_coordinates() [1/3]

template<int D>
void Wonton::Simple_Mesh::node_set_coordinates ( const ID  nodeid,
Point< D > *  pp 
)
inline

Set the coordinates of a node.

USE WITH EXTREME CARE. Improper setting of coordinates from outside the class can invalidate the adjacency information, among other mischief.

Template Parameters
DDimension of the node.
Parameters
[in]nodeidThe ID of the node.
[out]ppThe Point object of dimension D containing the new coordinates of node .

This is the general specification.

◆ node_set_coordinates() [2/3]

template<>
void Wonton::Simple_Mesh::node_set_coordinates ( const ID  nodeid,
Point< 3 > *  pp 
)
inline

◆ node_set_coordinates() [3/3]

template<>
void Wonton::Simple_Mesh::node_set_coordinates ( const ID  nodeid,
Point< 2 > *  pp 
)
inline

◆ num_entities()

int Wonton::Simple_Mesh::num_entities ( const Entity_kind  kind,
const Entity_type  type 
) const
inline

Determine the number of a specific mesh entity.

Parameters
[in]kindThe type of entity, e.g. CELL.
[in]typeThe type of the entity, e.g. PARALLEL_OWNED
Returns
The number of the specified mesh entity.

◆ operator=()

Simple_Mesh& Wonton::Simple_Mesh::operator= ( const Simple_Mesh )
delete

Assignment operator (disabled).

◆ space_dimension()

int Wonton::Simple_Mesh::space_dimension ( ) const
inline

Spatial dimension of the mesh.

◆ transform()

template<int D>
void Wonton::Simple_Mesh::transform ( const Matrix &  affine)
inline

Perform an affine transform on the coordinates of the mesh.

The input transform matrix is of dimension D x (D+1), where first D columns are a linear transform, the last column is a translation vector, and D is the dimension of the mesh.

Template Parameters

The documentation for this class was generated from the following file: