v0.10.0
Files | Classes
BitRefManager

Managing BitRefLevels. More...

Collaboration diagram for BitRefManager:

Files

file  BitRefManager.hpp
 Interface managing BitRefLevelsManaging BitRef levels.
 

Classes

struct  MoFEM::BitRefManager
 Managing BitRefLevels. More...
 
struct  MoFEM::CommInterface
 Managing BitRefLevels. More...
 

Setting and shifting bits

MoFEMErrorCode MoFEM::BitRefManager::setBitRefLevel (const Range &ents, const BitRefLevel bit, const bool only_tets=true, int verb=0) const
 add entities to database and set bit ref levelThis function set bit ref level, add entries to core database and create ref finite elements. Finite elements are create of entities in function argument, whereas all lower dimension entities are added as a field entities More...
 
MoFEMErrorCode MoFEM::BitRefManager::setElementsBitRefLevel (const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
 add entities to database and set bit ref level More...
 
MoFEMErrorCode MoFEM::BitRefManager::setEntitiesBitRefLevel (const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
 add entities to database and set bit ref level More...
 
MoFEMErrorCode MoFEM::BitRefManager::setBitLevelToMeshset (const EntityHandle meshset, const BitRefLevel bit, int verb=0) const
 
MoFEMErrorCode MoFEM::BitRefManager::addBitRefLevel (const Range &ents, const BitRefLevel bit, int verb=QUIET) const
 add bit ref level to ref entity More...
 
MoFEMErrorCode MoFEM::BitRefManager::setNthBitRefLevel (const int n, const bool b, int verb=0) const
 Set nth bit ref level. More...
 
MoFEMErrorCode MoFEM::BitRefManager::shiftLeftBitRef (const int shift, const BitRefLevel mask=BitRefLevel().set(), int verb=-1) const
 left shift bit ref levelthis results of deletion of entities on far left side More...
 
MoFEMErrorCode MoFEM::BitRefManager::shiftRightBitRef (const int shift, const BitRefLevel mask=BitRefLevel().set(), int verb=-1) const
 right shift bit ref level More...
 
MoFEMErrorCode MoFEM::BitRefManager::setFieldEntitiesBitRefLevel (const std::string field_name, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
 Set the bit ref level to entities in the field meshset. More...
 
MoFEMErrorCode MoFEM::BitRefManager::setBitRefLevelByDim (const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
 Set the Bit Ref Level By Dim object. More...
 
MoFEMErrorCode MoFEM::BitRefManager::setBitRefLevelByType (const EntityHandle meshset, const EntityType type, const BitRefLevel bit, int verb=QUIET) const
 Set the Bit Ref Level By Type object. More...
 
MoFEMErrorCode MoFEM::BitRefManager::addToDatabaseBitRefLevelByType (const EntityType type, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), int verb=QUIET) const
 Add entities which exist in MoAB database, and have set appropiate BitRef level tag, to multi-indices in MoFEM. More...
 
MoFEMErrorCode MoFEM::BitRefManager::addToDatabaseBitRefLevelByDim (const int dim, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), int verb=QUIET) const
 Add entities which exist in MoAB database, and have set appropiate BitRef level tag, to multi-indices in MoFEM. More...
 
MoFEMErrorCode MoFEM::BitRefManager::addBitRefLevelByDim (const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
 add bit ref level by dimension More...
 
MoFEMErrorCode MoFEM::BitRefManager::setNthBitRefLevel (const Range &ents, const int n, const bool b, int verb=0) const
 Set nth bit ref level. More...
 

Entity handlers by bit ref level

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByTypeAndRefLevel (const BitRefLevel bit, const BitRefLevel mask, const EntityType type, const EntityHandle meshset, int verb=0) const
 add all ents from ref level given by bit to meshset More...
 
MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByTypeAndRefLevel (const BitRefLevel bit, const BitRefLevel mask, const EntityType type, Range &ents, int verb=0) const
 add all ents from ref level given by bit to meshset More...
 
MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByDimAndRefLevel (const BitRefLevel bit, const BitRefLevel mask, const int dim, const EntityHandle meshset, int verb=0) const
 add all ents from ref level given by bit to meshset More...
 
MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByDimAndRefLevel (const BitRefLevel bit, const BitRefLevel mask, const int dim, Range &ents, int verb=0) const
 add all ents from ref level given by bit to meshset More...
 
MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByRefLevel (const BitRefLevel bit, const BitRefLevel mask, const EntityHandle meshset, const int verb=QUIET) const
 add all ents from ref level given by bit to meshset More...
 
MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByRefLevel (const BitRefLevel bit, const BitRefLevel mask, Range &ents, const int verb=QUIET) const
 add all ents from ref level given by bit to meshset More...
 

Get adjacencies bit ref level

virtual MoFEMErrorCode MoFEM::BitRefManager::getAdjacenciesEquality (const EntityHandle from_entity, const int to_dimension, Range &adj_entities) const
 Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is equal to bit ref level of adjacent entities. More...
 
virtual MoFEMErrorCode MoFEM::BitRefManager::getAdjacenciesAny (const EntityHandle from_entity, const int to_dimension, Range &adj_entities) const
 Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is any of bit ref level of adjacent entities. More...
 
virtual MoFEMErrorCode MoFEM::BitRefManager::getAdjacencies (const Problem *problem_ptr, const EntityHandle *from_entities, const int num_entities, const int to_dimension, Range &adj_entities, const int operation_type=moab::Interface::INTERSECT, const int verb=0) const
 Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is equal to bit ref level of adjacent entities. More...
 
virtual MoFEMErrorCode MoFEM::BitRefManager::getAdjacencies (const BitRefLevel bit, const EntityHandle *from_entities, const int num_entities, const int to_dimension, Range &adj_entities, const int operation_type=moab::Interface::INTERSECT, const int verb=0) const
 Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is equal to bit ref level of adjacent entities. More...
 

Update meshsets and ranges by children

MoFEMErrorCode MoFEM::BitRefManager::updateMeshsetByEntitiesChildren (const EntityHandle parent, const BitRefLevel &parent_bit, const BitRefLevel &parent_mask, const BitRefLevel &child_bit, const BitRefLevel &child_mask, const EntityHandle child, EntityType child_type, const bool recursive=false, int verb=0)
 Get child entities form meshset containing parent entitiesSearch for refined entities of given type whose parent are entities in the parent meshset. It can be used for example to transfer information about boundary conditions to refined mesh or split mesh by interface elements. It is used by function refine_MESHSET, to update MESHSET finite elements. More...
 
MoFEMErrorCode MoFEM::BitRefManager::updateMeshsetByEntitiesChildren (const EntityHandle parent, const BitRefLevel &child_bit, const EntityHandle child, EntityType child_type, const bool recursive=false, int verb=0)
 Get child entities form meshset containing parent entities. More...
 
MoFEMErrorCode MoFEM::BitRefManager::updateFieldMeshsetByEntitiesChildren (const BitRefLevel &child_bit, int verb=0)
 update fields meshesets by child entities More...
 
MoFEMErrorCode MoFEM::BitRefManager::updateFieldMeshsetByEntitiesChildren (const std::string name, const BitRefLevel &child_bit, int verb=0)
 update field meshset by child entities More...
 
MoFEMErrorCode MoFEM::BitRefManager::updateFiniteElementMeshsetByEntitiesChildren (const std::string name, const BitRefLevel &child_bit, const EntityType fe_ent_type, int verb=0)
 update finite element meshset by child entities More...
 
MoFEMErrorCode MoFEM::BitRefManager::updateRange (const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
 Update range by prents. More...
 

Detailed Description

Managing BitRefLevels.

Function Documentation

◆ addBitRefLevel()

MoFEMErrorCode MoFEM::BitRefManager::addBitRefLevel ( const Range &  ents,
const BitRefLevel  bit,
int  verb = QUIET 
) const

add bit ref level to ref entity

Parameters
entsrange of entities
bitbit ref level
verbverbosity level
Returns
error code

Definition at line 477 of file BitRefManager.cpp.

479  {
480  MoFEM::Interface &m_field = cOre;
482  std::vector<const BitRefLevel *> ents_bits_vec;
483  CHKERR RefEntity::getBitRefLevel(m_field.get_moab(), ents, ents_bits_vec);
484  for (auto it : ents_bits_vec)
485  const_cast<BitRefLevel &>(*it) |= bit;
487 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ addBitRefLevelByDim()

MoFEMErrorCode MoFEM::BitRefManager::addBitRefLevelByDim ( const EntityHandle  meshset,
const int  dim,
const BitRefLevel  bit,
int  verb = QUIET 
) const

add bit ref level by dimension

Parameters
meshset
dimdimension of entities
bitadded bit
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 489 of file BitRefManager.cpp.

492  {
493  MoFEM::Interface &m_field = cOre;
494  moab::Interface &moab = m_field.get_moab();
495  Range ents, adj;
497  CHKERR moab.get_entities_by_dimension(meshset, dim, ents, true);
498  for (int dd = dim - 1; dd >= 0; dd--) {
499  CHKERR moab.get_adjacencies(ents, dd, false, adj, moab::Interface::UNION);
500  }
501  ents.merge(adj);
502  if (verb == VERY_NOISY) {
504  MOFEM_LOG("BitRefSelf", Sev::noisy) << "Add add bit ref level by dim ";
505  }
506 
507  CHKERR addBitRefLevel(ents, bit, verb);
509 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
MoFEMErrorCode addBitRefLevel(const Range &ents, const BitRefLevel bit, int verb=QUIET) const
add bit ref level to ref entity
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
const int dim
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
#define CHKERR
Inline error check.
Definition: definitions.h:604
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ addToDatabaseBitRefLevelByDim()

MoFEMErrorCode MoFEM::BitRefManager::addToDatabaseBitRefLevelByDim ( const int  dim,
const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
int  verb = QUIET 
) const

Add entities which exist in MoAB database, and have set appropiate BitRef level tag, to multi-indices in MoFEM.

Note
Every entity, used for create DoFS, or elements has to have set BitRefLevel and be added to MoFEM database.
This functions add lower dimension entities by calling setEntitiesBitRefLevel
Parameters
dimdimension of entity
bitbit ref level
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 416 of file BitRefManager.cpp.

418  {
420  Range ents;
421  CHKERR getEntitiesByDimAndRefLevel(bit, mask, dim, ents);
424 }
MoFEMErrorCode setBitRefLevel(const Range &ents, const BitRefLevel bit, const bool only_tets=true, int verb=0) const
add entities to database and set bit ref levelThis function set bit ref level, add entries to core da...
MoFEMErrorCode getEntitiesByDimAndRefLevel(const BitRefLevel bit, const BitRefLevel mask, const int dim, const EntityHandle meshset, int verb=0) const
add all ents from ref level given by bit to meshset
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:604
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ addToDatabaseBitRefLevelByType()

MoFEMErrorCode MoFEM::BitRefManager::addToDatabaseBitRefLevelByType ( const EntityType  type,
const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
int  verb = QUIET 
) const

Add entities which exist in MoAB database, and have set appropiate BitRef level tag, to multi-indices in MoFEM.

Note
Every entity, used for create DoFS, or elements has to have set BitRefLevel and be added to MoFEM database.
This functions add lower dimension entities by calling setEntitiesBitRefLevel
Parameters
typeof entity
bitbit ref level
mask
verbverbosity level
Returns
MoFEMErrorCode

Definition at line 406 of file BitRefManager.cpp.

408  {
410  Range ents;
411  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents);
414 }
MoFEMErrorCode setBitRefLevel(const Range &ents, const BitRefLevel bit, const bool only_tets=true, int verb=0) const
add entities to database and set bit ref levelThis function set bit ref level, add entries to core da...
MoFEMErrorCode getEntitiesByTypeAndRefLevel(const BitRefLevel bit, const BitRefLevel mask, const EntityType type, const EntityHandle meshset, int verb=0) const
add all ents from ref level given by bit to meshset
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getAdjacencies() [1/2]

MoFEMErrorCode MoFEM::BitRefManager::getAdjacencies ( const Problem problem_ptr,
const EntityHandle from_entities,
const int  num_entities,
const int  to_dimension,
Range &  adj_entities,
const int  operation_type = moab::Interface::INTERSECT,
const int  verb = 0 
) const
virtual

Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is equal to bit ref level of adjacent entities.

Definition at line 874 of file BitRefManager.cpp.

877  {
879  BitRefLevel bit = problem_ptr->getBitRefLevel();
880  CHKERR getAdjacencies(bit, from_entities, num_entities, to_dimension,
881  adj_entities, operation_type);
883 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
virtual MoFEMErrorCode getAdjacencies(const Problem *problem_ptr, const EntityHandle *from_entities, const int num_entities, const int to_dimension, Range &adj_entities, const int operation_type=moab::Interface::INTERSECT, const int verb=0) const
Get the adjacencies associated with a entity to entities of a specified dimension....

◆ getAdjacencies() [2/2]

MoFEMErrorCode MoFEM::BitRefManager::getAdjacencies ( const BitRefLevel  bit,
const EntityHandle from_entities,
const int  num_entities,
const int  to_dimension,
Range &  adj_entities,
const int  operation_type = moab::Interface::INTERSECT,
const int  verb = 0 
) const
virtual

Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is equal to bit ref level of adjacent entities.

Definition at line 885 of file BitRefManager.cpp.

888  {
889  MoFEM::Interface &m_field = cOre;
890  moab::Interface &moab(m_field.get_moab());
892 
893  if (verb > VERBOSE) {
895  MOFEM_LOG("BitRef", Sev::noisy) << "from: " << bit;
896  }
897 
898  CHKERR moab.get_adjacencies(from_entities, num_entities, to_dimension, false,
899  adj_entities, operation_type);
900  std::vector<BitRefLevel> bit_levels(adj_entities.size());
901  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
902  &*bit_levels.begin());
903  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
904  for (Range::iterator eit = adj_entities.begin(); eit != adj_entities.end();
905  b_it++) {
906 
907  if (verb > VERBOSE) {
908  RefEntity adj_entity(m_field.get_basic_entity_data_ptr(), *eit);
910  MOFEM_LOG("BitRef", Sev::noisy)
911  << "to: " << adj_entity.getBitRefLevel() << " : " << adj_entity;
912  }
913 
914  if (!((*b_it) & bit).any()) {
915  eit = adj_entities.erase(eit);
916  } else {
917  eit++;
918  }
919  }
920  if (b_it != bit_levels.end()) {
921  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
922  }
924 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
Tag get_th_RefBitLevel() const
Definition: Core.hpp:193
RefEntityTmp< 0 > RefEntity
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ getAdjacenciesAny()

MoFEMErrorCode MoFEM::BitRefManager::getAdjacenciesAny ( const EntityHandle  from_entity,
const int  to_dimension,
Range &  adj_entities 
) const
virtual

Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is any of bit ref level of adjacent entities.

Definition at line 848 of file BitRefManager.cpp.

850  {
851  MoFEM::Interface &m_field = cOre;
852  moab::Interface &moab(m_field.get_moab());
854  BitRefLevel bit_from_entity;
855  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), &from_entity, 1,
856  &bit_from_entity);
857  CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension, false,
858  adj_entities);
859  std::vector<BitRefLevel> bit_levels(adj_entities.size());
860  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
861  &*bit_levels.begin());
862  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
863  Range::iterator eit = adj_entities.begin();
864  for (; eit != adj_entities.end(); b_it++) {
865  if (!(bit_from_entity & (*b_it)).any()) {
866  eit = adj_entities.erase(eit);
867  } else {
868  eit++;
869  }
870  }
872 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
Tag get_th_RefBitLevel() const
Definition: Core.hpp:193
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
#define CHKERR
Inline error check.
Definition: definitions.h:604
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943

◆ getAdjacenciesEquality()

MoFEMErrorCode MoFEM::BitRefManager::getAdjacenciesEquality ( const EntityHandle  from_entity,
const int  to_dimension,
Range &  adj_entities 
) const
virtual

Get the adjacencies associated with a entity to entities of a specified dimension.bit ref level of adjacent entities is equal to bit ref level of adjacent entities.

Definition at line 822 of file BitRefManager.cpp.

824  {
825  MoFEM::Interface &m_field = cOre;
826  moab::Interface &moab(m_field.get_moab());
828  BitRefLevel bit_from_entity;
829  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), &from_entity, 1,
830  &bit_from_entity);
831  CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension, false,
832  adj_entities);
833  std::vector<BitRefLevel> bit_levels(adj_entities.size());
834  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
835  &*bit_levels.begin());
836  auto b_it = bit_levels.begin();
837  auto eit = adj_entities.begin();
838  for (; eit != adj_entities.end(); b_it++) {
839  if (bit_from_entity != *b_it) {
840  eit = adj_entities.erase(eit);
841  } else {
842  eit++;
843  }
844  }
846 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
Tag get_th_RefBitLevel() const
Definition: Core.hpp:193
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getEntitiesByDimAndRefLevel() [1/2]

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByDimAndRefLevel ( const BitRefLevel  bit,
const BitRefLevel  mask,
const int  dim,
const EntityHandle  meshset,
int  verb = 0 
) const

add all ents from ref level given by bit to meshset

Note
Entities NOT have to be added to MoFEM database
Parameters
BitRefLevelbitLevel
BitRefLevelmask
EntityTypedimension of entities
Return values
ents

Definition at line 720 of file BitRefManager.cpp.

722  {
723  MoFEM::Interface &m_field = cOre;
724  moab::Interface &moab(m_field.get_moab());
726  Range ents;
727  CHKERR getEntitiesByDimAndRefLevel(bit, mask, dim, ents, verb);
728  CHKERR moab.add_entities(meshset, ents);
730 }
Deprecated interface functions.
MoFEMErrorCode getEntitiesByDimAndRefLevel(const BitRefLevel bit, const BitRefLevel mask, const int dim, const EntityHandle meshset, int verb=0) const
add all ents from ref level given by bit to meshset
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:604
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getEntitiesByDimAndRefLevel() [2/2]

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByDimAndRefLevel ( const BitRefLevel  bit,
const BitRefLevel  mask,
const int  dim,
Range &  ents,
int  verb = 0 
) const

add all ents from ref level given by bit to meshset

Note
Entities NOT have to be added to MoFEM database
Parameters
BitRefLevelbitLevel
BitRefLevelmask
EntityTypedimension of entities
Return values
ents

Definition at line 732 of file BitRefManager.cpp.

734  {
735  MoFEM::Interface &m_field = cOre;
736  moab::Interface &moab(m_field.get_moab());
738  CHKERR moab.get_entities_by_dimension(0, dim, ents, false);
739  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
741 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getEntitiesByRefLevel() [1/2]

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByRefLevel ( const BitRefLevel  bit,
const BitRefLevel  mask,
const EntityHandle  meshset,
const int  verb = QUIET 
) const

add all ents from ref level given by bit to meshset

Note
Entities NOT have to be added to MoFEM database
Parameters
BitRefLevelbitLevel
BitRefLevelmask
EntityHandlemeshset

Definition at line 743 of file BitRefManager.cpp.

746  {
747  MoFEM::Interface &m_field = cOre;
748  moab::Interface &moab(m_field.get_moab());
750  Range ents;
751  CHKERR getEntitiesByRefLevel(bit, mask, ents, verb);
752  CHKERR moab.add_entities(meshset, ents);
754 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode getEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, const EntityHandle meshset, const int verb=QUIET) const
add all ents from ref level given by bit to meshset
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getEntitiesByRefLevel() [2/2]

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByRefLevel ( const BitRefLevel  bit,
const BitRefLevel  mask,
Range &  ents,
const int  verb = QUIET 
) const

add all ents from ref level given by bit to meshset

Note
Entities NOT have to be added to MoFEM database
Parameters
BitRefLevelbitLevel
BitRefLevelmask
Return values
ents

Definition at line 756 of file BitRefManager.cpp.

759  {
760  MoFEM::Interface &m_field = cOre;
761  moab::Interface &moab(m_field.get_moab());
763  Range meshset_ents;
764  CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshset_ents, false);
765  CHKERR moab.get_entities_by_handle(0, ents, false);
766  ents.merge(meshset_ents);
767  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
769 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getEntitiesByTypeAndRefLevel() [1/2]

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByTypeAndRefLevel ( const BitRefLevel  bit,
const BitRefLevel  mask,
const EntityType  type,
const EntityHandle  meshset,
int  verb = 0 
) const

add all ents from ref level given by bit to meshset

Note
Entities NOT have to be added to MoFEM database
Parameters
BitRefLevelbitLevel
BitRefLevelmask
EntityTypetype of entities
Return values
EntityHandlemeshset
Examples
mesh_cut.cpp, and split_sideset.cpp.

Definition at line 632 of file BitRefManager.cpp.

634  {
635  MoFEM::Interface &m_field = cOre;
636  moab::Interface &moab(m_field.get_moab());
638  Range ents;
639  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents, verb);
640  CHKERR moab.add_entities(meshset, ents);
642 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
MoFEMErrorCode getEntitiesByTypeAndRefLevel(const BitRefLevel bit, const BitRefLevel mask, const EntityType type, const EntityHandle meshset, int verb=0) const
add all ents from ref level given by bit to meshset
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getEntitiesByTypeAndRefLevel() [2/2]

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByTypeAndRefLevel ( const BitRefLevel  bit,
const BitRefLevel  mask,
const EntityType  type,
Range &  ents,
int  verb = 0 
) const

add all ents from ref level given by bit to meshset

Note
Entities NOT have to be added to MoFEM database
Parameters
BitRefLevelbitLevel
BitRefLevelmask
EntityTypetype of entities
Return values
ents

Definition at line 709 of file BitRefManager.cpp.

711  {
712  MoFEM::Interface &m_field = cOre;
713  moab::Interface &moab(m_field.get_moab());
715  CHKERR moab.get_entities_by_type(0, type, ents, false);
716  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
718 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ setBitLevelToMeshset()

MoFEMErrorCode MoFEM::BitRefManager::setBitLevelToMeshset ( const EntityHandle  meshset,
const BitRefLevel  bit,
int  verb = 0 
) const

brief add meshset and set bit ref level

Parameters
EntityHandleMeshSet
BitRefLevelbitLevel

Definition at line 426 of file BitRefManager.cpp.

428  {
429  MoFEM::Interface &m_field = cOre;
430  auto ref_ents_ptr = m_field.get_ref_ents();
431  auto ref_fe_ptr = m_field.get_ref_finite_elements();
433  // Add ref entity
434  std::pair<RefEntity_multiIndex::iterator, bool> p_ent =
435  const_cast<RefEntity_multiIndex *>(ref_ents_ptr)
436  ->insert(boost::shared_ptr<RefEntity>(
437  new RefEntity(m_field.get_basic_entity_data_ptr(), meshset)));
438  *(const_cast<RefEntity *>(p_ent.first->get())->getBitRefLevelPtr()) |= bit;
439  // Add ref element
440  boost::shared_ptr<RefElement> fe_ptr =
441  boost::shared_ptr<RefElement>(new RefElement_MESHSET(*p_ent.first));
442  std::pair<RefElement_multiIndex::iterator, bool> p_fe =
443  const_cast<RefElement_multiIndex *>(ref_fe_ptr)->insert(fe_ptr);
444 
446  MOFEM_LOG("BitRefSelf", Sev::noisy)
447  << "Add meshset as ref_ent " << **p_fe.first;
448 
450 }
Deprecated interface functions.
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
RefEntityTmp< 0 > RefEntity
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual const RefElement_multiIndex * get_ref_finite_elements() const =0
Get the ref finite elements object.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ setBitRefLevel()

MoFEMErrorCode MoFEM::BitRefManager::setBitRefLevel ( const Range &  ents,
const BitRefLevel  bit,
const bool  only_tets = true,
int  verb = 0 
) const

add entities to database and set bit ref levelThis function set bit ref level, add entries to core database and create ref finite elements. Finite elements are create of entities in function argument, whereas all lower dimension entities are added as a field entities

Example:

EntityHandle meshset1; //contains ent1,ent2,ent3
BitRefLevel myLevel0;
myLevel0.set(0);
m_field.getInterface<BitRefManager>()->setBitRefLevelByDim(meshset1,3,myLevel0);
//refine meshset1 into meshset2 and get new ents which are ent4, ent5
EntityHandle meshset2; //contains ent1,ent2,ent3,ent4,ent5
BitRefLevel myLevel1;
myLevel1.set(1);
m_field.getInterface<BitRefManager>()->setBitRefLevelByDim(meshset2,3,myLevel1);

So entities 1,2,3 would be assigned to bit level 0 and 1
ent1[1,1,0,0,0,0,0], ent2[1,1,0,0,0,0,0], ent3[1,1,0,0,0,0,0],
and entities 4 and 5 are assigned to bit level 1 only
ent4[0,1,0,0,0,0,0], ent5[0,1,0,0,0,0,0]

Parameters
entsentities to set
bitbit refinement level
only_tetsonly add entities on tetrahedral (obsolete need to be fixed)
verbverbosity level
Returns
error code

Definition at line 288 of file BitRefManager.cpp.

291  {
292  MoFEM::Interface &m_field = cOre;
293  auto ref_ents_ptr = m_field.get_ref_ents();
294  auto ref_fe_ptr = m_field.get_ref_finite_elements();
296 
298  MOFEM_LOG_C("BitRefSelf", Sev::noisy, "nb. entities to add %d", ents.size());
299 
300  CHKERR setElementsBitRefLevel(ents, bit, verb);
301 
302  if (!ents.empty()) {
303  for (int d = 3; d >= 1; --d) {
304  Range dim_ents;
305  if (only_tets && d == 3) {
306  dim_ents = ents.subset_by_type(MBTET);
307  } else {
308  dim_ents = ents.subset_by_dimension(d);
309  }
310  if (!dim_ents.empty()) {
311  for (int dd = 0; dd < d; ++dd) {
312  Range adj_ents;
313  CHKERR m_field.get_moab().get_adjacencies(
314  dim_ents, dd, true, adj_ents, moab::Interface::UNION);
315  for (Range::pair_iterator pit = adj_ents.pair_begin();
316  pit != adj_ents.pair_end(); ++pit) {
317  Range seed_ents_range;
318  // get first and last element of range
319  EntityHandle f = pit->first;
320  EntityHandle s = pit->second;
321  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
322  .findEntsToAdd(f, s, seed_ents_range);
323  if (!seed_ents_range.empty())
324  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
325  .addEntsToDatabase(seed_ents_range);
326  }
327  }
328  }
329  }
330  }
331 
333 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:306
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual const RefElement_multiIndex * get_ref_finite_elements() const =0
Get the ref finite elements object.
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode setElementsBitRefLevel(const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
add entities to database and set bit ref level
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ setBitRefLevelByDim()

MoFEMErrorCode MoFEM::BitRefManager::setBitRefLevelByDim ( const EntityHandle  meshset,
const int  dim,
const BitRefLevel  bit,
int  verb = QUIET 
) const

Set the Bit Ref Level By Dim object.

Note
In THIS variant only entities in range are added. And DO NOT create elements.
Parameters
meshset
dim
bit
verb
Returns
MoFEMErrorCode
Examples
split_sideset.cpp.

Definition at line 452 of file BitRefManager.cpp.

455  {
456  MoFEM::Interface &m_field = cOre;
458  Range ents;
459  CHKERR m_field.get_moab().get_entities_by_dimension(meshset, dim, ents,
460  false);
461  CHKERR setBitRefLevel(ents, bit, false, verb);
463 }
Deprecated interface functions.
MoFEMErrorCode setBitRefLevel(const Range &ents, const BitRefLevel bit, const bool only_tets=true, int verb=0) const
add entities to database and set bit ref levelThis function set bit ref level, add entries to core da...
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ setBitRefLevelByType()

MoFEMErrorCode MoFEM::BitRefManager::setBitRefLevelByType ( const EntityHandle  meshset,
const EntityType  type,
const BitRefLevel  bit,
int  verb = QUIET 
) const

Set the Bit Ref Level By Type object.

Note
In THIS variant only entities in range are added. And DO NOT create elements.
Parameters
meshset
type
bit
verb
Returns
MoFEMErrorCode
Examples
mesh_cut.cpp.

Definition at line 465 of file BitRefManager.cpp.

468  {
469  MoFEM::Interface &m_field = cOre;
471  Range ents;
472  CHKERR m_field.get_moab().get_entities_by_type(meshset, type, ents, false);
473  CHKERR setBitRefLevel(ents, bit, false, verb);
475 }
Deprecated interface functions.
MoFEMErrorCode setBitRefLevel(const Range &ents, const BitRefLevel bit, const bool only_tets=true, int verb=0) const
add entities to database and set bit ref levelThis function set bit ref level, add entries to core da...
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ setElementsBitRefLevel()

MoFEMErrorCode MoFEM::BitRefManager::setElementsBitRefLevel ( const Range &  ents,
const BitRefLevel  bit = BitRefLevel(),
int  verb = QUIET 
) const

add entities to database and set bit ref level

Note
In THIS variant only entities in range are added and ref finite elements reated.
Parameters
ents
bit
only_tets
verb
Returns
MoFEMErrorCode setBitRefLevel

Definition at line 335 of file BitRefManager.cpp.

337  {
338  MoFEM::Interface &m_field = cOre;
339  auto ref_ents_ptr = m_field.get_ref_ents();
340  auto ref_fe_ptr = m_field.get_ref_finite_elements();
342 
343  for (Range::const_pair_iterator pit = ents.pair_begin();
344  pit != ents.pair_end(); pit++) {
345  // get first and last element of range
346  EntityHandle f = pit->first;
347  EntityHandle s = pit->second;
348  Range seed_ents_range; // entities seeded not in database
349  // find ents to add
350  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
351  .findEntsToAdd(f, s, seed_ents_range);
352  // add elements
353  if (!seed_ents_range.empty())
354  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
355  .addEntsToDatabase(seed_ents_range);
356 
357  Range seed_fe_range;
358  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
359  .findElementsToAdd(f, s, seed_fe_range);
360  if (!seed_fe_range.empty()) {
361  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
362  .addElementsToDatabase(seed_fe_range);
363  }
364  }
365 
367 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual const RefElement_multiIndex * get_ref_finite_elements() const =0
Get the ref finite elements object.
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ setEntitiesBitRefLevel()

MoFEMErrorCode MoFEM::BitRefManager::setEntitiesBitRefLevel ( const Range &  ents,
const BitRefLevel  bit = BitRefLevel(),
int  verb = QUIET 
) const

add entities to database and set bit ref level

Note
In THIS variant only entities in range are added. And DO NOT create elements.
Parameters
ents
bit
only_tets
verb
Returns
MoFEMErrorCode setBitRefLevel

Definition at line 369 of file BitRefManager.cpp.

371  {
372  MoFEM::Interface &m_field = cOre;
373  auto ref_ents_ptr = m_field.get_ref_ents();
374  auto ref_fe_ptr = m_field.get_ref_finite_elements();
376 
377  for (Range::const_pair_iterator pit = ents.pair_begin();
378  pit != ents.pair_end(); pit++) {
379  // get first and last element of range
380  EntityHandle f = pit->first;
381  EntityHandle s = pit->second;
382  Range seed_ents_range; // entities seeded not in database
383  // find ents to add
384  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
385  .findEntsToAdd(f, s, seed_ents_range);
386  // add elements
387  if (!seed_ents_range.empty())
388  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
389  .addEntsToDatabase(seed_ents_range);
390  }
392 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual const RefElement_multiIndex * get_ref_finite_elements() const =0
Get the ref finite elements object.
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ setFieldEntitiesBitRefLevel()

MoFEMErrorCode MoFEM::BitRefManager::setFieldEntitiesBitRefLevel ( const std::string  field_name,
const BitRefLevel  bit = BitRefLevel(),
int  verb = QUIET 
) const

Set the bit ref level to entities in the field meshset.

Parameters
field_name
bit
verb
Returns
MoFEMErrorCode

Definition at line 394 of file BitRefManager.cpp.

395  {
396  MoFEM::Interface &m_field = cOre;
398  EntityHandle field_meshset = m_field.get_field_meshset(field_name);
399  Range field_ents;
400  CHKERR m_field.get_moab().get_entities_by_handle(field_meshset, field_ents,
401  true);
402  CHKERR setEntitiesBitRefLevel(field_ents, bit, verb);
404 }
MoFEMErrorCode setEntitiesBitRefLevel(const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
add entities to database and set bit ref level
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
virtual EntityHandle get_field_meshset(const std::string name) const =0
get field meshset
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ setNthBitRefLevel() [1/2]

MoFEMErrorCode MoFEM::BitRefManager::setNthBitRefLevel ( const Range &  ents,
const int  n,
const bool  b,
int  verb = 0 
) const

Set nth bit ref level.

Note
This function modify bits only on entities in RefEntity_multiindex
Parameters
entsentities to set bit ref level
nnth bit
bvalue to set
Returns
error code

Definition at line 511 of file BitRefManager.cpp.

512  {
513  MoFEM::Interface &m_field = cOre;
515  std::vector<const BitRefLevel *> ents_bits_vec;
516  CHKERR RefEntity::getBitRefLevel(m_field.get_moab(), ents, ents_bits_vec);
517  for (std::vector<const BitRefLevel *>::iterator it = ents_bits_vec.begin();
518  it != ents_bits_vec.end(); ++it) {
519  const_cast<BitRefLevel &>(**it)[n] = b;
520  }
521  if (verb == VERY_NOISY) {
522  cerr << ents << endl;
523  }
525 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
static Index< 'n', 3 > n
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ setNthBitRefLevel() [2/2]

MoFEMErrorCode MoFEM::BitRefManager::setNthBitRefLevel ( const int  n,
const bool  b,
int  verb = 0 
) const

Set nth bit ref level.

Parameters
nnth bit
bvalue to set
Returns
error code

Definition at line 527 of file BitRefManager.cpp.

528  {
529  MoFEM::Interface &m_field = cOre;
530  auto ref_ents_ptr = m_field.get_ref_ents();
532  RefEntity_multiIndex::iterator dit, hi_dit;
533  dit = ref_ents_ptr->begin();
534  hi_dit = ref_ents_ptr->end();
535  for (; dit != hi_dit; dit++) {
536  (*const_cast<RefEntity *>(dit->get())->getBitRefLevelPtr())[n] = b;
537  if (verb >= VERY_VERBOSE) {
538  cerr << **dit << endl;
539  }
540  }
542 }
Deprecated interface functions.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
static Index< 'n', 3 > n

◆ shiftLeftBitRef()

MoFEMErrorCode MoFEM::BitRefManager::shiftLeftBitRef ( const int  shift,
const BitRefLevel  mask = BitRefLevel().set(),
int  verb = -1 
) const

left shift bit ref levelthis results of deletion of entities on far left side

Note
Not implemented

Definition at line 544 of file BitRefManager.cpp.

546  {
548  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
550 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516

◆ shiftRightBitRef()

MoFEMErrorCode MoFEM::BitRefManager::shiftRightBitRef ( const int  shift,
const BitRefLevel  mask = BitRefLevel().set(),
int  verb = -1 
) const

right shift bit ref level

Examples
split_sideset.cpp.

Definition at line 552 of file BitRefManager.cpp.

554  {
555  MoFEM::Interface &m_field = cOre;
556  auto ref_ents_ptr = m_field.get_ref_ents();
558  RefEntity_change_right_shift right_shift(1, mask);
559  for (int ii = 0; ii < shift; ii++) {
560  // delete bits on the right which are shifted to zero
561  BitRefLevel delete_bits = BitRefLevel().set(0) & mask;
562  if (delete_bits.any()) {
563  CHKERR m_field.delete_ents_by_bit_ref(delete_bits, delete_bits, true,
564  verb);
565  }
566  for (RefEntity_multiIndex::iterator ent_it = ref_ents_ptr->begin();
567  ent_it != ref_ents_ptr->end(); ent_it++) {
568  if (verb > NOISY) {
570  MOFEM_LOG("BitRefSelf", Sev::noisy)
571  << (*ent_it)->getBitRefLevel() << " : ";
572  }
573  right_shift(const_cast<boost::shared_ptr<RefEntity> &>(*ent_it));
574  if (verb >= VERY_NOISY) {
576  MOFEM_LOG("BitRefSelf", Sev::noisy) << (*ent_it)->getBitRefLevel();
577  }
578  }
579  }
581 }
Deprecated interface functions.
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual MoFEMErrorCode delete_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY)=0
delete entities form mofem and moab database
#define CHKERR
Inline error check.
Definition: definitions.h:604
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ updateFieldMeshsetByEntitiesChildren() [1/2]

MoFEMErrorCode MoFEM::BitRefManager::updateFieldMeshsetByEntitiesChildren ( const BitRefLevel child_bit,
int  verb = 0 
)

update fields meshesets by child entities

Note
This calls updateMeshsetByEntitiesChildren for all entity types.

Definition at line 960 of file BitRefManager.cpp.

961  {
962  MoFEM::Interface &m_field = cOre;
963  moab::Interface &moab = m_field.get_moab();
964  auto fields_ptr = m_field.get_fields();
965  auto ref_ents_ptr = m_field.get_ref_ents();
967 
968  for (auto &fit : (*fields_ptr)) {
969 
970  const EntityHandle meshset = fit->getMeshset();
971  Range parent_ents;
972  CHKERR moab.get_entities_by_handle(meshset, parent_ents, true);
973 
974  if (verb >= VERY_VERBOSE) {
976  MOFEM_LOG("BitRefSelf", Sev::noisy) << "Parnets:" << std::endl
977  << parent_ents << std::endl;
978  }
979 
980  Range children_ents;
981  CHKERR updateRange(parent_ents, children_ents);
982  CHKERR filterEntitiesByRefLevel(child_bit, BitRefLevel().set(),
983  children_ents, verb);
984 
985  CHKERR moab.add_entities(meshset, children_ents);
986 
987  if (verb >= VERY_VERBOSE) {
989  MOFEM_LOG("BitRefSelf", Sev::noisy) << "Children: " << std::endl
990  << children_ents << std::endl;
991  }
992  }
994 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
MoFEMErrorCode updateRange(const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
Update range by prents.
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ updateFieldMeshsetByEntitiesChildren() [2/2]

MoFEMErrorCode MoFEM::BitRefManager::updateFieldMeshsetByEntitiesChildren ( const std::string  name,
const BitRefLevel child_bit,
int  verb = 0 
)

update field meshset by child entities

Definition at line 996 of file BitRefManager.cpp.

997  {
998  MoFEM::Interface &m_field = cOre;
999  moab::Interface &moab = m_field.get_moab();
1001 
1002  EntityHandle field_meshset = m_field.get_field_structure(name)->getMeshset();
1003 
1004  Range parent_ents;
1005  CHKERR moab.get_entities_by_handle(field_meshset, parent_ents, true);
1006 
1007  if (verb >= VERBOSE) {
1009  MOFEM_LOG("BitRefSelf", Sev::noisy) << "Parnets:" << endl
1010  << parent_ents << std::endl;
1011  }
1012 
1013  Range children_ents;
1014  CHKERR updateRange(parent_ents, children_ents);
1015  CHKERR filterEntitiesByRefLevel(child_bit, BitRefLevel().set(), children_ents,
1016  verb);
1017 
1018  CHKERR moab.add_entities(field_meshset, children_ents);
1019 
1020  if (verb >= VERBOSE) {
1022  MOFEM_LOG("BitRefSelf", Sev::noisy) << "Children: " << endl
1023  << children_ents << std::endl;
1024  }
1025 
1027 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
MoFEMErrorCode updateRange(const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
Update range by prents.
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
virtual const Field * get_field_structure(const std::string &name)=0
get field structure
EntityHandle getMeshset() const
Get field meshset.
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ updateFiniteElementMeshsetByEntitiesChildren()

MoFEMErrorCode MoFEM::BitRefManager::updateFiniteElementMeshsetByEntitiesChildren ( const std::string  name,
const BitRefLevel child_bit,
const EntityType  fe_ent_type,
int  verb = 0 
)

update finite element meshset by child entities

Definition at line 1029 of file BitRefManager.cpp.

1031  {
1032  MoFEM::Interface &m_field = cOre;
1034  EntityHandle meshset = m_field.get_finite_element_meshset(name);
1035  CHKERR updateMeshsetByEntitiesChildren(meshset, child_bit, meshset,
1036  fe_ent_type, false, verb);
1038 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
MoFEMErrorCode updateMeshsetByEntitiesChildren(const EntityHandle parent, const BitRefLevel &parent_bit, const BitRefLevel &parent_mask, const BitRefLevel &child_bit, const BitRefLevel &child_mask, const EntityHandle child, EntityType child_type, const bool recursive=false, int verb=0)
Get child entities form meshset containing parent entitiesSearch for refined entities of given type w...
#define CHKERR
Inline error check.
Definition: definitions.h:604
virtual EntityHandle get_finite_element_meshset(const std::string &name) const =0
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ updateMeshsetByEntitiesChildren() [1/2]

MoFEMErrorCode MoFEM::BitRefManager::updateMeshsetByEntitiesChildren ( const EntityHandle  parent,
const BitRefLevel parent_bit,
const BitRefLevel parent_mask,
const BitRefLevel child_bit,
const BitRefLevel child_mask,
const EntityHandle  child,
EntityType  child_type,
const bool  recursive = false,
int  verb = 0 
)

Get child entities form meshset containing parent entitiesSearch for refined entities of given type whose parent are entities in the parent meshset. It can be used for example to transfer information about boundary conditions to refined mesh or split mesh by interface elements. It is used by function refine_MESHSET, to update MESHSET finite elements.

Parameters
parentmeshset
parent_bitrefinement level
maskof parent bit ref level
child_bitrefinement level
maskof child bit ref level
typeof refined entity
child_typemeshset where child entities are stored (if the child meshset is set to be the parent meshset, the parent would be updated with the refined entities)
recursiveif true parent meshset is searched recursively
Examples
split_sideset.cpp.

Definition at line 926 of file BitRefManager.cpp.

930  {
931  MoFEM::Interface &m_field = cOre;
932  moab::Interface &moab = m_field.get_moab();
934  Range parent_ents;
935  CHKERR moab.get_entities_by_handle(parent, parent_ents, recursive);
936  CHKERR filterEntitiesByRefLevel(parent_bit, parent_mask, parent_ents, verb);
937  if (verb >= VERY_VERBOSE) {
939  MOFEM_LOG("BitRefSelf", Sev::noisy) << "Parnets: " << parent;
940  }
941  Range children_ents;
942  CHKERR updateRange(parent_ents, children_ents);
943  CHKERR filterEntitiesByRefLevel(child_bit, BitRefLevel().set(), children_ents,
944  verb);
945  CHKERR moab.add_entities(child, children_ents);
947 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
MoFEMErrorCode updateRange(const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
Update range by prents.
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
#define MOFEM_LOG_FUNCTION()
Set scopeMacro for function scope markup. The scope name is constructed with help of compiler and con...
Definition: LogManager.hpp:320

◆ updateMeshsetByEntitiesChildren() [2/2]

MoFEMErrorCode MoFEM::BitRefManager::updateMeshsetByEntitiesChildren ( const EntityHandle  parent,
const BitRefLevel child_bit,
const EntityHandle  child,
EntityType  child_type,
const bool  recursive = false,
int  verb = 0 
)

Get child entities form meshset containing parent entities.

Note
this calls updateMeshsetByEntitiesChildren with setting masks and parent to parent_bit = parent_mask = BitRefLevel().set() and child_mask = child_bit.

Search for refined entities of given type whose parent are entities in the parent meshset. It can be used for example to transfer information about boundary conditions to refined mesh or split mesh by interface elements. It is used by function refine_MESHSET, to update MESHSET finite elements.

Parameters
parentmeshset
child_bitrefinement level
typeof refined entity
child_typemeshset where child entities are stored (if the child meshset is set to be the parent meshset, the parent would be updated with the refined entities)
recursiveif true parent meshset is searched recursively

Definition at line 949 of file BitRefManager.cpp.

952  {
955  parent, BitRefLevel().set(), BitRefLevel().set(), child_bit, child_bit,
956  child, child_type, recursive, verb);
958 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
MoFEMErrorCode updateMeshsetByEntitiesChildren(const EntityHandle parent, const BitRefLevel &parent_bit, const BitRefLevel &parent_mask, const BitRefLevel &child_bit, const BitRefLevel &child_mask, const EntityHandle child, EntityType child_type, const bool recursive=false, int verb=0)
Get child entities form meshset containing parent entitiesSearch for refined entities of given type w...
#define CHKERR
Inline error check.
Definition: definitions.h:604
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ updateRange()

MoFEMErrorCode MoFEM::BitRefManager::updateRange ( const Range &  parent,
Range &  child,
MoFEMTypes  bh = MF_ZERO 
)

Update range by prents.

FIXME: NOT TESTED

Parameters
parentparent range
childchildren range
Returns
error code

Definition at line 1040 of file BitRefManager.cpp.

1041  {
1042  MoFEM::Interface &m_field = cOre;
1043  auto ref_ents_ptr = m_field.get_ref_ents();
1045  auto &ref_ents =
1046  const_cast<RefEntity_multiIndex *>(ref_ents_ptr)->get<Ent_Ent_mi_tag>();
1047  std::vector<EntityHandle> child_ents_vec;
1048  child_ents_vec.reserve(ref_ents.size());
1049  for (Range::const_pair_iterator pit = parent_ents.const_pair_begin();
1050  pit != parent_ents.const_pair_end(); pit++) {
1051  const auto f = pit->first;
1052  auto it = ref_ents.lower_bound(f);
1053  if (it != ref_ents.end()) {
1054  const auto s = pit->second;
1055  auto hi_it = ref_ents.upper_bound(s);
1056  if (bh == MF_EXIST) {
1057  if (std::distance(it, hi_it) != (s - f) + 1) {
1058  SETERRQ2(
1059  PETSC_COMM_SELF, MOFEM_NOT_FOUND,
1060  "Number of entities and enties parents is diffrent %d != %d ",
1061  std::distance(it, hi_it), (s - f) + 1);
1062  }
1063  }
1064  for (; it != hi_it; it++) {
1065  if (it->get()->getEntType() == MBENTITYSET) {
1066  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
1067  "This should not happen; Entity should not have part of the "
1068  "meshset. It has no children.");
1069  }
1070  child_ents_vec.emplace_back((*it)->getEnt());
1071  }
1072  } else if (bh == MF_EXIST) {
1073  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "Entities not found");
1074  }
1075  }
1076  child_ents.insert_list(child_ents_vec.begin(), child_ents_vec.end());
1078 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415