Wonton::Direct_Product_Mesh< D, CoordSys > Class Template Reference

A basic, axis-aligned, logically-rectangular mesh. More...

#include <direct_product_mesh.h>

Public Member Functions

 Direct_Product_Mesh ()=delete
 Default constructor (disabled) More...
 
 Direct_Product_Mesh (const std::array< std::vector< double >, D > &axis_points_in, const Wonton::Executor_type *executor=nullptr, const int num_ghost_layers=0, const int dpart=D)
 Constructor to create a Direct_Product_Mesh. More...
 
Direct_Product_Meshoperator= (const Direct_Product_Mesh< D, CoordSys > &)=delete
 Assignment operator (disabled). More...
 
int space_dimension () const
 Get the dimensionality of the mesh. More...
 
bool distributed () const
 Is the mesh distributed. More...
 
int num_axis_points (const int dim, const Entity_type etype=Entity_type::ALL) const
 Get the number of axis points (cell boundary coordinates) along a specified axis. More...
 
int num_ghost_layers () const
 Number of ghost layers on any end. More...
 
Entity_type axis_point_type (const int dim, const int pointid) const
 Entity type of axis point. More...
 
GID_t point_global_index (const int dim, const int pointid) const
 Global index of point along a specified axis. More...
 
int num_axis_cells (const int dim, const Entity_type etype=Entity_type::ALL) const
 Get the number of cell along a specified axis. More...
 
double get_axis_point (const int dim, const int pointid) const
 Get the specified axis point (coordinate value of cell corner) More...
 
bool point_on_external_boundary (const int dim, const int pointid) const
 is point on external (global) boundary along given axis More...
 
void get_global_coord_bounds (const int dim, double *lo, double *hi) const
 get global coordinate bounds along axis More...
 
void get_local_coord_bounds (const int dim, double *lo, double *hi) const
 coordinate bounds of OWNED cells in local domain (ghost layers EXCLUDED) More...
 

Detailed Description

template<int D, class CoordSys = Wonton::DefaultCoordSys>
class Wonton::Direct_Product_Mesh< D, CoordSys >

A basic, axis-aligned, logically-rectangular mesh.

A Direct_Product_Mesh is a basic, serial, N-dimensional, axis-aliged, logically-rectangular mesh. It is called a direct product mesh because it is the direct product of independent discretizations along each axis.

The discretizations need not be uniform – that is, the cell sizes can vary across the mesh. However, they are static. Once set, they will not change.

Storage of the mesh is based on cell boundary coordinates, aka axis points.

This is meant to be an example of a simple structured mesh implementation that can be used by a wrapper class (see direct_product_mesh_wrapper.h) that implements the interface needed by Portage. All getters in this class are per axis.

The scheme for labeling cells as PARALLEL_OWNED or PARALLEL_GHOST is simple - each rank has a contiguous set of owned cells bounded by ghost cells on either side in each direction. There may be 0 to N ghost layers on each side (lower and upper) in each direction

LABELING CONVENTIONS: The scheme for labeling points as PARALLEL_OWNED or PARALLEL_GHOST on a parallel partition is PER AXIS coordinate. That means when considering a node as a whole, the parallel status of each of its coordinates must be taken into consideration - if it is PARALLEL_GHOST in any one direction, it is a PARALLEL_GHOST. The scheme is as follows:

  1. The outer most points of the ghost layer are PARALLEL_GHOST
  2. Any point in the "interior" of the partition in that axis is PARALLEL_OWNED (i.e., if all cells connected to it are PARALLEL_OWNED)
  3. The high boundary of owned cells of a partition (i.e. the axis point with a PARALLEL_OWNED cell before it and a PARALLEL_GHOST after it) is PARALLEL_OWNED
  4. The low boundary of owned cells of a partition (i.e. the axis point with a PARALLEL_GHOST cell before it and a PARALLEL_OWNED cell after it) is PARALLEL_GHOST unless it forms the low boundary of the global domain in which case it is PARALLEL_OWNED

The labeling scheme for nodes and cells is shown in the figure below (g is ghost and o is owned) for 1 layer of ghosts.

      lower       upper       lower       upper       lower       upper
     GLOBAL     partition   partition   partition   partition    GLOBAL
    boundary    boundary    boundary    boundary    boundary    boundary
        |           |           |           |           |           |

axis pts g o o o o g g g o o o g g g o o o g +—+—+—+—+—+ +—+—+—+—+—+ +—+—+—+—+—+ cells g o o o g g o o o g g o o o g

Indexing conventions: NG = num_ghost_layers N = Number of global points in the domain (exclude ghost points we created) Local index = index of points along an axis in the current partition

0. Both points and cells have one index per axis

  1. The local index for the lowest PARALLEL_OWNED POINT is 0
  2. The local indices for the PARALLEL_GHOST POINTS before point 0 are -1, -2, ..., -NG
  3. The local index for the lowest PARALLEL_OWNED CELL is 0
  4. The local indices for the PARALLEL_GHOST CELLS before cell 0 are -1, -2, ..., -NG
  5. The global index for the first globally owned POINT is 0
  6. The global index for the last globallly owned POINT is N (where N is the total number of global points in the input)
  1. The global indices for the ghost points before the first owned point are -1, -2, ..., -NG for the ghost points after the last owned point are N, N+1, ..., N+NG-1
  2. We don't bother with global cell indices along each axis (not needed so far)

Constructor & Destructor Documentation

◆ Direct_Product_Mesh() [1/2]

template<int D, class CoordSys = Wonton::DefaultCoordSys>
Wonton::Direct_Product_Mesh< D, CoordSys >::Direct_Product_Mesh ( )
delete

Default constructor (disabled)

◆ Direct_Product_Mesh() [2/2]

template<int D, class CoordSys >
Wonton::Direct_Product_Mesh< D, CoordSys >::Direct_Product_Mesh ( const std::array< std::vector< double >, D > &  axis_points_in,
const Wonton::Executor_type executor = nullptr,
const int  num_ghost_layers = 0,
const int  dpart = D 
)

Constructor to create a Direct_Product_Mesh.

Parameters
[in]axis_pointsGlobal cell boundary coords along each axis.
[in]executorPointer to serial or parallel executor
[in]num_ghost_layersNumber of ghost layers requested in parallel
[in]dpartNumber of directions to partition in parallel

Specify the axis point coordinates that delineate the cells of the mesh along each axis.

Member Function Documentation

◆ axis_point_type()

template<int D, class CoordSys >
Entity_type Wonton::Direct_Product_Mesh< D, CoordSys >::axis_point_type ( const int  dim,
const int  pointid 
) const

Entity type of axis point.

Parameters
[in]dimThe axis to query
[in]pointidThe point to query
Returns
Wonton entity type of point (along this axis)

◆ distributed()

template<int D, class CoordSys >
bool Wonton::Direct_Product_Mesh< D, CoordSys >::distributed ( ) const

Is the mesh distributed.

◆ get_axis_point()

template<int D, class CoordSys >
double Wonton::Direct_Product_Mesh< D, CoordSys >::get_axis_point ( const int  dim,
const int  pointid 
) const

Get the specified axis point (coordinate value of cell corner)

Parameters
[in]dimThe axis to query.
[in]pointidThe point to query (pointid of left ghost along axis is -1, of first owned point is 0 and of right ghost is n where n is the number of owned points along the axis
Returns
coordinate value of point along axis. If the point is a ghost but does not exist (e.g pointid=-1 on the left boundary), it will throw an exception

◆ get_global_coord_bounds()

template<int D, class CoordSys >
void Wonton::Direct_Product_Mesh< D, CoordSys >::get_global_coord_bounds ( const int  dim,
double *  lo,
double *  hi 
) const

get global coordinate bounds along axis

Parameters
[in]dimaxis along which to get bounds
[out]lolower coordinate bound along axis
[out]hiupper coordinate bound along axis

◆ get_local_coord_bounds()

template<int D, class CoordSys >
void Wonton::Direct_Product_Mesh< D, CoordSys >::get_local_coord_bounds ( const int  dim,
double *  lo,
double *  hi 
) const

coordinate bounds of OWNED cells in local domain (ghost layers EXCLUDED)

Parameters
[in]dimaxis along which to get bounds
[out]lolower coordinate bound along axis
[out]hiupper coordinate bound along axis

◆ num_axis_cells()

template<int D, class CoordSys >
int Wonton::Direct_Product_Mesh< D, CoordSys >::num_axis_cells ( const int  dim,
const Entity_type  etype = Entity_type::ALL 
) const

Get the number of cell along a specified axis.

Parameters
[in]dimThe axis to query.
[in]etypeThe type of cells to count (See Wonton::Entity_type)
Returns
The number of cells along specified axis

◆ num_axis_points()

template<int D, class CoordSys >
int Wonton::Direct_Product_Mesh< D, CoordSys >::num_axis_points ( const int  dim,
const Entity_type  etype = Entity_type::ALL 
) const

Get the number of axis points (cell boundary coordinates) along a specified axis.

Parameters
[in]dimThe axis to query.
[in]etypeThe type of points to count (See Wonton::Entity_type)
Returns
The number of points along specified axis

◆ num_ghost_layers()

template<int D, class CoordSys >
int Wonton::Direct_Product_Mesh< D, CoordSys >::num_ghost_layers ( ) const

Number of ghost layers on any end.

Returns
Number of ghost cell layers

Note that if this returns a value of 2, it means there are 2 ghost cells on each end of the mesh in that direction for a total of 4.

◆ operator=()

template<int D, class CoordSys = Wonton::DefaultCoordSys>
Direct_Product_Mesh& Wonton::Direct_Product_Mesh< D, CoordSys >::operator= ( const Direct_Product_Mesh< D, CoordSys > &  )
delete

Assignment operator (disabled).

◆ point_global_index()

template<int D, class CoordSys >
GID_t Wonton::Direct_Product_Mesh< D, CoordSys >::point_global_index ( const int  dim,
const int  pointid 
) const

Global index of point along a specified axis.

Parameters
[in]dimThe axis to query.
[in]pointidThe point to query (pointid of left ghost along axis is -1)
Returns
global index of point along axis

◆ point_on_external_boundary()

template<int D, class CoordSys >
bool Wonton::Direct_Product_Mesh< D, CoordSys >::point_on_external_boundary ( const int  dim,
const int  pointid 
) const

is point on external (global) boundary along given axis

Both the owned points on the global boundary AND their boundary ghost counterparts will return true in this call

◆ space_dimension()

template<int D, class CoordSys >
int Wonton::Direct_Product_Mesh< D, CoordSys >::space_dimension ( ) const

Get the dimensionality of the mesh.


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