ThunderEgg  1.0.0
ThunderEgg::PatchInfo< D > Class Template Reference

Contains metadata for a patch. More...

#include <PatchInfo.h>

Inheritance diagram for ThunderEgg::PatchInfo< D >:
Collaboration diagram for ThunderEgg::PatchInfo< D >:

Public Member Functions

 PatchInfo ()
 Construct a new Patch Info object starts, ns, and spacings are all set to 0.
 
 PatchInfo (const PatchInfo< D > &other_pinfo)
 Copy constructor. More...
 
PatchInfo< D > & operator= (const PatchInfo< D > &other_pinfo)
 Copy asisgnment. More...
 
template<int M>
void setNbrInfo (Face< D, M > f, nullptr_t)
 
template<int M>
void setNbrInfo (Face< D, M > f, NbrInfo< M > *nbr_info)
 Set the Nbr Info object on a given face. More...
 
template<int M>
NbrType getNbrType (Face< D, M > s) const
 Get the NbrType for a side. More...
 
template<int M>
NormalNbrInfo< M > & getNormalNbrInfo (Face< D, M > s) const
 Get the NormalNbrInfo object for a side. More...
 
template<int M>
CoarseNbrInfo< M > & getCoarseNbrInfo (Face< D, M > s) const
 Get the CoarseNbrInfo object. More...
 
template<int M>
FineNbrInfo< M > & getFineNbrInfo (Face< D, M > s) const
 Get the FineNbrInfo object. More...
 
template<int M>
bool hasNbr (Face< D, M > s) const
 Return whether the patch has a neighbor. More...
 
bool hasNbr () const
 Return if this patch has a neighbor.
 
bool hasCoarseParent () const
 Return whether the patch has a coarser parent. More...
 
void setNeighborLocalIndexes (const std::map< int, int > &id_to_local_index_map)
 Set the local indexes in the NbrInfo objects. More...
 
void setNeighborGlobalIndexes (const std::map< int, int > &id_to_global_index_map)
 Set the global indexes in the NbrInfo objects. More...
 
std::deque< int > getNbrIds () const
 return a vector of neighbor ids
 
std::deque< int > getNbrRanks () const
 return a vector of neighbor ranks
 
template<int M>
void serializeNeighbors (BufferWriter &writer) const
 
template<int M>
void deserializeNeighbors (BufferReader &reader)
 
int serialize (char *buffer) const
 Serialize object into buffer. More...
 
int deserialize (char *buffer)
 Deserialize an object. More...
 
- Public Member Functions inherited from ThunderEgg::Serializable
virtual ~Serializable ()=default
 Destroy the Serializable object.
 

Public Attributes

int id = 0
 The globally unique ID of the patch This ID only needs to be unique within a Domain.
 
int local_index = 0
 The local index of the patch in the Domain.
 
int global_index = 0
 The global index of the patch in the Domain.
 
int refine_level = -1
 The refinement level.
 
int parent_id = -1
 The id of the parent patch. More...
 
int parent_rank = -1
 the rank that the parent patch resides on
 
std::array< int, Orthant< D >::num_orthants > child_ids
 The id's of the children. More...
 
std::array< int, Orthant< D >::num_orthants > child_ranks
 The ranks of the children. More...
 
int num_ghost_cells = 0
 Number of ghost cells on each side of the patch.
 
int rank = -1
 MPI rank of this patch.
 
Orthant< D > orth_on_parent = Orthant<D>::null()
 The orthant of the parent that this parent resides on. More...
 
std::array< int, D > ns
 The number of cells in each direction.
 
std::array< double, D > starts
 The lower-left-bottom index of the patch.
 
std::array< double, D > spacings
 The cell spacings in each direction.
 

Friends

bool operator< (const PatchInfo &l, const PatchInfo &r)
 Compare the ids of the patches. More...
 

Detailed Description

template<int D>
class ThunderEgg::PatchInfo< D >

Contains metadata for a patch.

This contains metadata for a specific patch. Information like:

  • The globally unique id of this patch
  • The local and global indexes of this patch in the Domain
  • The parent patch in the tree (if there is one)

It also contains information for a patch's neighbor:

  • What are the neighbors id?
  • Are the neighbors at the same refinement level? Are coarser or finer?
Template Parameters
Dthe number of cartesian dimensions in the patch

Constructor & Destructor Documentation

◆ PatchInfo()

template<int D>
ThunderEgg::PatchInfo< D >::PatchInfo ( const PatchInfo< D > &  other_pinfo)
inline

Copy constructor.

Parameters
other_pinfoobject to copy

Member Function Documentation

◆ deserialize()

template<int D>
int ThunderEgg::PatchInfo< D >::deserialize ( char *  buffer)
inlinevirtual

Deserialize an object.

Parameters
bufferthe buffer
Returns
int the size of object that was deserialized

Implements ThunderEgg::Serializable.

◆ getCoarseNbrInfo()

template<int D>
template<int M>
CoarseNbrInfo<M>& ThunderEgg::PatchInfo< D >::getCoarseNbrInfo ( Face< D, M >  s) const
inline

Get the CoarseNbrInfo object.

Parameters
sthe side
Returns
CoarseNbrInfo<D>& the object

◆ getFineNbrInfo()

template<int D>
template<int M>
FineNbrInfo<M>& ThunderEgg::PatchInfo< D >::getFineNbrInfo ( Face< D, M >  s) const
inline

Get the FineNbrInfo object.

Neighbor must be of Fine type, otherwise behavior is undefined.

Parameters
sthe side
Returns
FineNbrInfo<D>& the object

◆ getNbrType()

template<int D>
template<int M>
NbrType ThunderEgg::PatchInfo< D >::getNbrType ( Face< D, M >  s) const
inline

Get the NbrType for a side.

Parameters
sthe side
Returns
The NbrType

◆ getNormalNbrInfo()

template<int D>
template<int M>
NormalNbrInfo<M>& ThunderEgg::PatchInfo< D >::getNormalNbrInfo ( Face< D, M >  s) const
inline

Get the NormalNbrInfo object for a side.

Neighbor must be of Normal type, otherwise behavior is undefined.

Parameters
sthe side
Returns
NormalNbrInfo<D>& the object

◆ hasCoarseParent()

template<int D>
bool ThunderEgg::PatchInfo< D >::hasCoarseParent ( ) const
inline

Return whether the patch has a coarser parent.

Returns
true if there is a parent

◆ hasNbr()

template<int D>
template<int M>
bool ThunderEgg::PatchInfo< D >::hasNbr ( Face< D, M >  s) const
inline

Return whether the patch has a neighbor.

Parameters
sthe side
Returns
true if the is neighbor
false if at domain boundary

◆ operator=()

template<int D>
PatchInfo<D>& ThunderEgg::PatchInfo< D >::operator= ( const PatchInfo< D > &  other_pinfo)
inline

Copy asisgnment.

Parameters
other_pinfothe object to copy
Returns
PatchInfo<D>& this object

◆ serialize()

template<int D>
int ThunderEgg::PatchInfo< D >::serialize ( char *  buffer) const
inlinevirtual

Serialize object into buffer.

Parameters
bufferthe buffer. Can be set to nullptr if you just want the size
Returns
int the size of the serialized object

Implements ThunderEgg::Serializable.

◆ setNbrInfo()

template<int D>
template<int M>
void ThunderEgg::PatchInfo< D >::setNbrInfo ( Face< D, M >  f,
NbrInfo< M > *  nbr_info 
)
inline

Set the Nbr Info object on a given face.

Template Parameters
Mthe dimensionality of the face
Parameters
sthe face
nbr_infothe neighbor info object, this patchinfo will take ownership of it

◆ setNeighborGlobalIndexes()

template<int D>
void ThunderEgg::PatchInfo< D >::setNeighborGlobalIndexes ( const std::map< int, int > &  id_to_global_index_map)
inline

Set the global indexes in the NbrInfo objects.

Parameters
id_to_global_index_mapmap form id to global_index

◆ setNeighborLocalIndexes()

template<int D>
void ThunderEgg::PatchInfo< D >::setNeighborLocalIndexes ( const std::map< int, int > &  id_to_local_index_map)
inline

Set the local indexes in the NbrInfo objects.

Parameters
id_to_local_index_mapmap from id to local_index

Friends And Related Function Documentation

◆ operator<

template<int D>
bool operator< ( const PatchInfo< D > &  l,
const PatchInfo< D > &  r 
)
friend

Compare the ids of the patches.

Parameters
lleft operand
rright operand
Returns
true if r's id is lower
false if r's id is not lower

Member Data Documentation

◆ child_ids

template<int D>
std::array<int, Orthant<D>::num_orthants> ThunderEgg::PatchInfo< D >::child_ids

The id's of the children.

Set to -1 if there are no children

◆ child_ranks

template<int D>
std::array<int, Orthant<D>::num_orthants> ThunderEgg::PatchInfo< D >::child_ranks

The ranks of the children.

Set to -1 if there are no children

◆ orth_on_parent

template<int D>
Orthant<D> ThunderEgg::PatchInfo< D >::orth_on_parent = Orthant<D>::null()

The orthant of the parent that this parent resides on.

If the parent is the same size, it should be set to Orthant::null

◆ parent_id

template<int D>
int ThunderEgg::PatchInfo< D >::parent_id = -1

The id of the parent patch.

Set to -1 if there is no parent.


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