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.
retrieve_global_pointers_by_index_functor.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_RETRIEVE_GLOBAL_POINTERS_BY_INDEX_FUNCTOR_H_INCLUDED )
14 #define KRATOS_RETRIEVE_GLOBAL_POINTERS_BY_INDEX_FUNCTOR_H_INCLUDED
15 
16 
17 // System includes
18 #include <string>
19 #include <iostream>
20 
21 
22 // External includes
23 
24 
25 // Project includes
26 #include "includes/define.h"
28 
29 namespace Kratos
30 {
33 
36 
40 
44 
48 
52 
54 
56 template< class TContainerType >
58 {
59 public:
62 
65 
69 
72  const TContainerType& rContainer,
73  const std::vector<int>& rIndices
74  )
75  : mrContainer(rContainer), mrIndices(rIndices)
76  {}
77 
80 
85  {
86  return GlobalPointerUtilities::RetrieveGlobalIndexedPointers(mrContainer, mrIndices, rComm );
87  }
88 
89 
93 
94 
98 
99 
103 
104 
108 
110  virtual std::string Info() const
111  {
112  std::stringstream buffer;
113  buffer << "RetrieveGlobalPointersByIndex" ;
114  return buffer.str();
115  }
116 
118  virtual void PrintInfo(std::ostream& rOStream) const {rOStream << "RetrieveGlobalPointersByIndex";}
119 
121  virtual void PrintData(std::ostream& rOStream) const {}
122 
126 
127 
129 
130 protected:
133 
134 
138 
139 
143 
144 
148 
149 
153 
154 
158 
159 
163 
164 
166 
167 private:
170 
171 
175  const TContainerType& mrContainer;
176  const std::vector<int>& mrIndices; //note that A REFERENCE is stored
177 
178 
182 
183 
187 
188 
192 
193 
197 
198 
202 
204 
205 }; // Class RetrieveGlobalPointersByIndex
206 
208 
211 
212 
216 
217 
219 template<class TContainerType>
220 inline std::istream& operator >> (std::istream& rIStream,
222 {return rIStream;}
223 
225 template<class TContainerType>
226 inline std::ostream& operator << (std::ostream& rOStream,
228 {
229  rThis.PrintInfo(rOStream);
230  rOStream << std::endl;
231  rThis.PrintData(rOStream);
232 
233  return rOStream;
234 }
236 
238 
239 } // namespace Kratos.
240 
241 #endif // KRATOS_RETRIEVE_GLOBAL_POINTERS_BY_INDEX_FUNCTOR_H_INCLUDED defined
242 
243 
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
static GlobalPointersVector< typename TContainerType::value_type > RetrieveGlobalIndexedPointers(const TContainerType &rContainer, const std::vector< int > &rIdList, const DataCommunicator &rDataCommunicator)
Retrieve global indexed pointers from container and data communicator.
Definition: global_pointer_utilities.h:329
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
Short class definition.
Definition: retrieve_global_pointers_by_index_functor.h:58
virtual ~RetrieveGlobalPointersByIndex()
Destructor.
Definition: retrieve_global_pointers_by_index_functor.h:79
virtual std::string Info() const
Turn back information as a string.
Definition: retrieve_global_pointers_by_index_functor.h:110
RetrieveGlobalPointersByIndex(const TContainerType &rContainer, const std::vector< int > &rIndices)
Default constructor.
Definition: retrieve_global_pointers_by_index_functor.h:71
GlobalPointersVector< typename TContainerType::value_type > operator()(const DataCommunicator &rComm) const
Definition: retrieve_global_pointers_by_index_functor.h:84
KRATOS_CLASS_POINTER_DEFINITION(RetrieveGlobalPointersByIndex)
Pointer definition of RetrieveGlobalPointersByIndex.
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: retrieve_global_pointers_by_index_functor.h:121
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: retrieve_global_pointers_by_index_functor.h:118
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