Go to the documentation of this file.
20 #ifndef THUNDEREGG_FINENBRINFO_H
21 #define THUNDEREGG_FINENBRINFO_H
45 std::array<int, Orthant<D>::num_orthants>
ranks;
49 std::array<int, Orthant<D>::num_orthants>
ids;
82 void getNbrIds(std::deque<int>& nbr_ids)
const override
84 for (
size_t i = 0; i <
ids.size(); i++) {
85 nbr_ids.push_back(
ids[i]);
90 for (
size_t i = 0; i <
ranks.size(); i++) {
91 nbr_ranks.push_back(
ranks[i]);
103 auto iter = id_to_local_index_map.find(
ids[i]);
104 if (iter != id_to_local_index_map.end()) {
123 std::unique_ptr<NbrInfoBase>
clone()
const override
125 return std::make_unique<FineNbrInfo<D>>(*this);
130 to_json(tpl::nlohmann::json& j,
const FineNbrInfo<D>& n)
134 j[
"ranks"] = n.ranks;
138 from_json(
const tpl::nlohmann::json& j, FineNbrInfo<D>& n)
140 n.ids = j[
"ids"].get<std::array<int, Orthant<D>::num_orthants>>();
141 n.ranks = j[
"ranks"].get<std::array<int, Orthant<D>::num_orthants>>();
An enum-style class that represents the octants of a cube.
Definition: Orthant.h:43
Class that is used to help serialize objects into a buffer.
Definition: BufferWriter.h:38
void setLocalIndexes(const std::map< int, int > &id_to_local_index_map) override
Set the global indexes in the NbrInfo objects.
Definition: FineNbrInfo.h:100
FineNbrInfo()
Construct a new empty FineNbrInfo object.
Definition: FineNbrInfo.h:61
int deserialize(char *buffer) override
Deserialize an object.
Definition: FineNbrInfo.h:116
void getNbrIds(std::deque< int > &nbr_ids) const override
Add to a deque of neighbor ids.
Definition: FineNbrInfo.h:82
std::array< int, Orthant< D >::num_orthants > ids
The ids of the neighbors.
Definition: FineNbrInfo.h:49
NbrType
The type of neighbor.
Definition: NbrType.h:34
The ThunderEgg namespace.
Definition: BiLinearGhostFiller.h:31
Represents information about a patch's neighbor.
Definition: NbrInfo.h:36
std::unique_ptr< NbrInfoBase > clone() const override
get a clone of this object (equivalent to copy constructor)
Definition: FineNbrInfo.h:123
std::array< int, Orthant< D >::num_orthants > global_indexes
The global indexes of the neighbors.
Definition: FineNbrInfo.h:53
FineNbrInfo(std::array< int, Orthant< D >::num_orthants > ids)
Construct a new FineNbrInfo object.
Definition: FineNbrInfo.h:74
void getNbrRanks(std::deque< int > &nbr_ranks) const override
Add to a deque of neighbor ranks.
Definition: FineNbrInfo.h:88
std::array< int, Orthant< D >::num_orthants > ranks
The mpi rank that the neighbor resides on.
Definition: FineNbrInfo.h:45
std::array< int, Orthant< D >::num_orthants > local_indexes
The local indexes of the neighbors.
Definition: FineNbrInfo.h:57
int getPos()
get the current position in the buffer
Definition: BufferReader.h:74
NbrType getNbrType() const override
Get the NbrType.
Definition: FineNbrInfo.h:81
@ Fine
The nighbor is at a finer refinement level.
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
void setGlobalIndexes(const std::map< int, int > &id_to_global_index_map) override
Set the local indexes in the NbrInfo objects.
Definition: FineNbrInfo.h:94
Represents neighbors that are at a finer refinement level.
Definition: FineNbrInfo.h:39
int serialize(char *buffer) const override
Serialize object into buffer.
Definition: FineNbrInfo.h:109