v0.9.0
BitRefManager.cpp
Go to the documentation of this file.
1 /** \file BitRefManager.cpp
2  * \brief Managing BitRefLevels
3  * \mofem_bit_ref
4  */
5 
6 /* MoFEM is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
18  */
19 
20 namespace MoFEM {
21 
23  UnknownInterface **iface) const {
25  *iface = NULL;
26  if (uuid == IDD_MOFEMBitRefManager) {
27  *iface = const_cast<BitRefManager *>(this);
29  }
30  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
32 }
33 
35  : cOre(const_cast<MoFEM::Core &>(core)), dEbug(false) {}
37 
38 /// tool class with methods used more than twp times
40 
41  const BitRefLevel &bIt; ///< bit to set
42  const RefEntity_multiIndex *refEntsPtr; ///< access to ents database
43  const RefElement_multiIndex *refElementPtr; ///< access to fe database
44 
45  boost::shared_ptr<BasicEntityData> &baseEntData; ///< base entity data
46 
47  /// constrictor
49  const RefEntity_multiIndex *ref_ents_ptr,
50  const RefElement_multiIndex *ref_element_ptr)
51  : bIt(bit), refEntsPtr(ref_ents_ptr), refElementPtr(ref_element_ptr),
52  baseEntData(m_field.get_basic_entity_data_ptr()) {}
53 
54  /// find entities and change entity bit if in database
56  Range &seed_ents_range) const {
58 
59  seed_ents_range.insert(f, s);
60  // get lower bound of multi-index
61  auto rit = refEntsPtr->lower_bound(f);
62  if (rit == refEntsPtr->end()) {
63  // all enties in range are added to database
65  } else {
66 
67  // some entities from range are in database
68  auto hi_rit = refEntsPtr->upper_bound(s);
69 
70  Range to_erase;
71  insertOrdered(to_erase, RefEntExtractor(), rit, hi_rit);
72  if (bIt.any())
73  for (; rit != hi_rit; ++rit)
74  const_cast<BitRefLevel &>((*rit)->getBitRefLevel()) |= bIt;
75 
76  Range::iterator lo, hi = seed_ents_range.begin();
77  for (auto pt = to_erase.pair_begin(); pt != to_erase.pair_end(); ++pt) {
78  lo = seed_ents_range.lower_bound(hi, seed_ents_range.end(), pt->first);
79  if (lo != seed_ents_range.end()) {
80  hi = seed_ents_range.upper_bound(lo, seed_ents_range.end(),
81  pt->second);
82  seed_ents_range.erase(lo, hi);
83  } else
84  break;
85  }
86 
87  }
88 
90  }
91 
92  /// add entities to database
93  MoFEMErrorCode addEntsToDatabase(const Range &seed_ents_range) const {
95  std::vector<boost::shared_ptr<RefEntity>> shared_ref_ents_vec;
96  shared_ref_ents_vec.reserve(seed_ents_range.size());
97  for (Range::const_pair_iterator pit = seed_ents_range.pair_begin();
98  pit != seed_ents_range.pair_end(); pit++) {
99  // add entities to database
100  EntityHandle f = pit->first;
101  EntityHandle s = pit->second;
102  boost::shared_ptr<std::vector<RefEntity>> ref_ents_vec(
103  new std::vector<RefEntity>());
104  ref_ents_vec->reserve(s - f + 1);
105  for (auto f : Range(f, s))
106  ref_ents_vec->emplace_back(baseEntData, f);
107 
108  // Set bits to range
109  if (bIt.any()) {
110  boost::shared_ptr<std::vector<const void *>> bits_by_ptr(
111  new std::vector<const void *>());
112  bits_by_ptr->resize(s - f + 1);
113  CHKERR baseEntData->moab.tag_get_by_ptr(
114  baseEntData->th_RefBitLevel, Range(f, s), &*bits_by_ptr->begin());
115  for (auto &v_bit_ptr : *bits_by_ptr)
116  const_cast<BitRefLevel &>(
117  *(static_cast<const BitRefLevel *>(v_bit_ptr))) |= bIt;
118  }
119 
120  for (auto &re : *ref_ents_vec)
121  shared_ref_ents_vec.emplace_back(ref_ents_vec, &re);
122  }
123  if (!shared_ref_ents_vec.empty()) {
124  int s0 = refEntsPtr->size();
125  const_cast<RefEntity_multiIndex *>(refEntsPtr)
126  ->insert(shared_ref_ents_vec.begin(), shared_ref_ents_vec.end());
127  if ((refEntsPtr->size() - s0) != shared_ref_ents_vec.size()) {
128  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
129  "Data inconsistency %d != %d", refEntsPtr->size() - s0,
130  shared_ref_ents_vec.size());
131  }
132  }
134  }
135 
137  Range &seed_fe_range) const {
139  seed_fe_range.insert(f, s);
140  RefElement_multiIndex::iterator rit, hi_rit;
141  // get lower bound of multi-index
142  rit = refElementPtr->lower_bound(f);
143  if (rit == refElementPtr->end()) {
144  // all enties in range are added to database
146  } else {
147  // some entities from range are in database
148  hi_rit = refElementPtr->upper_bound(s);
149  for (; rit != hi_rit; ++rit) {
150  seed_fe_range.erase(rit->get()->getRefEnt());
151  }
152  }
154  }
155 
156  MoFEMErrorCode addElementsToDatabase(Range &seed_fe_range) const {
158  std::vector<boost::shared_ptr<RefElement>> shared_ref_fe_vec;
159  shared_ref_fe_vec.reserve(seed_fe_range.size());
160  // create ref entity instances
161  for (Range::const_pair_iterator pit = seed_fe_range.const_pair_begin();
162  pit != seed_fe_range.const_pair_end(); ++pit) {
163  RefEntity_multiIndex::iterator rit, hi_rit;
164  rit = refEntsPtr->lower_bound(pit->first);
165  hi_rit = refEntsPtr->upper_bound(pit->second);
166  if (static_cast<int>(std::distance(rit, hi_rit)) !=
167  static_cast<int>(pit->second - pit->first + 1)) {
168  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
169  "data inconsistency %d != %d", std::distance(rit, hi_rit),
170  pit->second - pit->first + 1);
171  }
172  switch ((*rit)->getEntType()) {
173  case MBVERTEX: {
174  boost::shared_ptr<std::vector<RefElement_VERTEX>> ref_fe_vec =
175  boost::make_shared<std::vector<RefElement_VERTEX>>();
176  ref_fe_vec->reserve(pit->second - pit->first + 1);
177  for (; rit != hi_rit; ++rit) {
178  ref_fe_vec->push_back(RefElement_VERTEX(*rit));
179  shared_ref_fe_vec.push_back(
180  boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
181  }
182  } break;
183  case MBEDGE: {
184  boost::shared_ptr<std::vector<RefElement_EDGE>> ref_fe_vec =
185  boost::make_shared<std::vector<RefElement_EDGE>>();
186  ref_fe_vec->reserve(pit->second - pit->first + 1);
187  for (; rit != hi_rit; ++rit) {
188  ref_fe_vec->push_back(RefElement_EDGE(*rit));
189  shared_ref_fe_vec.push_back(
190  boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
191  }
192  } break;
193  case MBTRI:
194  case MBQUAD: {
195  boost::shared_ptr<std::vector<RefElementFace>> ref_fe_vec =
196  boost::make_shared<std::vector<RefElementFace>>();
197  ref_fe_vec->reserve(pit->second - pit->first + 1);
198  for (; rit != hi_rit; ++rit) {
199  ref_fe_vec->push_back(RefElementFace(*rit));
200  shared_ref_fe_vec.push_back(
201  boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
202  }
203  } break;
204  case MBTET: {
205  boost::shared_ptr<std::vector<RefElement_TET>> ref_fe_vec =
206  boost::make_shared<std::vector<RefElement_TET>>();
207  ref_fe_vec->reserve(pit->second - pit->first + 1);
208  for (; rit != hi_rit; ++rit) {
209  ref_fe_vec->push_back(RefElement_TET(*rit));
210  shared_ref_fe_vec.push_back(
211  boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
212  }
213  } break;
214  case MBPRISM: {
215  boost::shared_ptr<std::vector<RefElement_PRISM>> ref_fe_vec =
216  boost::make_shared<std::vector<RefElement_PRISM>>();
217  ref_fe_vec->reserve(pit->second - pit->first + 1);
218  for (; rit != hi_rit; ++rit) {
219  ref_fe_vec->push_back(RefElement_PRISM(*rit));
220  shared_ref_fe_vec.push_back(
221  boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
222  }
223  } break;
224  case MBENTITYSET: {
225  boost::shared_ptr<std::vector<RefElement_MESHSET>> ref_fe_vec =
226  boost::make_shared<std::vector<RefElement_MESHSET>>();
227  ref_fe_vec->reserve(pit->second - pit->first + 1);
228  for (; rit != hi_rit; ++rit) {
229  ref_fe_vec->push_back(RefElement_MESHSET(*rit));
230  shared_ref_fe_vec.push_back(
231  boost::shared_ptr<RefElement>(ref_fe_vec, &ref_fe_vec->back()));
232  }
233  } break;
234  default:
235  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
236  }
237  }
238  // add shared pointers to database
239  const_cast<RefElement_multiIndex *>(refElementPtr)
240  ->insert(shared_ref_fe_vec.begin(), shared_ref_fe_vec.end());
242  }
243 };
244 
246  const BitRefLevel bit,
247  const bool only_tets,
248  int verb) const {
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 }
295 
297  const BitRefLevel bit,
298  int verb) const {
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 }
331 
333  const BitRefLevel bit,
334  int verb) const {
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 }
359 
361  const std::string field_name, const BitRefLevel bit, int verb) const {
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 }
371 
373  const EntityType type, const BitRefLevel bit, const BitRefLevel mask,
374  int verb) const {
376  Range ents;
377  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents);
380 }
381 
383  const int dim, const BitRefLevel bit, const BitRefLevel mask,
384  int verb) const {
386  Range ents;
387  CHKERR getEntitiesByDimAndRefLevel(bit, mask, dim, ents);
390 }
391 
393  const BitRefLevel bit,
394  int verb) const {
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 }
419 
421  const int dim,
422  const BitRefLevel bit,
423  int verb) const {
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 }
432 
434  const EntityType type,
435  const BitRefLevel bit,
436  int verb) const {
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 }
444 
446  const BitRefLevel bit,
447  int verb) const {
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 }
456 
458  const int dim,
459  const BitRefLevel bit,
460  int verb) const {
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 }
476 
477 MoFEMErrorCode BitRefManager::setNthBitRefLevel(const Range &ents, const int n,
478  const bool b, int verb) const {
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 }
492 
494  int verb) const {
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 }
510 
512  const BitRefLevel mask,
513  int verb) const {
515  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
517 }
518 
520  const BitRefLevel mask,
521  int verb) const {
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 }
547 
549  const BitRefLevel bit, const BitRefLevel mask, const EntityType type,
550  const char *file_name, const char *file_type, const char *options,
551  const bool check_for_empty) const {
552  MoFEM::Interface &m_field = cOre;
553  moab::Interface &moab(m_field.get_moab());
555  Range ents;
556  CHKERR getEntitiesByTypeAndRefLevel(bit, mask, type, ents);
557  if (check_for_empty && ents.empty())
559  EntityHandle meshset;
560  CHKERR moab.create_meshset(MESHSET_SET, meshset);
561  CHKERR moab.add_entities(meshset, ents);
562  CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
563  CHKERR moab.delete_entities(&meshset, 1);
565 }
566 
568  const char *file_name, const char *file_type, const char *options,
569  const bool check_for_empty) const {
570  MoFEM::Interface &m_field = cOre;
571  moab::Interface &moab(m_field.get_moab());
573  EntityHandle meshset;
574  Range ents;
576  if (check_for_empty && ents.empty())
578  CHKERR moab.create_meshset(MESHSET_SET, meshset);
579  CHKERR moab.add_entities(meshset, ents);
580  CHKERR moab.write_file(file_name, file_type, options, &meshset, 1);
581  CHKERR moab.delete_entities(&meshset, 1);
583 }
584 
586  const BitRefLevel mask, const EntityType type, const char *file_name,
587  const char *file_type, const char *options) {
589  for (int ll = 0; ll != BITREFLEVEL_SIZE; ++ll) {
590  std::string name = boost::lexical_cast<std::string>(ll) + "_" + file_name;
591  CHKERR writeBitLevelByType(BitRefLevel().set(ll), mask, type, name.c_str(),
592  file_type, options, true);
593  }
595 }
596 
598  const BitRefLevel bit, const BitRefLevel mask, const EntityType type,
599  const EntityHandle meshset, int verb) const {
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 }
608 
610  const BitRefLevel mask,
611  Range &ents,
612  int verb) const {
613  MoFEM::Interface &m_field = cOre;
614  moab::Interface &moab(m_field.get_moab());
616 
617  std::vector<EntityHandle> ents_vec;
618  ents_vec.reserve(ents.size());
619 
620  std::vector<BitRefLevel *> tags_bits_ptr_vec(ents.size());
621 
622  Range swap_ents;
623  auto hint = swap_ents.begin();
624 
625  for (Range::pair_iterator p_eit = ents.pair_begin(); p_eit != ents.pair_end();
626  ++p_eit) {
627 
628  EntityHandle f = p_eit->first;
629  const EntityHandle s = p_eit->second;
630 
631  // get bits on entities
632  rval = moab.tag_get_by_ptr(cOre.get_th_RefBitLevel(), Range(f, s),
633  (const void **)(&*tags_bits_ptr_vec.begin()));
634 
635  if (rval == MB_SUCCESS) {
636 
637  auto bit_it = tags_bits_ptr_vec.begin();
638 
639  auto check = [&bit, &mask](const auto &entity_bit) -> bool {
640  return
641 
642  (entity_bit & bit).any() &&
643 
644  ((entity_bit & mask) == entity_bit);
645  };
646 
647  while (f != s + 1) {
648 
649  while (f != s + 1 && !check(**bit_it)) {
650  ++bit_it;
651  ++f;
652  }
653 
654  if (f != s + 1) {
655 
656  const EntityHandle start = f;
657 
658  while (f != (s + 1) && check(**bit_it)) {
659  ++bit_it;
660  ++f;
661  };
662 
663  hint = swap_ents.insert(hint, start, f - 1);
664  }
665 
666  }
667  }
668  }
669 
670  ents.swap(swap_ents);
671 
673 }
674 
676  const BitRefLevel bit, const BitRefLevel mask, const EntityType type,
677  Range &ents, int verb) const {
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 }
685 
687  const BitRefLevel bit, const BitRefLevel mask, const int dim,
688  const EntityHandle meshset, int verb) const {
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 }
697 
699  const BitRefLevel bit, const BitRefLevel mask, const int dim, Range &ents,
700  int verb) const {
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 }
708 
710  const BitRefLevel mask,
711  const EntityHandle meshset,
712  const int verb) const {
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 }
721 
723  const BitRefLevel mask,
724  Range &ents,
725  const int verb) const {
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 }
736 
738  const BitRefLevel mask,
739  const EntityType type,
740  Range &ents,
741  const int verb) const {
742  MoFEM::Interface &m_field = cOre;
743  const RefEntity_multiIndex *ref_ents_ptr;
745  CHKERR m_field.get_ref_ents(&ref_ents_ptr);
746  auto &ref_ents = ref_ents_ptr->get<ParentEntType_mi_tag>();
747  auto it = ref_ents.lower_bound(type);
748  auto hi_it = ref_ents.upper_bound(type);
749  std::vector<EntityHandle> ents_vec;
750  ents_vec.reserve(std::distance(it, hi_it));
751  for (; it != hi_it; it++) {
752  const BitRefLevel &ent_bit = it->get()->getBitRefLevel();
753  if ((ent_bit & mask) == ent_bit && (ent_bit & bit).any())
754  ents_vec.emplace_back(it->get()->getRefEnt());
755  }
756  ents.insert_list(ents_vec.begin(), ents_vec.end());
757  if (verb > NOISY)
758  cerr << "getEntitiesByParentType: " << ents << endl;
760 }
761 
763  MoFEM::Interface &m_field = cOre;
764  moab::Interface &moab = m_field.get_moab();
766  rval = moab.get_entities_by_handle(0, ents, false);
767  CHKERRG(rval);
768  ents = subtract(ents, ents.subset_by_type(MBENTITYSET));
770  CHKERRG(ierr);
772 }
773 
775  MoFEM::Interface &m_field = cOre;
776  const RefEntity_multiIndex *ref_ents_ptr;
778  ierr = m_field.get_ref_ents(&ref_ents_ptr);
779  CHKERRG(ierr);
780  Range::iterator eit = ents.begin();
781  for (; eit != ents.end();) {
782  RefEntity_multiIndex::index<Ent_mi_tag>::type::iterator rit;
783  rit = ref_ents_ptr->get<Ent_mi_tag>().find(*eit);
784  if (rit != ref_ents_ptr->get<Ent_mi_tag>().end()) {
785  eit = ents.erase(eit);
786  } else {
787  eit++;
788  }
789  }
791 }
792 
795  const int to_dimension,
796  Range &adj_entities) const {
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 }
819 
821  const int to_dimension,
822  Range &adj_entities) const {
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 }
845 
847  const Problem *problem_ptr, const EntityHandle *from_entities,
848  const int num_entities, const int to_dimension, Range &adj_entities,
849  const int operation_type, const int verb) const {
851  BitRefLevel bit = problem_ptr->getBitRefLevel();
852  CHKERR getAdjacencies(bit, from_entities, num_entities, to_dimension,
853  adj_entities, operation_type);
855 }
856 
858  const BitRefLevel bit, const EntityHandle *from_entities,
859  const int num_entities, const int to_dimension, Range &adj_entities,
860  const int operation_type, const int verb) const {
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 }
896 
898  const EntityHandle parent, const BitRefLevel &parent_bit,
899  const BitRefLevel &parent_mask, const BitRefLevel &child_bit,
900  const BitRefLevel &child_mask, const EntityHandle child,
901  EntityType child_type, const bool recursive, int verb) {
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)
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 }
934 
936  const EntityHandle parent, const BitRefLevel &child_bit,
937  const EntityHandle child, EntityType child_type, const bool recursive,
938  int verb) {
941  parent, BitRefLevel().set(), BitRefLevel().set(), child_bit, child_bit,
942  child, child_type, recursive, verb);
944 }
945 
947  const BitRefLevel &child_bit, int verb) {
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 }
977 
979  const std::string name, const BitRefLevel &child_bit, int verb) {
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 }
1004 
1006  const std::string name, const BitRefLevel &child_bit,
1007  const EntityType fe_ent_type, int verb) {
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 }
1015 
1017  Range &child_ents) {
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 }
1043 } // namespace MoFEM
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 setEntitiesBitRefLevel(const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
add entities to database and set bit ref level
keeps data about abstract VERTEX finite element
const BitRefLevel & getBitRefLevel() const
Get entity ref bit refinement signature.
virtual MoFEMErrorCode get_ref_ents(const RefEntity_multiIndex **refined_ents_ptr) const =0
Get ref entities multi-index from database.
MoFEM interface unique ID.
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 findEntsToAdd(EntityHandle f, EntityHandle s, Range &seed_ents_range) const
find entities and change entity bit if in database
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
Tag get_th_RefBitLevel() const
Definition: Core.hpp:151
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
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 boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
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 setNthBitRefLevel(const Range &ents, const int n, const bool b, int verb=0) const
Set nth bit ref level.
const RefElement_multiIndex * refElementPtr
access to fe database
MoFEMErrorCode addBitRefLevel(const Range &ents, const BitRefLevel bit, int verb=QUIET) const
add bit ref level to ref entity
MoFEMErrorCode setBitRefLevelByType(const EntityHandle meshset, const EntityType type, const BitRefLevel bit, int verb=QUIET) const
Set the Bit Ref Level By Type object.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
keeps data about abstract PRISM finite element
base class for all interface classes
MoFEMErrorCode addEntsToDatabase(const Range &seed_ents_range) const
add entities to database
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:544
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.
static const MOFEMuuid IDD_MOFEMBitRefManager
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
Core (interface) class.
Definition: Core.hpp:50
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....
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
keeps basic data about problemThis is low level structure with information about problem,...
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,...
Struct keeps handle to refined handle.
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
MoFEMErrorCode addBitRefLevelByDim(const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
add bit ref level by dimension
moab::Range::iterator insertOrdered(Range &r, Extractor, Iterator begin_iter, Iterator end_iter)
Insert ordered mofem multi-index into range.
Definition: Templates.hpp:590
Extract entity handle form multi-index container.
Definition: Templates.hpp:566
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
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 query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
#define BITREFLEVEL_SIZE
max number of refinements
Definition: definitions.h:279
tool class with methods used more than twp times
const RefEntity_multiIndex * refEntsPtr
access to ents database
virtual EntityHandle get_field_meshset(const std::string &name) const =0
get field meshset
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
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
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
keeps data about abstract TRI finite element
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.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
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...
MoFEMErrorCode setBitLevelToMeshset(const EntityHandle meshset, const BitRefLevel bit, int verb=0) const
keeps data about abstract TET finite element
MoFEMErrorCode updateFieldMeshsetByEntitiesChildren(const BitRefLevel &child_bit, int verb=0)
update fields meshesets by child entities
MoFEMErrorCode updateRange(const Range &parent, Range &child)
Update range by prents.
#define CHKERR
Inline error check.
Definition: definitions.h:596
virtual EntityHandle get_finite_element_meshset(const std::string &name) const =0
virtual MoFEMErrorCode get_ref_finite_elements(const RefElement_multiIndex **refined_finite_elements_ptr) const =0
Get ref finite elements multi-index form database.
boost::shared_ptr< BasicEntityData > & baseEntData
base entity data
MoFEMErrorCode filterEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, Range &ents, int verb=QUIET) const
filter entities by bit ref level
BitRefLevel getBitRefLevel() const
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.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
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
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
ref mofem entity, right shift
MoFEMErrorCode 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
MoFEMErrorCode addElementsToDatabase(Range &seed_fe_range) const
MoFEMErrorCode setElementsBitRefLevel(const Range &ents, const BitRefLevel bit=BitRefLevel(), int verb=QUIET) const
add entities to database and set bit ref level
keeps data about abstract EDGE finite element
MoFEMErrorCode findElementsToAdd(EntityHandle f, EntityHandle s, Range &seed_fe_range) const
static MoFEMErrorCode getBitRefLevel(Interface &moab, Range ents, std::vector< BitRefLevel > &vec_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
MoFEMErrorCode shiftRightBitRef(const int shift, const BitRefLevel mask=BitRefLevel().set(), int verb=-1) const
right shift bit ref level
virtual MoFEMErrorCode get_fields(const Field_multiIndex **fields_ptr) const =0
Get fields multi-index from database.
virtual const Field * get_field_structure(const std::string &name)=0
get field structure
EntityHandle getMeshset() const
Get field meshset.
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
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....
SetBitRefLevelTool(MoFEM::Interface &m_field, const BitRefLevel &bit, const RefEntity_multiIndex *ref_ents_ptr, const RefElement_multiIndex *ref_element_ptr)
constrictor
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.
keeps data about abstract MESHSET finite element
MoFEMErrorCode setBitRefLevelByDim(const EntityHandle meshset, const int dim, const BitRefLevel bit, int verb=QUIET) const
Set the Bit Ref Level By Dim object.
BitRefManager(const MoFEM::Core &core)
MoFEMErrorCode filterEntitiesNotInDatabase(Range &ents) const
Get entities not in database.
const BitRefLevel & bIt
bit to set
MoFEMErrorCode getAllEntitiesNotInDatabase(Range &ents) const
Get all entities not in database.
~BitRefManager()
Destructor.