v0.16.0
Loading...
Searching...
No Matches
Classes | Functions
AdaptiveOrderRef.hpp File Reference

Calculate error indicators. More...

Go to the source code of this file.

Classes

struct  OpCalculateTractionJump
 

Functions

static MoFEMErrorCode getTagHandle (MoFEM::Interface &m_field, const char *name, DataType type, Tag &tag_handle)
 
static MoFEMErrorCode getDomainEntsPart (MoFEM::Interface &m_field, Range &domain_ents_part)
 
static MoFEMErrorCode copyTagOnSkin (MoFEM::Interface &m_field, const char *name, DataType type)
 

Detailed Description

Calculate error indicators.

Date
2024-04-14

Definition in file AdaptiveOrderRef.hpp.

Function Documentation

◆ copyTagOnSkin()

static MoFEMErrorCode copyTagOnSkin ( MoFEM::Interface m_field,
const char *  name,
DataType  type 
)
static

Definition at line 45 of file AdaptiveOrderRef.hpp.

46 {
48 auto simple = m_field.getInterface<Simple>();
49
50 Range all_boundary_ents;
51 CHKERR m_field.get_moab().get_entities_by_handle(simple->getBoundaryMeshSet(),
52 all_boundary_ents);
53
54 Range domain_ents_part;
55 CHKERR getDomainEntsPart(m_field, domain_ents_part);
56 Range domain_faces, boundary_faces;
57 CHKERR m_field.get_moab().get_adjacencies(domain_ents_part, SPACE_DIM - 1,
58 true, domain_faces,
59 moab::Interface::UNION);
60 boundary_faces = intersect(domain_faces, all_boundary_ents);
61
62 Tag th;
63 CHKERR getTagHandle(m_field, name, type, th);
64
65 for (auto &face_ent : boundary_faces) {
66 Range adj_tet;
67 CHKERR m_field.get_moab().get_adjacencies(&face_ent, 1, SPACE_DIM, true,
68 adj_tet, moab::Interface::UNION);
69 if (adj_tet.size() != 1)
72 "There should be only one ent adjacent to the boundary ent");
73
74 std::variant<int, double> data;
75
76 switch (type) {
77 case MB_TYPE_INTEGER:
78 data = int{};
79 break;
80 case MB_TYPE_DOUBLE:
81 data = double{};
82 break;
83 default:
84 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
85 "Wrong data type %d for tag", type);
86 }
87
88 std::visit(
89 [&](auto &val) {
90 CHKERR m_field.get_moab().tag_get_data(th, adj_tet, &val);
91 CHKERR m_field.get_moab().tag_set_data(th, &face_ent, 1, &val);
92 },
93 data);
94 }
95
97}
static MoFEMErrorCode getTagHandle(MoFEM::Interface &m_field, const char *name, DataType type, Tag &tag_handle)
static MoFEMErrorCode getDomainEntsPart(MoFEM::Interface &m_field, Range &domain_ents_part)
std::string type
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
constexpr int SPACE_DIM
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
virtual moab::Interface & get_moab()=0
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ getDomainEntsPart()

static MoFEMErrorCode getDomainEntsPart ( MoFEM::Interface m_field,
Range domain_ents_part 
)
static

Definition at line 31 of file AdaptiveOrderRef.hpp.

32 {
34 auto simple = m_field.getInterface<Simple>();
35 Range domain_ents;
36 CHKERR m_field.get_moab().get_entities_by_dimension(simple->getMeshset(),
37 SPACE_DIM, domain_ents);
38 ParallelComm *pcomm =
39 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
40 CHKERR pcomm->filter_pstatus(domain_ents, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1,
41 &domain_ents_part);
43}
#define MYPCOMM_INDEX
default communicator number PCOMM

◆ getTagHandle()

static MoFEMErrorCode getTagHandle ( MoFEM::Interface m_field,
const char *  name,
DataType  type,
Tag tag_handle 
)
static

Definition at line 10 of file AdaptiveOrderRef.hpp.

11 {
13 int int_val = 0;
14 double double_val = 0;
15 switch (type) {
16 case MB_TYPE_INTEGER:
17 CHKERR m_field.get_moab().tag_get_handle(
18 name, 1, type, tag_handle, MB_TAG_CREAT | MB_TAG_SPARSE, &int_val);
19 break;
20 case MB_TYPE_DOUBLE:
21 CHKERR m_field.get_moab().tag_get_handle(
22 name, 1, type, tag_handle, MB_TAG_CREAT | MB_TAG_SPARSE, &double_val);
23 break;
24 default:
25 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
26 "Wrong data type %d for tag", type);
27 }
29}