v0.14.0
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 133 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 282 of file MeshProjectionDataOperators.hpp.

285 {
287 if constexpr (DIM == 3)
288 CHKERR DefaultElementAdjacency::defaultVolume(moab, field, fe, adjacency);
289 if constexpr (DIM == 2)
290 CHKERR DefaultElementAdjacency::defaultFace(moab, field, fe, adjacency);
291 else if constexpr (DIM == 1)
292 CHKERR DefaultElementAdjacency::defaultEdge(moab, field, fe, adjacency);
293 else if constexpr (DIM == 0)
294 CHKERR DefaultElementAdjacency::defaultVertex(moab, field, fe, adjacency);
296 };
#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 198 of file MeshProjectionDataOperators.hpp.

200 {
202
203 auto check = [](auto &b, auto &m, auto &bit) {
204 return ((bit & b).any()) && ((bit & m) == bit);
205 };
206
207 BitRefLevel bit_fe;
208 CHKERR moab.tag_get_data(th_bit_level, &fe, 1, &bit_fe);
209 if (check(bitEnt, bitEntMask, bit_fe)) {
210
211 using GetParent = boost::function<MoFEMErrorCode(
212 EntityHandle fe, std::vector<EntityHandle> & parents)>;
213 /**
214 * @brief this function os called recursively, until all stack of parents
215 * is found.
216 *
217 */
218 GetParent get_parent = [&](EntityHandle fe,
219 std::vector<EntityHandle> &parents) {
221 EntityHandle fe_parent;
222
223 CHKERR moab.tag_get_data(th_parent_handle, &fe, 1, &fe_parent);
224 auto parent_type = type_from_handle(fe_parent);
225 auto back_type = type_from_handle(fe);
226 BitRefLevel bit_parent;
227 CHKERR moab.tag_get_data(th_bit_level, &fe_parent, 1, &bit_parent);
228 if (check(bitParent, bitParentMask, bit_parent)) {
229 if ((fe_parent != 0) && (fe_parent != fe) &&
230 (parent_type == back_type)) {
231 parents.push_back(fe_parent);
232 CHKERR get_parent(parents.back(), parents);
233 }
234 }
236 };
237
238 CHKERR get_parent(fe, parents);
239 }
241 }
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:1869

◆ 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 243 of file MeshProjectionDataOperators.hpp.

246 {
248
249 switch (field.getSpace()) {
250 case H1:
251 for (int i = 0; i != parents.size(); ++i)
252 CHKERR moab.get_connectivity(&*parents.begin(), parents.size(),
253 adjacency, true);
254 case HCURL:
255 if constexpr (DIM >= 1)
256 for (auto fe_ent : parents)
257 CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
258 moab::Interface::UNION);
259 case HDIV:
260 if constexpr (DIM == 2)
261 for (auto fe_ent : parents)
262 CHKERR moab.get_adjacencies(&fe_ent, 1, 2, false, adjacency,
263 moab::Interface::UNION);
264 case L2:
265 for (auto fe_ent : parents)
266 adjacency.push_back(fe_ent);
267 break;
268 default:
269 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
270 "this field is not implemented for face finite element");
271 }
272
273 if (adjacency.size()) {
274 std::sort(adjacency.begin(), adjacency.end());
275 auto it = std::unique(adjacency.begin(), adjacency.end());
276 adjacency.resize(std::distance(adjacency.begin(), it));
277 }
278
280 }
@ 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
FTensor::Index< 'i', SPACE_DIM > i

◆ 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 155 of file MeshProjectionDataOperators.hpp.

157 {
159
160 static_assert(DIM >= 0 && DIM <= 3, "DIM is out of scope");
161
162 adjacency.clear();
163
164 if (field.getSpace() != NOFIELD) {
165
166 auto basic_entity_data_ptr = fe.getBasicDataPtr();
167 auto th_parent_handle = basic_entity_data_ptr->th_RefParentHandle;
168 auto th_bit_level = basic_entity_data_ptr->th_RefBitLevel;
169
170 std::vector<EntityHandle> parents;
171 parents.reserve(BITREFLEVEL_SIZE);
172
173 CHKERR getParent(fe.getEnt(), parents, moab, th_parent_handle,
174 th_bit_level);
175
176 CHKERR getParentsAdjacencies(field, moab, parents, adjacency);
177 }
178
179 adjTmp.clear();
180 CHKERR getDefaultAdjacencies(moab, field, fe, adjTmp);
181 adjacency.insert(adjacency.end(), adjTmp.begin(), adjTmp.end());
182
183 std::sort(adjacency.begin(), adjacency.end());
184 auto it = std::unique(adjacency.begin(), adjacency.end());
185 adjacency.resize(std::distance(adjacency.begin(), it));
186
187 for (auto e : adjacency) {
188 auto &side_table = fe.getSideNumberTable();
189 if (side_table.find(e) == side_table.end())
190 const_cast<SideNumber_multiIndex &>(side_table)
191 .insert(boost::shared_ptr<SideNumber>(new SideNumber(e, -1, 0, 0)));
192 }
193
195 }
#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 302 of file MeshProjectionDataOperators.hpp.

◆ bitEnt

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

Definition at line 300 of file MeshProjectionDataOperators.hpp.

◆ bitEntMask

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

Definition at line 301 of file MeshProjectionDataOperators.hpp.

◆ bitParent

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

Definition at line 298 of file MeshProjectionDataOperators.hpp.

◆ bitParentMask

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

Definition at line 299 of file MeshProjectionDataOperators.hpp.


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