v0.13.2
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
16/**
17 * \brief Managing BitRefLevels
18 * \ingroup mofem_bit_ref
19 * \nosubgrouping
20 */
22
23 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
24 UnknownInterface **iface) const;
25
27 bool dEbug;
28
29 CommInterface(const MoFEM::Core &core);
30
31 /**
32 * \brief Destructor
33 */
34 ~CommInterface() = default;
35
36 /** \name Make elemnts multishared */
37
38 /**@{*/
39
40 /**
41 * \brief resolve shared entities for finite elements in the problem
42 * \ingroup mofem_problems
43
44 * @param problem_ptr problem pointer
45 * @param fe_name finite element name
46 * @param verb verbosity level
47 * @return error code
48 *
49 * This allows for tag reduction or tag exchange, f.e.
50
51 \code
52 CHKERR m_field.resolveSharedFiniteElements(problem_ptr,"SHELL_ELEMENT");
53 Tag th;
54 CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
55 CHKERR ParallelComm* pcomm =
56 ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
57 CHKERR pcomm->exchange_tags(th,prisms);
58 \endcode
59
60 *
61 */
63 const std::string &fe_name,
64 int verb = DEFAULT_VERBOSITY);
65
66 /**
67 * \brief resolve shared entities for finite elements in the problem
68 * \ingroup mofem_problems
69
70 * @param name problem name
71 * @param fe_name finite element name
72 * @param verb verbosity level
73 * @return error code
74 *
75 * This allows for tag reduction or tag exchange, f.e.
76
77 \code
78 CHKERR m_field.resolveSharedFiniteElements(problem_ptr,"SHELL_ELEMENT");
79 Tag th;
80 CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
81 ParallelComm* pcomm =
82 ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
83 // CHKERR pcomm->reduce_tags(th,MPI_SUM,prisms);
84 CHKERR pcomm->exchange_tags(th,prisms);
85 \endcode
86
87 *
88 */
89 MoFEMErrorCode resolveSharedFiniteElements(const std::string name,
90 const std::string &fe_name,
91 int verb = DEFAULT_VERBOSITY);
92
93 /** \name Make entities multishared */
94
95 /**
96 * @brief make entities from proc 0 shared on all proc
97 *
98 * \note collective - need tu be run on all processors in communicator
99 *
100 * @param entities
101 * @param num_entities
102 * @param my_proc default proc id to share from
103 * @param verb
104 * @return MoFEMErrorCode
105 */
107 const int num_entities,
108 const int owner_proc = 0,
109 int verb = DEFAULT_VERBOSITY);
110
111 /**
112 * @brief make entities from proc 0 shared on all proc
113 *
114 * \note collective - need tu be run on all processors in communicator
115 *
116 * @param entities
117 * @param my_proc default proc id to share from
118 * @param verb
119 * @return MoFEMErrorCode
120 */
122 const int owner_proc = 0,
123 int verb = DEFAULT_VERBOSITY);
124
125 /**
126 * @brief make field entities multi shared
127 *
128 * \note collective - need tu be run on all processors in communicator
129 *
130 * @param field_name
131 * @param owner_proc
132 * @param verb
133 * @return MoFEMErrorCode
134 */
136 const int owner_proc = 0,
137 int verb = DEFAULT_VERBOSITY);
138
139 /**
140 * @brief Exchange field data
141 *
142 * Exchange field for all shared and ghosted entities. This function should be
143 * called collectively over the communicator for this ParallelComm. If the
144 * entities vector is empty, all shared entities participate in the exchange.
145 * If a proc has no owned entities this function must still be called since it
146 * is collective.
147 *
148 * \note collective - need tu be run on all processors in communicator
149 *
150 * \todo It is not working if field has entities diffrent than vertices.
151 *
152 * @param verb
153 * @param field_name @return MoFEMErrorCode
154 */
156 int verb = DEFAULT_VERBOSITY);
157
158 /**@}*/
159
160 /** \name Synchronize entities (Following functions in future will be
161 * deprecated) */
162
163 /**@{*/
164
165 /** synchronize entity range on processors (collective)
166 *
167 * \note collective - need tu be run on all processors in communicator
168 *
169 */
171
172 /** synchronize entity range on processors (collective)
173 * \ingroup mofem_field
174 *
175 * \note collective - need tu be run on all processors in communicator
176 *
177 * \param name field
178 * \param verbose level
179 *
180 */
181 MoFEMErrorCode synchroniseFieldEntities(const std::string name,
182 int verb = DEFAULT_VERBOSITY);
183
184 /**
185 * @brief Synchronise parent entities
186 *
187 * \note collective - need tu be run on all processors in communicator
188 *
189 * Exchange parent entity tag and bitref of entity. Note thar parent handle
190 * can be different on each processor.
191 *
192 * @param ent
193 * @param verb
194 * @return MoFEMErrorCode
195 */
197 int verb = DEFAULT_VERBOSITY);
198
199 /**@}*/
200
201 /**@*/
202
203 /** \name Read load and boradcoast */
204
205 /**
206 * \brief Set partition tag to each finite element in the problem
207 * \ingroup mofem_problems_manager
208 *
209 * This will use one of the mesh partitioning programs available from PETSc
210 * See
211 * <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatPartitioningType.html>
212 *
213 * @param ents Entities to partition
214 * @param dim Dimension of entities to partition
215 * @param adj_dim Adjacency dimension
216 * @param n_parts Number of partitions
217 * @param verb Verbosity level
218 * @return Error code
219 */
220 MoFEMErrorCode partitionMesh(const Range &ents, const int dim,
221 const int adj_dim, const int n_parts,
222 Tag *th_vertex_weights = nullptr,
223 Tag *th_edge_weights = nullptr,
224 Tag *th_part_weights = nullptr,
225 int verb = VERBOSE, const bool debug = false);
226
227
228 // /**
229 // * @brief
230 // *
231 // * @param meshset
232 // * @param overlap
233 // * @param dim
234 // * @param adj_dim
235 // * @param n_parts
236 // * @param th_vertex_weights
237 // * @param th_edge_weights
238 // * @param th_part_weights
239 // * @param verb
240 // * @return MoFEMErrorCode
241 // */
242 // MoFEMErrorCode partitionAndShare(const EntityHandle meshset,
243 // const int overlap = 0, const int dim,
244 // const int adj_dim, const int n_parts,
245 // Tag *th_vertex_weights = nullptr,
246 // Tag *th_edge_weights = nullptr,
247 // Tag *th_part_weights = nullptr,
248 // int verb = VERBOSE);
249
250 /**@}*/
251
252};
253} // namespace MoFEM
254
255#endif //__COMMINTERFACE_HPP__
256
257/**
258 * \defgroup mofem_comm Comm intrface
259 * \brief Comm interface
260 *
261 * \ingroup mofem
262 */
MoFEM interface.
@ DEFAULT_VERBOSITY
Definition: definitions.h:207
@ VERBOSE
Definition: definitions.h:209
static const bool debug
const int dim
MoFEMErrorCode synchroniseFieldEntities(const std::string name, int verb=DEFAULT_VERBOSITY)
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)
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
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
constexpr auto field_name
Managing BitRefLevels.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
~CommInterface()=default
Destructor.
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
MoFEMErrorCode synchroniseEntities(Range &ent, int verb=DEFAULT_VERBOSITY)
MoFEMErrorCode makeFieldEntitiesMultishared(const std::string field_name, const int owner_proc=0, int verb=DEFAULT_VERBOSITY)
make field entities multi shared
MoFEMErrorCode resolveParentEntities(const Range &ent, int verb=DEFAULT_VERBOSITY)
Synchronise parent entities.
MoFEMErrorCode exchangeFieldData(const std::string field_name, int verb=DEFAULT_VERBOSITY)
Exchange field data.
Core (interface) class.
Definition: Core.hpp:82
keeps basic data about problem
base class for all interface classes