v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MoFEM::ParentFiniteElementAdjacencyFunction< DIM > Struct Template Reference

Create adjacency to parent elements. More...

#include <src/finite_elements/MeshProjectionDataOperators.hpp>

Inheritance diagram for MoFEM::ParentFiniteElementAdjacencyFunction< DIM >:
[legend]
Collaboration diagram for MoFEM::ParentFiniteElementAdjacencyFunction< DIM >:
[legend]

Public Member Functions

 ParentFiniteElementAdjacencyFunction (BitRefLevel bit_parent, BitRefLevel bit_parent_mask, BitRefLevel bit_ent, BitRefLevel bit_ent_mask)
 
MoFEMErrorCode operator() (moab::Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 Function setting adjacencies to DOFs of parent element. More...
 

Protected Member Functions

MoFEMErrorCode getParent (EntityHandle fe, std::vector< EntityHandle > &parents, moab::Interface &moab, Tag th_parent_handle, Tag th_bit_level)
 
MoFEMErrorCode getParentsAdjacencies (const Field &field, moab::Interface &moab, std::vector< EntityHandle > &parents, std::vector< EntityHandle > &adjacency)
 
MoFEMErrorCode getDefaultAdjacencies (moab::Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)
 

Protected Attributes

BitRefLevel bitParent
 
BitRefLevel bitParentMask
 
BitRefLevel bitEnt
 
BitRefLevel bitEntMask
 
std::vector< EntityHandleadjTmp
 

Detailed Description

template<int DIM>
struct MoFEM::ParentFiniteElementAdjacencyFunction< DIM >

Create adjacency to parent elements.

That class is used during entity finite element construction.

Template Parameters
DIMdimension of parent element

Definition at line 132 of file MeshProjectionDataOperators.hpp.

Constructor & Destructor Documentation

◆ ParentFiniteElementAdjacencyFunction()

template<int DIM>
MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::ParentFiniteElementAdjacencyFunction ( BitRefLevel  bit_parent,
BitRefLevel  bit_parent_mask,
BitRefLevel  bit_ent,
BitRefLevel  bit_ent_mask 
)
inline

Member Function Documentation

◆ getDefaultAdjacencies()

template<int DIM>
MoFEMErrorCode MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::getDefaultAdjacencies ( moab::Interface &  moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
inlineprotected

Definition at line 281 of file MeshProjectionDataOperators.hpp.

284 {
286 if constexpr (DIM == 3)
287 CHKERR DefaultElementAdjacency::defaultVolume(moab, field, fe, adjacency);
288 if constexpr (DIM == 2)
289 CHKERR DefaultElementAdjacency::defaultFace(moab, field, fe, adjacency);
290 else if constexpr (DIM == 1)
291 CHKERR DefaultElementAdjacency::defaultEdge(moab, field, fe, adjacency);
292 else if constexpr (DIM == 0)
293 CHKERR DefaultElementAdjacency::defaultVertex(moab, field, fe, adjacency);
295 };
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#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
static MoFEMErrorCode defaultVertex(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 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)

◆ getParent()

template<int DIM>
MoFEMErrorCode MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::getParent ( EntityHandle  fe,
std::vector< EntityHandle > &  parents,
moab::Interface &  moab,
Tag  th_parent_handle,
Tag  th_bit_level 
)
inlineprotected

this function os called recursively, until all stack of parents is found.

Definition at line 197 of file MeshProjectionDataOperators.hpp.

199 {
201
202 auto check = [](auto &b, auto &m, auto &bit) {
203 return ((bit & b).any()) && ((bit & m) == bit);
204 };
205
206 BitRefLevel bit_fe;
207 CHKERR moab.tag_get_data(th_bit_level, &fe, 1, &bit_fe);
208 if (check(bitEnt, bitEntMask, bit_fe)) {
209
210 using GetParent = boost::function<MoFEMErrorCode(
211 EntityHandle fe, std::vector<EntityHandle> & parents)>;
212 /**
213 * @brief this function os called recursively, until all stack of parents
214 * is found.
215 *
216 */
217 GetParent get_parent = [&](EntityHandle fe,
218 std::vector<EntityHandle> &parents) {
220 EntityHandle fe_parent;
221
222 CHKERR moab.tag_get_data(th_parent_handle, &fe, 1, &fe_parent);
223 auto parent_type = type_from_handle(fe_parent);
224 auto back_type = type_from_handle(fe);
225 BitRefLevel bit_parent;
226 CHKERR moab.tag_get_data(th_bit_level, &fe_parent, 1, &bit_parent);
227 if (check(bitParent, bitParentMask, bit_parent)) {
228 if ((fe_parent != 0) && (fe_parent != fe) &&
229 (parent_type == back_type)) {
230 parents.push_back(fe_parent);
231 CHKERR get_parent(parents.back(), parents);
232 }
233 }
235 };
236
237 CHKERR get_parent(fe, parents);
238 }
240 }
FTensor::Index< 'm', SPACE_DIM > m
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
auto type_from_handle(const EntityHandle h)
get type from entity handle
Definition: Templates.hpp:1634

◆ getParentsAdjacencies()

template<int DIM>
MoFEMErrorCode MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::getParentsAdjacencies ( const Field field,
moab::Interface &  moab,
std::vector< EntityHandle > &  parents,
std::vector< EntityHandle > &  adjacency 
)
inlineprotected

Definition at line 242 of file MeshProjectionDataOperators.hpp.

245 {
247
248 switch (field.getSpace()) {
249 case H1:
250 for (auto fe_ent : parents)
251 CHKERR moab.get_connectivity(&*parents.begin(), parents.size(),
252 adjacency, true);
253 case HCURL:
254 if constexpr (DIM >= 1)
255 for (auto fe_ent : parents)
256 CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
257 moab::Interface::UNION);
258 case HDIV:
259 if constexpr (DIM == 2)
260 for (auto fe_ent : parents)
261 CHKERR moab.get_adjacencies(&fe_ent, 1, 2, false, adjacency,
262 moab::Interface::UNION);
263 case L2:
264 for (auto fe_ent : parents)
265 adjacency.push_back(fe_ent);
266 break;
267 default:
268 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
269 "this field is not implemented for face finite element");
270 }
271
272 if (adjacency.size()) {
273 std::sort(adjacency.begin(), adjacency.end());
274 auto it = std::unique(adjacency.begin(), adjacency.end());
275 adjacency.resize(std::distance(adjacency.begin(), it));
276 }
277
279 }
@ L2
field with C-1 continuity
Definition: definitions.h:88
@ H1
continuous field
Definition: definitions.h:85
@ HCURL
field with continuous tangents
Definition: definitions.h:86
@ HDIV
field with continuous normal traction
Definition: definitions.h:87
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32

◆ operator()()

template<int DIM>
MoFEMErrorCode MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::operator() ( moab::Interface &  moab,
const Field field,
const EntFiniteElement fe,
std::vector< EntityHandle > &  adjacency 
)
inline

Function setting adjacencies to DOFs of parent element.

Note
elements form child, see dofs from parent, so DOFs located on adjacencies of parent entity has adjacent to dofs of child.
Template Parameters
DIMdimension of the element entity
Parameters
moab
field
fe
adjacency
Returns
MoFEMErrorCode

Definition at line 154 of file MeshProjectionDataOperators.hpp.

156 {
158
159 static_assert(DIM >= 0 && DIM <= 3, "DIM is out of scope");
160
161 adjacency.clear();
162
163 if (field.getSpace() != NOFIELD) {
164
165 auto basic_entity_data_ptr = fe.getBasicDataPtr();
166 auto th_parent_handle = basic_entity_data_ptr->th_RefParentHandle;
167 auto th_bit_level = basic_entity_data_ptr->th_RefBitLevel;
168
169 std::vector<EntityHandle> parents;
170 parents.reserve(BITREFLEVEL_SIZE);
171
172 CHKERR getParent(fe.getEnt(), parents, moab, th_parent_handle,
173 th_bit_level);
174
175 CHKERR getParentsAdjacencies(field, moab, parents, adjacency);
176 }
177
178 adjTmp.clear();
179 CHKERR getDefaultAdjacencies(moab, field, fe, adjTmp);
180 adjacency.insert(adjacency.end(), adjTmp.begin(), adjTmp.end());
181
182 std::sort(adjacency.begin(), adjacency.end());
183 auto it = std::unique(adjacency.begin(), adjacency.end());
184 adjacency.resize(std::distance(adjacency.begin(), it));
185
186 for (auto e : adjacency) {
187 auto &side_table = fe.getSideNumberTable();
188 if (side_table.find(e) == side_table.end())
189 const_cast<SideNumber_multiIndex &>(side_table)
190 .insert(boost::shared_ptr<SideNumber>(new SideNumber(e, -1, 0, 0)));
191 }
192
194 }
#define BITREFLEVEL_SIZE
max number of refinements
Definition: definitions.h:219
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:84
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.
MoFEMErrorCode getParent(EntityHandle fe, std::vector< EntityHandle > &parents, moab::Interface &moab, Tag th_parent_handle, Tag th_bit_level)
MoFEMErrorCode getParentsAdjacencies(const Field &field, moab::Interface &moab, std::vector< EntityHandle > &parents, std::vector< EntityHandle > &adjacency)
MoFEMErrorCode getDefaultAdjacencies(moab::Interface &moab, const Field &field, const EntFiniteElement &fe, std::vector< EntityHandle > &adjacency)

Member Data Documentation

◆ adjTmp

template<int DIM>
std::vector<EntityHandle> MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::adjTmp
protected

Definition at line 301 of file MeshProjectionDataOperators.hpp.

◆ bitEnt

template<int DIM>
BitRefLevel MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::bitEnt
protected

Definition at line 299 of file MeshProjectionDataOperators.hpp.

◆ bitEntMask

template<int DIM>
BitRefLevel MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::bitEntMask
protected

Definition at line 300 of file MeshProjectionDataOperators.hpp.

◆ bitParent

template<int DIM>
BitRefLevel MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::bitParent
protected

Definition at line 297 of file MeshProjectionDataOperators.hpp.

◆ bitParentMask

template<int DIM>
BitRefLevel MoFEM::ParentFiniteElementAdjacencyFunction< DIM >::bitParentMask
protected

Definition at line 298 of file MeshProjectionDataOperators.hpp.


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