v0.9.2
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)
 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 437 of file BitRefManager.cpp.

439  {
440  MoFEM::Interface &m_field = cOre;
442  std::vector<const BitRefLevel *> ents_bits_vec;
443  CHKERR RefEntity::getBitRefLevel(m_field.get_moab(), ents, ents_bits_vec);
444  for (auto it : ents_bits_vec)
445  const_cast<BitRefLevel &>(*it) |= bit;
447 }
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 449 of file BitRefManager.cpp.

452  {
453  MoFEM::Interface &m_field = cOre;
454  moab::Interface &moab = m_field.get_moab();
455  Range ents, adj;
457  CHKERR moab.get_entities_by_dimension(meshset, dim, ents, true);
458  for (int dd = dim - 1; dd >= 0; dd--) {
459  CHKERR moab.get_adjacencies(ents, dd, false, adj, moab::Interface::UNION);
460  }
461  ents.merge(adj);
462  if (verb == VERY_NOISY) {
463  cerr << ents << endl;
464  }
465  CHKERR addBitRefLevel(ents, bit, verb);
467 }
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 MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:602
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 376 of file BitRefManager.cpp.

378  {
380  Range ents;
381  CHKERR getEntitiesByDimAndRefLevel(bit, mask, dim, ents);
384 }
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:483
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 366 of file BitRefManager.cpp.

368  {
370  Range ents;
371  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents);
374 }
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 833 of file BitRefManager.cpp.

836  {
838  BitRefLevel bit = problem_ptr->getBitRefLevel();
839  CHKERR getAdjacencies(bit, from_entities, num_entities, to_dimension,
840  adj_entities, operation_type);
842 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
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 844 of file BitRefManager.cpp.

847  {
848  MoFEM::Interface &m_field = cOre;
849  moab::Interface &moab(m_field.get_moab());
851  if (verb > QUIET) {
852  std::ostringstream ss;
853  ss << "from: " << bit << std::endl << "to: " << std::endl;
854  PetscPrintf(PETSC_COMM_SELF, ss.str().c_str());
855  }
856  CHKERR moab.get_adjacencies(from_entities, num_entities, to_dimension, false,
857  adj_entities, operation_type);
858  std::vector<BitRefLevel> bit_levels(adj_entities.size());
859  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
860  &*bit_levels.begin());
861  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
862  // std::cerr << "to:\n";
863  for (Range::iterator eit = adj_entities.begin(); eit != adj_entities.end();
864  b_it++) {
865  if (verb > VERBOSE) {
866  RefEntity adj_entity(m_field.get_basic_entity_data_ptr(), *eit);
867  std::ostringstream ss;
868  ss << "\t" << adj_entity.getBitRefLevel() << " : " << adj_entity
869  << std::endl;
870  PetscPrintf(PETSC_COMM_SELF, ss.str().c_str());
871  }
872  if (!((*b_it) & bit).any()) {
873  eit = adj_entities.erase(eit);
874  } else {
875  eit++;
876  }
877  }
878  if (b_it != bit_levels.end()) {
879  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
880  }
882 }
Deprecated interface functions.
Tag get_th_RefBitLevel() const
Definition: Core.hpp:151
virtual moab::Interface & get_moab()=0
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 807 of file BitRefManager.cpp.

809  {
810  MoFEM::Interface &m_field = cOre;
811  moab::Interface &moab(m_field.get_moab());
813  BitRefLevel bit_from_entity;
814  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), &from_entity, 1,
815  &bit_from_entity);
816  CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension, false,
817  adj_entities);
818  std::vector<BitRefLevel> bit_levels(adj_entities.size());
819  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
820  &*bit_levels.begin());
821  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
822  Range::iterator eit = adj_entities.begin();
823  for (; eit != adj_entities.end(); b_it++) {
824  if (!(bit_from_entity & (*b_it)).any()) {
825  eit = adj_entities.erase(eit);
826  } else {
827  eit++;
828  }
829  }
831 }
Deprecated interface functions.
Tag get_th_RefBitLevel() const
Definition: Core.hpp:151
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
#define CHKERR
Inline error check.
Definition: definitions.h:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879

◆ 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 781 of file BitRefManager.cpp.

783  {
784  MoFEM::Interface &m_field = cOre;
785  moab::Interface &moab(m_field.get_moab());
787  BitRefLevel bit_from_entity;
788  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), &from_entity, 1,
789  &bit_from_entity);
790  CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension, false,
791  adj_entities);
792  std::vector<BitRefLevel> bit_levels(adj_entities.size());
793  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
794  &*bit_levels.begin());
795  auto b_it = bit_levels.begin();
796  auto eit = adj_entities.begin();
797  for (; eit != adj_entities.end(); b_it++) {
798  if (bit_from_entity != *b_it) {
799  eit = adj_entities.erase(eit);
800  } else {
801  eit++;
802  }
803  }
805 }
Deprecated interface functions.
Tag get_th_RefBitLevel() const
Definition: Core.hpp:151
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 676 of file BitRefManager.cpp.

678  {
679  MoFEM::Interface &m_field = cOre;
680  moab::Interface &moab(m_field.get_moab());
682  Range ents;
683  CHKERR getEntitiesByDimAndRefLevel(bit, mask, dim, ents, verb);
684  CHKERR moab.add_entities(meshset, ents);
686 }
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:483
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:602
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 688 of file BitRefManager.cpp.

690  {
691  MoFEM::Interface &m_field = cOre;
692  moab::Interface &moab(m_field.get_moab());
694  CHKERR moab.get_entities_by_dimension(0, dim, ents, false);
695  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
697 }
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:483
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 699 of file BitRefManager.cpp.

702  {
703  MoFEM::Interface &m_field = cOre;
704  moab::Interface &moab(m_field.get_moab());
706  Range ents;
707  CHKERR getEntitiesByRefLevel(bit, mask, ents, verb);
708  CHKERR moab.add_entities(meshset, ents);
710 }
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 712 of file BitRefManager.cpp.

715  {
716  MoFEM::Interface &m_field = cOre;
717  moab::Interface &moab(m_field.get_moab());
719  Range meshset_ents;
720  CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshset_ents, false);
721  CHKERR moab.get_entities_by_handle(0, ents, false);
722  ents.merge(meshset_ents);
723  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
725 }
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 587 of file BitRefManager.cpp.

589  {
590  MoFEM::Interface &m_field = cOre;
591  moab::Interface &moab(m_field.get_moab());
593  Range ents;
594  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents, verb);
595  CHKERR moab.add_entities(meshset, ents);
597 }
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 665 of file BitRefManager.cpp.

667  {
668  MoFEM::Interface &m_field = cOre;
669  moab::Interface &moab(m_field.get_moab());
671  CHKERR moab.get_entities_by_type(0, type, ents, false);
672  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
674 }
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 386 of file BitRefManager.cpp.

388  {
389  MoFEM::Interface &m_field = cOre;
390  auto ref_ents_ptr = m_field.get_ref_ents();
391  auto ref_fe_ptr = m_field.get_ref_finite_elements();
393  // Add ref entity
394  std::pair<RefEntity_multiIndex::iterator, bool> p_ent =
395  const_cast<RefEntity_multiIndex *>(ref_ents_ptr)
396  ->insert(boost::shared_ptr<RefEntity>(
397  new RefEntity(m_field.get_basic_entity_data_ptr(), meshset)));
398  *(const_cast<RefEntity *>(p_ent.first->get())->getBitRefLevelPtr()) |= bit;
399  // Add ref element
400  boost::shared_ptr<RefElement> fe_ptr =
401  boost::shared_ptr<RefElement>(new RefElement_MESHSET(*p_ent.first));
402  std::pair<RefElement_multiIndex::iterator, bool> p_fe =
403  const_cast<RefElement_multiIndex *>(ref_fe_ptr)->insert(fe_ptr);
404  if (verb > 0) {
405  std::ostringstream ss;
406  ss << "add meshset as ref_ent " << **p_fe.first << std::endl;
407  PetscPrintf(PETSC_COMM_SELF, ss.str().c_str());
408  }
410 }
Deprecated interface functions.
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:413

◆ 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 245 of file BitRefManager.cpp.

248  {
249  MoFEM::Interface &m_field = cOre;
250  auto ref_ents_ptr = m_field.get_ref_ents();
251  auto ref_fe_ptr = m_field.get_ref_finite_elements();
253 
254  if (verb > VERBOSE)
255  PetscSynchronizedPrintf(PETSC_COMM_SELF, "nb. entities to add %d\n",
256  ents.size());
257 
258  CHKERR setElementsBitRefLevel(ents, bit, verb);
259 
260  if (!ents.empty()) {
261  for (int d = 3; d >= 1; --d) {
262  Range dim_ents;
263  if (only_tets && d == 3) {
264  dim_ents = ents.subset_by_type(MBTET);
265  } else {
266  dim_ents = ents.subset_by_dimension(d);
267  }
268  if (!dim_ents.empty()) {
269  for (int dd = 0; dd < d; ++dd) {
270  Range adj_ents;
271  CHKERR m_field.get_moab().get_adjacencies(
272  dim_ents, dd, true, adj_ents, moab::Interface::UNION);
273  for (Range::pair_iterator pit = adj_ents.pair_begin();
274  pit != adj_ents.pair_end(); ++pit) {
275  Range seed_ents_range;
276  // get first and last element of range
277  EntityHandle f = pit->first;
278  EntityHandle s = pit->second;
279  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
280  .findEntsToAdd(f, s, seed_ents_range);
281  if (!seed_ents_range.empty()) {
282  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
283  .addEntsToDatabase(seed_ents_range);
284  }
285  }
286  }
287  }
288  }
289  }
290 
292 }
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:483
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:602
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:413

◆ 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 412 of file BitRefManager.cpp.

415  {
416  MoFEM::Interface &m_field = cOre;
418  Range ents;
419  CHKERR m_field.get_moab().get_entities_by_dimension(meshset, dim, ents,
420  false);
421  CHKERR setBitRefLevel(ents, bit, false, verb);
423 }
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:483
const int dim
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 425 of file BitRefManager.cpp.

428  {
429  MoFEM::Interface &m_field = cOre;
431  Range ents;
432  CHKERR m_field.get_moab().get_entities_by_type(meshset, type, ents, false);
433  CHKERR setBitRefLevel(ents, bit, false, verb);
435 }
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:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 294 of file BitRefManager.cpp.

296  {
297  MoFEM::Interface &m_field = cOre;
298  auto ref_ents_ptr = m_field.get_ref_ents();
299  auto ref_fe_ptr = m_field.get_ref_finite_elements();
301 
302  for (Range::const_pair_iterator pit = ents.pair_begin();
303  pit != ents.pair_end(); pit++) {
304  // get first and last element of range
305  EntityHandle f = pit->first;
306  EntityHandle s = pit->second;
307  Range seed_ents_range; // entities seeded not in database
308  // find ents to add
309  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
310  .findEntsToAdd(f, s, seed_ents_range);
311  // add elements
312  if (!seed_ents_range.empty()) {
313  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
314  .addEntsToDatabase(seed_ents_range);
315  }
316  Range seed_fe_range;
317  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
318  .findElementsToAdd(f, s, seed_fe_range);
319  if (!seed_fe_range.empty()) {
320  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
321  .addElementsToDatabase(seed_fe_range);
322  }
323  }
324 
326 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 328 of file BitRefManager.cpp.

330  {
331  MoFEM::Interface &m_field = cOre;
332  auto ref_ents_ptr = m_field.get_ref_ents();
333  auto ref_fe_ptr = m_field.get_ref_finite_elements();
335 
336  for (Range::const_pair_iterator pit = ents.pair_begin();
337  pit != ents.pair_end(); pit++) {
338  // get first and last element of range
339  EntityHandle f = pit->first;
340  EntityHandle s = pit->second;
341  Range seed_ents_range; // entities seeded not in database
342  // find ents to add
343  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
344  .findEntsToAdd(f, s, seed_ents_range);
345  // add elements
346  if (!seed_ents_range.empty()) {
347  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
348  .addEntsToDatabase(seed_ents_range);
349  }
350  }
352 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 354 of file BitRefManager.cpp.

355  {
356  MoFEM::Interface &m_field = cOre;
358  EntityHandle field_meshset = m_field.get_field_meshset(field_name);
359  Range field_ents;
360  CHKERR m_field.get_moab().get_entities_by_handle(field_meshset, field_ents,
361  true);
362  CHKERR setEntitiesBitRefLevel(field_ents, bit, verb);
364 }
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:483
virtual EntityHandle get_field_meshset(const std::string &name) const =0
get field meshset
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 469 of file BitRefManager.cpp.

470  {
471  MoFEM::Interface &m_field = cOre;
473  std::vector<const BitRefLevel *> ents_bits_vec;
474  CHKERR RefEntity::getBitRefLevel(m_field.get_moab(), ents, ents_bits_vec);
475  for (std::vector<const BitRefLevel *>::iterator it = ents_bits_vec.begin();
476  it != ents_bits_vec.end(); ++it) {
477  const_cast<BitRefLevel &>(**it)[n] = b;
478  }
479  if (verb == VERY_NOISY) {
480  cerr << ents << endl;
481  }
483 }
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
FTensor::Index< 'n', 2 > n
Definition: PlasticOps.hpp:68
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 485 of file BitRefManager.cpp.

486  {
487  MoFEM::Interface &m_field = cOre;
488  auto ref_ents_ptr = m_field.get_ref_ents();
490  RefEntity_multiIndex::iterator dit, hi_dit;
491  dit = ref_ents_ptr->begin();
492  hi_dit = ref_ents_ptr->end();
493  for (; dit != hi_dit; dit++) {
494  (*const_cast<RefEntity *>(dit->get())->getBitRefLevelPtr())[n] = b;
495  if (verb >= VERY_VERBOSE) {
496  cerr << **dit << endl;
497  }
498  }
500 }
Deprecated interface functions.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
FTensor::Index< 'n', 2 > n
Definition: PlasticOps.hpp:68
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:514

◆ 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 502 of file BitRefManager.cpp.

504  {
506  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
508 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514

◆ 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 510 of file BitRefManager.cpp.

512  {
513  MoFEM::Interface &m_field = cOre;
514  auto ref_ents_ptr = m_field.get_ref_ents();
516  RefEntity_change_right_shift right_shift(1, mask);
517  for (int ii = 0; ii < shift; ii++) {
518  // delete bits on the right which are shifted to zero
519  BitRefLevel delete_bits = BitRefLevel().set(0) & mask;
520  if (delete_bits.any()) {
521  CHKERR m_field.delete_ents_by_bit_ref(delete_bits, delete_bits, true,
522  verb);
523  }
524  for (RefEntity_multiIndex::iterator ent_it = ref_ents_ptr->begin();
525  ent_it != ref_ents_ptr->end(); ent_it++) {
526  if (verb > NOISY) {
527  std::cerr << (*ent_it)->getBitRefLevel() << " : ";
528  }
529  right_shift(const_cast<boost::shared_ptr<RefEntity> &>(*ent_it));
530  if (verb >= VERY_NOISY) {
531  std::cerr << (*ent_it)->getBitRefLevel() << std::endl;
532  }
533  }
534  }
536 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 941 of file BitRefManager.cpp.

942  {
943  MoFEM::Interface &m_field = cOre;
944  moab::Interface &moab = m_field.get_moab();
945  auto fields_ptr = m_field.get_fields();
946  auto ref_ents_ptr = m_field.get_ref_ents();
948 
949  for (auto &fit : (*fields_ptr)) {
950 
951  const EntityHandle meshset = fit->getMeshset();
952  Range parent_ents;
953  CHKERR moab.get_entities_by_handle(meshset, parent_ents, true);
954 
955  if (verb >= VERY_VERBOSE)
956  std::cerr << "Parnets:" << endl << parent_ents << std::endl;
957 
958  Range children_ents;
959  CHKERR updateRange(parent_ents, children_ents);
960  CHKERR filterEntitiesByRefLevel(child_bit, BitRefLevel().set(),
961  children_ents, verb);
962 
963  CHKERR moab.add_entities(meshset, children_ents);
964 
965  if (verb >= VERY_VERBOSE)
966  std::cerr << "Children: " << endl << children_ents << std::endl;
967  }
969 }
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
MoFEMErrorCode updateRange(const Range &parent, Range &child)
Update range by prents.
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:50
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 971 of file BitRefManager.cpp.

972  {
973  MoFEM::Interface &m_field = cOre;
974  moab::Interface &moab = m_field.get_moab();
976 
977  EntityHandle field_meshset = m_field.get_field_structure(name)->getMeshset();
978 
979  Range parent_ents;
980  CHKERR moab.get_entities_by_handle(field_meshset, parent_ents, true);
981 
982  if (verb >= VERY_VERBOSE)
983  std::cerr << "Parnets:" << endl << parent_ents << std::endl;
984 
985  Range children_ents;
986  CHKERR updateRange(parent_ents, children_ents);
987  CHKERR filterEntitiesByRefLevel(child_bit, BitRefLevel().set(), children_ents,
988  verb);
989 
990  CHKERR moab.add_entities(field_meshset, children_ents);
991 
992  if (verb >= VERY_VERBOSE)
993  std::cerr << "Children: " << endl << children_ents << std::endl;
994 
996 }
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:483
MoFEMErrorCode updateRange(const Range &parent, Range &child)
Update range by prents.
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:50
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
virtual const Field * get_field_structure(const std::string &name)=0
get field structure
EntityHandle getMeshset() const
Get field meshset.

◆ 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 998 of file BitRefManager.cpp.

1000  {
1001  MoFEM::Interface &m_field = cOre;
1003  EntityHandle meshset = m_field.get_finite_element_meshset(name);
1004  CHKERR updateMeshsetByEntitiesChildren(meshset, child_bit, meshset,
1005  fe_ent_type, false, verb);
1007 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:602
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:413

◆ 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 884 of file BitRefManager.cpp.

888  {
889  MoFEM::Interface &m_field = cOre;
890  moab::Interface &moab = m_field.get_moab();
891  auto ref_ents_ptr = m_field.get_ref_ents();
893  Range ents;
894  CHKERR moab.get_entities_by_handle(parent, ents, recursive);
895  CHKERR filterEntitiesByRefLevel(parent_bit, parent_mask, ents, verb);
896  if (verb >= VERY_VERBOSE) {
897  std::cerr << "Parnets:" << endl << parent << std::endl;
898  }
899  auto &ref_ents = const_cast<RefEntity_multiIndex *>(ref_ents_ptr)
900  ->get<Composite_ParentEnt_And_EntType_mi_tag>();
901  Range children_ents;
902 
903  auto check = [&child_bit, &child_mask](const auto &entity_bit) -> bool {
904  return
905 
906  (entity_bit & child_bit).any() &&
907 
908  ((entity_bit & child_mask) == entity_bit);
909  };
910  std::vector<EntityHandle> children_ents_vec;
911 
912  for (Range::pair_iterator pit = ents.pair_begin(); pit != ents.pair_end();
913  ++pit) {
914  const EntityHandle f = pit->first;
915  const EntityHandle s = pit->second;
916  auto lo_mit = ref_ents.lower_bound(boost::make_tuple(child_type, f));
917  auto hi_mit = ref_ents.upper_bound(boost::make_tuple(child_type, s));
918  children_ents_vec.clear();
919  children_ents_vec.reserve(std::distance(lo_mit, hi_mit));
920  for (; lo_mit != hi_mit; ++lo_mit)
921  if (check(*(*lo_mit)->getBitRefLevelPtr()))
922  children_ents_vec.emplace_back((*lo_mit)->getRefEnt());
923  children_ents.insert_list(children_ents_vec.begin(),
924  children_ents_vec.end());
925  }
926  CHKERR moab.add_entities(child, children_ents);
928 }
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:483
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
#define CHKERR
Inline error check.
Definition: definitions.h:602
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:1879
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ 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 930 of file BitRefManager.cpp.

933  {
936  parent, BitRefLevel().set(), BitRefLevel().set(), child_bit, child_bit,
937  child, child_type, recursive, verb);
939 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:602
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:50
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

◆ updateRange()

MoFEMErrorCode MoFEM::BitRefManager::updateRange ( const Range &  parent,
Range &  child 
)

Update range by prents.

FIXME: NOT TESTED

Parameters
parentparent range
childchildren range
Returns
error code

Definition at line 1009 of file BitRefManager.cpp.

1010  {
1011  MoFEM::Interface &m_field = cOre;
1012  auto ref_ents_ptr = m_field.get_ref_ents();
1014  auto &ref_ents =
1015  const_cast<RefEntity_multiIndex *>(ref_ents_ptr)->get<Ent_Ent_mi_tag>();
1016  std::vector<EntityHandle> child_ents_vec;
1017  child_ents_vec.reserve(ref_ents.size());
1018  for (Range::const_pair_iterator pit = parent_ents.const_pair_begin();
1019  pit != parent_ents.const_pair_end(); pit++) {
1020  auto it = ref_ents.lower_bound(pit->first);
1021  if (it != ref_ents.end()) {
1022  auto hi_it = ref_ents.upper_bound(pit->second);
1023  for (; it != hi_it; it++) {
1024  if (it->get()->getEntType() == MBENTITYSET) {
1025  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
1026  "this should not happen");
1027  }
1028  child_ents_vec.emplace_back((*it)->getRefEnt());
1029  }
1030  }
1031  }
1032  child_ents.insert_list(child_ents_vec.begin(), child_ents_vec.end());
1034 }
Deprecated interface functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
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:413