v0.13.1
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 */
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
186 /**@*/
187
188 /** \name Read load and boradcoast */
189
190 /**
191 * \brief Set partition tag to each finite element in the problem
192 * \ingroup mofem_problems_manager
193 *
194 * This will use one of the mesh partitioning programs available from PETSc
195 * See
196 * <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatPartitioningType.html>
197 *
198 * @param ents Entities to partition
199 * @param dim Dimension of entities to partition
200 * @param adj_dim Adjacency dimension
201 * @param n_parts Number of partitions
202 * @param verb Verbosity level
203 * @return Error code
204 */
205 MoFEMErrorCode partitionMesh(const Range &ents, const int dim,
206 const int adj_dim, const int n_parts,
207 Tag *th_vertex_weights = nullptr,
208 Tag *th_edge_weights = nullptr,
209 Tag *th_part_weights = nullptr,
210 int verb = VERBOSE, const bool debug = false);
211
212
213 // /**
214 // * @brief
215 // *
216 // * @param meshset
217 // * @param overlap
218 // * @param dim
219 // * @param adj_dim
220 // * @param n_parts
221 // * @param th_vertex_weights
222 // * @param th_edge_weights
223 // * @param th_part_weights
224 // * @param verb
225 // * @return MoFEMErrorCode
226 // */
227 // MoFEMErrorCode partitionAndShare(const EntityHandle meshset,
228 // const int overlap = 0, const int dim,
229 // const int adj_dim, const int n_parts,
230 // Tag *th_vertex_weights = nullptr,
231 // Tag *th_edge_weights = nullptr,
232 // Tag *th_part_weights = nullptr,
233 // int verb = VERBOSE);
234
235 /**@}*/
236
237};
238} // namespace MoFEM
239
240#endif //__COMMINTERFACE_HPP__
241
242/**
243 * \defgroup mofem_comm Comm intrface
244 * \brief Comm interface
245 *
246 * \ingroup mofem
247 */
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()
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 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