v0.16.3
Loading...
Searching...
No Matches
CommInterface.hpp
Go to the documentation of this file.
1/** \file CommInterface.hpp
2 * \brief Interface for communication functions
3 * \ingroup mofem_comm
4 *
5 * Functions used to communicate, share entities, share data, etc.
6 *
7 */
8
9#ifndef __COMMINTERFACE_HPP__
10#define __COMMINTERFACE_HPP__
11
12#include "UnknownInterface.hpp"
13
14namespace MoFEM {
15
16struct TetMeshData;
17
19
20 // This is not fully safe, very unlikely to cause problems in practice,
21 // but it is possible that a ParallelComm is created for a mesh, then
22 // the mesh is deleted and a new mesh is created at the same address, and then getOrCreate
23 // is called again, which will return the old ParallelComm for the new mesh.
24 // This can be avoided that we create tag in moab with uniqe ID, that
25 // is incremented each time mesh is created, and we store this ID in the
26 // registry along with the pointer, and check it when we get ParallelComm from registry.
27 static auto &getMap() {
28 static std::map<moab::Core *, boost::weak_ptr<ParallelComm>> pcomm_map;
29 return pcomm_map;
30 }
31
32 static auto getOrCreate(moab::Core *core_mesh_ptr) {
33 auto *mesh_ptr = core_mesh_ptr;
34 auto &pcomm_map = getMap();
35
36 if (auto it = pcomm_map.find(mesh_ptr); it != pcomm_map.end()) {
37 if (auto pcomm_ptr = it->second.lock())
38 return pcomm_ptr;
39 }
40
41 if (auto *raw_pcomm = ParallelComm::get_pcomm(mesh_ptr, MYPCOMM_INDEX)) {
42 auto pcomm_ptr = boost::shared_ptr<ParallelComm>(
43 raw_pcomm, [mesh_ptr](ParallelComm *) {});
44 pcomm_map[mesh_ptr] = pcomm_ptr;
45 return pcomm_ptr;
46 }
47
48 auto pcomm_ptr = boost::shared_ptr<ParallelComm>(
49 new ParallelComm(mesh_ptr, PETSC_COMM_WORLD),
50 [mesh_ptr](ParallelComm *pcomm) {
51 delete pcomm;
52 return;
53 });
54 return pcomm_ptr;
55 }
56
57 /** @deprecated Do not use this function, use getOrCreate(moab::Core*) instead */
58 static auto getOrCreate(const boost::shared_ptr<moab::Core> &core_mesh_ptr) {
59 return MeshPCommRegistry::getOrCreate(core_mesh_ptr.get());
60 }
61};
62
63/**
64 * \brief Managing BitRefLevels
65 * \ingroup mofem_bit_ref
66 * \nosubgrouping
67 */
69
70 inline static bool debug = false;
71 inline static Sev sev = Sev::verbose;
72
73 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
74 UnknownInterface **iface) const;
75
77 bool dEbug;
78
79 CommInterface(const MoFEM::Core &core);
80
81 /**
82 * \brief Destructor
83 */
84 ~CommInterface() = default;
85
86 /** \name Parent-child and connectivity mesh synchronisation
87 * Examples use a MoFEM::Interface reference named m_field and entity ranges
88 * prepared according to each operation's contract.
89 */
90
91 /**@{*/
92
93 /** Synchronise a linear simplicial subdivision using existing ancestry.
94 * Collective on the mesh ParallelComm, including empty ranks. The parent
95 * level must already have consistent ownership, sharing and resident copies.
96 * Child vertices require consistent positive GLOBAL_ID values; copies must
97 * have matching connectivity and ancestry. Coordinates are not compared;
98 * geometry synchronisation is a separate caller operation.
99 * Each producer supplies a complete subdivision of the parent carriers it
100 * refines, including bounding entities.
101 * Children may be created concurrently or on a single, arbitrary rank.
102 * Missing children are transferred through MOAB; existing copies are reused.
103 * Children inherit their parent's owner and resident ranks, with local parent
104 * handles, refinement indices and partition/BC membership updated afterwards.
105 * Field/DOF numbering and additional ghost layers are caller responsibilities.
106 *
107 * \code
108 * auto comm = m_field.getInterface<CommInterface>();
109 * const auto parent_bit = BitRefLevel().set(0);
110 * const auto child_bit = BitRefLevel().set(1);
111 * // Parent sharing, child ancestry and global vertex IDs are already set.
112 * CHKERR comm->synchroniseByParentChild(parent_bit, child_bit);
113 * \endcode
114 */
116 const BitRefLevel &parent_bit, const BitRefLevel &child_bit,
117 int verb = DEFAULT_VERBOSITY);
118
119 /** Collective indexed-mesh transport for small global reconstruction jobs.
120 * gatherMesh merges selected cell closures by positive vertex IDs on root;
121 * cell copies must agree on partition. Vertex coordinates come from the
122 * owning rank when it contributes; otherwise use the lowest contributing
123 * rank. Without registered sharing, the lowest rank claiming ownership wins.
124 *
125 * \code
126 * auto comm = m_field.getInterface<CommInterface>();
127 * TetMeshData mesh;
128 * // Every rank contributes its selected tetrahedra, possibly an empty range.
129 * CHKERR comm->gatherMesh(cells, mesh, 0);
130 * // Only rank 0 now holds the collected mesh.
131 * \endcode
132 */
134 int root = 0);
135
136 /** Collectively broadcast indexed mesh data from root to every rank.
137 * Sends coordinates, vertex IDs, connectivity, labels and partitions.
138 * Non-root input data is replaced by root's data.
139 *
140 * \code
141 * auto comm = m_field.getInterface<CommInterface>();
142 * TetMeshData mesh;
143 * CHKERR comm->gatherMesh(cells, mesh, 0);
144 * CHKERR comm->broadcastMesh(mesh, 0);
145 * // The collected mesh is now available on every rank.
146 * \endcode
147 */
148 MoFEMErrorCode broadcastMesh(TetMeshData &data, int root = 0);
149
150 /** Initialise cell partitions from representative parent tags. No BC,
151 * material, field or geometric transfer is performed.
152 *
153 * \code
154 * auto comm = m_field.getInterface<CommInterface>();
155 * CHKERR m_field.getInterface<MeshRefinement>()->setTopologicalParents(
156 * source_entities, child_entities, BitRefLevel().set(1));
157 * CHKERR comm->inheritPartitions(source_entities, child_entities);
158 * \endcode
159 */
160 MoFEMErrorCode inheritPartitions(const Range &source_entities,
161 const Range &child_entities);
162
163 /** Keep this rank's cells and closure; delete other selected entities except
164 * preserve (e.g. source lineage). Use before registering output sharing.
165 *
166 * \code
167 * auto comm = m_field.getInterface<CommInterface>();
168 * // Child partitions are assigned; preserve the source entities for lineage.
169 * CHKERR comm->retainPartition(child_entities, BitRefLevel().set(1),
170 * source_entities);
171 * // child_entities now contains only this rank's cells and their closure.
172 * \endcode
173 */
174 MoFEMErrorCode retainPartition(Range &entities, const BitRefLevel &active_bit,
175 const Range &preserve = {});
176
177 /** Establish sharing of an agreed, already distributed cell closure by
178 * vertex IDs/connectivity. Input has no previously registered output sharing.
179 * Coordinates are neither compared nor updated.
180 * Parent partition tags seed ownership; incident cells determine residence.
181 * Builds the local partition set and registers actual handles through MOAB.
182 * By default each tetrahedron must reside only on its partition owner.
183 * With complete_mesh_rank >= 0, that rank must hold every selected cell;
184 * other ranks may also retain halo cells. All cell owners must be resident.
185 * Non-owned cell copies are registered as ghosts, and local partition sets
186 * contain only owned cells and their closure. No mesh payload is transferred.
187 * The complete_mesh_rank argument must agree across ranks.
188 *
189 * \code
190 * auto comm = m_field.getInterface<CommInterface>();
191 * // Each rank has already retained its assigned cells and full closure.
192 * // Output sharing has not yet been registered.
193 * CHKERR comm->synchroniseByConnectivity(child_entities);
194 * \endcode
195 */
197 int complete_mesh_rank = -1);
198
199 /**@}*/
200
201 /** \name Make elements multishared */
202
203 /**@{*/
204
205 /**
206 * \brief resolve shared entities for finite elements in the problem
207 * \ingroup mofem_problems
208
209 * @param problem_ptr problem pointer
210 * @param fe_name finite element name
211 * @param verb verbosity level
212 * @return error code
213 *
214 * This allows for tag reduction or tag exchange, f.e.
215
216 \code
217 CHKERR m_field.resolveSharedFiniteElements(problem_ptr,"SHELL_ELEMENT");
218 Tag th;
219 CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
220 CHKERR ParallelComm* pcomm =
221 ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
222 CHKERR pcomm->exchange_tags(th,prisms);
223 \endcode
224
225 *
226 */
228 const std::string &fe_name,
229 int verb = DEFAULT_VERBOSITY);
230
231 /**
232 * \brief resolve shared entities for finite elements in the problem
233 * \ingroup mofem_problems
234
235 * @param name problem name
236 * @param fe_name finite element name
237 * @param verb verbosity level
238 * @return error code
239 *
240 * This allows for tag reduction or tag exchange, f.e.
241
242 \code
243 CHKERR m_field.resolveSharedFiniteElements(problem_ptr,"SHELL_ELEMENT");
244 Tag th;
245 CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
246 ParallelComm* pcomm =
247 ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
248 // CHKERR pcomm->reduce_tags(th,MPI_SUM,prisms);
249 CHKERR pcomm->exchange_tags(th,prisms);
250 \endcode
251
252 *
253 */
255 const std::string &fe_name,
256 int verb = DEFAULT_VERBOSITY);
257
258 /** \name Make entities multishared */
259
260 /**
261 * @brief make entities from proc 0 shared on all proc
262 *
263 * \note collective - need to be run on all processors in communicator
264 *
265 * @param entities
266 * @param num_entities
267 * @param my_proc default proc id to share from
268 * @param verb
269 * @return MoFEMErrorCode
270 */
271 MoFEMErrorCode makeEntitiesMultishared(const EntityHandle *entities,
272 const int num_entities,
273 const int owner_proc = 0,
274 int verb = DEFAULT_VERBOSITY);
275
276 /**
277 * @brief make entities from proc 0 shared on all proc
278 *
279 * \note collective - need to be run on all processors in communicator
280 *
281 * @param entities
282 * @param my_proc default proc id to share from
283 * @param verb
284 * @return MoFEMErrorCode
285 */
287 const int owner_proc = 0,
288 int verb = DEFAULT_VERBOSITY);
289
290 /**
291 * @brief make field entities multi shared
292 *
293 * \note collective - need to be run on all processors in communicator
294 *
295 * @param field_name
296 * @param owner_proc
297 * @param verb
298 * @return MoFEMErrorCode
299 */
301 const int owner_proc = 0,
302 int verb = DEFAULT_VERBOSITY);
303
304 /**
305 * @brief Exchange field data
306 *
307 * Exchange field for all shared and ghosted entities. This function should be
308 * called collectively over the communicator for this ParallelComm. If the
309 * entities vector is empty, all shared entities participate in the exchange.
310 * If a proc has no owned entities this function must still be called since it
311 * is collective.
312 *
313 * \note collective - need to be run on all processors in communicator
314 *
315 * \todo It is not working if field has entities different than vertices.
316 *
317 * @param verb
318 * @param field_name @return MoFEMErrorCode
319 */
321 int verb = DEFAULT_VERBOSITY);
322
323 /**@}*/
324
325 /** \name Synchronize entities (Following functions in future will be
326 * deprecated) */
327
328 /**@{*/
329
330 /** synchronize entity range on processors (collective)
331 *
332 * \note collective - need to be run on all processors in communicator
333 *
334 */
335
336 /**
337 * @brief synchronize entity range on processors (collective)
338 *
339 * \note collective - need to be run on all processors in communicator
340 *
341 * @param ent ents to send and received
342 * @param received_ents pointer to map with received entities
343 * @param verb
344 * @return MoFEMErrorCode
345 */
347 std::map<int, Range> *received_ents,
348 int verb = DEFAULT_VERBOSITY);
349
350 /**
351 * @brief synchronize entity range on processors (collective)
352 *
353 * \note collective - need to be run on all processors in communicator
354 *
355 * @param ent ents to send and received
356 * @param verb
357 * @return MoFEMErrorCode
358 */
360
361 /** synchronize entity range on processors (collective)
362 * \ingroup mofem_field
363 *
364 * \note collective - need to be run on all processors in communicator
365 *
366 * \param name field
367 * \param verbose level
368 *
369 */
371 int verb = DEFAULT_VERBOSITY);
372
373 /**
374 * @brief Synchronise parent entities
375 *
376 * \note collective - need to be run on all processors in communicator
377 *
378 * Exchange parent entity tag and bitref of entity. Note thar parent handle
379 * can be different on each processor.
380 *
381 * @param ent
382 * @param verb
383 * @return MoFEMErrorCode
384 */
386 int verb = DEFAULT_VERBOSITY);
387
388 /**@}*/
389
390 /**@*/
391
392 /** \name Read, load and broadcast */
393
394 /**
395 * \brief Set partition tag to each finite element in the problem
396 * \ingroup mofem_problems_manager
397 *
398 * This will use one of the mesh partitioning programs available from PETSc
399 * See
400 * <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatPartitioningType.html>
401 *
402 * @param ents Entities to partition
403 * @param dim Dimension of entities to partition
404 * @param adj_dim Adjacency dimension
405 * @param n_parts Number of partitions
406 * @param verb Verbosity level
407 * @return Error code
408 */
409 MoFEMErrorCode partitionMesh(const Range &ents, const int dim,
410 const int adj_dim, const int n_parts,
411 Tag *th_vertex_weights = nullptr,
412 Tag *th_edge_weights = nullptr,
413 Tag *th_part_weights = nullptr,
414 int verb = VERBOSE, const bool debug = false,
415 const bool preserve_vertex_ids = false);
416
417 /**@}*/
418
419 /**@{*/
420
421 /** \name Load file */
422
423 using LoadFileFun = std::function<std::array<Range, 4>(
424 std::array<Range, 4> &&, std::vector<const CubitMeshSets *> &&)>;
425
426 static std::array<Range, 4>
427 defaultProcSkinFun(std::array<Range, 4> &&proc_ents_skin,
428 std::vector<const CubitMeshSets *> &&) {
429 return proc_ents_skin;
430 }
431
432 /**
433 * @brief Root proc has whole mesh, other procs only part of it
434 *
435 * @param moab
436 * @param file_name
437 * @param dim
438 * @param proc_skin_fun
439 * @param options
440 * @return MoFEMErrorCode
441 */
443 moab::Interface &moab, const char *file_name, int dim,
444 LoadFileFun proc_skin_fun = defaultProcSkinFun,
445 const char *options = "PARALLEL=BCAST;PARTITION=");
446
447 static Range getPartEntities(moab::Interface &moab, int part);
448
449 /**
450 * @brief Remove a meshset from all partition sets before it is deleted
451 *
452 * Field, finite element and problem meshsets are added to the partition
453 * set of their rank when created. MOAB does not remove a deleted handle
454 * from plain sets, so deleting such a meshset alone leaves a stale handle
455 * in the partition set, and recursive queries of that set, e.g.
456 * getPartEntities, fail with MB_ENTITY_NOT_FOUND. Call this before
457 * deleting the meshset. Does nothing when there is no ParallelComm or no
458 * partition set.
459 *
460 * @param moab MOAB instance
461 * @param meshset meshset about to be deleted
462 * @param pcomm_id ParallelComm index
463 * @return MoFEMErrorCode
464 */
465 static MoFEMErrorCode
466 removeMeshsetFromPartition(moab::Interface &moab, const EntityHandle meshset,
467 const int pcomm_id = MYPCOMM_INDEX);
468
469 /**@}*/
470 /**@*/
471
472 /** \name Functions when root proc has all entities */
473
475 std::pair<std::pair<Range, Range>, SmartPetscObj<Vec>>;
476
477 /**
478 * @brief Create a ghost vector for exchanging data
479 *
480 * With one MPI rank, all selected entities are local, even when the input
481 * mesh contains partition labels from a parallel run.
482 *
483 * @note Only works if loadFileRootProcAllRestDistributed function is used.
484 *
485 * @param comm
486 * @param moab
487 * @param get_entities_fun function to get entities to partition
488 * @param dim dimension of partition entities
489 * @param adj_dim dimension of adjacent entities
490 * @param nb_coeffs number of coefficients
491 * @param sev
492 * @param root_rank
493 * @param get_vertices whether to get vertices along with entities
494 *
495 * Example:
496 * \code
497 auto face_exchange = CommInterface::createEntitiesPetscVector(
498 mField.get_comm(), mField.get_moab(),
499 [](Range part_ents) { return part_ents.subset_by_dimension(2); },
500 3, Sev::inform);
501 CHKERR CommInterface::updateEntitiesPetscVector(
502 mField.get_moab(), face_exchange, tag_value_to_exchange);
503 * \endcode
504 *
505 * @return std::pair<Range, SmartPetscObj<Vec>>
506 */
508 createEntitiesPetscVector(MPI_Comm comm, moab::Interface &moab,
509 std::function<Range(Range)> get_entities_fun,
510 const int nb_coeffs, Sev sev = Sev::verbose,
511 int root_rank = 0, bool get_vertices = true);
512
513 /**
514 * @brief Create a ghost vector for exchanging data
515 *
516 * @note Only works if loadFileRootProcAllRestDistributed function is used.
517 *
518 * @param comm
519 * @param moab
520 * @param dim dimension of partition entities
521 * @param adj_dim dimension of adjacent entities
522 * @param nb_coeffs number of coefficients
523 * @param sev
524 * @param root_rank
525 *
526 * Example:
527 * \code
528 auto face_exchange = CommInterface::createEntitiesPetscVector(
529 mField.get_comm(), mField.get_moab(), 2, 3, Sev::inform);
530 \endcode
531 *
532 * @return std::pair<Range, SmartPetscObj<Vec>>
533 */
535 createEntitiesPetscVector(MPI_Comm comm, moab::Interface &moab, int dim,
536 const int nb_coeffs, Sev sev = Sev::verbose,
537 int root_rank = 0);
538
539 using UpdateGhosts = std::function<MoFEMErrorCode(Vec vec)>;
540
543 CHKERR VecAssemblyBegin(v);
544 CHKERR VecAssemblyEnd(v);
545 CHKERR VecGhostUpdateBegin(v, ADD_VALUES, SCATTER_REVERSE);
546 CHKERR VecGhostUpdateEnd(v, ADD_VALUES, SCATTER_REVERSE);
547 CHKERR VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_FORWARD);
548 CHKERR VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_FORWARD);
550 };
551
552 /**
553 * @brief Set the Vector From Tag object
554 *
555 * @param moab
556 * @param vec
557 * @param tag
558 *
559 * Example:
560 * \code
561 CHKERR CommInterface::setVectorFromTag(
562 mField.get_moab(), face_exchange, tag_value_to_exchange);
563 \endcode
564 *
565 * @return MoFEMErrorCode
566 */
567 static MoFEMErrorCode setVectorFromTag(moab::Interface &moab,
569
570 /**
571 * @brief Set the Tag From Vector object
572 *
573 * @param moab
574 * @param vec
575 * @param tag
576 *
577 * Example:
578 * \code
579 CHKERR CommInterface::setTagFromVector(
580 mField.get_moab(), face_exchange, tag_value_to_exchange);
581 \endcode
582 *
583 * @return MoFEMErrorCode
584 */
585 static MoFEMErrorCode setTagFromVector(moab::Interface &moab,
587
588 /**
589 * @brief Exchange data between vector and data
590 *
591 * @param tag
592 *
593 * This reads values from the tag, exchanges ghost values, and writes the
594 * exchanged values back to the tag.
595 *
596 * Example:
597 * \code
598 CHKERR CommInterface::updateEntitiesPetscVector(
599 mField.get_moab(), face_exchange, tag_value_to_exchange);
600 \endcode
601 *
602 * @return MoFEMErrorCode
603 */
604 static MoFEMErrorCode
605 updateEntitiesPetscVector(moab::Interface &moab, EntitiesPetscVector &vec,
606 Tag tag,
607 UpdateGhosts update_gosts = defaultUpdateGhosts);
608
609 /**@}*/
610
611};
612} // namespace MoFEM
613
614#endif //__COMMINTERFACE_HPP__
615
616/**
617 * \defgroup mofem_comm Comm interface
618 * \brief Communication interface
619 *
620 * \ingroup mofem
621 */
std::vector< Cell > cells
MPI_Comm comm
Tag tag
It it
Definition Schur.cpp:2568
std::string name
MoFEM interface.
@ DEFAULT_VERBOSITY
@ VERBOSE
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
MoFEMErrorCode synchroniseFieldEntities(const std::string name, int verb=DEFAULT_VERBOSITY)
SeverityLevel
Severity levels.
MoFEMErrorCode partitionMesh(const Range &ents, const int dim, const int adj_dim, const int n_parts, Tag *th_vertex_weights=nullptr, Tag *th_edge_weights=nullptr, Tag *th_part_weights=nullptr, int verb=VERBOSE, const bool debug=false, const bool preserve_vertex_ids=false)
Set partition tag to each finite element in the problem.
MoFEMErrorCode resolveSharedFiniteElements(const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
resolve shared entities for finite elements in the problem
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
constexpr auto field_name
Managing BitRefLevels.
static MoFEMErrorCode updateEntitiesPetscVector(moab::Interface &moab, EntitiesPetscVector &vec, Tag tag, UpdateGhosts update_gosts=defaultUpdateGhosts)
Exchange data between vector and data.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
std::function< MoFEMErrorCode(Vec vec)> UpdateGhosts
MoFEMErrorCode inheritPartitions(const Range &source_entities, const Range &child_entities)
static Range getPartEntities(moab::Interface &moab, int part)
~CommInterface()=default
Destructor.
MoFEMErrorCode synchroniseByConnectivity(const Range &entities, int complete_mesh_rank=-1)
MoFEMErrorCode retainPartition(Range &entities, const BitRefLevel &active_bit, const Range &preserve={})
static MoFEMErrorCode defaultUpdateGhosts(Vec v)
MoFEMErrorCode makeEntitiesMultishared(const EntityHandle *entities, const int num_entities, const int owner_proc=0, int verb=DEFAULT_VERBOSITY)
make entities from proc 0 shared on all proc
static std::array< Range, 4 > defaultProcSkinFun(std::array< Range, 4 > &&proc_ents_skin, std::vector< const CubitMeshSets * > &&)
static MoFEMErrorCode loadFileRootProcAllRestDistributed(moab::Interface &moab, const char *file_name, int dim, LoadFileFun proc_skin_fun=defaultProcSkinFun, const char *options="PARALLEL=BCAST;PARTITION=")
Root proc has whole mesh, other procs only part of it.
MoFEMErrorCode synchroniseEntities(Range &ent, std::map< int, Range > *received_ents, int verb=DEFAULT_VERBOSITY)
synchronize entity range on processors (collective)
MoFEMErrorCode synchroniseByParentChild(const BitRefLevel &parent_bit, const BitRefLevel &child_bit, int verb=DEFAULT_VERBOSITY)
std::function< std::array< Range, 4 >(std::array< Range, 4 > &&, std::vector< const CubitMeshSets * > &&)> LoadFileFun
static MoFEMErrorCode setVectorFromTag(moab::Interface &moab, EntitiesPetscVector &vec, Tag tag)
Set the Vector From Tag object.
static MoFEMErrorCode removeMeshsetFromPartition(moab::Interface &moab, const EntityHandle meshset, const int pcomm_id=MYPCOMM_INDEX)
Remove a meshset from all partition sets before it is deleted.
static MoFEMErrorCode setTagFromVector(moab::Interface &moab, EntitiesPetscVector &vec, Tag tag)
Set the Tag From Vector object.
MoFEMErrorCode makeFieldEntitiesMultishared(const std::string field_name, const int owner_proc=0, int verb=DEFAULT_VERBOSITY)
make field entities multi shared
std::pair< std::pair< Range, Range >, SmartPetscObj< Vec > > EntitiesPetscVector
MoFEMErrorCode resolveParentEntities(const Range &ent, int verb=DEFAULT_VERBOSITY)
Synchronise parent entities.
MoFEMErrorCode gatherMesh(const Range &cells, TetMeshData &data, int root=0)
MoFEMErrorCode exchangeFieldData(const std::string field_name, int verb=DEFAULT_VERBOSITY)
Exchange field data.
static EntitiesPetscVector createEntitiesPetscVector(MPI_Comm comm, moab::Interface &moab, std::function< Range(Range)> get_entities_fun, const int nb_coeffs, Sev sev=Sev::verbose, int root_rank=0, bool get_vertices=true)
Create a ghost vector for exchanging data.
MoFEMErrorCode broadcastMesh(TetMeshData &data, int root=0)
Core (interface) class.
Definition Core.hpp:83
static auto getOrCreate(const boost::shared_ptr< moab::Core > &core_mesh_ptr)
static auto getOrCreate(moab::Core *core_mesh_ptr)
keeps basic data about problem
intrusive_ptr for managing petsc objects
base class for all interface classes