Go to the documentation of this file.
20 #ifndef THUNDEREGG_COARSENBRINFO_H
21 #define THUNDEREGG_COARSENBRINFO_H
80 void getNbrIds(std::deque<int>& nbr_ids)
const override { nbr_ids.push_back(
id); };
81 void getNbrRanks(std::deque<int>& nbr_ranks)
const override { nbr_ranks.push_back(
rank); }
88 auto iter = id_to_local_index_map.find(
id);
89 if (iter != id_to_local_index_map.end()) {
109 std::unique_ptr<NbrInfoBase>
clone()
const override
111 return std::make_unique<CoarseNbrInfo<D>>(*this);
116 to_json(tpl::nlohmann::json& j,
const CoarseNbrInfo<D>& n)
120 j[
"ranks"] = { n.rank };
121 j[
"orth_on_coarse"] = n.orth_on_coarse;
125 from_json(
const tpl::nlohmann::json& j, CoarseNbrInfo<D>& n)
128 n.rank = j[
"ranks"][0];
129 if (j.contains(
"orth_on_coarse")) {
130 n.orth_on_coarse = j[
"orth_on_coarse"].get<Orthant<D>>();
void getNbrIds(std::deque< int > &nbr_ids) const override
Add to a deque of neighbor ids.
Definition: CoarseNbrInfo.h:80
int id
The id of the neighbor.
Definition: CoarseNbrInfo.h:49
std::unique_ptr< NbrInfoBase > clone() const override
get a clone of this object (equivalent to copy constructor)
Definition: CoarseNbrInfo.h:109
static Orthant< D > null()
null value
Definition: Orthant.h:68
An enum-style class that represents the octants of a cube.
Definition: Orthant.h:43
int global_index
The global index of the neighbor.
Definition: CoarseNbrInfo.h:57
Class that is used to help serialize objects into a buffer.
Definition: BufferWriter.h:38
void getNbrRanks(std::deque< int > &nbr_ranks) const override
Add to a deque of neighbor ranks.
Definition: CoarseNbrInfo.h:81
@ Coarse
The neighbor is at a coarser refinement level.
NbrType getNbrType() const override
Get the NbrType.
Definition: CoarseNbrInfo.h:79
int local_index
The local index of the neighbor.
Definition: CoarseNbrInfo.h:53
NbrType
The type of neighbor.
Definition: NbrType.h:34
int deserialize(char *buffer) override
Deserialize an object.
Definition: CoarseNbrInfo.h:101
void setLocalIndexes(const std::map< int, int > &id_to_local_index_map) override
Set the global indexes in the NbrInfo objects.
Definition: CoarseNbrInfo.h:86
Orthant< D > orth_on_coarse
The orthant that this patch in relation to the coarser patch's interface.
Definition: CoarseNbrInfo.h:61
The ThunderEgg namespace.
Definition: BiLinearGhostFiller.h:31
CoarseNbrInfo()=default
Construct a new empty CoarseNbrInfo object.
Represents information about a patch's neighbor.
Definition: NbrInfo.h:36
Represents a neighbor that is at a coarser refinement level.
Definition: CoarseNbrInfo.h:39
int getPos()
get the current position in the buffer
Definition: BufferReader.h:74
int serialize(char *buffer) const override
Serialize object into buffer.
Definition: CoarseNbrInfo.h:93
int rank
The mpi rank that the neighbor resides on.
Definition: CoarseNbrInfo.h:45
int getPos()
get the current position in the buffer
Definition: BufferWriter.h:80
Class that is used to help read serialized objects from a buffer.
Definition: BufferReader.h:38
CoarseNbrInfo(int id, Orthant< D > orth_on_coarse)
Construct a new CoarseNbrInfo object.
Definition: CoarseNbrInfo.h:74
void setGlobalIndexes(const std::map< int, int > &id_to_global_index_map) override
Set the local indexes in the NbrInfo objects.
Definition: CoarseNbrInfo.h:82