v0.13.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
MoFEM::BitRefManager Struct Reference

Managing BitRefLevels. More...

#include <src/interfaces/BitRefManager.hpp>

Inheritance diagram for MoFEM::BitRefManager:
[legend]
Collaboration diagram for MoFEM::BitRefManager:
[legend]

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 BitRefManager (const MoFEM::Core &core)
 
virtual ~BitRefManager ()=default
 Destructor. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
virtual MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
 
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Public Attributes

MoFEM::CorecOre
 
bool dEbug
 

Setting and shifting bits

MoFEMErrorCode setBitRefLevel (const Range &ents, const BitRefLevel bit, const bool only_tets=true, int verb=0, Range *adj_ents_ptr=nullptr) const
 add entities to database and set bit ref level More...
 
MoFEMErrorCode setElementsBitRefLevel (const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
 add entities to database and set bit ref level More...
 
MoFEMErrorCode setEntitiesBitRefLevel (const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
 add entities to database and set bit ref level More...
 
MoFEMErrorCode 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 setBitRefLevelByDim (const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
 Set the Bit Ref Level By Dim object. More...
 
MoFEMErrorCode setBitRefLevelByType (const EntityHandle meshset, const EntityType type, const BitRefLevel bit, int verb=QUIET) const
 Set the Bit Ref Level By Type object. More...
 
MoFEMErrorCode setBitLevelToMeshset (const EntityHandle meshset, const BitRefLevel bit, int verb=0) const
 
MoFEMErrorCode 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 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 addBitRefLevel (const Range &ents, const BitRefLevel bit, int verb=QUIET) const
 add bit ref level to ref entity More...
 
MoFEMErrorCode addBitRefLevelByDim (const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
 add bit ref level by dimension More...
 
MoFEMErrorCode setNthBitRefLevel (const Range &ents, const int n, const bool b, int verb=QUIET) const
 Set nth bit ref level. More...
 
MoFEMErrorCode setNthBitRefLevel (const int n, const bool b, int verb=QUIET) const
 Set nth bit ref level to all entities in databse. More...
 
MoFEMErrorCode shiftLeftBitRef (const int shift, const BitRefLevel mask=BitRefLevel().set(), int verb=DEFAULT_VERBOSITY) const
 left shift bit ref levelthis results of deletion of entities on far left side More...
 
MoFEMErrorCode shiftRightBitRef (const int shift, const BitRefLevel mask=BitRefLevel().set(), int verb=DEFAULT_VERBOSITY, MoFEMTypes mf=MF_ZERO) const
 right shift bit ref level More...
 

Entity handlers by bit ref level

MoFEMErrorCode filterEntitiesByRefLevel (const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
 filter entities by bit ref level More...
 
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 More...
 
MoFEMErrorCode 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 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 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 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 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...
 
MoFEMErrorCode getEntitiesByParentType (const BitRefLevel bit, const BitRefLevel mask, const EntityType type, Range &ents, const int verb=QUIET) const
 get entities by bit ref level and type of parent More...
 
MoFEMErrorCode getAllEntitiesNotInDatabase (Range &ents) const
 Get all entities not in database. More...
 
MoFEMErrorCode filterEntitiesNotInDatabase (Range &ents) const
 Get entities not in database. More...
 

Get adjacencies bit ref level

virtual MoFEMErrorCode 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. More...
 
virtual MoFEMErrorCode 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. More...
 
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. More...
 
virtual MoFEMErrorCode 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. More...
 

Update meshsets and ranges by children

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 entities. More...
 
MoFEMErrorCode 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 updateFieldMeshsetByEntitiesChildren (const BitRefLevel &child_bit, int verb=0)
 update fields meshesets by child entities More...
 
MoFEMErrorCode updateFieldMeshsetByEntitiesChildren (const std::string name, const BitRefLevel &child_bit, int verb=0)
 update field meshset by child entities More...
 
MoFEMErrorCode 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 updateRangeByChildren (const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
 Update range by childresn. More...
 
MoFEMErrorCode updateRangeByParent (const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
 Update range by prents. More...
 
DEPRECATED MoFEMErrorCode updateRange (const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
 

Writting files

MoFEMErrorCode writeBitLevel (const BitRefLevel bit, const BitRefLevel mask, const char *file_name, const char *file_type, const char *options, const bool check_for_empty=true) const
 Write bit ref level to file. More...
 
MoFEMErrorCode writeBitLevelByDim (const BitRefLevel bit, const BitRefLevel mask, const int dim, const char *file_name, const char *file_type, const char *options, const bool check_for_empty=true) const
 Write bit ref level to file. More...
 
MoFEMErrorCode writeBitLevelByType (const BitRefLevel bit, const BitRefLevel mask, const EntityType type, const char *file_name, const char *file_type, const char *options, const bool check_for_empty=true) const
 Write bit ref level to file. More...
 
MoFEMErrorCode writeEntitiesNotInDatabase (const char *file_name, const char *file_type, const char *options, const bool check_for_empty=true) const
 Write ents not in database. More...
 
MoFEMErrorCode writeEntitiesAllBitLevelsByType (const BitRefLevel mask, const EntityType type, const char *file_name, const char *file_type, const char *options)
 Write all entities by bit levels and type. More...
 

Get tag handles to data on the mesh

Tag get_th_RefParentHandle () const
 
Tag get_th_RefBitLevel () const
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

Managing BitRefLevels.

Examples
Remodeling.cpp, bernstein_bezier_generate_base.cpp, build_large_problem.cpp, build_problems.cpp, child_and_parent.cpp, continuity_check_on_contact_prism_side_ele.cpp, continuity_check_on_skeleton_3d.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, field_blas.cpp, field_to_vertices.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, hanging_node_approx.cpp, hcurl_divergence_operator_2d.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, mesh_smoothing.cpp, minimal_surface_area.cpp, navier_stokes.cpp, nonlinear_dynamics.cpp, plot_base.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, remove_entities_from_problem.cpp, remove_entities_from_problem_not_partitioned.cpp, simple_contact.cpp, simple_contact_thermal.cpp, split_sideset.cpp, test_jacobian_of_simple_contact_element.cpp, and unsaturated_transport.cpp.

Definition at line 21 of file BitRefManager.hpp.

Constructor & Destructor Documentation

◆ BitRefManager()

MoFEM::BitRefManager::BitRefManager ( const MoFEM::Core core)

Definition at line 17 of file BitRefManager.cpp.

18 : cOre(const_cast<MoFEM::Core &>(core)), dEbug(false) {
19
20 if (!LogManager::checkIfChannelExist("BitRefSelf")) {
21 auto core_log = logging::core::get();
22 core_log->add_sink(
24 LogManager::setLog("BitRefSelf");
25 core_log->add_sink(
27 LogManager::setLog("BitRefWorld");
28 core_log->add_sink(
30 LogManager::setLog("BitRefSync");
31 MOFEM_LOG_TAG("BitRefSelf", "BitRefManager");
32 MOFEM_LOG_TAG("BitRefWorld", "BitRefManager");
33 MOFEM_LOG_TAG("BitRefSync", "BitRefManager");
34 }
35
37 MOFEM_LOG("BitRefWorld", Sev::noisy) << "BitRefManager interface created";
38}
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:364
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:301
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:332
#define MOFEM_LOG_FUNCTION()
Set scope.
Definition: LogManager.hpp:318
Core (interface) class.
Definition: Core.hpp:82
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:279
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:323
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:327
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:374
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:319

◆ ~BitRefManager()

virtual MoFEM::BitRefManager::~BitRefManager ( )
virtualdefault

Destructor.

Member Function Documentation

◆ filterEntitiesByRefLevel()

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

filter entities by bit ref level

Parameters
bit
mask
ents
QUIET
Returns
MoFEMErrorCode
Examples
hanging_node_approx.cpp.

Definition at line 740 of file BitRefManager.cpp.

743 {
744 MoFEM::Interface &m_field = cOre;
745 moab::Interface &moab(m_field.get_moab());
747
748 std::vector<EntityHandle> ents_vec;
749 ents_vec.reserve(ents.size());
750
751 std::vector<BitRefLevel *> tags_bits_ptr_vec(ents.size());
752
753 Range swap_ents;
754 auto hint = swap_ents.begin();
755
756 for (Range::pair_iterator p_eit = ents.pair_begin(); p_eit != ents.pair_end();
757 ++p_eit) {
758
759 EntityHandle f = p_eit->first;
760 const EntityHandle s = p_eit->second;
761
762 // get bits on entities
763 rval = moab.tag_get_by_ptr(cOre.get_th_RefBitLevel(), Range(f, s),
764 (const void **)(&*tags_bits_ptr_vec.begin()));
765
766 if (rval == MB_SUCCESS) {
767
768 auto bit_it = tags_bits_ptr_vec.begin();
769
770 auto check = [&bit, &mask](const auto &entity_bit) -> bool {
771 return
772
773 (entity_bit & bit).any() &&
774
775 ((entity_bit & mask) == entity_bit);
776 };
777
778 while (f != s + 1) {
779
780 while (f != s + 1 && !check(**bit_it)) {
781 ++bit_it;
782 ++f;
783 }
784
785 if (f != s + 1) {
786
787 const EntityHandle start = f;
788
789 while (f != (s + 1) && check(**bit_it)) {
790 ++bit_it;
791 ++f;
792 };
793
794 hint = swap_ents.insert(hint, start, f - 1);
795 }
796 }
797 }
798 }
799
800 ents.swap(swap_ents);
801
803}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
auto bit
set bit
auto f
Definition: HenckyOps.hpp:5
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74
virtual moab::Interface & get_moab()=0
Tag get_th_RefBitLevel() const
Definition: Core.hpp:198
Deprecated interface functions.

◆ filterEntitiesNotInDatabase()

MoFEMErrorCode MoFEM::BitRefManager::filterEntitiesNotInDatabase ( Range ents) const

Get entities not in database.

Parameters
ents
Returns
MoFEMErrorCode

Definition at line 902 of file BitRefManager.cpp.

902 {
903 MoFEM::Interface &m_field = cOre;
904 auto ref_ents_ptr = m_field.get_ref_ents();
906 auto eit = ents.begin();
907 for (; eit != ents.end();) {
908 auto rit = ref_ents_ptr->get<Ent_mi_tag>().find(*eit);
909 if (rit != ref_ents_ptr->get<Ent_mi_tag>().end()) {
910 eit = ents.erase(eit);
911 } else {
912 eit++;
913 }
914 }
916}
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.

◆ get_th_RefBitLevel()

Tag MoFEM::BitRefManager::get_th_RefBitLevel ( ) const
inline

Definition at line 673 of file BitRefManager.hpp.

673{ return cOre.get_th_RefBitLevel(); }

◆ get_th_RefParentHandle()

Tag MoFEM::BitRefManager::get_th_RefParentHandle ( ) const
inline

Definition at line 670 of file BitRefManager.hpp.

670 {
672 }
Tag get_th_RefParentHandle() const
Definition: Core.hpp:197

◆ getAllEntitiesNotInDatabase()

MoFEMErrorCode MoFEM::BitRefManager::getAllEntitiesNotInDatabase ( Range ents) const

Get all entities not in database.

Parameters
ents
Returns
MoFEMErrorCode

Definition at line 892 of file BitRefManager.cpp.

892 {
893 MoFEM::Interface &m_field = cOre;
894 moab::Interface &moab = m_field.get_moab();
896 CHKERR moab.get_entities_by_handle(0, ents, false);
897 ents = subtract(ents, ents.subset_by_type(MBENTITYSET));
900}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEMErrorCode filterEntitiesNotInDatabase(Range &ents) const
Get entities not in database.

◆ getEntitiesByParentType()

MoFEMErrorCode MoFEM::BitRefManager::getEntitiesByParentType ( const BitRefLevel  bit,
const BitRefLevel  mask,
const EntityType  type,
Range ents,
const int  verb = QUIET 
) const

get entities by bit ref level and type of parent

Note
Entities have to be added to MoFEM database
Parameters
BitRefLevelbitLevel
BitRefLevelmask
typeof parent
entsreturned ents
Returns
error code

Definition at line 867 of file BitRefManager.cpp.

871 {
872 MoFEM::Interface &m_field = cOre;
873 auto ref_ents_ptr = m_field.get_ref_ents();
875 auto &ref_ents = ref_ents_ptr->get<Ent_Ent_mi_tag>();
876 auto it = ref_ents.lower_bound(get_id_for_min_type(type));
877 auto hi_it = ref_ents.upper_bound(get_id_for_max_type(type));
878 std::vector<EntityHandle> ents_vec;
879 ents_vec.reserve(std::distance(it, hi_it));
880 for (; it != hi_it; it++) {
881 const BitRefLevel &ent_bit = it->get()->getBitRefLevel();
882 if ((ent_bit & mask) == ent_bit && (ent_bit & bit).any())
883 ents_vec.emplace_back(it->get()->getEnt());
884 }
885 ents.insert_list(ents_vec.begin(), ents_vec.end());
886 if (verb > NOISY)
887 MOFEM_LOG("BitRefSelf", Sev::noisy)
888 << "getEntitiesByParentType: " << ents << endl;
890}
@ NOISY
Definition: definitions.h:211
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
EntityHandle get_id_for_max_type()
EntityHandle get_id_for_min_type()

◆ query_interface()

MoFEMErrorCode MoFEM::BitRefManager::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Implements MoFEM::UnknownInterface.

Definition at line 10 of file BitRefManager.cpp.

11 {
13 *iface = const_cast<BitRefManager *>(this);
15}
BitRefManager(const MoFEM::Core &core)

◆ writeBitLevel()

MoFEMErrorCode MoFEM::BitRefManager::writeBitLevel ( const BitRefLevel  bit,
const BitRefLevel  mask,
const char *  file_name,
const char *  file_type,
const char *  options,
const bool  check_for_empty = true 
) const

Write bit ref level to file.

Parameters
bitbit ref level
maskmask of bit ref level
dimdimension
file_namefile name (see moab documentation)
file_typefile type (see moab documentation)
optionsfile options (see moab documentation)
Returns
error code

Definition at line 628 of file BitRefManager.cpp.

633 {
634 MoFEM::Interface &m_field = cOre;
635 moab::Interface &moab(m_field.get_moab());
637 EntityHandle meshset;
638 CHKERR moab.create_meshset(MESHSET_SET, meshset);
639 CHKERR getEntitiesByRefLevel(bit, mask, meshset);
640 int nb_ents;
641 CHKERR moab.get_number_entities_by_handle(meshset, nb_ents, true);
642 if (check_for_empty && !nb_ents) {
643 MOFEM_LOG("SELF", Sev::warning)
644 << "No entities to save < " << file_name << " > in writeBitLevel";
646 }
647
648 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
649 CHKERR moab.delete_entities(&meshset, 1);
651}
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

◆ writeBitLevelByDim()

MoFEMErrorCode MoFEM::BitRefManager::writeBitLevelByDim ( const BitRefLevel  bit,
const BitRefLevel  mask,
const int  dim,
const char *  file_name,
const char *  file_type,
const char *  options,
const bool  check_for_empty = true 
) const

Write bit ref level to file.

Parameters
bitbit ref level
maskmask of bit ref level
dimdimension
file_namefile name (see moab documentation)
file_typefile type (see moab documentation)
optionsfile options (see moab documentation)
Returns
error code
Examples
hanging_node_approx.cpp.

Definition at line 654 of file BitRefManager.cpp.

657 {
658 MoFEM::Interface &m_field = cOre;
659 moab::Interface &moab(m_field.get_moab());
661 Range ents;
663 if (check_for_empty && ents.empty()) {
664 MOFEM_LOG("SELF", Sev::warning)
665 << "No entities to save < " << file_name << " > in writeBitLevelByDim";
667 }
668 EntityHandle meshset;
669 CHKERR moab.create_meshset(MESHSET_SET, meshset);
670 CHKERR moab.add_entities(meshset, ents);
671 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
672 CHKERR moab.delete_entities(&meshset, 1);
674}
const int dim
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

◆ writeBitLevelByType()

MoFEMErrorCode MoFEM::BitRefManager::writeBitLevelByType ( const BitRefLevel  bit,
const BitRefLevel  mask,
const EntityType  type,
const char *  file_name,
const char *  file_type,
const char *  options,
const bool  check_for_empty = true 
) const

Write bit ref level to file.

Parameters
bitbit ref level
maskmask of bit ref level
typetype of entity
file_namefile name (see moab documentation)
file_typefile type (see moab documentation)
optionsfile options (see moab documentation)
Returns
error code

Definition at line 676 of file BitRefManager.cpp.

679 {
680 MoFEM::Interface &m_field = cOre;
681 moab::Interface &moab(m_field.get_moab());
683 Range ents;
684 CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents);
685 if (check_for_empty && ents.empty()) {
686 MOFEM_LOG("SELF", Sev::warning)
687 << "No entities to save < " << file_name << " > in writeBitLevelByType";
689 }
690 EntityHandle meshset;
691 CHKERR moab.create_meshset(MESHSET_SET, meshset);
692 CHKERR moab.add_entities(meshset, ents);
693 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
694 CHKERR moab.delete_entities(&meshset, 1);
696}
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

◆ writeEntitiesAllBitLevelsByType()

MoFEMErrorCode MoFEM::BitRefManager::writeEntitiesAllBitLevelsByType ( const BitRefLevel  mask,
const EntityType  type,
const char *  file_name,
const char *  file_type,
const char *  options 
)

Write all entities by bit levels and type.

Parameters
mask
type
file_name
file_type
options
Returns
MoFEMErrorCode

Definition at line 716 of file BitRefManager.cpp.

718 {
720 for (int ll = 0; ll != BITREFLEVEL_SIZE; ++ll) {
721 std::string name = boost::lexical_cast<std::string>(ll) + "_" + file_name;
722 CHKERR writeBitLevelByType(BitRefLevel().set(ll), mask, type, name.c_str(),
723 file_type, options, true);
724 }
726}
#define BITREFLEVEL_SIZE
max number of refinements
Definition: definitions.h:219
MoFEMErrorCode writeBitLevelByType(const BitRefLevel bit, const BitRefLevel mask, const EntityType type, const char *file_name, const char *file_type, const char *options, const bool check_for_empty=true) const
Write bit ref level to file.

◆ writeEntitiesNotInDatabase()

MoFEMErrorCode MoFEM::BitRefManager::writeEntitiesNotInDatabase ( const char *  file_name,
const char *  file_type,
const char *  options,
const bool  check_for_empty = true 
) const

Write ents not in database.

Parameters
file_name
file_typefor example "VTK"
options
check_for_empty
Returns
MoFEMErrorCode

Definition at line 698 of file BitRefManager.cpp.

700 {
701 MoFEM::Interface &m_field = cOre;
702 moab::Interface &moab(m_field.get_moab());
704 EntityHandle meshset;
705 Range ents;
707 if (check_for_empty && ents.empty())
709 CHKERR moab.create_meshset(MESHSET_SET, meshset);
710 CHKERR moab.add_entities(meshset, ents);
711 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
712 CHKERR moab.delete_entities(&meshset, 1);
714}
MoFEMErrorCode getAllEntitiesNotInDatabase(Range &ents) const
Get all entities not in database.

Member Data Documentation

◆ cOre

MoFEM::Core& MoFEM::BitRefManager::cOre

Definition at line 26 of file BitRefManager.hpp.

◆ dEbug

bool MoFEM::BitRefManager::dEbug

Definition at line 27 of file BitRefManager.hpp.


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