v0.9.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)
 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 445 of file BitRefManager.cpp.

447  {
448  MoFEM::Interface &m_field = cOre;
450  std::vector<const BitRefLevel *> ents_bits_vec;
451  CHKERR RefEntity::getBitRefLevel(m_field.get_moab(), ents, ents_bits_vec);
452  for (auto it : ents_bits_vec)
453  const_cast<BitRefLevel &>(*it) |= bit;
455 }
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

460  {
461  MoFEM::Interface &m_field = cOre;
462  moab::Interface &moab = m_field.get_moab();
463  Range ents, adj;
465  CHKERR moab.get_entities_by_dimension(meshset, dim, ents, true);
466  for (int dd = dim - 1; dd >= 0; dd--) {
467  CHKERR moab.get_adjacencies(ents, dd, false, adj, moab::Interface::UNION);
468  }
469  ents.merge(adj);
470  if (verb == VERY_NOISY) {
471  cerr << ents << endl;
472  }
473  CHKERR addBitRefLevel(ents, bit, verb);
475 }
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:477
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:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

384  {
386  Range ents;
387  CHKERR getEntitiesByDimAndRefLevel(bit, mask, dim, ents);
390 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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:407

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

374  {
376  Range ents;
377  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents);
380 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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:407

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

849  {
851  BitRefLevel bit = problem_ptr->getBitRefLevel();
852  CHKERR getAdjacencies(bit, from_entities, num_entities, to_dimension,
853  adj_entities, operation_type);
855 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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:407
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 857 of file BitRefManager.cpp.

860  {
861  MoFEM::Interface &m_field = cOre;
862  moab::Interface &moab(m_field.get_moab());
864  if (verb > QUIET) {
865  std::ostringstream ss;
866  ss << "from: " << bit << std::endl << "to: " << std::endl;
867  PetscPrintf(PETSC_COMM_SELF, ss.str().c_str());
868  }
869  CHKERR moab.get_adjacencies(from_entities, num_entities, to_dimension, false,
870  adj_entities, operation_type);
871  std::vector<BitRefLevel> bit_levels(adj_entities.size());
872  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
873  &*bit_levels.begin());
874  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
875  // std::cerr << "to:\n";
876  for (Range::iterator eit = adj_entities.begin(); eit != adj_entities.end();
877  b_it++) {
878  if (verb > VERBOSE) {
879  RefEntity adj_entity(m_field.get_basic_entity_data_ptr(), *eit);
880  std::ostringstream ss;
881  ss << "\t" << adj_entity.getBitRefLevel() << " : " << adj_entity
882  << std::endl;
883  PetscPrintf(PETSC_COMM_SELF, ss.str().c_str());
884  }
885  if (!((*b_it) & bit).any()) {
886  eit = adj_entities.erase(eit);
887  } else {
888  eit++;
889  }
890  }
891  if (b_it != bit_levels.end()) {
892  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
893  }
895 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

822  {
823  MoFEM::Interface &m_field = cOre;
824  moab::Interface &moab(m_field.get_moab());
826  BitRefLevel bit_from_entity;
827  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), &from_entity, 1,
828  &bit_from_entity);
829  CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension, false,
830  adj_entities);
831  std::vector<BitRefLevel> bit_levels(adj_entities.size());
832  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
833  &*bit_levels.begin());
834  std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
835  Range::iterator eit = adj_entities.begin();
836  for (; eit != adj_entities.end(); b_it++) {
837  if (!(bit_from_entity & (*b_it)).any()) {
838  eit = adj_entities.erase(eit);
839  } else {
840  eit++;
841  }
842  }
844 }
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:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
#define CHKERR
Inline error check.
Definition: definitions.h:596
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51

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

796  {
797  MoFEM::Interface &m_field = cOre;
798  moab::Interface &moab(m_field.get_moab());
800  BitRefLevel bit_from_entity;
801  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), &from_entity, 1,
802  &bit_from_entity);
803  CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension, false,
804  adj_entities);
805  std::vector<BitRefLevel> bit_levels(adj_entities.size());
806  CHKERR moab.tag_get_data(cOre.get_th_RefBitLevel(), adj_entities,
807  &*bit_levels.begin());
808  auto b_it = bit_levels.begin();
809  auto eit = adj_entities.begin();
810  for (; eit != adj_entities.end(); b_it++) {
811  if (bit_from_entity != *b_it) {
812  eit = adj_entities.erase(eit);
813  } else {
814  eit++;
815  }
816  }
818 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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:407

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

688  {
689  MoFEM::Interface &m_field = cOre;
690  moab::Interface &moab(m_field.get_moab());
692  Range ents;
693  CHKERR getEntitiesByDimAndRefLevel(bit, mask, dim, ents, verb);
694  CHKERR moab.add_entities(meshset, ents);
696 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

700  {
701  MoFEM::Interface &m_field = cOre;
702  moab::Interface &moab(m_field.get_moab());
704  CHKERR moab.get_entities_by_dimension(0, dim, ents, false);
705  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
707 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

712  {
713  MoFEM::Interface &m_field = cOre;
714  moab::Interface &moab(m_field.get_moab());
716  Range ents;
717  CHKERR getEntitiesByRefLevel(bit, mask, ents, verb);
718  CHKERR moab.add_entities(meshset, ents);
720 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

725  {
726  MoFEM::Interface &m_field = cOre;
727  moab::Interface &moab(m_field.get_moab());
729  Range meshset_ents;
730  CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshset_ents, false);
731  CHKERR moab.get_entities_by_handle(0, ents, false);
732  ents.merge(meshset_ents);
733  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
735 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

599  {
600  MoFEM::Interface &m_field = cOre;
601  moab::Interface &moab(m_field.get_moab());
603  Range ents;
604  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents, verb);
605  CHKERR moab.add_entities(meshset, ents);
607 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

677  {
678  MoFEM::Interface &m_field = cOre;
679  moab::Interface &moab(m_field.get_moab());
681  CHKERR moab.get_entities_by_type(0, type, ents, false);
682  CHKERR filterEntitiesByRefLevel(bit, mask, ents, verb);
684 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

394  {
395  MoFEM::Interface &m_field = cOre;
396  const RefEntity_multiIndex *ref_ents_ptr;
397  const RefElement_multiIndex *ref_fe_ptr;
399  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
400  CHKERR m_field.get_ref_finite_elements(&ref_fe_ptr);
401  // Add ref entity
402  std::pair<RefEntity_multiIndex::iterator, bool> p_ent =
403  const_cast<RefEntity_multiIndex *>(ref_ents_ptr)
404  ->insert(boost::shared_ptr<RefEntity>(
405  new RefEntity(m_field.get_basic_entity_data_ptr(), meshset)));
406  *(const_cast<RefEntity *>(p_ent.first->get())->getBitRefLevelPtr()) |= bit;
407  // Add ref element
408  boost::shared_ptr<RefElement> fe_ptr =
409  boost::shared_ptr<RefElement>(new RefElement_MESHSET(*p_ent.first));
410  std::pair<RefElement_multiIndex::iterator, bool> p_fe =
411  const_cast<RefElement_multiIndex *>(ref_fe_ptr)->insert(fe_ptr);
412  if (verb > 0) {
413  std::ostringstream ss;
414  ss << "add meshset as ref_ent " << **p_fe.first << std::endl;
415  PetscPrintf(PETSC_COMM_SELF, ss.str().c_str());
416  }
418 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getRefEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityType, &RefElement::getEntType > > > > RefElement_multiIndex
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
virtual MoFEMErrorCode get_ref_finite_elements(const RefElement_multiIndex **refined_finite_elements_ptr) const =0
Get ref finite elements multi-index form database.
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ 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  const RefEntity_multiIndex *ref_ents_ptr;
251  const RefElement_multiIndex *ref_fe_ptr;
253  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
254  CHKERR m_field.get_ref_finite_elements(&ref_fe_ptr);
255 
256  if (verb > VERBOSE)
257  PetscSynchronizedPrintf(PETSC_COMM_SELF, "nb. entities to add %d\n",
258  ents.size());
259 
260  CHKERR setElementsBitRefLevel(ents, bit, verb);
261 
262  if (!ents.empty()) {
263  for (int d = 3; d >= 1; --d) {
264  Range dim_ents;
265  if (only_tets && d == 3) {
266  dim_ents = ents.subset_by_type(MBTET);
267  } else {
268  dim_ents = ents.subset_by_dimension(d);
269  }
270  if (!dim_ents.empty()) {
271  for (int dd = 0; dd < d; ++dd) {
272  Range adj_ents;
273  CHKERR m_field.get_moab().get_adjacencies(
274  dim_ents, dd, true, adj_ents, moab::Interface::UNION);
275  for (Range::pair_iterator pit = adj_ents.pair_begin();
276  pit != adj_ents.pair_end(); ++pit) {
277  Range seed_ents_range;
278  // get first and last element of range
279  EntityHandle f = pit->first;
280  EntityHandle s = pit->second;
281  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
282  .findEntsToAdd(f, s, seed_ents_range);
283  if (!seed_ents_range.empty()) {
284  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
285  .addEntsToDatabase(seed_ents_range);
286  }
287  }
288  }
289  }
290  }
291  }
292 
294 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
virtual moab::Interface & get_moab()=0
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getRefEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityType, &RefElement::getEntType > > > > RefElement_multiIndex
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
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:596
virtual MoFEMErrorCode get_ref_finite_elements(const RefElement_multiIndex **refined_finite_elements_ptr) const =0
Get ref finite elements multi-index form database.
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
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:407

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

423  {
424  MoFEM::Interface &m_field = cOre;
426  Range ents;
427  CHKERR m_field.get_moab().get_entities_by_dimension(meshset, dim, ents,
428  false);
429  CHKERR setBitRefLevel(ents, bit, false, verb);
431 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

436  {
437  MoFEM::Interface &m_field = cOre;
439  Range ents;
440  CHKERR m_field.get_moab().get_entities_by_type(meshset, type, ents, false);
441  CHKERR setBitRefLevel(ents, bit, false, verb);
443 }
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

298  {
299  MoFEM::Interface &m_field = cOre;
300  const RefEntity_multiIndex *ref_ents_ptr;
301  const RefElement_multiIndex *ref_fe_ptr;
303  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
304  CHKERR m_field.get_ref_finite_elements(&ref_fe_ptr);
305 
306  for (Range::const_pair_iterator pit = ents.pair_begin();
307  pit != ents.pair_end(); pit++) {
308  // get first and last element of range
309  EntityHandle f = pit->first;
310  EntityHandle s = pit->second;
311  Range seed_ents_range; // entities seeded not in database
312  // find ents to add
313  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
314  .findEntsToAdd(f, s, seed_ents_range);
315  // add elements
316  if (!seed_ents_range.empty()) {
317  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
318  .addEntsToDatabase(seed_ents_range);
319  }
320  Range seed_fe_range;
321  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
322  .findElementsToAdd(f, s, seed_fe_range);
323  if (!seed_fe_range.empty()) {
324  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
325  .addElementsToDatabase(seed_fe_range);
326  }
327  }
328 
330 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getRefEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityType, &RefElement::getEntType > > > > RefElement_multiIndex
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
virtual MoFEMErrorCode get_ref_finite_elements(const RefElement_multiIndex **refined_finite_elements_ptr) const =0
Get ref finite elements multi-index form database.
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

334  {
335  MoFEM::Interface &m_field = cOre;
336  const RefEntity_multiIndex *ref_ents_ptr;
337  const RefElement_multiIndex *ref_fe_ptr;
339  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
340  CHKERR m_field.get_ref_finite_elements(&ref_fe_ptr);
341 
342  for (Range::const_pair_iterator pit = ents.pair_begin();
343  pit != ents.pair_end(); pit++) {
344  // get first and last element of range
345  EntityHandle f = pit->first;
346  EntityHandle s = pit->second;
347  Range seed_ents_range; // entities seeded not in database
348  // find ents to add
349  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
350  .findEntsToAdd(f, s, seed_ents_range);
351  // add elements
352  if (!seed_ents_range.empty()) {
353  CHKERR SetBitRefLevelTool(m_field, bit, ref_ents_ptr, ref_fe_ptr)
354  .addEntsToDatabase(seed_ents_range);
355  }
356  }
358 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getRefEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityType, &RefElement::getEntType > > > > RefElement_multiIndex
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
virtual MoFEMErrorCode get_ref_finite_elements(const RefElement_multiIndex **refined_finite_elements_ptr) const =0
Get ref finite elements multi-index form database.
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

361  {
362  MoFEM::Interface &m_field = cOre;
364  EntityHandle field_meshset = m_field.get_field_meshset(field_name);
365  Range field_ents;
366  CHKERR m_field.get_moab().get_entities_by_handle(field_meshset, field_ents,
367  true);
368  CHKERR setEntitiesBitRefLevel(field_ents, bit, verb);
370 }
MoFEMErrorCode setEntitiesBitRefLevel(const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
add entities to database and set bit ref level
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:477
virtual EntityHandle get_field_meshset(const std::string &name) const =0
get field meshset
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

478  {
479  MoFEM::Interface &m_field = cOre;
481  std::vector<const BitRefLevel *> ents_bits_vec;
482  CHKERR RefEntity::getBitRefLevel(m_field.get_moab(), ents, ents_bits_vec);
483  for (std::vector<const BitRefLevel *>::iterator it = ents_bits_vec.begin();
484  it != ents_bits_vec.end(); ++it) {
485  const_cast<BitRefLevel &>(**it)[n] = b;
486  }
487  if (verb == VERY_NOISY) {
488  cerr << ents << endl;
489  }
491 }
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
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:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

494  {
495  MoFEM::Interface &m_field = cOre;
496  const RefEntity_multiIndex *ref_ent_ptr;
498  ierr = m_field.get_ref_ents(&ref_ent_ptr);
499  RefEntity_multiIndex::iterator dit, hi_dit;
500  dit = ref_ent_ptr->begin();
501  hi_dit = ref_ent_ptr->end();
502  for (; dit != hi_dit; dit++) {
503  (*const_cast<RefEntity *>(dit->get())->getBitRefLevelPtr())[n] = b;
504  if (verb >= VERY_VERBOSE) {
505  cerr << **dit << endl;
506  }
507  }
509 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex

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

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

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

521  {
522  MoFEM::Interface &m_field = cOre;
523  const RefEntity_multiIndex *ref_ent_ptr;
525  CHKERR m_field.get_ref_ents(&ref_ent_ptr);
526  RefEntity_change_right_shift right_shift(1, mask);
527  for (int ii = 0; ii < shift; ii++) {
528  // delete bits on the right which are shifted to zero
529  BitRefLevel delete_bits = BitRefLevel().set(0) & mask;
530  if (delete_bits.any()) {
531  CHKERR m_field.delete_ents_by_bit_ref(delete_bits, delete_bits, true,
532  verb);
533  }
534  for (RefEntity_multiIndex::iterator ent_it = ref_ent_ptr->begin();
535  ent_it != ref_ent_ptr->end(); ent_it++) {
536  if (verb > NOISY) {
537  std::cerr << (*ent_it)->getBitRefLevel() << " : ";
538  }
539  right_shift(const_cast<boost::shared_ptr<RefEntity> &>(*ent_it));
540  if (verb >= VERY_NOISY) {
541  std::cerr << (*ent_it)->getBitRefLevel() << std::endl;
542  }
543  }
544  }
546 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
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:596
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

947  {
948  MoFEM::Interface &m_field = cOre;
949  moab::Interface &moab = m_field.get_moab();
950  const Field_multiIndex *fields_ptr;
951  const RefEntity_multiIndex *ref_ents_ptr;
953  CHKERR m_field.get_fields(&fields_ptr);
954  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
955 
956  for (auto &fit : (*fields_ptr)) {
957 
958  const EntityHandle meshset = fit->getMeshset();
959  Range parent_ents;
960  CHKERR moab.get_entities_by_handle(meshset, parent_ents, true);
961 
962  if (verb >= VERY_VERBOSE)
963  std::cerr << "Parnets:" << endl << parent_ents << std::endl;
964 
965  Range children_ents;
966  CHKERR updateRange(parent_ents, children_ents);
967  CHKERR filterEntitiesByRefLevel(child_bit, BitRefLevel().set(),
968  children_ents, verb);
969 
970  CHKERR moab.add_entities(meshset, children_ents);
971 
972  if (verb >= VERY_VERBOSE)
973  std::cerr << "Children: " << endl << children_ents << std::endl;
974  }
976 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
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:477
multi_index_container< boost::shared_ptr< Field >, indexed_by< hashed_unique< tag< BitFieldId_mi_tag >, const_mem_fun< Field, const BitFieldId &, &Field::getId >, HashBit< BitFieldId >, EqBit< BitFieldId > >, ordered_unique< tag< Meshset_mi_tag >, member< Field, EntityHandle, &Field::meshSet > >, ordered_unique< tag< FieldName_mi_tag >, const_mem_fun< Field, boost::string_ref, &Field::getNameRef > >, ordered_non_unique< tag< BitFieldId_space_mi_tag >, const_mem_fun< Field, FieldSpace, &Field::getSpace > > > > Field_multiIndex
Field_multiIndex for Field.
MoFEMErrorCode updateRange(const Range &parent, Range &child)
Update range by prents.
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
virtual MoFEMErrorCode get_fields(const Field_multiIndex **fields_ptr) const =0
Get fields multi-index from database.

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

979  {
980  MoFEM::Interface &m_field = cOre;
981  moab::Interface &moab = m_field.get_moab();
983 
984  EntityHandle field_meshset = m_field.get_field_structure(name)->getMeshset();
985 
986  Range parent_ents;
987  CHKERR moab.get_entities_by_handle(field_meshset, parent_ents, true);
988 
989  if (verb >= VERY_VERBOSE)
990  std::cerr << "Parnets:" << endl << parent_ents << std::endl;
991 
992  Range children_ents;
993  CHKERR updateRange(parent_ents, children_ents);
994  CHKERR filterEntitiesByRefLevel(child_bit, BitRefLevel().set(), children_ents,
995  verb);
996 
997  CHKERR moab.add_entities(field_meshset, children_ents);
998 
999  if (verb >= VERY_VERBOSE)
1000  std::cerr << "Children: " << endl << children_ents << std::endl;
1001 
1003 }
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:477
MoFEMErrorCode updateRange(const Range &parent, Range &child)
Update range by prents.
#define CHKERR
Inline error check.
Definition: definitions.h:596
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
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
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 1005 of file BitRefManager.cpp.

1007  {
1008  MoFEM::Interface &m_field = cOre;
1010  EntityHandle meshset = m_field.get_finite_element_meshset(name);
1011  CHKERR updateMeshsetByEntitiesChildren(meshset, child_bit, meshset,
1012  fe_ent_type, false, verb);
1014 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
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:596
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:407

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

901  {
902  MoFEM::Interface &m_field = cOre;
903  moab::Interface &moab = m_field.get_moab();
904  const RefEntity_multiIndex *ref_ents_ptr;
906  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
907  Range ents;
908  CHKERR moab.get_entities_by_handle(parent, ents, recursive);
909  CHKERR filterEntitiesByRefLevel(parent_bit, parent_mask, ents, verb);
910  if (verb >= VERY_VERBOSE) {
911  std::cerr << "Parnets:" << endl << parent << std::endl;
912  }
913  typedef RefEntity_multiIndex::index<
914  Composite_ParentEnt_And_EntType_mi_tag>::type RefEntsByComposite;
915  RefEntsByComposite &ref_ents =
916  const_cast<RefEntity_multiIndex *>(ref_ents_ptr)
917  ->get<Composite_ParentEnt_And_EntType_mi_tag>();
918  Range children_ents;
919  for (Range::pair_iterator pit = ents.pair_begin(); pit != ents.pair_end();
920  ++pit) {
921  const EntityHandle f = pit->first;
922  const EntityHandle s = pit->second;
923  auto lo_mit = ref_ents.lower_bound(boost::make_tuple(child_type, f));
924  auto hi_mit = ref_ents.upper_bound(boost::make_tuple(child_type, s));
925  insertOrdered(children_ents, RefEntExtractor(), lo_mit, hi_mit);
926  }
927  CHKERR filterEntitiesByRefLevel(child_bit, child_mask, children_ents, verb);
928  if (verb >= VERY_VERBOSE) {
929  std::cerr << "Children: " << endl << parent << std::endl;
930  }
931  CHKERR moab.add_entities(child, children_ents);
933 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
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:477
moab::Range::iterator insertOrdered(Range &r, Extractor, Iterator begin_iter, Iterator end_iter)
Insert ordered mofem multi-index into range.
Definition: Templates.hpp:590
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

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

938  {
941  parent, BitRefLevel().set(), BitRefLevel().set(), child_bit, child_bit,
942  child, child_type, recursive, verb);
944 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
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:596
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:407

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

1017  {
1018  MoFEM::Interface &m_field = cOre;
1019  const RefEntity_multiIndex *ref_ents_ptr;
1021  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
1022  auto &ref_ents =
1023  const_cast<RefEntity_multiIndex *>(ref_ents_ptr)->get<Ent_Ent_mi_tag>();
1024  std::vector<EntityHandle> child_ents_vec;
1025  child_ents_vec.reserve(ref_ents.size());
1026  for (Range::const_pair_iterator pit = parent_ents.const_pair_begin();
1027  pit != parent_ents.const_pair_end(); pit++) {
1028  auto it = ref_ents.lower_bound(pit->first);
1029  if (it != ref_ents.end()) {
1030  auto hi_it = ref_ents.upper_bound(pit->second);
1031  for (; it != hi_it; it++) {
1032  if (it->get()->getEntType() == MBENTITYSET) {
1033  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
1034  "this should not happen");
1035  }
1036  child_ents_vec.emplace_back((*it)->getRefEnt());
1037  }
1038  }
1039  }
1040  child_ents.insert_list(child_ents_vec.begin(), child_ents_vec.end());
1042 }
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407