10 #if !defined(KRATOS_COMPOSITE_CRITERION_H_INCLUDED )
11 #define KRATOS_COMPOSITE_CRITERION_H_INCLUDED
49 template<
class TSparseSpace,
class TDenseSpace>
77 mConvergenceCriteria.push_back(pFirstCriterion);
78 mConvergenceCriteria.push_back(pSecondCriterion);
89 ,mConvergenceCriteria(rOther.mConvergenceCriteria)
111 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
112 it!=mConvergenceCriteria.end(); ++it)
113 (*it)->SetEchoLevel(Level);
125 if(this->
Is(LocalFlagType::AND)){
127 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
128 it!=mConvergenceCriteria.end(); ++it)
129 if( !((*it)->PreCriteria(rModelPart,rDofSet,rA,rDx,rb)) )
134 else if (this->
Is(LocalFlagType::OR)){
136 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
137 it!=mConvergenceCriteria.end(); ++it)
138 if( ((*it)->PreCriteria(rModelPart,rDofSet,rA,rDx,rb)) )
156 if(this->
Is(LocalFlagType::AND)){
158 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
159 it!=mConvergenceCriteria.end(); ++it)
160 if( !((*it)->PostCriteria(rModelPart,rDofSet,rA,rDx,rb)) )
165 else if (this->
Is(LocalFlagType::OR)){
167 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
168 it!=mConvergenceCriteria.end(); ++it)
169 if( ((*it)->PostCriteria(rModelPart,rDofSet,rA,rDx,rb)) )
184 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
185 it!=mConvergenceCriteria.end(); ++it)
186 (*it)->InitializeSolutionStep(rModelPart,rDofSet,rA,rDx,rb);
195 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
196 it!=mConvergenceCriteria.end(); ++it)
197 (*it)->FinalizeSolutionStep(rModelPart,rDofSet,rA,rDx,rb);
212 if( !(this->
Is(LocalFlagType::AND) || this->
Is(LocalFlagType::OR)) )
213 KRATOS_ERROR <<
"Flag AND or OR is not set for the Composite Convergence Criterion "<< std::endl;
215 for(
typename ConvergenceCriterionVectorType::iterator it=mConvergenceCriteria.begin();
216 it!=mConvergenceCriteria.end(); ++it)
217 if( ((*it)->Check(rModelPart)) != 0 )
This convergence criteria checks simultaneously different convergence criteria.
Definition: composite_criterion.hpp:51
BaseType::DataType DataType
Definition: composite_criterion.hpp:58
std::vector< BasePointerType > ConvergenceCriterionVectorType
Definition: composite_criterion.hpp:64
void SetEchoLevel(int Level) override
It sets the level of echo for the solving strategy.
Definition: composite_criterion.hpp:108
int Check(ModelPart &rModelPart) override
This function is designed to be called once to perform all the checks needed on the input provided.
Definition: composite_criterion.hpp:208
BaseType::SystemMatrixType SystemMatrixType
Definition: composite_criterion.hpp:60
ConvergenceCriterion< TSparseSpace, TDenseSpace > BaseType
Definition: composite_criterion.hpp:56
KRATOS_CLASS_POINTER_DEFINITION(CompositeCriterion)
Pointer definition of CompositeCriterion.
void FinalizeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb) override
Definition: composite_criterion.hpp:189
BaseType::SystemVectorType SystemVectorType
Definition: composite_criterion.hpp:61
void InitializeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb) override
Definition: composite_criterion.hpp:178
BaseType::LocalFlagType LocalFlagType
Definition: composite_criterion.hpp:57
CompositeCriterion(ConvergenceCriterionVectorType &rConvergenceCriteria)
Constructor.
Definition: composite_criterion.hpp:82
bool PostCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb) override
Definition: composite_criterion.hpp:150
~CompositeCriterion() override
Destructor.
Definition: composite_criterion.hpp:94
CompositeCriterion(CompositeCriterion const &rOther)
Copy constructor.
Definition: composite_criterion.hpp:87
BaseType::DofsArrayType DofsArrayType
Definition: composite_criterion.hpp:59
bool PreCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb) override
Definition: composite_criterion.hpp:119
BaseType::Pointer BasePointerType
Definition: composite_criterion.hpp:63
CompositeCriterion(BasePointerType pFirstCriterion, BasePointerType pSecondCriterion)
Constructor.
Definition: composite_criterion.hpp:75
Convergence Criterion base class.
Definition: convergence_criterion.hpp:52
TSparseSpace::DataType DataType
Definition: convergence_criterion.hpp:58
TSparseSpace::MatrixType SystemMatrixType
Definition: convergence_criterion.hpp:60
virtual void SetEchoLevel(int Level)
Definition: convergence_criterion.hpp:104
TSparseSpace::VectorType SystemVectorType
Definition: convergence_criterion.hpp:61
Solver local flags class definition.
Definition: solution_local_flags.hpp:74
bool Is(Flags const &rOther) const
Definition: flags.h:274
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21