ThunderEgg  1.0.0
CoarseIfaceInfo.h
Go to the documentation of this file.
1 /***************************************************************************
2  * ThunderEgg, a library for solvers on adaptively refined block-structured
3  * Cartesian grids.
4  *
5  * Copyright (c) 2020-2021 Scott Aiton
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  ***************************************************************************/
20 
21 #ifndef THUNDEREGG_SCHUR_COARSEIFACEINFO_H
22 #define THUNDEREGG_SCHUR_COARSEIFACEINFO_H
23 
28 #include <ThunderEgg/PatchInfo.h>
30 namespace ThunderEgg {
31 namespace Schur {
40 template<int D>
41 class CoarseIfaceInfo : public IfaceInfo<D>
42 {
43 private:
51  static int GetId(const PatchInfo<D>& pinfo, Side<D> s)
52  {
53  return (int)(pinfo.id * Side<D>::number_of + s.getIndex());
54  }
55 
56 public:
68  int coarse_id;
86  : IfaceInfo<D>(pinfo.rank, GetId(pinfo, s))
87  {
88  // fine and coarse interfaces always belong to their patches
89  auto nbr_info = pinfo.getCoarseNbrInfo(s);
90  orth_on_coarse = nbr_info.orth_on_coarse;
91  coarse_rank = nbr_info.rank;
92  coarse_id = nbr_info.id * Side<D>::number_of + s.opposite().getIndex();
93  }
94 };
95 } // namespace Schur
96 } // namespace ThunderEgg
97 #endif
ThunderEgg::Orthant
An enum-style class that represents the octants of a cube.
Definition: Orthant.h:43
ThunderEgg::Schur::CoarseIfaceInfo::coarse_id
int coarse_id
The id of the coarser patch's interface.
Definition: CoarseIfaceInfo.h:68
ThunderEgg::Schur::CoarseIfaceInfo::CoarseIfaceInfo
CoarseIfaceInfo(const PatchInfo< D > &pinfo, Side< D > s)
Construct a new CoarseIfaceInfo object.
Definition: CoarseIfaceInfo.h:85
ThunderEgg::Schur::CoarseIfaceInfo::orth_on_coarse
Orthant< D - 1 > orth_on_coarse
The orthant that this patch in relation to the coarser patch's interface.
Definition: CoarseIfaceInfo.h:60
ThunderEgg::Schur::CoarseIfaceInfo
Represents the interfaces where the neighbor is at a coarser refinement level.
Definition: CoarseIfaceInfo.h:41
ThunderEgg::Schur::CoarseIfaceInfo::coarse_col_local_index
int coarse_col_local_index
The local column index of the coarser patch's inteface.
Definition: CoarseIfaceInfo.h:72
ThunderEgg::Schur::CoarseIfaceInfo::coarse_rank
int coarse_rank
Rank of the coarse interface.
Definition: CoarseIfaceInfo.h:64
ThunderEgg
The ThunderEgg namespace.
Definition: BiLinearGhostFiller.h:31
ThunderEgg::PatchInfo::id
int id
The globally unique ID of the patch This ID only needs to be unique within a Domain.
Definition: PatchInfo.h:65
ThunderEgg::Face::getIndex
size_t getIndex() const
Get the index for this Face.
Definition: Face.h:452
PatchInfo.h
PatchInfo class.
ThunderEgg::Schur::IfaceInfo
The IfaceInfo class represents the information for an interface on a given side of the patch.
Definition: IfaceInfo.h:43
ThunderEgg::PatchInfo
Contains metadata for a patch.
Definition: PatchInfo.h:51
ThunderEgg::Schur::CoarseIfaceInfo::coarse_global_index
int coarse_global_index
The global index of the coarser patch's interface.
Definition: CoarseIfaceInfo.h:76
IfaceInfo.h
IfaceInfo class.
ThunderEgg::Face
Enum-style class for the faces of an n-dimensional cube.
Definition: Face.h:41
ThunderEgg::Schur::IfaceInfo::rank
int rank
The rank that the interface resides on.
Definition: IfaceInfo.h:49
ThunderEgg::Face::opposite
Face< D, M > opposite() const
Get the face on the opposite side of the hypercube.
Definition: Face.h:489
ThunderEgg::PatchInfo::getCoarseNbrInfo
CoarseNbrInfo< M > & getCoarseNbrInfo(Face< D, M > s) const
Get the CoarseNbrInfo object.
Definition: PatchInfo.h:258