1 #ifndef ABLATELIBRARY_REGION_HPP
2 #define ABLATELIBRARY_REGION_HPP
7 #include <utilities/petscUtilities.hpp>
9 namespace ablate::domain {
13 inline const static std::shared_ptr<Region> ENTIREDOMAIN = {};
16 const std::string name;
26 explicit Region(
const std::string& name = {},
int value = 1);
28 [[nodiscard]]
inline const std::size_t& GetId()
const {
return id; }
30 [[nodiscard]]
inline const std::string& GetName()
const {
return name; }
32 [[nodiscard]]
inline const PetscInt& GetValue()
const {
return value; }
34 [[nodiscard]]
inline std::string ToString()
const {
return name +
":" + std::to_string(value); };
43 void CreateLabel(DM dm, DMLabel& regionLabel, PetscInt& regionValue)
const;
52 static void GetLabel(
const std::shared_ptr<Region>& region, DM dm, DMLabel& regionLabel, PetscInt& regionValue);
60 void GetLabel(DM dm, DMLabel& regionLabel, PetscInt& regionValue);
69 static bool InRegion(
const std::shared_ptr<Region>& region, DM dm, PetscInt point);
77 inline bool InRegion(DM dm, PetscInt point)
const {
80 return ptValue == value;
108 inline bool operator<(
const Region& otherRegion)
const {
return id < otherRegion.id; }
111 std::ostream& operator<<(std::ostream& os,
const Region& region);
113 std::ostream& operator<<(std::ostream& os,
const std::shared_ptr<Region>& region);
Definition: region.hpp:11
bool operator<(const Region &otherRegion) const
Definition: region.hpp:108
static void GetLabel(const std::shared_ptr< Region > ®ion, DM dm, DMLabel ®ionLabel, PetscInt ®ionValue)
Definition: region.cpp:18
bool InRegion(DM dm, PetscInt point) const
Definition: region.hpp:77
void CreateLabel(DM dm, DMLabel ®ionLabel, PetscInt ®ionValue) const
Definition: region.cpp:12
void CheckForLabel(DM dm) const
Definition: region.cpp:32
Region(const std::string &name={}, int value=1)
Definition: region.cpp:6
static bool InRegion(const std::shared_ptr< Region > ®ion, DM dm, PetscInt point)
Definition: region.cpp:55
bool operator==(const Region &otherRegion) const
Definition: region.hpp:101
static utilities::PetscUtilities::ErrorChecker checkError
Definition: petscUtilities.hpp:46