v0.13.1
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
MoFEM::DefaultElementAdjacency Struct Reference

default adjacency map More...

#include <src/multi_indices/FEMultiIndices.hpp>

Public Types

using DefEntTypeMap = std::array< bool, MBMAXTYPE >
 

Static Public Member Functions

static MoFEMErrorCode defaultVertex (Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 
static MoFEMErrorCode defaultEdge (Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 
static MoFEMErrorCode defaultFace (Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 
static MoFEMErrorCode defaultVolume (Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 
static MoFEMErrorCode defaultPrism (Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 
static MoFEMErrorCode defaultMeshset (Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 
static bool getDefTypeMap (const EntityType fe_type, const EntityType ent_type)
 

Static Public Attributes

static constexpr DefEntTypeMap defVertexTypeMap
 
static constexpr DefEntTypeMap defEdgeTypeMap
 
static constexpr DefEntTypeMap defTriTypeMap
 
static constexpr DefEntTypeMap defQuadTypeMap
 
static constexpr DefEntTypeMap defTetTypeMap
 
static constexpr DefEntTypeMap defHexTypeMap
 
static constexpr DefEntTypeMap defPrismTypeMap
 
static constexpr DefEntTypeMap defMeshsetTypeMap
 
static constexpr std::array< const DefEntTypeMap *, MBMAXTYPE > defTypeMap
 

Detailed Description

default adjacency map

Definition at line 124 of file FEMultiIndices.hpp.

Member Typedef Documentation

◆ DefEntTypeMap

using MoFEM::DefaultElementAdjacency::DefEntTypeMap = std::array<bool, MBMAXTYPE>

Definition at line 145 of file FEMultiIndices.hpp.

Member Function Documentation

◆ defaultEdge()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultEdge ( Interface moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
static

Definition at line 54 of file FEMultiIndices.cpp.

56 {
58 EntityHandle fe_ent = fe.getEnt();
59 // Range nodes;
60 switch (field.getSpace()) {
61 case H1:
62 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
63 case L2:
64 case HCURL:
65 adjacency.push_back(fe_ent);
66 // build side table
67 for (auto e : adjacency)
68 fe.getSideNumberPtr(e);
69 break;
70 case NOFIELD: {
71 CHKERR moab.get_entities_by_handle(field.getMeshset(), adjacency, false);
72 for (auto e : adjacency) {
73 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
74 .insert(boost::shared_ptr<SideNumber>(new SideNumber(e, -1, 0, 0)));
75 }
76 } break;
77 default:
78 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
79 "this field is not implemented for EDGE finite element");
80 }
81
83}
@ L2
field with C-1 continuity
Definition: definitions.h:88
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:84
@ H1
continuous field
Definition: definitions.h:85
@ HCURL
field with continuous tangents
Definition: definitions.h:86
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< ordered_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, signed char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.

◆ defaultFace()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultFace ( Interface moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
static

Definition at line 86 of file FEMultiIndices.cpp.

88 {
90 // Range nodes,edges;
91 const EntityHandle fe_ent = fe.getEnt();
92 switch (field.getSpace()) {
93 case H1:
94 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
95 case HCURL:
96 CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
97 moab::Interface::UNION);
98 case HDIV:
99 case L2:
100 adjacency.push_back(fe_ent);
101 // build side table
102 for (auto ent : adjacency)
103 fe.getSideNumberPtr(ent);
104 break;
105 case NOFIELD: {
106 CHKERR moab.get_entities_by_handle(field.getMeshset(), adjacency, false);
107 for (auto ent : adjacency) {
108 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
109 .insert(boost::shared_ptr<SideNumber>(new SideNumber(ent, -1, 0, 0)));
110 }
111 } break;
112 default:
113 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
114 "this field is not implemented for TRI finite element");
115 }
116
118}
@ HDIV
field with continuous normal traction
Definition: definitions.h:87

◆ defaultMeshset()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultMeshset ( Interface moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
static

Definition at line 294 of file FEMultiIndices.cpp.

296 {
298 EntityHandle fe_ent = fe.getEnt();
299 // resolve recursively all ents in the meshset
300 switch (field.getSpace()) {
301 case H1:
302 CHKERR moab.get_entities_by_type(fe_ent, MBVERTEX, adjacency, true);
303 case HCURL:
304 CHKERR moab.get_entities_by_type(fe_ent, MBEDGE, adjacency, true);
305 case HDIV:
306 CHKERR moab.get_entities_by_dimension(fe_ent, 2, adjacency, true);
307 case L2:
308 CHKERR moab.get_entities_by_dimension(fe_ent, 3, adjacency, true);
309 break;
310 case NOFIELD: {
311 CHKERR moab.get_entities_by_handle(field.getMeshset(), adjacency, false);
312 for (auto ent : adjacency) {
313 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
314 .insert(boost::shared_ptr<SideNumber>(new SideNumber(ent, -1, 0, 0)));
315 }
316 } break;
317 default:
318 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
319 }
321}

◆ defaultPrism()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultPrism ( Interface moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
static

Definition at line 156 of file FEMultiIndices.cpp.

158 {
160 const EntityHandle prism = fe.getEnt();
161 Range nodes;
162 // initialize side sets
163 fe.getRefElement()->getSideNumberPtr(prism);
164 EntityHandle face_side3, face_side4;
165 CHKERR moab.side_element(prism, 2, 3, face_side3);
166 CHKERR moab.side_element(prism, 2, 4, face_side4);
167 fe.getRefElement()->getSideNumberPtr(face_side3);
168 fe.getRefElement()->getSideNumberPtr(face_side4);
169 for (int qq = 0; qq < 3; qq++) {
170 EntityHandle quad = 0;
171 rval = moab.side_element(prism, 2, qq, quad);
172 if (rval != MB_SUCCESS || quad == 0)
173 continue;
174 int side_number, sense, offset;
175 rval = moab.side_number(prism, quad, side_number, sense, offset);
176 if (side_number == -1 || rval != MB_SUCCESS)
177 continue;
178 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
179 .insert(boost::shared_ptr<SideNumber>(
180 new SideNumber(quad, side_number, sense, offset)));
181 }
182 int ee = 0;
183 for (; ee < 3; ee++) {
184 EntityHandle edge = 0;
185 CHKERR moab.side_element(prism, 1, ee, edge);
186 boost::shared_ptr<SideNumber> side_ptr =
187 fe.getRefElement()->getSideNumberPtr(edge);
188 if (side_ptr->side_number != ee) {
189 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
190 "data inconsistency for edge %d while in FE datastructure is "
191 "numbered %d.",
192 ee, side_ptr->side_number);
193 }
194 CHKERR moab.side_element(prism, 1, 6 + ee, edge);
195 side_ptr = fe.getRefElement()->getSideNumberPtr(edge);
196 if (side_ptr->side_number != ee + 6) {
197 if (side_ptr->side_number != ee) {
198 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
199 "data inconsistency for edge %d while in FE datastructure "
200 "is numbered %d.",
201 ee, side_ptr->side_number);
202 } else {
203 side_ptr->brother_side_number = ee + 6;
204 }
205 }
206 }
207 for (; ee < 6; ee++) {
208 EntityHandle edge = 0;
209 rval = moab.side_element(prism, 1, ee, edge);
210 if (rval != MB_SUCCESS || edge == 0)
211 continue;
212 int side_number, sense, offset;
213 rval = moab.side_number(prism, edge, side_number, sense, offset);
214 if (side_number == -1 || rval != MB_SUCCESS)
215 continue;
216 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
217 .insert(boost::shared_ptr<SideNumber>(
218 new SideNumber(edge, side_number, sense, offset)));
219 }
220 int nn = 0;
221 for (; nn < 3; nn++) {
222 EntityHandle node;
223 CHKERR moab.side_element(prism, 0, nn, node);
224 boost::shared_ptr<SideNumber> side_ptr =
225 fe.getRefElement()->getSideNumberPtr(node);
226 if (side_ptr->side_number != nn) {
227 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
228 "data inconsistency for node %d while in FE datastructure is "
229 "numbered %d.",
230 nn, side_ptr->side_number);
231 }
232 CHKERR moab.side_element(prism, 0, nn + 3, node);
233 side_ptr = fe.getRefElement()->getSideNumberPtr(node);
234 if (side_ptr->side_number != nn + 3) {
235 if (side_ptr->side_number != nn) {
236 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
237 "data inconsistency for node %d while in FE datastructure is "
238 "numbered %d.",
239 nn, side_ptr->side_number);
240 } else {
241 side_ptr->brother_side_number = nn + 3;
242 }
243 }
244 }
245
246 // get adjacencies
247 SideNumber_multiIndex &side_table = fe.getRefElement()->getSideNumberTable();
248 switch (field.getSpace()) {
249 case H1:
250 // moab.get_connectivity(&prism,1,nodes,true);
251 // use get adjacencies, this will allow take in account adjacencies set user
252 CHKERR moab.get_adjacencies(&prism, 1, 0, false, nodes,
253 moab::Interface::UNION);
254 {
255 Range topo_nodes;
256 CHKERR moab.get_connectivity(&prism, 1, topo_nodes, true);
257 Range mid_nodes;
258 CHKERR moab.get_connectivity(&prism, 1, mid_nodes, false);
259 mid_nodes = subtract(mid_nodes, topo_nodes);
260 nodes = subtract(nodes, mid_nodes);
261 }
262 adjacency.insert(adjacency.end(), nodes.begin(), nodes.end());
263 case HCURL: {
264 auto siit = side_table.get<0>().lower_bound(get_id_for_min_type<MBEDGE>());
265 auto hi_siit =
266 side_table.get<0>().upper_bound(get_id_for_max_type<MBEDGE>());
267 for (; siit != hi_siit; siit++)
268 adjacency.push_back(siit->get()->ent);
269 }
270 case HDIV: {
271 auto siit = side_table.get<0>().lower_bound(get_id_for_min_type<MBTRI>());
272 auto hi_siit =
273 side_table.get<0>().upper_bound(get_id_for_max_type<MBQUAD>());
274 for (; siit != hi_siit; siit++)
275 adjacency.push_back(siit->get()->ent);
276 }
277 case L2:
278 adjacency.push_back(prism);
279 break;
280 case NOFIELD: {
281 CHKERR moab.get_entities_by_handle(field.getMeshset(), adjacency, false);
282 for (auto ent : adjacency) {
283 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
284 .insert(boost::shared_ptr<SideNumber>(new SideNumber(ent, -1, 0, 0)));
285 }
286 } break;
287 default:
288 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
289 "this field is not implemented for TRI finite element");
290 }
292}
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74

◆ defaultVertex()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultVertex ( Interface moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
static

Definition at line 27 of file FEMultiIndices.cpp.

29 {
31 switch (field.getSpace()) {
32 case H1:
33 adjacency.push_back(fe.getEnt());
34 // build side table
35 for (auto ent : adjacency)
36 fe.getSideNumberPtr(ent);
37 break;
38 case NOFIELD: {
39 CHKERR moab.get_entities_by_handle(field.getMeshset(), adjacency, false);
40 for (auto ent : adjacency) {
41 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
42 .insert(boost::shared_ptr<SideNumber>(new SideNumber(ent, -1, 0, 0)));
43 }
44 } break;
45 default:
46 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
47 "this field is not implemented for VERTEX finite element");
48 }
49
51}

◆ defaultVolume()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultVolume ( Interface moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
static

Definition at line 120 of file FEMultiIndices.cpp.

122 {
124 EntityHandle fe_ent = fe.getEnt();
125 switch (field.getSpace()) {
126 case H1:
127 CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
128 case HCURL:
129 CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
130 moab::Interface::UNION);
131 case HDIV:
132 CHKERR moab.get_adjacencies(&fe_ent, 1, 2, false, adjacency,
133 moab::Interface::UNION);
134 case L2:
135 adjacency.push_back(fe_ent);
136 // build side table
137 for (auto ent : adjacency)
138 fe.getSideNumberPtr(ent);
139 break;
140 case NOFIELD: {
141 CHKERR moab.get_entities_by_handle(field.getMeshset(), adjacency, false);
142 for (auto ent : adjacency) {
143 const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
144 .insert(boost::shared_ptr<SideNumber>(new SideNumber(ent, -1, 0, 0)));
145 }
146 } break;
147 default:
148 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
149 "this field is not implemented for TRI finite element");
150 }
151
153}

◆ getDefTypeMap()

static bool MoFEM::DefaultElementAdjacency::getDefTypeMap ( const EntityType  fe_type,
const EntityType  ent_type 
)
static

Definition at line 300 of file FEMultiIndices.hpp.

301 {
302 if(auto ptr = defTypeMap[fe_type])
303 return (*ptr)[ent_type];
304 THROW_MESSAGE("DefTypeMap is not defined by this element. This is propably "
305 "new implementation, and has to be implemented");
306 return false;
307 }
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:561
static constexpr std::array< const DefEntTypeMap *, MBMAXTYPE > defTypeMap

Member Data Documentation

◆ defEdgeTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defEdgeTypeMap
staticconstexpr
Initial value:
= {
true,
true,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
}

Definition at line 164 of file FEMultiIndices.hpp.

◆ defHexTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defHexTypeMap
staticconstexpr
Initial value:
= {
true,
true,
false,
true,
false,
false,
false,
false,
false,
true,
false,
false
}

Definition at line 232 of file FEMultiIndices.hpp.

◆ defMeshsetTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defMeshsetTypeMap
staticconstexpr
Initial value:
= {
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true
}

Definition at line 266 of file FEMultiIndices.hpp.

◆ defPrismTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defPrismTypeMap
staticconstexpr
Initial value:
= {
true,
true,
true,
true,
false,
false,
false,
true,
false,
false,
false,
false
}

Definition at line 249 of file FEMultiIndices.hpp.

◆ defQuadTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defQuadTypeMap
staticconstexpr
Initial value:
= {
true,
true,
false,
true,
false,
false,
false,
false,
false,
false,
false,
false
}

Definition at line 198 of file FEMultiIndices.hpp.

◆ defTetTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defTetTypeMap
staticconstexpr
Initial value:
= {
true,
true,
true,
false,
false,
true,
false,
false,
false,
false,
false,
false
}

Definition at line 215 of file FEMultiIndices.hpp.

◆ defTriTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defTriTypeMap
staticconstexpr
Initial value:
= {
true,
true,
true,
false,
false,
false,
false,
false,
false,
false,
false,
false
}

Definition at line 181 of file FEMultiIndices.hpp.

◆ defTypeMap

constexpr std::array< const DefaultElementAdjacency::DefEntTypeMap *, MBMAXTYPE > MoFEM::DefaultElementAdjacency::defTypeMap
staticconstexpr
Initial value:
= {
nullptr,
nullptr,
nullptr,
nullptr,
}
static constexpr DefEntTypeMap defVertexTypeMap
static constexpr DefEntTypeMap defEdgeTypeMap
static constexpr DefEntTypeMap defQuadTypeMap
static constexpr DefEntTypeMap defTriTypeMap
static constexpr DefEntTypeMap defTetTypeMap
static constexpr DefEntTypeMap defHexTypeMap
static constexpr DefEntTypeMap defMeshsetTypeMap
static constexpr DefEntTypeMap defPrismTypeMap

Definition at line 283 of file FEMultiIndices.hpp.

◆ defVertexTypeMap

constexpr DefaultElementAdjacency::DefEntTypeMap MoFEM::DefaultElementAdjacency::defVertexTypeMap
staticconstexpr
Initial value:
= {
true,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
}

Definition at line 147 of file FEMultiIndices.hpp.


The documentation for this struct was generated from the following files: