32 #define KRATOS_DOF_TRAITS \
33 KRATOS_MAKE_DOF_TRAIT(0) Variable<TDataType> KRATOS_END_DOF_TRAIT(0);
35 template<
class TDataType,
class TVariableType = Variable<TDataType> >
42 #define KRATOS_MAKE_DOF_TRAIT(id) \
43 template<class TDataType> \
44 struct DofTrait<TDataType,
47 #define KRATOS_END_DOF_TRAIT(id) \
49 static const int Id = id;\
56 #undef KRATOS_MAKE_DOF_TRAIT
57 #undef KRATOS_END_DOF_TRAIT
85 template<
class TDataType>
118 template<
class TVariableType>
120 const TVariableType& rThisVariable)
122 mVariableType(
DofTrait<TDataType, TVariableType>::
Id),
125 mpNodalData(pThisNodalData)
128 <<
"The Dof-Variable " << rThisVariable.Name() <<
" is not "
129 <<
"in the list of variables" << std::endl;
155 template<
class TVariableType,
class TReactionType>
157 const TVariableType& rThisVariable,
158 const TReactionType& rThisReaction)
160 mVariableType(
DofTrait<TDataType, TVariableType>::
Id),
161 mReactionType(
DofTrait<TDataType, TReactionType>::
Id),
163 mpNodalData(pThisNodalData)
166 <<
"The Dof-Variable " << rThisVariable.Name() <<
" is not "
167 <<
"in the list of variables" << std::endl;
170 <<
"The Reaction-Variable " << rThisReaction.Name() <<
" is not "
171 <<
"in the list of variables" << std::endl;
189 : mIsFixed(rOther.mIsFixed),
190 mVariableType(rOther.mVariableType),
191 mReactionType(rOther.mReactionType),
192 mIndex(rOther.mIndex),
193 mEquationId(rOther.mEquationId),
194 mpNodalData(rOther.mpNodalData)
210 mIsFixed = rOther.mIsFixed;
211 mEquationId = rOther.mEquationId;
212 mpNodalData = rOther.mpNodalData;
213 mIndex = rOther.mIndex;
214 mVariableType = rOther.mVariableType;
215 mReactionType = rOther.mReactionType;
220 template<
class TVariableType>
221 typename TVariableType::Type&
operator()(
const TVariableType& rThisVariable,
IndexType SolutionStepIndex = 0)
226 template<
class TVariableType>
227 typename TVariableType::Type
const&
operator()(
const TVariableType& rThisVariable,
IndexType SolutionStepIndex = 0)
const
266 template<
class TVariableType>
272 template<
class TVariableType>
294 return mpNodalData->
GetId();
299 return mpNodalData->
GetId();
312 return (p_reaction ==
nullptr) ? msNone : *p_reaction;
315 template<
class TReactionType>
333 mEquationId = NewEquationId;
359 mpNodalData = pNewNodalData;
360 if(p_reaction !=
nullptr){
395 std::stringstream buffer;
417 rOStream <<
" IsFixed : True" << std::endl;
419 rOStream <<
" IsFixed : False" << std::endl;
420 rOStream <<
" Equation Id : " << mEquationId << std::endl;
433 static constexpr
int msIsFixedPosition = 63;
442 int mVariableType : 4;
444 int mReactionType : 4;
457 #define KRATOS_MAKE_DOF_TRAIT(id) \
459 return rData.GetValue(static_cast<
462 #define KRATOS_END_DOF_TRAIT(id) \
463 const&>(ThisVariable), SolutionStepIndex);
465 TDataType& GetReference(VariableData
const& ThisVariable, VariablesListDataValueContainer& rData,
IndexType SolutionStepIndex,
int ThisId)
471 KRATOS_ERROR <<
"Not supported type for Dof" << std::endl;
474 TDataType
const& GetReference(VariableData
const& ThisVariable, VariablesListDataValueContainer
const& rData,
IndexType SolutionStepIndex,
int ThisId)
const
480 KRATOS_ERROR <<
"Not supported type for Dof" << std::endl;
491 rSerializer.
save(
"IsFixed",
static_cast<bool>(mIsFixed));
493 rSerializer.
save(
"NodalData", mpNodalData);
494 rSerializer.
save(
"VariableType",
static_cast<int>(mVariableType));
495 rSerializer.
save(
"ReactionType",
static_cast<int>(mReactionType));
496 rSerializer.
save(
"Index",
static_cast<int>(mIndex));
504 rSerializer.
load(
"IsFixed", is_fixed);
507 rSerializer.
load(
"EquationId", equation_id);
508 mEquationId = equation_id;
509 rSerializer.
load(
"NodalData", mpNodalData);
513 rSerializer.
load(
"VariableType", variable_type);
514 rSerializer.
load(
"ReactionType", reaction_type);
516 mVariableType = variable_type;
517 mReactionType = reaction_type;
520 rSerializer.
load(
"Index", index);
538 template<
class TDataType>
const Variable<TDataType> Dof<TDataType>::msNone(
"NONE");
549 template<
class TDataType>
555 template<
class TDataType>
560 rOStream << std::endl;
572 template<
class TDataType>
576 if(First.
Id() == Second.
Id())
579 return (First.
Id() > Second.
Id());
583 template<
class TDataType>
587 if(First.
Id() == Second.
Id())
590 return (First.
Id() < Second.
Id());
594 template<
class TDataType>
598 if(First.
Id() == Second.
Id())
601 return (First.
Id() > Second.
Id());
605 template<
class TDataType>
609 if(First.
Id() == Second.
Id())
612 return (First.
Id() < Second.
Id());
616 template<
class TDataType>
627 #undef KRATOS_DOF_TRAITS
628 #undef KRATOS_MAKE_DOF_TRAIT
629 #undef KRATOS_END_DOF_TRAIT
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
TDataType const & operator()(IndexType SolutionStepIndex=0) const
Definition: dof.h:237
std::size_t EquationIdType
Definition: dof.h:97
VariablesListDataValueContainer SolutionStepsDataContainerType
Definition: dof.h:99
Dof(Dof const &rOther)
Copy constructor.
Definition: dof.h:188
TVariableType::Type & GetSolutionStepValue(const TVariableType &rThisVariable, IndexType SolutionStepIndex=0)
Definition: dof.h:267
Dof & operator=(Dof const &rOther)
Assignment operator.
Definition: dof.h:208
const VariableData & GetVariable() const
Definition: dof.h:303
IndexType GetId() const
Definition: dof.h:297
TDataType & operator()(IndexType SolutionStepIndex=0)
Definition: dof.h:232
void SetEquationId(EquationIdType NewEquationId)
Definition: dof.h:331
void SetReaction(TReactionType const &rReaction)
Definition: dof.h:316
void FixDof()
Definition: dof.h:338
SolutionStepsDataContainerType * GetSolutionStepsData()
Definition: dof.h:350
void SetNodalData(NodalData *pNewNodalData)
Definition: dof.h:355
Dof(NodalData *pThisNodalData, const TVariableType &rThisVariable)
Definition: dof.h:119
IndexType Id() const
Definition: dof.h:292
std::string Info() const
Turn back information as a string.
Definition: dof.h:393
TDataType const & GetSolutionStepReactionValue(IndexType SolutionStepIndex=0) const
Definition: dof.h:283
bool IsFixed() const
Definition: dof.h:376
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: dof.h:406
Dof(NodalData *pThisNodalData, const TVariableType &rThisVariable, const TReactionType &rThisReaction)
Definition: dof.h:156
void FreeDof()
Definition: dof.h:345
TVariableType::Type const & GetSolutionStepValue(const TVariableType &rThisVariable, IndexType SolutionStepIndex=0) const
Definition: dof.h:273
TVariableType::Type const & operator()(const TVariableType &rThisVariable, IndexType SolutionStepIndex=0) const
Definition: dof.h:227
Dof()
Definition: dof.h:177
const VariableData & GetReaction() const
Definition: dof.h:309
bool HasReaction() const
Definition: dof.h:367
bool IsFree() const
Definition: dof.h:382
TVariableType::Type & operator()(const TVariableType &rThisVariable, IndexType SolutionStepIndex=0)
Definition: dof.h:221
TDataType const & operator[](IndexType SolutionStepIndex) const
Definition: dof.h:247
TDataType const & GetSolutionStepValue(IndexType SolutionStepIndex=0) const
Definition: dof.h:261
EquationIdType EquationId() const
Definition: dof.h:324
~Dof()
Destructor.
Definition: dof.h:200
TDataType & GetSolutionStepValue(IndexType SolutionStepIndex=0)
Definition: dof.h:256
TDataType & GetSolutionStepReactionValue(IndexType SolutionStepIndex=0)
Definition: dof.h:278
TDataType & operator[](IndexType SolutionStepIndex)
Definition: dof.h:242
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: dof.h:412
std::size_t IndexType
Definition: dof.h:95
Stores all data and dofs which are stored in each elements.
Definition: nodal_data.h:37
VariablesListDataValueContainer & GetSolutionStepData()
Definition: nodal_data.h:106
IndexType GetId() const
Returns the Id of the Node.
Definition: nodal_data.h:89
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
This class is the base of variables and variable's components which contains their common data.
Definition: variable_data.h:49
const std::string & Name() const
Definition: variable_data.h:201
KeyType Key() const
Definition: variable_data.h:187
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
A shared variable list gives the position of each variable in the containers sharing it.
Definition: variables_list_data_value_container.h:61
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Definition: variables_list_data_value_container.h:282
bool Has(const VariableData &rThisVariable) const
This method returns if a certain variable is stored in the data value container.
Definition: variables_list_data_value_container.h:704
VariablesList::Pointer pGetVariablesList()
Definition: variables_list_data_value_container.h:424
VariablesList & GetVariablesList()
Definition: variables_list_data_value_container.h:434
const VariableData * pGetDofReaction(int DofIndex) const
Definition: variables_list.h:327
const VariableData & GetDofVariable(int DofIndex) const
Definition: variables_list.h:323
#define KRATOS_DOF_TRAITS
Definition: dof.h:32
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_DEBUG_ERROR_IF_NOT(conditional)
Definition: exception.h:172
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
bool operator<=(Dof< TDataType > const &First, Dof< TDataType > const &Second)
Less equal operator.
Definition: dof.h:606
bool operator<(Dof< TDataType > const &First, Dof< TDataType > const &Second)
Less than operator.
Definition: dof.h:584
bool operator==(const Flags &Left, const Flags &Right)
Definition: flags.cpp:45
bool operator>(Dof< TDataType > const &First, Dof< TDataType > const &Second)
Greater than operator.
Definition: dof.h:573
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
bool operator>=(Dof< TDataType > const &First, Dof< TDataType > const &Second)
Greater equal operator.
Definition: dof.h:595
def load(f)
Definition: ode_solve.py:307
static const int Id
Definition: dof.h:38