11 #if !defined(KRATOS_PROPERTIES_LAYOUT_H_INCLUDED )
12 #define KRATOS_PROPERTIES_LAYOUT_H_INCLUDED
22 #include "custom_utilities/properties_extensions.hpp"
60 typedef __int64 int64_t;
96 :mpData(rOther.mpData)
97 ,mpTables(rOther.mpTables)
98 ,mTableVariables(rOther.mTableVariables)
99 ,mTableArguments(rOther.mTableArguments)
103 PropertiesLayout::Pointer
Clone()
const
105 return Kratos::make_shared< PropertiesLayout >(*
this);
118 mpData = rOther.mpData;
119 mpTables = rOther.mpTables;
120 mTableVariables = rOther.mTableVariables;
121 mTableArguments = rOther.mTableArguments;
138 template<
class TVariableType>
139 void GetValue(
const TVariableType& rVariable,
typename TVariableType::Type& rValue)
const
141 typename ScalarTableArgumentsContainerType::const_iterator
i;
143 if((
i = std::find_if(mTableArguments.begin(), mTableArguments.end(), VariableKeyCheck(rVariable.Key()))) != mTableArguments.end())
145 rValue =
static_cast<const typename TVariableType::Type
>(mpTables->at((
i->first))[(
i->second).second]);
148 rValue = mpData->
GetValue(rVariable);
151 template<
class TVariableType>
152 void GetValue(
const TVariableType& rVariable,
typename TVariableType::Type& rValue)
154 typename ScalarTableArgumentsContainerType::const_iterator
i;
156 if((
i = std::find_if(mTableArguments.begin(), mTableArguments.end(), VariableKeyCheck(rVariable.Key()))) != mTableArguments.end())
158 rValue =
static_cast<const typename TVariableType::Type
>(mpTables->at((
i->first))[(
i->second).second]);
161 rValue = mpData->
GetValue(rVariable);
171 return !mpTables->empty();
194 return "PropertiesLayout";
200 rOStream <<
"PropertiesLayout";
206 if(mpData !=
nullptr)
208 if(mpTables !=
nullptr)
209 rOStream <<
"This properties contains " << mpTables->size() <<
" tables";
273 class VariableKeyCheck
277 VariableKeyCheck(std::size_t I) : mI(I) {}
280 return I.first == mI;
292 rSerializer.
save(
"mTableVariables", mTableVariables);
293 rSerializer.
save(
"mTableArguments", mTableArguments);
298 rSerializer.
load(
"mTableVariables", mTableVariables);
299 rSerializer.
load(
"mTableArguments", mTableArguments);
345 rOStream << std::endl;
#define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES
Definition: properties_extensions.hpp:14
#define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES
Definition: properties_extensions.hpp:29
Container for storing data values associated with variables.
Definition: data_value_container.h:63
virtual void PrintData(std::ostream &rOStream) const
Outputs the detailed data contents of the data value container to a given stream.
Definition: data_value_container.h:423
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
bool IsEmpty() const
Checks if the data container is empty.
Definition: data_value_container.h:391
Geometry base class.
Definition: geometry.h:71
This class defines the node.
Definition: node.h:65
std::size_t IndexType
The index type.
Definition: node.h:86
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
PropertiesLayout.
Definition: properties_layout.hpp:51
~PropertiesLayout()
Destructor.
Definition: properties_layout.hpp:109
void RegisterTable(const Variable< double > &rXVariable, const Variable< double > &rYVariable)
Definition: properties_layout.hpp:130
void GetValue(const TVariableType &rVariable, typename TVariableType::Type &rValue)
Definition: properties_layout.hpp:152
DataValueContainer ContainerType
Type of container used for variables.
Definition: properties_layout.hpp:64
bool HasTables() const
Definition: properties_layout.hpp:169
Table< double > TableType
Type of container used for tables.
Definition: properties_layout.hpp:73
bool HasVariables() const
Definition: properties_layout.hpp:164
PropertiesLayout::Pointer Clone() const
Clone.
Definition: properties_layout.hpp:103
PropertiesLayout(const PropertiesLayout &rOther)
Copy constructor.
Definition: properties_layout.hpp:95
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: properties_layout.hpp:204
Node NodeType
Definition: properties_layout.hpp:66
void Configure(const Properties &rProperties, const GeometryType &rGeometry, const Vector &rShapeFunctions)
Definition: properties_layout.cpp:23
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: properties_layout.hpp:198
std::string Info() const
Turn back information as a string.
Definition: properties_layout.hpp:192
std::pair< std::size_t, double > VariableKeyArgumentsType
Definition: properties_layout.hpp:77
void GetValue(const TVariableType &rVariable, typename TVariableType::Type &rValue) const
Definition: properties_layout.hpp:139
bool IsEmpty() const
Definition: properties_layout.hpp:174
PropertiesLayout()
Default constructor.
Definition: properties_layout.hpp:88
PropertiesLayout & operator=(PropertiesLayout const &rOther)
Assignment operator.
Definition: properties_layout.hpp:116
KRATOS_CLASS_POINTER_DEFINITION(PropertiesLayout)
Pointer definition of PropertiesLayout.
Geometry< NodeType > GeometryType
Definition: properties_layout.hpp:68
std::unordered_map< std::size_t, TableType > TablesContainerType
Definition: properties_layout.hpp:75
std::vector< ScalarTableArgumentsType > ScalarTableArgumentsContainerType
Definition: properties_layout.hpp:81
NodeType::IndexType IndexType
Definition: properties_layout.hpp:70
std::pair< std::size_t, VariableKeyArgumentsType > ScalarTableArgumentsType
Definition: properties_layout.hpp:79
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
void RegisterTable(const XVariableType &rXVariable, const YVariableType &rYVariable)
Definition: table_key_variables.hpp:100
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
integer i
Definition: TensorModule.f:17
Configure::ContainerType ContainerType
Definition: transfer_utility.h:247