v0.9.1
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 /*
10  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
17  */
18 
19 #ifndef __COMMINTERFACE_HPP__
20 #define __COMMINTERFACE_HPP__
21 
22 #include "UnknownInterface.hpp"
23 
24 namespace MoFEM {
25 
27 
28 /**
29  * \brief Managing BitRefLevels
30  * \ingroup mofem_bit_ref
31  * \nosubgrouping
32  */
34 
36  UnknownInterface **iface) const;
37 
39  bool dEbug;
40 
41  CommInterface(const MoFEM::Core &core);
42 
43  /**
44  * \brief Destructor
45  */
47 
48  /** \name Make entities multishared */
49 
50  /**
51  * @brief make entities from proc 0 shared on all proc
52  *
53  * \note collective - need tu be run on all processors in communicator
54  *
55  * @param entities
56  * @param num_entities
57  * @param my_proc default proc id to share from
58  * @param verb
59  * @return MoFEMErrorCode
60  */
62  const int num_entities,
63  const int owner_proc = 0,
64  int verb = DEFAULT_VERBOSITY);
65 
66  /**
67  * @brief make entities from proc 0 shared on all proc
68  *
69  * \note collective - need tu be run on all processors in communicator
70  *
71  * @param entities
72  * @param my_proc default proc id to share from
73  * @param verb
74  * @return MoFEMErrorCode
75  */
77  const int owner_proc = 0,
78  int verb = DEFAULT_VERBOSITY);
79 
80  /**
81  * @brief make field entities multi shared
82  *
83  * \note collective - need tu be run on all processors in communicator
84  *
85  * @param field_name
86  * @param owner_proc
87  * @param verb
88  * @return MoFEMErrorCode
89  */
90  MoFEMErrorCode makeFieldEntitiesMultishared(const std::string field_name,
91  const int owner_proc = 0,
92  int verb = DEFAULT_VERBOSITY);
93 
94  /**
95  * @brief Exchange field data
96  *
97  * Exchange field for all shared and ghosted entities. This function should be
98  * called collectively over the communicator for this ParallelComm. If the
99  * entities vector is empty, all shared entities participate in the exchange.
100  * If a proc has no owned entities this function must still be called since it
101  * is collective.
102  *
103  * \note collective - need tu be run on all processors in communicator
104  *
105  * \todo It is not working if field has entities diffrent than vertices.
106  *
107  * @param verb
108  * @param field_name @return MoFEMErrorCode
109  */
110  MoFEMErrorCode exchangeFieldData(const std::string field_name,
111  int verb = DEFAULT_VERBOSITY);
112 
113  /**@}*/
114 
115  /** \name Synchronize entities (Following functions in future will be
116  * deprecated) */
117 
118  /**@{*/
119 
120  /** synchronize entity range on processors (collective)
121  *
122  * \note collective - need tu be run on all processors in communicator
123  *
124  */
125  MoFEMErrorCode synchroniseEntities(Range &ent, int verb = DEFAULT_VERBOSITY);
126 
127  /** synchronize entity range on processors (collective)
128  * \ingroup mofem_field
129  *
130  * \note collective - need tu be run on all processors in communicator
131  *
132  * \param name field
133  * \param verbose level
134  *
135  */
136  MoFEMErrorCode synchroniseFieldEntities(const std::string name,
137  int verb = DEFAULT_VERBOSITY);
138 
139  /**@}*/
140 };
141 } // namespace MoFEM
142 
143 #endif //__COMMINTERFACE_HPP__
144 
145 /**
146  * \defgroup mofem_comm Comm intrface
147  * \brief Comm interface
148  *
149  * \ingroup mofem
150  */
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
MoFEM interface unique ID.
Managing BitRefLevels.
base class for all interface classes
Core (interface) class.
Definition: Core.hpp:50
MoFEM interface.
MoFEMErrorCode makeFieldEntitiesMultishared(const std::string field_name, const int owner_proc=0, int verb=DEFAULT_VERBOSITY)
make field entities multi shared
std::bitset< BITINTERFACEUID_SIZE > BitIntefaceId
Definition: Types.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
MoFEMErrorCode synchroniseEntities(Range &ent, int verb=DEFAULT_VERBOSITY)
~CommInterface()
Destructor.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
MoFEMErrorCode synchroniseFieldEntities(const std::string name, int verb=DEFAULT_VERBOSITY)
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 exchangeFieldData(const std::string field_name, int verb=DEFAULT_VERBOSITY)
Exchange field data.
CommInterface(const MoFEM::Core &core)
static const MOFEMuuid IDD_MOFEMComm