17 : cOre(const_cast<
MoFEM::
Core &>(core)), dEbug(false) {
20 auto core_log = logging::core::get();
36 MOFEM_LOG(
"BitRefWorld", Sev::noisy) <<
"BitRefManager interface created";
60 Range &seed_ents_range)
const {
63 seed_ents_range.insert(f, s);
78 for (; rit != hi_rit; ++rit)
81 Range::iterator lo, hi = seed_ents_range.begin();
82 for (
auto pt = to_erase.pair_begin(); pt != to_erase.pair_end(); ++pt) {
83 lo = seed_ents_range.lower_bound(hi, seed_ents_range.end(), pt->first);
84 if (lo != seed_ents_range.end()) {
85 hi = seed_ents_range.upper_bound(lo, seed_ents_range.end(),
87 seed_ents_range.erase(lo, hi);
101 std::vector<boost::shared_ptr<RefEntity>> shared_ref_ents_vec;
102 shared_ref_ents_vec.reserve(seed_ents_range.size());
103 std::vector<const void *> tag_by_ptr;
104 for (Range::const_pair_iterator pit = seed_ents_range.pair_begin();
105 pit != seed_ents_range.pair_end(); pit++) {
110 boost::shared_ptr<std::vector<RefEntityTmp<N>>> ref_ents_vec(
112 ref_ents_vec->reserve(s - f + 1);
114 tag_by_ptr.resize(s - f + 1);
117 auto tag_parent_it = tag_by_ptr.begin();
118 for (
auto f :
Range(f, s)) {
119 ref_ents_vec->emplace_back(
128 tag_by_ptr.resize(s - f + 1);
131 for (
auto &v_bit_ptr : tag_by_ptr)
136 for (
auto &re : *ref_ents_vec)
137 shared_ref_ents_vec.emplace_back(ref_ents_vec,
140 if (!shared_ref_ents_vec.empty()) {
143 ->insert(shared_ref_ents_vec.begin(), shared_ref_ents_vec.end());
144 if ((
refEntsPtr->size() - s0) != shared_ref_ents_vec.size()) {
146 "Data inconsistency %ld != %ld",
refEntsPtr->size() - s0,
147 shared_ref_ents_vec.size());
172 Range &seed_fe_range)
const {
174 seed_fe_range.insert(f, s);
175 RefElement_multiIndex::iterator rit, hi_rit;
184 for (; rit != hi_rit; ++rit) {
185 seed_fe_range.erase(rit->get()->getEnt());
193 std::vector<boost::shared_ptr<RefElement>> shared_ref_fe_vec;
194 shared_ref_fe_vec.reserve(seed_fe_range.size());
196 for (Range::const_pair_iterator pit = seed_fe_range.const_pair_begin();
197 pit != seed_fe_range.const_pair_end(); ++pit) {
198 RefEntity_multiIndex::iterator rit, hi_rit;
200 hi_rit =
refEntsPtr->upper_bound(pit->second);
201 if (
static_cast<int>(std::distance(rit, hi_rit)) !=
202 static_cast<int>(pit->second - pit->first + 1)) {
204 "data inconsistency %ld != %ld", std::distance(rit, hi_rit),
205 pit->second - pit->first + 1);
207 switch ((*rit)->getEntType()) {
209 boost::shared_ptr<std::vector<RefElement_VERTEX>> ref_fe_vec =
210 boost::make_shared<std::vector<RefElement_VERTEX>>();
211 ref_fe_vec->reserve(pit->second - pit->first + 1);
212 for (; rit != hi_rit; ++rit) {
214 shared_ref_fe_vec.push_back(
215 boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
219 boost::shared_ptr<std::vector<RefElement_EDGE>> ref_fe_vec =
220 boost::make_shared<std::vector<RefElement_EDGE>>();
221 ref_fe_vec->reserve(pit->second - pit->first + 1);
222 for (; rit != hi_rit; ++rit) {
224 shared_ref_fe_vec.push_back(
225 boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
230 boost::shared_ptr<std::vector<RefElementFace>> ref_fe_vec =
231 boost::make_shared<std::vector<RefElementFace>>();
232 ref_fe_vec->reserve(pit->second - pit->first + 1);
233 for (; rit != hi_rit; ++rit) {
235 shared_ref_fe_vec.push_back(
236 boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
241 boost::shared_ptr<std::vector<RefElementVolume>> ref_fe_vec =
242 boost::make_shared<std::vector<RefElementVolume>>();
243 ref_fe_vec->reserve(pit->second - pit->first + 1);
244 for (; rit != hi_rit; ++rit) {
246 shared_ref_fe_vec.push_back(
247 boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
251 boost::shared_ptr<std::vector<RefElement_PRISM>> ref_fe_vec =
252 boost::make_shared<std::vector<RefElement_PRISM>>();
253 ref_fe_vec->reserve(pit->second - pit->first + 1);
254 for (; rit != hi_rit; ++rit) {
256 shared_ref_fe_vec.push_back(
257 boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
261 boost::shared_ptr<std::vector<RefElement_MESHSET>> ref_fe_vec =
262 boost::make_shared<std::vector<RefElement_MESHSET>>();
263 ref_fe_vec->reserve(pit->second - pit->first + 1);
264 for (; rit != hi_rit; ++rit) {
266 shared_ref_fe_vec.push_back(
267 boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
276 ->insert(shared_ref_fe_vec.begin(), shared_ref_fe_vec.end());
283 const bool only_tets,
int verb,
284 Range *adj_ents_ptr)
const {
291 MOFEM_LOG_C(
"BitRefSelf", Sev::noisy,
"Number of entities to add %d",
297 for (
int d = 3; d >= 1; --d) {
299 if (only_tets && d == 3) {
300 dim_ents = ents.subset_by_type(MBTET);
302 dim_ents = ents.subset_by_dimension(d);
307 " Number of dim %d entities to add %d", d,
310 if (!dim_ents.empty()) {
311 for (
int dd = 0; dd < d; ++dd) {
315 rval = m_field.
get_moab().get_connectivity(ents, adj_ents,
true);
320 adj_ents = adj_ents_ptr->subset_by_dimension(MBEDGE);
321 }
else if (dd == 2) {
322 adj_ents = adj_ents_ptr->subset_by_dimension(MBTRI);
326 dim_ents, dd,
true, adj_ents, moab::Interface::UNION);
333 " Number of dim %d adj entities for dim %d to add %d",
334 d, dd, adj_ents.size());
336 if (
rval == MB_MULTIPLE_ENTITIES_FOUND) {
337 auto log_message = [&](
const auto sev) {
341 <<
"When get adjacencies moab return MB_MULTIPLE_ENTITIES_ "
343 << dd <<
" and dim of entities " << d;
348 log_message(Sev::noisy);
350 log_message(Sev::warning);
355 for (Range::pair_iterator pit = adj_ents.pair_begin();
356 pit != adj_ents.pair_end(); ++pit) {
357 Range seed_ents_range;
363 if (!seed_ents_range.empty())
385 for (Range::const_pair_iterator pit = ents.pair_begin();
386 pit != ents.pair_end(); pit++) {
390 Range seed_ents_range;
395 if (!seed_ents_range.empty())
402 if (!seed_fe_range.empty()) {
410 <<
"Number of entities in database " << ref_ents_ptr->size();
412 <<
"Number of finite element entities in database " << ref_fe_ptr->size();
425 for (Range::const_pair_iterator pit = ents.pair_begin();
426 pit != ents.pair_end(); pit++) {
430 Range seed_ents_range;
435 if (!seed_ents_range.empty())
448 CHKERR m_field.
get_moab().get_entities_by_handle(field_meshset, field_ents,
482 std::pair<RefEntity_multiIndex::iterator, bool> p_ent =
484 ->insert(boost::shared_ptr<RefEntity>(
486 *(
const_cast<RefEntity *
>(p_ent.first->get())->getBitRefLevelPtr()) |=
bit;
488 boost::shared_ptr<RefElement> fe_ptr =
490 std::pair<RefElement_multiIndex::iterator, bool> p_fe =
495 <<
"Add meshset as ref_ent " << **p_fe.first;
507 CHKERR m_field.
get_moab().get_entities_by_dimension(meshset, dim, ents,
514 const EntityType type,
520 CHKERR m_field.
get_moab().get_entities_by_type(meshset, type, ents,
false);
529 auto get_ents = [&]() {
532 m_field.
get_moab().get_root_set(), ents,
true);
533 ents = subtract(ents, ents.subset_by_type(MBENTITYSET));
545 std::vector<const BitRefLevel *> ents_bits_vec;
547 auto eit = ents.begin();
548 for (
auto &it : ents_bits_vec) {
567 moab::Interface &moab = m_field.
get_moab();
570 CHKERR moab.get_entities_by_dimension(meshset, dim, ents,
true);
571 for (
int dd = dim - 1; dd >= 0; dd--)
572 CHKERR moab.get_adjacencies(ents, dd,
false, adj, moab::Interface::UNION);
575 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Add add bit ref level by dim";
581 const bool b,
int verb)
const {
583 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Set bit to " << ents;
591 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Set bit to all entities";
611 for (
int ii = 0; ii < shift; ii++) {
614 if (delete_bits.any()) {
618 for (RefEntity_multiIndex::iterator ent_it = ref_ents_ptr->begin();
619 ent_it != ref_ents_ptr->end(); ent_it++) {
623 << (*ent_it)->getBitRefLevel() <<
" : ";
625 right_shift(
const_cast<boost::shared_ptr<RefEntity> &
>(*ent_it));
628 MOFEM_LOG(
"BitRefSelf", Sev::noisy) << (*ent_it)->getBitRefLevel();
637 const char *file_name,
638 const char *file_type,
640 const bool check_for_empty)
const {
642 moab::Interface &moab(m_field.
get_moab());
645 CHKERR moab.create_meshset(MESHSET_SET, meshset);
648 CHKERR moab.get_number_entities_by_handle(meshset, nb_ents,
true);
649 if (check_for_empty && !nb_ents) {
651 <<
"No entities to save < " << file_name <<
" > in writeBitLevel";
655 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
656 CHKERR moab.delete_entities(&meshset, 1);
662 const int dim,
const char *file_name,
663 const char *file_type,
const char *options,
664 const bool check_for_empty)
const {
666 moab::Interface &moab(m_field.
get_moab());
670 if (check_for_empty && ents.empty()) {
672 <<
"No entities to save < " << file_name <<
" > in writeBitLevelByDim";
676 CHKERR moab.create_meshset(MESHSET_SET, meshset);
677 CHKERR moab.add_entities(meshset, ents);
678 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
679 CHKERR moab.delete_entities(&meshset, 1);
685 const char *file_name,
const char *file_type,
const char *options,
686 const bool check_for_empty)
const {
688 moab::Interface &moab(m_field.
get_moab());
692 if (check_for_empty && ents.empty()) {
694 <<
"No entities to save < " << file_name <<
" > in writeBitLevelByType";
698 CHKERR moab.create_meshset(MESHSET_SET, meshset);
699 CHKERR moab.add_entities(meshset, ents);
700 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
701 CHKERR moab.delete_entities(&meshset, 1);
706 const char *file_name,
const char *file_type,
const char *options,
707 const bool check_for_empty)
const {
709 moab::Interface &moab(m_field.
get_moab());
714 if (check_for_empty && ents.empty())
716 CHKERR moab.create_meshset(MESHSET_SET, meshset);
717 CHKERR moab.add_entities(meshset, ents);
718 CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
719 CHKERR moab.delete_entities(&meshset, 1);
724 const BitRefLevel mask,
const EntityType type,
const char *file_name,
725 const char *file_type,
const char *options) {
728 std::string name = boost::lexical_cast<std::string>(ll) +
"_" + file_name;
730 file_type, options,
true);
739 moab::Interface &moab(m_field.
get_moab());
743 CHKERR moab.add_entities(meshset, ents);
752 moab::Interface &moab(m_field.
get_moab());
755 std::vector<EntityHandle> ents_vec;
756 ents_vec.reserve(ents.size());
758 std::vector<BitRefLevel *> tags_bits_ptr_vec(ents.size());
761 auto hint = swap_ents.begin();
763 for (Range::pair_iterator p_eit = ents.pair_begin(); p_eit != ents.pair_end();
771 (
const void **)(&*tags_bits_ptr_vec.begin()));
773 if (
rval == MB_SUCCESS) {
775 auto bit_it = tags_bits_ptr_vec.begin();
777 auto check = [&
bit, &mask](
const auto &entity_bit) ->
bool {
780 (entity_bit &
bit).any() &&
782 ((entity_bit & mask) == entity_bit);
787 while (f != s + 1 && !check(**bit_it)) {
796 while (f != (s + 1) && check(**bit_it)) {
801 hint = swap_ents.insert(hint, start, f - 1);
807 ents.swap(swap_ents);
814 Range &ents,
int verb)
const {
816 moab::Interface &moab(m_field.
get_moab());
818 CHKERR moab.get_entities_by_type(0, type, ents,
false);
827 moab::Interface &moab(m_field.
get_moab());
831 CHKERR moab.add_entities(meshset, ents);
839 moab::Interface &moab(m_field.
get_moab());
841 CHKERR moab.get_entities_by_dimension(0, dim, ents,
false);
849 const int verb)
const {
851 moab::Interface &moab(m_field.
get_moab());
855 CHKERR moab.add_entities(meshset, ents);
862 const int verb)
const {
864 moab::Interface &moab(m_field.
get_moab());
867 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshset_ents,
false);
868 CHKERR moab.get_entities_by_handle(0, ents,
false);
869 ents.merge(meshset_ents);
876 const EntityType type,
878 const int verb)
const {
885 std::vector<EntityHandle> ents_vec;
886 ents_vec.reserve(std::distance(it, hi_it));
887 for (; it != hi_it; it++) {
888 const BitRefLevel &ent_bit = it->get()->getBitRefLevel();
889 if ((ent_bit & mask) == ent_bit && (ent_bit &
bit).any())
890 ents_vec.emplace_back(it->get()->getEnt());
892 ents.insert_list(ents_vec.begin(), ents_vec.end());
895 <<
"getEntitiesByParentType: " << ents << endl;
901 moab::Interface &moab = m_field.
get_moab();
903 CHKERR moab.get_entities_by_handle(0, ents,
false);
904 ents = subtract(ents, ents.subset_by_type(MBENTITYSET));
913 auto eit = ents.begin();
914 for (; eit != ents.end();) {
915 auto rit = ref_ents_ptr->get<
Ent_mi_tag>().find(*eit);
916 if (rit != ref_ents_ptr->get<
Ent_mi_tag>().end()) {
917 eit = ents.erase(eit);
927 const int to_dimension,
928 Range &adj_entities)
const {
930 moab::Interface &moab(m_field.
get_moab());
935 CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension,
false,
937 std::vector<BitRefLevel> bit_levels(adj_entities.size());
939 &*bit_levels.begin());
940 auto b_it = bit_levels.begin();
941 auto eit = adj_entities.begin();
942 for (; eit != adj_entities.end(); b_it++) {
943 if (bit_from_entity != *b_it) {
944 eit = adj_entities.erase(eit);
953 const int to_dimension,
954 Range &adj_entities)
const {
956 moab::Interface &moab(m_field.
get_moab());
961 CHKERR moab.get_adjacencies(&from_entity, 1, to_dimension,
false,
963 std::vector<BitRefLevel> bit_levels(adj_entities.size());
965 &*bit_levels.begin());
966 std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
967 Range::iterator eit = adj_entities.begin();
968 for (; eit != adj_entities.end(); b_it++) {
969 if (!(bit_from_entity & (*b_it)).any()) {
970 eit = adj_entities.erase(eit);
980 const int num_entities,
const int to_dimension,
Range &adj_entities,
981 const int operation_type,
const int verb)
const {
985 adj_entities, operation_type);
991 const int num_entities,
const int to_dimension,
Range &adj_entities,
992 const int operation_type,
const int verb)
const {
994 moab::Interface &moab(m_field.
get_moab());
1002 CHKERR moab.get_adjacencies(from_entities, num_entities, to_dimension,
false,
1003 adj_entities, operation_type);
1004 std::vector<BitRefLevel> bit_levels(adj_entities.size());
1006 &*bit_levels.begin());
1007 std::vector<BitRefLevel>::iterator b_it = bit_levels.begin();
1008 for (Range::iterator eit = adj_entities.begin(); eit != adj_entities.end();
1018 if (!((*b_it) &
bit).any()) {
1019 eit = adj_entities.erase(eit);
1024 if (b_it != bit_levels.end()) {
1034 EntityType child_type,
const bool recursive,
int verb) {
1036 moab::Interface &moab = m_field.
get_moab();
1039 CHKERR moab.get_entities_by_handle(parent, parent_ents, recursive);
1043 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Parents: " << parent;
1045 Range children_ents;
1047 if (child_type < MBMAXTYPE)
1048 children_ents = children_ents.subset_by_type(child_type);
1051 CHKERR moab.add_entities(child, children_ents);
1057 const EntityHandle child, EntityType child_type,
const bool recursive,
1062 child, child_type, recursive, verb);
1069 moab::Interface &moab = m_field.
get_moab();
1073 for (
auto &fit : (*fields_ptr)) {
1077 CHKERR moab.get_entities_by_handle(meshset, parent_ents,
true);
1081 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Parnets:" << std::endl
1082 << parent_ents << std::endl;
1085 Range children_ents;
1088 children_ents, verb);
1090 CHKERR moab.add_entities(meshset, children_ents);
1094 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Children: " << std::endl
1095 << children_ents << std::endl;
1102 const std::string name,
const BitRefLevel &child_bit,
int verb) {
1104 moab::Interface &moab = m_field.
get_moab();
1110 CHKERR moab.get_entities_by_handle(field_meshset, parent_ents,
true);
1114 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Parnets:" << endl
1115 << parent_ents << std::endl;
1118 Range children_ents;
1123 CHKERR moab.add_entities(field_meshset, children_ents);
1127 MOFEM_LOG(
"BitRefSelf", Sev::noisy) <<
"Children: " << endl
1128 << children_ents << std::endl;
1135 const std::string name,
const BitRefLevel &child_bit,
1136 const EntityType fe_ent_type,
int verb) {
1141 fe_ent_type,
false, verb);
1153 std::vector<EntityHandle> child_ents_vec;
1154 child_ents_vec.reserve(ref_ents.size());
1155 for (Range::const_pair_iterator pit = parent_ents.const_pair_begin();
1156 pit != parent_ents.const_pair_end(); pit++) {
1157 const auto f = pit->first;
1158 auto it = ref_ents.lower_bound(f);
1159 if (it != ref_ents.end()) {
1160 const auto s = pit->second;
1161 auto hi_it = ref_ents.upper_bound(s);
1163 if (std::distance(it, hi_it) != (s - f) + 1) {
1165 "Number of entities and entities parents is different %ld != "
1167 std::distance(it, hi_it), (s - f) + 1);
1170 for (; it != hi_it; it++) {
1172 if (it->get()->getEntType() == MBENTITYSET) {
1174 "This should not happen; Entity should not have part of the "
1175 "meshset. It has no children.");
1178 child_ents_vec.emplace_back((*it)->getEnt());
1184 child_ents.insert_list(child_ents_vec.begin(), child_ents_vec.end());
1196 std::vector<EntityHandle> parent_ents_vec;
1197 parent_ents_vec.reserve(ref_ents.size());
1198 for (Range::const_pair_iterator pit = child_ents.const_pair_begin();
1199 pit != child_ents.const_pair_end(); pit++) {
1200 const auto f = pit->first;
1201 auto it = ref_ents.lower_bound(f);
1202 if (it != ref_ents.end()) {
1203 const auto s = pit->second;
1204 auto hi_it = ref_ents.upper_bound(s);
1206 if (std::distance(it, hi_it) != (s - f) + 1) {
1208 "Number of entities and entities parents is different %ld != "
1210 std::distance(it, hi_it), (s - f) + 1);
1213 for (; it != hi_it; it++) {
1215 if (it->get()->getEntType() == MBENTITYSET) {
1217 "This should not happen; Entity should not have part of the "
1218 "meshset. It has no children.");
1221 auto parent = (*it)->getParentEnt();
1223 parent_ents_vec.emplace_back(parent);
1229 parent_ents.insert_list(parent_ents_vec.begin(), parent_ents_vec.end());
1240 if (
Tag th = 0; moab.tag_get_handle(
"_RefBitLevel",
th) == MB_SUCCESS) {
1244 auto get_old_tag = [&](
auto &&name) {
1247 "bit ref level handle does not exist");
1251 auto get_new_tag = [&](
auto &&name,
auto &&def_val) {
1255 MB_TAG_CREAT | MB_TAG_BYTES | MB_TAG_SPARSE, &def_val),
1256 "can not create tag");
1261 CHKERR moab.tag_get_length(get_old_tag(
"_RefBitLevel"), length);
1269 <<
"Fixing tag length";
1272 CHKERR moab.get_entities_by_type(0, MBENTITYSET, all_ents,
true);
1273 CHKERR moab.get_entities_by_handle(0, all_ents,
true);
1275 auto process_tag = [&](
auto &&name,
auto &&def_val) {
1277 auto tag_old = get_old_tag(name);
1278 auto get_bits = [&]() {
1279 std::vector<BitRefLevel> bits;
1280 bits.reserve(all_ents.size());
1281 auto it_bit = bits.begin();
1282 for (
auto e : all_ents) {
1285 CHKERR moab.tag_get_by_ptr(tag_old, &e, 1, (
const void **)&data,
1289 std::min(
sizeof(
BitRefLevel),
static_cast<size_t>(data_size)));
1294 auto bits = get_bits();
1295 CHKERR moab.tag_delete(tag_old);
1296 auto tag_new = get_new_tag(name, def_val);
1297 auto it_bit = bits.begin();
1298 for (
auto e : all_ents) {
1299 if (it_bit->any()) {
1300 CHKERR moab.tag_set_data(tag_new, &e, 1, &*it_bit);
#define MOFEM_LOG_C(channel, severity, format,...)
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
#define BITREFLEVEL_SIZE
max number of refinements
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
#define MAX_CORE_TMP
maximal number of cores
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
auto fun
Function to approximate.
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, 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, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getEnt > > > > RefElement_multiIndex
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
virtual const RefElement_multiIndex * get_ref_finite_elements() const =0
Get the ref finite elements object.
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.
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.
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
MoFEMErrorCode setElementsBitRefLevel(const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
add entities to database and set bit ref level
MoFEMErrorCode shiftRightBitRef(const int shift, const BitRefLevel mask=BitRefLevel().set(), int verb=DEFAULT_VERBOSITY, MoFEMTypes mf=MF_ZERO) const
right shift bit ref level
MoFEMErrorCode setEntitiesBitRefLevel(const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
add entities to database and set bit ref level
MoFEMErrorCode addBitRefLevel(const Range &ents, const BitRefLevel &bit, int verb=QUIET) const
add bit ref level to ref entity
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
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
MoFEMErrorCode setBitRefLevelByType(const EntityHandle meshset, const EntityType type, const BitRefLevel bit, int verb=QUIET) const
Set the Bit Ref Level By Type object.
MoFEMErrorCode addBitRefLevelByDim(const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
add bit ref level by dimension
MoFEMErrorCode setBitLevelToMeshset(const EntityHandle meshset, const BitRefLevel bit, int verb=0) const
MoFEMErrorCode setNthBitRefLevel(const Range &ents, const int n, const bool b, int verb=QUIET) const
Set nth bit ref level.
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,...
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
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,...
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.
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.
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
MoFEMErrorCode updateRangeByParent(const Range &child_ents, Range &parent_ents, MoFEMTypes bh=MF_ZERO)
Update range by parents.
MoFEMErrorCode lambdaBitRefLevel(boost::function< void(EntityHandle ent, BitRefLevel &bit)> fun) const
Process bit ref level by lambda function.
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
MoFEMErrorCode updateFieldMeshsetByEntitiesChildren(const BitRefLevel &child_bit, int verb=0)
update fields meshesets by child entities
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.
MoFEMErrorCode setBitRefLevelByDim(const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
Set the Bit Ref Level By Dim object.
MoFEMErrorCode updateRangeByChildren(const Range &parent, Range &child, MoFEMTypes bh=MF_ZERO)
Update range by childrens.
virtual EntityHandle get_finite_element_meshset(const std::string name) const =0
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
#define MOFEM_LOG_FUNCTION()
Set scope.
const double n
refractive index of diffusive medium
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
EntityHandle get_id_for_max_type()
EntityHandle get_id_for_min_type()
RefEntityTmp< 0 > RefEntity
moab::Range::iterator insertOrdered(Range &r, Extractor, Iterator begin_iter, Iterator end_iter)
Insert ordered mofem multi-index into range.
constexpr auto field_name
MoFEMErrorCode getAllEntitiesNotInDatabase(Range &ents) const
Get all entities not in database.
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.
static MoFEMErrorCode fixTagSize(moab::Interface &moab, bool *changed=nullptr)
Fix tag size when BITREFLEVEL_SIZE of core library is different than file BITREFLEVEL_SIZE.
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.
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
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
BitRefManager(const MoFEM::Core &core)
MoFEMErrorCode filterEntitiesNotInDatabase(Range &ents) const
Get entities not in database.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
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.
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.
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.
virtual moab::Interface & get_moab()=0
virtual EntityHandle get_field_meshset(const std::string name) const =0
get field meshset
virtual const int getValue() const =0
Get the core.
virtual MoFEMErrorCode delete_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY, MoFEMTypes mf=MF_ZERO)=0
delete entities form mofem and moab database
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
Tag get_th_RefBitLevel() const
Deprecated interface functions.
EntityHandle getMeshset() const
Get field meshset.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
keeps basic data about problem
BitRefLevel getBitRefLevel() const
keeps data about abstract TRI finite element
keeps data about abstract TET finite element
keeps data about abstract EDGE finite element
keeps data about abstract MESHSET finite element
keeps data about abstract PRISM finite element
keeps data about abstract VERTEX finite element
Struct keeps handle to refined handle.
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
static MoFEMErrorCode getBitRefLevel(Interface &moab, Range ents, std::vector< BitRefLevel > &vec_bit_ref_level)
ref mofem entity, right shift
base class for all interface classes