Class MeshContinuum

Class Documentation

class MeshContinuum

Encapsulates all the necessary information required to fully define a computational domain.

Public Functions

MeshContinuum()
inline unsigned int GetDimension() const
inline void SetDimension(const unsigned int dim)
inline MeshType GetType() const
inline void SetType(const MeshType type)
inline CoordinateSystemType GetCoordinateSystem() const
inline void SetCoordinateSystem(const CoordinateSystemType coord_sys)
GeometryType GetGeometryType() const
inline bool Extruded() const
inline void SetExtruded(const bool extruded)
std::array<size_t, 3> GetIJKInfo() const

Gets and orthogonal mesh interface object.

inline void SetOrthoAttributes(const OrthoMeshAttributes &attrs)
inline void SetGlobalVertexCount(const uint64_t count)
inline uint64_t GetGlobalVertexCount() const
inline Vector3 &GlobalVertex(const uint64_t global_id)

Get vertex using global vertex ID.

inline const Vector3 &GlobalVertex(const uint64_t global_id) const

Get vertex using global vertex ID.

inline void AddGlobalVertex(const uint64_t global_id, const Vector3 &pos)

Add global vertex providing global ID and location in 3D space.

inline int GetNumPartitions() const
size_t GetGlobalNumberOfCells() const
inline std::map<std::string, uint64_t> &GetBoundaryNameMap()
inline const std::map<std::string, uint64_t> &GetBoundaryNameMap() const
inline std::map<uint64_t, std::string> &GetBoundaryIDMap()
inline const std::map<uint64_t, std::string> &GetBoundaryIDMap() const
std::vector<uint64_t> GetUniqueBoundaryIDs() const

Returns the unique boundary ids present in the problem.

void ComputeGeometricInfo()

Compute the geometric data for the cells and faces in the mesh.

void ClearCellReferences()

Method to be called if cells and nodes have been transferred to another grid.

uint64_t MakeBoundaryID(const std::string &boundary_name) const

Makes a boundary id given a name.

If the boundary name already exists, the associated boundary id will be returned. Other the id will be set to one more than the maximum boundary id.

void SetBoundaryName(std::uint64_t id, const std::string &name)

Associate boundary name with a boundary ID.

Parameters:
  • id – Boundary ID

  • name – Boundary name to associate with id

void SetOrthogonalBoundaries()

Defines the standard x/y/z min/max boundaries.

inline size_t GhostCellCount() const

Returns the the total number of ghost cells.

void AddGlobalCell(std::shared_ptr<Cell> new_cell)

Adds a new cell to the appropriate category (local or ghost).

Parameters:

new_cell – The cell to add.

Cell &GetGlobalCell(uint64_t cell_global_index)

Returns a reference to a cell given its global cell index.

const Cell &GetGlobalCell(uint64_t cell_global_index) const

Returns a const reference to a cell given its global cell index.

std::vector<uint64_t> GetGhostGlobalIDs() const

Returns the cell global ids of all ghost cells.

These are cells that neighbors to this partition’s cells but are on a different partition.

uint64_t GetGhostLocalID(uint64_t cell_global_index) const

Returns the local storage address of a ghost cell.

If the ghost is not truly a ghost then -1 is returned, but is wasteful and therefore the user of this function should implement code to prevent it.

std::shared_ptr<GridFaceHistogram> MakeGridFaceHistogram(double master_tolerance = 100.0, double slave_tolerance = 1.1) const

Populates a face histogram.

The function populates face_categories which is a structure containing pairs. Pair.first is the max dofs-per-face for the category and Pair.second is the number of faces in this category.

Parameters:
  • master_tolerance – Multiple histograms will only be attempted if the ratio of the maximum dofs-per-face to the average dofs-per-face is greater than this value. Default 1.2.

  • slave_tolerance – While traversing a sorted list of dofs-per-face, a new bin will only be generated when the ratio of the listed dofs-per-face to a running bin average exceeds this value. Defualt 1.1.

std::size_t GetLocalCellCount() const
const Cell &GetLocalCell(uint64_t id) const
Cell &GetLocalCell(uint64_t id)
std::vector<std::shared_ptr<Cell>> &GetLocalCells()
const std::vector<std::shared_ptr<Cell>> &GetLocalCells() const
inline bool IsCellLocal(uint64_t global_id) const noexcept

Returns whether the cell with the given global id is locally owned.

size_t MapCellGlobalID2LocalID(uint64_t global_id) const

Given a global id of a cell, returns the local id if the cell is local, otherwise throws an out_of_range error.

void FindAssociatedVertices(const CellFace &cur_face, std::vector<short> &dof_mapping) const

Creates a mapping of the current face local ids to the adjacent face’s local ids.

void FindAssociatedCellVertices(const CellFace &cur_face, std::vector<short> &dof_mapping) const

Creates a mapping of the current face local ids to the adjacent cell’s local ids.

size_t CountCellsInLogicalVolume(const LogicalVolume &log_vol) const

Counts the number of cells within a logical volume across all partitions.

bool CheckPointInsideCell(const Cell &cell, const Vector3 &point) const

Checks whether a point is within a cell.

bool CheckPointInsideCellFace(const Cell &cell, size_t face_i, const Vector3 &point) const

Checks whether a point is within a cell face.

NDArray<uint64_t, 3> MakeIJKToGlobalIDMapping() const

Provides a mapping from cell ijk indices to global ids.

std::vector<Vector3> MakeCellOrthoSizes() const

Determines the bounding box size of each cell and returns it as a list of 3-component vectors, one Vector3 for each cell.

std::pair<Vector3, Vector3> GetLocalBoundingBox() const

Returns the bounding box corners for the locally owned cells.

void SetUniformBlockID(unsigned int blk_id)

Sets block ids for all cells to the specified block id.

void SetBlockIDFromLogicalVolume(const LogicalVolume &log_vol, unsigned int blk_id, bool sense)

Sets block IDs using a logical volume.

void SetUniformBoundaryID(const std::string &boundary_name)

Assign all boundary faces to a single name.

void SetBoundaryIDFromLogicalVolume(const LogicalVolume &log_vol, const std::string &boundary_name, bool sense = true)

Sets boundary ids using a logical volume.

Vector3 ComputeCentroidFromListOfNodes(const std::vector<uint64_t> &list) const

Computes the centroid from nodes specified by the given list.

std::array<std::array<Vector3, 3>, 4> GetTetrahedralFaceVertices(const Cell &cell, const CellFace &face, size_t side) const

Get the face vertices of a tetrahedron contained within the given face and side of a polyhedron.

std::map<unsigned int, double> ComputeVolumePerBlockID() const

Compute volume per block IDs.

Public Static Functions

static inline std::shared_ptr<MeshContinuum> New()

Returns a new instance of the spatial discretization.

static int GetCellDimension(const Cell &cell)

Returns the spatial dimensionality of the cell.

static size_t MapCellFace(const Cell &cur_cell, const Cell &adj_cell, unsigned int f)

Given the current cell, cell A, and its adjacent cell, cell B, with cell B adjacent to A at the f-th face of cell A.

Will determine the af-th index of the face on cell B that interface with the f-th face of cell A.