v0.10.0
DeleteCore.cpp
Go to the documentation of this file.
1 /** \file DeleteCore.cpp
2  * \brief Core interface methods for managing deletions and insertion dofs
3  *
4  * \note If entity/dof/finite element is cleared it mean that is erased from
5  * multi-index database
6  *
7  * \note If entity/dof/finite element is removed is is clearded and
8  * removed from filed or finite element meshset
9  *
10  * \note If entity if deleted is cleated, removed and deleted from MoAB
11  * database.
12  *
13  * \todo Implement tag_field_delete, tag_field_delete_by_bit_ref to remove field
14  * tags from entities. This is for entities which are as well removed, thus
15  * cleared as well.
16  */
17 
18 /* MoFEM is free software: you can redistribute it and/or modify it under
19  * the terms of the GNU Lesser General Public License as published by the
20  * Free Software Foundation, either version 3 of the License, or (at your
21  * option) any later version.
22  *
23  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
24  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
26  * License for more details.
27  *
28  * You should have received a copy of the GNU Lesser General Public
29  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
30 */
31 
32 #include <MoFEM.hpp>
33 
34 #define DeleteCoreFunctionBegin \
35  MoFEMFunctionBegin; \
36  MOFEM_LOG_CHANNEL("WORLD"); \
37  MOFEM_LOG_FUNCTION(); \
38  MOFEM_LOG_TAG("WORLD", "DeleteCore");
39 
40 namespace MoFEM {
41 
44  if (verb == -1)
45  verb = verbose;
46  Range ents;
47  for (DofEntity_multiIndex::iterator dit = dofsField.begin();
48  dit != dofsField.end();) {
49  if (!dit->get()->getActive()) {
50  dit = dofsField.erase(dit);
51  } else {
52  ++dit;
53  }
54  }
56 }
57 
59  const BitRefLevel mask, int verb) {
61  if (verb == -1)
62  verb = verbose;
63  Range ents;
64  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
65  CHKERR clear_dofs_fields(ents, verb);
67 }
68 
69 MoFEMErrorCode Core::clear_dofs_fields(const Range ents, int verb) {
71  if (verb == -1)
72  verb = verbose;
73 
74  for (Range::const_pair_iterator p_eit = ents.pair_begin();
75  p_eit != ents.pair_end(); p_eit++) {
76  EntityHandle first = p_eit->first;
77  EntityHandle second = p_eit->second;
78  // get dofs range
79  DofEntityByEnt::iterator dit, hi_dit;
80  dit = dofsField.get<Ent_mi_tag>().lower_bound(first);
81  if (dit == dofsField.get<Ent_mi_tag>().end())
82  continue;
83  hi_dit = dofsField.get<Ent_mi_tag>().upper_bound(second);
84  // finally clear dofs
85  dofsField.get<Ent_mi_tag>().erase(dit,hi_dit);
86  }
88 }
89 
90 MoFEMErrorCode Core::clear_dofs_fields(const std::string name,
91  const Range ents, int verb) {
93  if (verb == -1)
94  verb = verbose;
95 
96  const auto bit_number = get_field_bit_number(name);
97 
98  for (Range::const_pair_iterator p_eit = ents.pair_begin();
99  p_eit != ents.pair_end(); p_eit++) {
100  const auto first = p_eit->first;
101  const auto second = p_eit->second;
102  const auto lo_uid =
103  DofEntity::getLoFieldEntityUId(bit_number, first);
104  const auto hi_uid =
105  DofEntity::getHiFieldEntityUId(bit_number, second);
106  auto dit = dofsField.get<Unique_mi_tag>().lower_bound(lo_uid);
107  auto hi_dit = dofsField.get<Unique_mi_tag>().upper_bound(hi_uid);
108  dofsField.get<Unique_mi_tag>().erase(dit, hi_dit);
109  }
111 }
112 
114  const BitRefLevel mask, int verb) {
116  if (verb == -1)
117  verb = verbose;
118  Range ents;
119  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
120  CHKERR clear_dofs_fields(ents, verb);
121  CHKERR clear_adjacencies_entities(ents, verb);
122  CHKERR clear_ents_fields(ents, verb);
124 }
125 
126 MoFEMErrorCode Core::clear_ents_fields(const Range ents, int verb) {
128  if (verb == -1)
129  verb = verbose;
130  CHKERR clear_dofs_fields(ents, verb);
131  CHKERR clear_adjacencies_entities(ents, verb);
132  for (Range::const_pair_iterator p_eit = ents.pair_begin();
133  p_eit != ents.pair_end(); p_eit++) {
134  EntityHandle first = p_eit->first;
135  EntityHandle second = p_eit->second;
136  FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator dit, hi_dit;
137  dit = entsFields.get<Ent_mi_tag>().lower_bound(first);
138  hi_dit = entsFields.get<Ent_mi_tag>().upper_bound(second);
139  entsFields.get<Ent_mi_tag>().erase(dit, hi_dit);
140  }
142 }
143 
145  const Range ents, int verb) {
147  if (verb == -1)
148  verb = verbose;
149  const auto bit_number = get_field_bit_number(name);
150  CHKERR clear_dofs_fields(name, ents, verb);
151  CHKERR clear_adjacencies_entities(name, ents, verb);
152  for (Range::const_pair_iterator p_eit = ents.pair_begin();
153  p_eit != ents.pair_end(); p_eit++) {
154  const auto first = p_eit->first;
155  const auto second = p_eit->second;
156  auto dit = entsFields.get<Unique_mi_tag>().lower_bound(
157  FieldEntity::getLocalUniqueIdCalculate(bit_number, first));
158  auto hi_dit = entsFields.get<Unique_mi_tag>().upper_bound(
159  FieldEntity::getLocalUniqueIdCalculate(bit_number, second));
160  entsFields.get<Unique_mi_tag>().erase(dit, hi_dit);
161  }
163 }
164 
166  const EntityHandle meshset,
167  const EntityType type, int verb) {
169  if (verb == -1)
170  verb = verbose;
171  Range ents;
172  CHKERR get_moab().get_entities_by_type(meshset, type, ents);
173  CHKERR remove_ents_from_field(name, ents, verb);
175 }
176 
178  const Range ents, int verb) {
180  if (verb == -1)
181  verb = verbose;
182  EntityHandle meshset;
183  meshset = get_field_meshset(name);
184  CHKERR clear_ents_fields(name, ents, verb);
185  CHKERR get_moab().remove_entities(meshset, ents);
187 }
188 
189 MoFEMErrorCode Core::remove_ents_from_field(const Range ents, int verb) {
191  if (verb == -1)
192  verb = verbose;
193  CHKERR clear_ents_fields(ents, verb);
194  for (Field_multiIndex::iterator fit = fIelds.begin(); fit != fIelds.end();
195  fit++) {
196  EntityHandle meshset = fit->get()->getMeshset();
197  CHKERR get_moab().remove_entities(meshset, ents);
198  }
200 }
201 
203  const BitRefLevel mask,
204  int verb) {
206  if (verb == -1)
207  verb = verbose;
208  Range ents;
209  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
210  CHKERR remove_ents_from_field(ents, verb);
212 }
213 
215  const BitRefLevel mask,
216  int verb) {
218  if (verb == -1)
219  verb = verbose;
220  Range ents;
221  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
222  CHKERR clear_adjacencies_entities(ents, verb);
224 }
225 
228  if (verb == -1)
229  verb = verbose;
230  for (Range::const_pair_iterator p_eit = ents.pair_begin();
231  p_eit != ents.pair_end(); ++p_eit) {
232  const EntityHandle first = p_eit->first;
233  const EntityHandle second = p_eit->second;
234  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
235  Ent_mi_tag>::type::iterator ait,
236  hi_ait;
237  ait = entFEAdjacencies.get<Ent_mi_tag>().lower_bound(first);
238  hi_ait = entFEAdjacencies.get<Ent_mi_tag>().upper_bound(second);
239  entFEAdjacencies.get<Ent_mi_tag>().erase(ait, hi_ait);
240  }
242 }
243 
245  const Range ents, int verb) {
247  if (verb == -1)
248  verb = verbose;
249 
250  const Field *field_ptr = get_field_structure(name);
251  int field_bit_number = field_ptr->getBitNumber();
252  ParallelComm *pcomm =
253  ParallelComm::get_pcomm(&get_moab(), basicEntityDataPtr->pcommID);
254 
255  for (Range::const_pair_iterator p_eit = ents.pair_begin();
256  p_eit != ents.pair_end(); p_eit++) {
257 
258  // First and last handle
259  const EntityHandle first = p_eit->first;
260  const EntityHandle second = p_eit->second;
261 
262  // Get UId
263  UId first_uid =
264  FieldEntity::getLocalUniqueIdCalculate(field_bit_number, first);
265  UId second_uid =
266  FieldEntity::getLocalUniqueIdCalculate(field_bit_number, second);
267 
268  // Find adjacencies
269  auto ait = entFEAdjacencies.get<Unique_mi_tag>().lower_bound(first_uid);
270  auto hi_ait = entFEAdjacencies.get<Unique_mi_tag>().upper_bound(second_uid);
271  entFEAdjacencies.get<Unique_mi_tag>().erase(ait, hi_ait);
272  }
274 }
275 
277  const BitRefLevel mask,
278  int verb) {
280  if (verb == -1)
281  verb = verbose;
282  Range ents;
283  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
284  CHKERR clear_finite_elements(ents, verb);
286 }
287 
288 MoFEMErrorCode Core::clear_finite_elements(const Range ents, int verb) {
290  if (verb == -1)
291  verb = verbose;
292  CHKERR clear_adjacencies_finite_elements(ents, verb);
293  for (Range::const_pair_iterator p_eit = ents.pair_begin();
294  p_eit != ents.pair_end(); p_eit++) {
295  EntityHandle first = p_eit->first;
296  EntityHandle second = p_eit->second;
297  EntFiniteElement_multiIndex::index<Ent_mi_tag>::type::iterator fit, hi_fit;
298  fit = entsFiniteElements.get<Ent_mi_tag>().lower_bound(first);
299  hi_fit = entsFiniteElements.get<Ent_mi_tag>().upper_bound(second);
300  entsFiniteElements.get<Ent_mi_tag>().erase(fit, hi_fit);
301  }
303 }
304 
306  const Range ents, int verb) {
308  if (verb == -1)
309  verb = verbose;
310  CHKERR clear_adjacencies_finite_elements(name, ents, verb);
311  for (Range::const_pair_iterator p_eit = ents.pair_begin();
312  p_eit != ents.pair_end(); p_eit++) {
313  EntityHandle first = p_eit->first;
314  EntityHandle second = p_eit->second;
315  EntFiniteElement_multiIndex::index<
316  Composite_Name_And_Ent_mi_tag>::type::iterator fit,
317  hi_fit;
318  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().lower_bound(
319  boost::make_tuple(name, first));
320  hi_fit =
321  entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().upper_bound(
322  boost::make_tuple(name, second));
323  fit = entsFiniteElements.get<Composite_Name_And_Ent_mi_tag>().erase(fit,
324  hi_fit);
325  }
327 }
328 
330  const BitRefLevel mask,
331  int verb) {
333  Range ents;
334  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
335  CHKERR clear_adjacencies_finite_elements(ents,verb);
337 }
338 
340  int verb) {
342  if (verb == -1)
343  verb = verbose;
344  for (Range::const_pair_iterator p_eit = ents.pair_begin();
345  p_eit != ents.pair_end(); p_eit++) {
346  EntityHandle first = p_eit->first;
347  EntityHandle second = p_eit->second;
348  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
349  FEEnt_mi_tag>::type::iterator ait,
350  hi_ait;
351  ait = entFEAdjacencies.get<FEEnt_mi_tag>().lower_bound(first);
352  hi_ait = entFEAdjacencies.get<FEEnt_mi_tag>().upper_bound(second);
353  entFEAdjacencies.get<FEEnt_mi_tag>().erase(ait, hi_ait);
354  }
356 }
357 
359  const Range ents,
360  int verb) {
362  if (verb == -1)
363  verb = verbose;
364 
365  FiniteElement_multiIndex::index<FiniteElement_name_mi_tag>::type::iterator
366  it_fe = finiteElements.get<FiniteElement_name_mi_tag>().find(name);
367  if (it_fe != finiteElements.get<FiniteElement_name_mi_tag>().end()) {
368 
369  const auto fe_uid = (*it_fe)->getFEUId();
370 
371  for (Range::const_pair_iterator p_eit = ents.pair_begin();
372  p_eit != ents.pair_end(); p_eit++) {
373 
374  // First and last handle
375  const EntityHandle first = p_eit->first;
376  const EntityHandle second = p_eit->second;
377 
378  // Get UId
379  UId first_uid =
381  UId second_uid =
383 
384  // Find and remove adjacencies
385  FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
386  FE_Unique_mi_tag>::type::iterator ait,
387  hi_ait;
388  ait = entFEAdjacencies.get<FE_Unique_mi_tag>().lower_bound(first_uid);
389  hi_ait = entFEAdjacencies.get<FE_Unique_mi_tag>().upper_bound(second_uid);
390  entFEAdjacencies.get<FE_Unique_mi_tag>().erase(ait, hi_ait);
391  }
392  }
394 }
395 
397  const EntityHandle meshset,
398  const EntityType type,
399  int verb) {
401  if (verb == -1)
402  verb = verbose;
403  Range ents;
404  CHKERR get_moab().get_entities_by_type(meshset, type, ents, false);
405  CHKERR remove_ents_from_finite_element(name, ents, verb);
407 }
408 
410  const Range ents,
411  int verb) {
413  if (verb == -1)
414  verb = verbose;
415  CHKERR clear_finite_elements(name, ents, verb);
416  const EntityHandle idm = get_finite_element_meshset(name);
417  CHKERR get_moab().remove_entities(idm, ents);
419 }
420 
422  int verb) {
424  if (verb == -1)
425  verb = verbose;
426  CHKERR clear_finite_elements(ents, verb);
427  for (FiniteElement_multiIndex::iterator fe_it = finiteElements.begin();
428  fe_it != finiteElements.end(); fe_it++) {
429  EntityHandle meshset = fe_it->get()->getMeshset();
430  CHKERR get_moab().remove_entities(meshset, ents);
431  }
433 }
434 
436  const BitRefLevel bit, const BitRefLevel mask, int verb) {
438  if (verb == -1)
439  verb = verbose;
440  Range ents;
441  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
442  CHKERR remove_ents_from_finite_element(ents,verb);
444 }
445 
446 MoFEMErrorCode Core::remove_ents(const Range ents, int verb) {
448  if (verb == -1)
449  verb = verbose;
450  CHKERR remove_ents_from_finite_element(ents, verb);
451  CHKERR remove_ents_from_field(ents, verb);
452 
453  for (Range::const_pair_iterator p_eit = ents.pair_begin();
454  p_eit != ents.pair_end(); ++p_eit) {
455 
456  RefElement_multiIndex::index<Ent_mi_tag>::type::iterator frit, hi_frit;
457  frit = refinedFiniteElements.get<Ent_mi_tag>().lower_bound(p_eit->first);
458  hi_frit =
459  refinedFiniteElements.get<Ent_mi_tag>().upper_bound(p_eit->second);
460  refinedFiniteElements.get<Ent_mi_tag>().erase(frit, hi_frit);
461 
462  RefEntity_multiIndex::index<Ent_mi_tag>::type::iterator rit, hi_rit;
463  rit = refinedEntities.get<Ent_mi_tag>().lower_bound(p_eit->first);
464  hi_rit = refinedEntities.get<Ent_mi_tag>().upper_bound(p_eit->second);
465  refinedEntities.get<Ent_mi_tag>().erase(rit, hi_rit);
466 
467  }
468 
470 }
471 
473  const BitRefLevel mask, int verb) {
475  if (verb == -1)
476  verb = verbose;
477  Range ents;
478  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
479  CHKERR remove_ents(ents, verb);
481 }
482 
484  const BitRefLevel mask,
485  int verb) {
487  if (verb == -1)
488  verb = verbose;
489  Range ents;
490  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
491  CHKERR remove_parents_by_ents(ents, verb);
493 }
494 
495 MoFEMErrorCode Core::remove_parents_by_ents(const Range &ents, int verb) {
497 
498  std::vector<EntityHandle> leftovers_ents;
499  leftovers_ents.reserve(ents.size());
500 
501  for (auto pit = ents.pair_begin(); pit != ents.pair_end(); ++pit) {
502 
503  EntityHandle f = pit->first;
504  const EntityHandle s = pit->second;
505  auto lo = refinedEntities.lower_bound(f);
506  for (; f <= s; ++f) {
507 
508  if ((*lo)->getEnt() == f) {
509  bool success = refinedEntities.modify(lo, RefEntity_change_parent(0));
510  if (!success)
511  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
512  "Operation of removing parent unsuccessful");
513  ++lo;
514  } else
515  leftovers_ents.emplace_back(f);
516 
517  }
518  }
519 
520  if (!leftovers_ents.empty()) {
521  std::vector<EntityHandle> zero_parents(leftovers_ents.size());
522  CHKERR get_moab().tag_set_data(th_RefParentHandle, &leftovers_ents[0],
523  leftovers_ents.size(),
524  &*zero_parents.begin());
525  }
527 }
528 
529 MoFEMErrorCode Core::remove_parents_by_parents(const Range &ents, int verb) {
531  for (Range::iterator eit = ents.begin(); eit != ents.end(); ++eit) {
532  RefEntity_multiIndex::index<Ent_Ent_mi_tag>::type::iterator it;
533  while ((it = refinedEntities.get<Ent_Ent_mi_tag>().find(*eit)) !=
534  refinedEntities.get<Ent_Ent_mi_tag>().end()) {
535  bool success = refinedEntities.get<Ent_Ent_mi_tag>().modify(
536  it, RefEntity_change_parent(0));
537  if (!success) {
538  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
539  "Operation of removing parent unsuccessful");
540  }
541  }
542  }
544 }
545 
547  const BitRefLevel mask,
548  const bool remove_parent,
549  int verb) {
551  if (verb == -1)
552  verb = verbose;
553 
554  Range ents;
555  CHKERR BitRefManager(*this).getEntitiesByRefLevel(bit, mask, ents, verb);
556  Range ents_meshsets = ents.subset_by_type(MBENTITYSET);
557  ents = subtract(ents,ents_meshsets);
558 
559  CHKERR remove_ents(ents, verb);
560 
561  // remove parent
562  if (remove_parent) {
563  CHKERR remove_parents_by_parents(ents);
564  }
565 
566  Range meshsets;
567  CHKERR get_moab().get_entities_by_type(0, MBENTITYSET, meshsets, false);
568  for (Range::iterator mit = meshsets.begin(); mit != meshsets.end(); mit++) {
569  CHKERR get_moab().remove_entities(*mit, ents);
570  }
571 
572  rval = get_moab().delete_entities(ents);
573  if(rval != MB_SUCCESS) {
574  if(verb >= VERY_VERBOSE) {
575  for (Range::iterator eit = ents.begin(); eit != ents.end(); ++eit) {
576  try {
577  RefEntity ref_ent(basicEntityDataPtr, *eit);
578  MOFEM_LOG("WORLD", Sev::error)
579  << "Error: " << RefEntity(basicEntityDataPtr, *eit) << " "
580  << ref_ent.getBitRefLevel();
581  } catch (std::exception const &ex) {
582  }
583  };
584  }
585  EntityHandle out_meshset;
586  CHKERR get_moab().create_meshset(MESHSET_SET, out_meshset);
587  CHKERR get_moab().add_entities(out_meshset,ents);
588  CHKERR get_moab().write_file("error.vtk", "VTK", "", &out_meshset, 1);
589  THROW_MESSAGE("Can not delete entities from MoAB database (see error.vtk)");
590  }
591 
592  if (verb >= VERBOSE)
593  MOFEM_LOG_C("WORLD", Sev::verbose, "Nb. of deleted entities %d",
594  ents.size());
595 
597 }
598 
599 MoFEMErrorCode Core::delete_finite_element(const std::string name, int verb) {
602  FiniteElementsByName;
603  FiniteElementsByName &fe = finiteElements.get<FiniteElement_name_mi_tag>();
604  FiniteElementsByName::iterator mit = fe.find(name);
605  if (mit == fe.end()) {
606  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
607  "Finite element <%s> not found", name.c_str());
608  }
609  EntityHandle meshset = mit->get()->getMeshset();
610  Range ents;
611  CHKERR get_moab().get_entities_by_handle(meshset, ents, false);
612  CHKERR remove_ents_from_finite_element(name, ents, verb);
613  fe.erase(mit);
614  CHKERR get_moab().delete_entities(&meshset, 1);
616 }
617 }
MoFEMErrorCode clear_ents_fields_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:113
FieldBitNumber getBitNumber() const
Get number of set bit in Field ID. Each field has uid, get getBitNumber get number of bit set for giv...
static MoFEMErrorCode getBitRefLevel(Interface &moab, Range ents, std::vector< BitRefLevel > &vec_bit_ref_level)
change parentUse this function with care. Some other multi-indices can deponent on this.
MoFEMErrorCode clear_dofs_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:69
MoFEMErrorCode remove_ents_from_finite_element(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from given refinement level to finite element database
Definition: DeleteCore.cpp:396
Provide data structure for (tensor) field approximation.The Field is intended to provide support for ...
UId getLocalUniqueIdCalculate()
Get the Local Unique Id Calculate object.
RefEntityTmp< 0 > RefEntity
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
MoFEMErrorCode remove_ents(const Range ents, int verb=DEFAULT_VERBOSITY)
remove entities form mofem database
Definition: DeleteCore.cpp:446
Struct keeps handle to refined handle.
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:303
#define DeleteCoreFunctionBegin
Definition: DeleteCore.cpp:34
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:306
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
MoFEMErrorCode delete_finite_element(const std::string name, int verb=DEFAULT_VERBOSITY)
delete finite element from mofem database
Definition: DeleteCore.cpp:599
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:628
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
MoFEMErrorCode clear_adjacencies_entities(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for entities on given bit level
Definition: DeleteCore.cpp:214
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
MoFEMErrorCode clear_finite_elements_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:276
MoFEMErrorCode clear_ents_fields(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:126
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
MoFEMErrorCode remove_ents_from_finite_element_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
remove elements from given refinement level to finite element database
Definition: DeleteCore.cpp:435
MoFEMErrorCode remove_ents_from_field(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)
remove entities from field
Definition: DeleteCore.cpp:165
MoFEMErrorCode remove_parents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Remove parent from entities on bit level.
Definition: DeleteCore.cpp:483
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
Managing BitRefLevels.
MoFEMErrorCode remove_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
remove entities form mofem database
Definition: DeleteCore.cpp:472
MoFEMErrorCode delete_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY)
delete entities form mofem and moab database
Definition: DeleteCore.cpp:546
MoFEMErrorCode clear_adjacencies_finite_elements(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
clear adjacency map for finite elements on given bit level
Definition: DeleteCore.cpp:329
#define CHKERR
Inline error check.
Definition: definitions.h:604
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
MoFEMErrorCode remove_parents_by_ents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove parents from entities.
Definition: DeleteCore.cpp:495
MoFEMErrorCode remove_ents_from_field_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
remove entities from field
Definition: DeleteCore.cpp:202
MoFEMErrorCode clear_finite_elements(const Range ents, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:288
MoFEMErrorCode remove_parents_by_parents(const Range &ents, int verb=DEFAULT_VERBOSITY)
Remove paremts from entities having parents in passed range.
Definition: DeleteCore.cpp:529
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
MoFEMErrorCode clear_inactive_dofs(int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:42
static UId getHiFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)
uint128_t UId
Unique Id.
Definition: Types.hpp:42
UId getLocalUniqueIdCalculate() const
Generate UId for finite element entity.
MoFEMErrorCode clear_dofs_fields_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, int verb=DEFAULT_VERBOSITY)
Definition: DeleteCore.cpp:58
static UId getLoFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)