KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
communication_coloring_utilities.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Riccardo Rossi
11 //
12 
13 #if !defined(KRATOS_MPI_COLORING_UTILITIES_H_INCLUDED )
14 #define KRATOS_MPI_COLORING_UTILITIES_H_INCLUDED
15 
16 // System includes
17 #include <iostream>
18 #include <sstream>
19 #include <map>
20 
21 // External includes
22 
23 
24 // Project includes
25 #include "includes/define.h"
26 #include "includes/serializer.h"
28 
29 namespace Kratos
30 {
33 
36 
40 
44 
48 
52 
54 class KRATOS_API(KRATOS_CORE) MPIColoringUtilities
55 {
56 public:
59 
62 
66 
69 
71  virtual ~MPIColoringUtilities() {}
72 
76 
82  static std::vector<int> ComputeRecvList(
83  const std::vector<int>& rLocalDestinationIds,
84  const DataCommunicator& rComm
85  );
86 
102  static std::vector<int> ComputeCommunicationScheduling(
103  const std::vector<int>& rLocalDestinationIds,
104  const DataCommunicator& rComm
105  );
106 
107 
108 
109 
113 
114 
118 
119 
123 
124 
128 
130  virtual std::string Info() const
131  {
132  std::stringstream buffer;
133  buffer << "MPIColoringUtilities" ;
134  return buffer.str();
135  }
136 
138  virtual void PrintInfo(std::ostream& rOStream) const
139  {
140  rOStream << "MPIColoringUtilities";
141  }
142 
144  virtual void PrintData(std::ostream& rOStream) const {}
145 
146 
150 
151 
153 
154 protected:
157 
158 
162 
163 
167 
168 
172  static bool HasEdge(std::map<int, std::map<int, int> >& rGraph, int i, int j);
173 
174 
178 
179 
183 
184 
188 
189 
191 
192 private:
195 
196 
200 
201 
205 
206  friend class Serializer;
207 
208  void save(Serializer& rSerializer) const
209  {
210  }
211 
212  void load(Serializer& rSerializer)
213  {
214  }
215 
216 
220 
221 
225 
226 
230 
231 
235 
237 
238 }; // Class MPIColoringUtilities
239 
241 
244 
245 
249 
250 
252 template< class TDataType >
253 inline std::istream& operator >> (std::istream& rIStream,
254  MPIColoringUtilities& rThis)
255 {
256  return rIStream;
257 }
258 
260 template< class TDataType >
261 inline std::ostream& operator << (std::ostream& rOStream,
262  const MPIColoringUtilities& rThis)
263 {
264  rThis.PrintInfo(rOStream);
265  rOStream << std::endl;
266  rThis.PrintData(rOStream);
267 
268  return rOStream;
269 }
271 
273 
274 } // namespace Kratos.
275 
276 #endif // KRATOS_MPI_COLORING_UTILITIES_H_INCLUDED defined
277 
278 
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
This class provides elementary function for computing the recv list and to define a coloring for comm...
Definition: communication_coloring_utilities.h:55
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: communication_coloring_utilities.h:144
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: communication_coloring_utilities.h:138
virtual std::string Info() const
Turn back information as a string.
Definition: communication_coloring_utilities.h:130
KRATOS_CLASS_POINTER_DEFINITION(MPIColoringUtilities)
Pointer definition of MPIColoringUtilities.
MPIColoringUtilities()
Default constructor.
Definition: communication_coloring_utilities.h:68
virtual ~MPIColoringUtilities()
Destructor.
Definition: communication_coloring_utilities.h:71
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17