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.
compute_neighbour_list_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_NEIGHBOUR_LIST_FUNCTOR_H_INCLUDED )
14 #define KRATOS_NEIGHBOUR_LIST_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, class TVariableType >
58 {
59 public:
62 
65 
69 
72  const TContainerType& rContainer,
73  const TVariableType& rVar
74 
75  )
76  : mrContainer(rContainer), mrVariable(rVar)
77  {}
78 
81 
86  {
88  for(auto& item : mrContainer)
89  {
90  auto& neighbours = item.GetValue(mrVariable);
91  for(auto& gp : neighbours.GetContainer())
92  gp_list.push_back(gp);
93  }
94  gp_list.Unique();
95  return gp_list;
96  }
97 
98 
102 
103 
107 
108 
112 
113 
117 
119  virtual std::string Info() const
120  {
121  std::stringstream buffer;
122  buffer << "ComputeNeighbourListFunctor" ;
123  return buffer.str();
124  }
125 
127  virtual void PrintInfo(std::ostream& rOStream) const {rOStream << "ComputeNeighbourListFunctor";}
128 
130  virtual void PrintData(std::ostream& rOStream) const {}
131 
135 
136 
138 
139 protected:
142 
143 
147 
148 
152 
153 
157 
158 
162 
163 
167 
168 
172 
173 
175 
176 private:
179 
180 
184  const TContainerType& mrContainer;
185  const TVariableType& mrVariable; //note that A REFERENCE is stored
186 
187 
191 
192 
196 
197 
201 
202 
206 
207 
211 
213 
214 }; // Class ComputeNeighbourListFunctor
215 
217 
220 
221 
225 
226 
228 template<class TContainerType, class TVariableType>
229 inline std::istream& operator >> (std::istream& rIStream,
231 {return rIStream;}
232 
234 template<class TContainerType, class TVariableType>
235 inline std::ostream& operator << (std::ostream& rOStream,
237 {
238  rThis.PrintInfo(rOStream);
239  rOStream << std::endl;
240  rThis.PrintData(rOStream);
241 
242  return rOStream;
243 }
245 
247 
248 } // namespace Kratos.
249 
250 #endif // KRATOS_NEIGHBOUR_LIST_FUNCTOR_H_INCLUDED defined
251 
252 
Short class definition.
Definition: compute_neighbour_list_functor.h:58
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: compute_neighbour_list_functor.h:127
virtual ~ComputeNeighbourListFunctor()
Destructor.
Definition: compute_neighbour_list_functor.h:80
ComputeNeighbourListFunctor(const TContainerType &rContainer, const TVariableType &rVar)
Default constructor.
Definition: compute_neighbour_list_functor.h:71
KRATOS_CLASS_POINTER_DEFINITION(ComputeNeighbourListFunctor)
Pointer definition of ComputeNeighbourListFunctor.
virtual std::string Info() const
Turn back information as a string.
Definition: compute_neighbour_list_functor.h:119
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: compute_neighbour_list_functor.h:130
GlobalPointersVector< typename TVariableType::Type::data_type > operator()(const DataCommunicator &rComm) const
Definition: compute_neighbour_list_functor.h:85
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
void push_back(TPointerType x)
Definition: global_pointers_vector.h:322
void Unique()
Remove duplicate elements from the container.
Definition: global_pointers_vector.h:131
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