v0.14.0
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>

Collaboration diagram for MoFEM::DefaultElementAdjacency:
[legend]

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 128 of file FEMultiIndices.hpp.

Member Typedef Documentation

◆ DefEntTypeMap

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

Definition at line 149 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 55 of file FEMultiIndices.cpp.

57  {
59  EntityHandle fe_ent = fe.getEnt();
60  // Range nodes;
61  switch (field.getSpace()) {
62  case H1:
63  CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
64  case HCURL:
65  case L2:
66  adjacency.push_back(fe_ent);
67  // build side table
68  for (auto e : adjacency)
69  fe.getSideNumberPtr(e);
70  break;
71  case NOFIELD: {
72  CHKERR moab.get_entities_by_handle(field.getMeshset(), adjacency, false);
73  for (auto e : adjacency) {
74  const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
75  .insert(boost::shared_ptr<SideNumber>(new SideNumber(e, -1, 0, 0)));
76  }
77  } break;
78  default:
79  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
80  "this field is not implemented for EDGE finite element");
81  }
82 
84 }

◆ defaultFace()

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

Definition at line 87 of file FEMultiIndices.cpp.

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

◆ defaultMeshset()

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

Definition at line 295 of file FEMultiIndices.cpp.

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

◆ defaultPrism()

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

Definition at line 157 of file FEMultiIndices.cpp.

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

◆ defaultVertex()

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

Definition at line 28 of file FEMultiIndices.cpp.

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

◆ defaultVolume()

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

Definition at line 121 of file FEMultiIndices.cpp.

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

◆ getDefTypeMap()

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

Definition at line 304 of file FEMultiIndices.hpp.

305  {
306  if (auto ptr = defTypeMap[fe_type])
307  return (*ptr)[ent_type];
308  THROW_MESSAGE("DefTypeMap is not defined by this element. This is propably "
309  "new implementation, and has to be implemented");
310  return false;
311  }

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 168 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 236 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 270 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 253 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 202 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 219 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 185 of file FEMultiIndices.hpp.

◆ defTypeMap

constexpr std::array< const DefaultElementAdjacency::DefEntTypeMap *, MBMAXTYPE > MoFEM::DefaultElementAdjacency::defTypeMap
staticconstexpr
Initial value:

Definition at line 287 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 151 of file FEMultiIndices.hpp.


The documentation for this struct was generated from the following files:
H1
@ H1
continuous field
Definition: definitions.h:85
EntityHandle
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
THROW_MESSAGE
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
MoFEM::DefaultElementAdjacency::defVertexTypeMap
static constexpr DefEntTypeMap defVertexTypeMap
Definition: FEMultiIndices.hpp:151
MoFEM::DefaultElementAdjacency::defTypeMap
static constexpr std::array< const DefEntTypeMap *, MBMAXTYPE > defTypeMap
Definition: FEMultiIndices.hpp:287
MoFEM::Exceptions::rval
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::DefaultElementAdjacency::defEdgeTypeMap
static constexpr DefEntTypeMap defEdgeTypeMap
Definition: FEMultiIndices.hpp:168
SideNumber_multiIndex
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.
Definition: RefEntsMultiIndices.hpp:101
Range
MoFEM::DefaultElementAdjacency::defHexTypeMap
static constexpr DefEntTypeMap defHexTypeMap
Definition: FEMultiIndices.hpp:236
MoFEM::DefaultElementAdjacency::defMeshsetTypeMap
static constexpr DefEntTypeMap defMeshsetTypeMap
Definition: FEMultiIndices.hpp:270
HCURL
@ HCURL
field with continuous tangents
Definition: definitions.h:86
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::DefaultElementAdjacency::defTriTypeMap
static constexpr DefEntTypeMap defTriTypeMap
Definition: FEMultiIndices.hpp:185
MoFEM::DefaultElementAdjacency::defTetTypeMap
static constexpr DefEntTypeMap defTetTypeMap
Definition: FEMultiIndices.hpp:219
MoFEM::DefaultElementAdjacency::defPrismTypeMap
static constexpr DefEntTypeMap defPrismTypeMap
Definition: FEMultiIndices.hpp:253
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
HDIV
@ HDIV
field with continuous normal traction
Definition: definitions.h:87
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
NOFIELD
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:84
MoFEM::DefaultElementAdjacency::defQuadTypeMap
static constexpr DefEntTypeMap defQuadTypeMap
Definition: FEMultiIndices.hpp:202