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.
time_integration_methods_container.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosSolidMechanicsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: November 2017 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_TIME_INTEGRATION_METHODS_CONTAINER_H_INCLUDED)
11 #define KRATOS_TIME_INTEGRATION_METHODS_CONTAINER_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
19 
20 namespace Kratos
21 {
24 
27 
31 
35 
39 
43 
47 template<class TVariableType, class TValueType>
49 {
50 public:
53 
56 
58  typedef typename TimeIntegrationMethodType::Pointer TimeIntegrationMethodPointerType;
59  typedef std::string LabelType;
60 
63 
66  :mTimeIntegrationMethods()
67  {
68  }
69 
72  :mTimeIntegrationMethods(rOther.mTimeIntegrationMethods)
73  {
74  }
75 
78 
88 
89  void Set(LabelType const& rLabel, TimeIntegrationMethodPointerType pTimeIntegrationMethod)
90  {
91  mTimeIntegrationMethods[rLabel] = pTimeIntegrationMethod;
92  }
93 
95  {
96  return mTimeIntegrationMethods[rLabel];
97  }
98 
99  bool Has(LabelType const& rLabel)
100  {
101  typename std::map<LabelType,TimeIntegrationMethodPointerType>::iterator it_method = mTimeIntegrationMethods.find(rLabel);
102 
103  if ( it_method != mTimeIntegrationMethods.end() )
104  return true;
105  else
106  return false;
107  }
108 
110  {
111 
112  for(typename std::map<LabelType,TimeIntegrationMethodPointerType>::const_iterator it=mTimeIntegrationMethods.begin(); it!=mTimeIntegrationMethods.end(); ++it)
113  {
114  if( (*it->second).HasVariableName(rLabel) )
115  return it->first;
116  }
117 
118  return rLabel;
119  }
120 
127 
129  virtual std::string Info() const
130  {
131  std::stringstream buffer;
132  buffer << "TimeIntegrationMethodsContainer\n";
133  for(typename std::map<LabelType,TimeIntegrationMethodPointerType>::const_iterator it=mTimeIntegrationMethods.begin(); it!=mTimeIntegrationMethods.end(); ++it)
134  buffer << "["<<it->first<<"] = "<<*(it->second)<< "\n";
135  return buffer.str();
136  }
137 
139  virtual void PrintInfo(std::ostream& rOStream) const
140  {
141  rOStream << "TimeIntegrationMethodsContainer\n";
142  for(typename std::map<LabelType,TimeIntegrationMethodPointerType>::const_iterator it=mTimeIntegrationMethods.begin(); it!=mTimeIntegrationMethods.end(); ++it)
143  rOStream << "["<<it->first<<"] = "<<*(it->second)<<std::endl;
144 
145  }
146 
148  virtual void PrintData(std::ostream& rOStream) const
149  {
150  rOStream << "TimeIntegrationMethodsContainer Data";
151  }
152 
156 
157 
159 
160 protected:
179 private:
185 
186  std::map<LabelType,TimeIntegrationMethodPointerType> mTimeIntegrationMethods;
187 
197  friend class Serializer;
198 
199  virtual void save(Serializer& rSerializer) const
200  {
201  };
202 
203  virtual void load(Serializer& rSerializer)
204  {
205  };
206 
211 
215 
217 
218 public:
219 
223 
224 }; // Class TimeIntegrationMethodsContainer
226 
229 
230 
234 template<class TVariableType, class TValueType>
235 inline std::istream & operator >> (std::istream & rIStream, TimeIntegrationMethodsContainer<TVariableType,TValueType>& rThis)
236 {
237  return rIStream;
238 }
239 
240 template<class TVariableType, class TValueType>
241 inline std::ostream & operator << (std::ostream & rOStream, const TimeIntegrationMethodsContainer<TVariableType,TValueType>& rThis)
242 {
243  return rOStream << rThis.Info();
244 }
245 
246 
248 
250 
251 } // namespace Kratos.
252 
253 #endif // KRATOS_TIME_INTEGRATION_METHODS_CONTAINER_H_INCLUDED defined
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Short class definition.
Definition: time_integration_method.hpp:55
Definition: time_integration_methods_container.hpp:49
TimeIntegrationMethodsContainer(TimeIntegrationMethodsContainer const &rOther)
Copy constructor.
Definition: time_integration_methods_container.hpp:71
TimeIntegrationMethodPointerType Get(LabelType const &rLabel)
Definition: time_integration_methods_container.hpp:94
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: time_integration_methods_container.hpp:148
TimeIntegrationMethodsContainer()
Default constructor.
Definition: time_integration_methods_container.hpp:65
TimeIntegrationMethodType::Pointer TimeIntegrationMethodPointerType
Definition: time_integration_methods_container.hpp:58
virtual ~TimeIntegrationMethodsContainer()
Destructor.
Definition: time_integration_methods_container.hpp:77
LabelType GetMethodVariableName(LabelType const &rLabel)
Definition: time_integration_methods_container.hpp:109
virtual std::string Info() const
Turn back information as a string.
Definition: time_integration_methods_container.hpp:129
std::string LabelType
Definition: time_integration_methods_container.hpp:59
TimeIntegrationMethod< TVariableType, TValueType > TimeIntegrationMethodType
Definition: time_integration_methods_container.hpp:57
bool Has(LabelType const &rLabel)
Definition: time_integration_methods_container.hpp:99
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: time_integration_methods_container.hpp:139
void Set(LabelType const &rLabel, TimeIntegrationMethodPointerType pTimeIntegrationMethod)
Definition: time_integration_methods_container.hpp:89
KRATOS_CLASS_POINTER_DEFINITION(TimeIntegrationMethodsContainer)
Pointer definition of TimeIntegrationMethodsContainer.
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
#define DECLARE_GET_THIS_TYPE_FROM_PROCESS_INFO
Definition: process_info_extensions.hpp:44
#define DECLARE_ADD_THIS_TYPE_TO_PROCESS_INFO
Definition: process_info_extensions.hpp:29
#define DECLARE_HAS_THIS_TYPE_PROCESS_INFO
Definition: process_info_extensions.hpp:14