ThunderEgg  1.0.0
FineIfaceInfo.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_FINEIFACEINFO_H
22 #define THUNDEREGG_SCHUR_FINEIFACEINFO_H
23 
28 #include <ThunderEgg/PatchInfo.h>
30 namespace ThunderEgg {
31 namespace Schur {
40 template<int D>
41 class FineIfaceInfo : 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:
60  std::array<int, Orthant<D - 1>::num_orthants> fine_ranks;
64  std::array<int, Orthant<D - 1>::num_orthants> fine_ids;
68  std::array<int, Orthant<D - 1>::num_orthants> fine_col_local_indexes;
72  std::array<int, Orthant<D - 1>::num_orthants> fine_global_indexes;
82  : IfaceInfo<D>(pinfo.rank, GetId(pinfo, s))
83  {
84  auto nbr_info = pinfo.getFineNbrInfo(s);
85  for (size_t i = 0; i < fine_ids.size(); i++) {
86  fine_ids[i] = nbr_info.ids[i] * Side<D>::number_of + s.opposite().getIndex();
87  fine_ranks[i] = nbr_info.ranks[i];
88  }
89  fine_col_local_indexes.fill(-1);
90  fine_global_indexes.fill(-1);
91  }
92 };
93 } // namespace Schur
94 } // namespace ThunderEgg
95 #endif
ThunderEgg::PatchInfo::getFineNbrInfo
FineNbrInfo< M > & getFineNbrInfo(Face< D, M > s) const
Get the FineNbrInfo object.
Definition: PatchInfo.h:272
ThunderEgg::Schur::FineIfaceInfo::FineIfaceInfo
FineIfaceInfo(const PatchInfo< D > &pinfo, Side< D > s)
Construct a new FineIfaceInfo object.
Definition: FineIfaceInfo.h:81
ThunderEgg::Orthant
An enum-style class that represents the octants of a cube.
Definition: Orthant.h:43
ThunderEgg::Schur::FineIfaceInfo::fine_global_indexes
std::array< int, Orthant< D - 1 >::num_orthants > fine_global_indexes
the global indexes of the fine patches' interfaces
Definition: FineIfaceInfo.h:72
ThunderEgg::Schur::FineIfaceInfo::fine_ranks
std::array< int, Orthant< D - 1 >::num_orthants > fine_ranks
the ranks of the fine patches' interfaces
Definition: FineIfaceInfo.h:60
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::FineIfaceInfo
Represents the interfaces where the neighbors are at a finer refinement level.
Definition: FineIfaceInfo.h:41
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::Schur::FineIfaceInfo::fine_col_local_indexes
std::array< int, Orthant< D - 1 >::num_orthants > fine_col_local_indexes
the local column indexes of the fine patches' interfaces
Definition: FineIfaceInfo.h:68
ThunderEgg::Face::opposite
Face< D, M > opposite() const
Get the face on the opposite side of the hypercube.
Definition: Face.h:489
ThunderEgg::Schur::FineIfaceInfo::fine_ids
std::array< int, Orthant< D - 1 >::num_orthants > fine_ids
the ids of the fine patches' interfaces
Definition: FineIfaceInfo.h:64