14 #if !defined(KRATOS_AND_CRITERIA_H)
15 #define KRATOS_AND_CRITERIA_H
55 template<
class TSparseSpace,
107 KRATOS_ERROR <<
"IMPLEMENTATION PENDING IN CONSTRUCTOR WITH PARAMETERS" << std::endl;
120 mpFirstCriterion(pFirstCriterion),
121 mpSecondCriterion(pSecondCriterion)
134 mpFirstCriterion(rOther.mpFirstCriterion),
135 mpSecondCriterion(rOther.mpSecondCriterion)
160 return Kratos::make_shared<ClassType>(ThisParameters);
174 mpFirstCriterion->SetEchoLevel(Level);
175 mpSecondCriterion->SetEchoLevel(Level);
195 const bool first_criterion_result = mpFirstCriterion ->PreCriteria(rModelPart,rDofSet,
A,Dx,
b);
196 const bool second_criterion_result = mpSecondCriterion ->PreCriteria(rModelPart,rDofSet,
A,Dx,
b);
198 return (first_criterion_result && second_criterion_result);
218 const bool first_criterion_result = mpFirstCriterion ->PostCriteria(rModelPart,rDofSet,
A,Dx,
b);
219 const bool second_criterion_result = mpSecondCriterion ->PostCriteria(rModelPart,rDofSet,
A,Dx,
b);
221 return (first_criterion_result && second_criterion_result);
230 mpFirstCriterion->Initialize(rModelPart);
231 mpSecondCriterion->Initialize(rModelPart);
250 mpFirstCriterion->InitializeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
251 mpSecondCriterion->InitializeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
270 mpFirstCriterion->InitializeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
271 mpSecondCriterion->InitializeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
290 mpFirstCriterion->FinalizeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
291 mpSecondCriterion->FinalizeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
310 mpFirstCriterion->FinalizeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
311 mpSecondCriterion->FinalizeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
325 const int check1 = mpFirstCriterion->Check(rModelPart);
326 const int check2 = mpSecondCriterion->Check(rModelPart);
328 return check1 + check2;
341 "name" : "and_criteria",
342 "first_criterion_settings" : {
343 "name" : "residual_criteria",
344 "residual_absolute_tolerance" : 1.0e-4,
345 "residual_relative_tolerance" : 1.0e-9
347 "second_criterion_settings" : {
348 "name" : "displacement_criteria",
349 "displacement_relative_tolerance" : 1.0e-4,
350 "displacement_absolute_tolerance" : 1.0e-9
357 return default_parameters;
366 return "and_criteria";
382 std::string
Info()
const override
384 return "And_Criteria";
This convergence criteria checks simultaneously two convergence criteria (both must be satisfied)
Definition: and_criteria.h:60
BaseType::TDataType TDataType
Definition: and_criteria.h:75
TSparseSpace SparseSpaceType
Definition: and_criteria.h:73
And_Criteria< TSparseSpace, TDenseSpace > ClassType
The definition of the current class.
Definition: and_criteria.h:71
void SetEchoLevel(int Level) override
It sets the level of echo for the solving strategy.
Definition: and_criteria.h:171
BaseType::TSystemMatrixType TSystemMatrixType
Definition: and_criteria.h:79
~And_Criteria() override
Definition: and_criteria.h:144
BaseType::DofsArrayType DofsArrayType
Definition: and_criteria.h:77
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: and_criteria.h:394
void Initialize(ModelPart &rModelPart) override
This function initialize the convergence criteria.
Definition: and_criteria.h:228
And_Criteria(Kratos::Parameters ThisParameters)
Default constructor. (with parameters)
Definition: and_criteria.h:100
void InitializeNonLinearIteration(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function initializes the non linear iteration.
Definition: and_criteria.h:262
KRATOS_CLASS_POINTER_DEFINITION(And_Criteria)
int Check(ModelPart &rModelPart) override
This function is designed to be called once to perform all the checks needed on the input provided.
Definition: and_criteria.h:321
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: and_criteria.h:364
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: and_criteria.h:337
And_Criteria()
Definition: and_criteria.h:90
And_Criteria(And_Criteria const &rOther)
Copy constructor.
Definition: and_criteria.h:132
std::string Info() const override
Turn back information as a string.
Definition: and_criteria.h:382
void FinalizeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function finalizes the solution step.
Definition: and_criteria.h:282
BaseType::Pointer Create(Parameters ThisParameters) const override
Create method.
Definition: and_criteria.h:158
ConvergenceCriteria< TSparseSpace, TDenseSpace > BaseType
Definition: and_criteria.h:68
BaseType::TSystemVectorType TSystemVectorType
Definition: and_criteria.h:81
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: and_criteria.h:388
ConvergenceCriteria< TSparseSpace, TDenseSpace >::Pointer ConvergenceCriteriaPointerType
Definition: and_criteria.h:83
bool PostCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
Criteria that need to be called after getting the solution.
Definition: and_criteria.h:210
void InitializeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function initializes the solution step.
Definition: and_criteria.h:242
void FinalizeNonLinearIteration(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function finalizes the non linear iteration.
Definition: and_criteria.h:302
bool PreCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
Criterias that need to be called before getting the solution.
Definition: and_criteria.h:187
And_Criteria(ConvergenceCriteriaPointerType pFirstCriterion, ConvergenceCriteriaPointerType pSecondCriterion)
Default constructor.
Definition: and_criteria.h:116
This is the base class to define the different convergence criterion considered.
Definition: convergence_criteria.h:58
bool mActualizeRHSIsNeeded
Definition: convergence_criteria.h:447
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: convergence_criteria.h:466
TSparseSpace::MatrixType TSystemMatrixType
Matrix type definition.
Definition: convergence_criteria.h:72
virtual Parameters GetDefaultParameters() const
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: convergence_criteria.h:384
virtual void SetEchoLevel(int Level)
It sets the level of echo for the solving strategy.
Definition: convergence_criteria.h:195
TSparseSpace::DataType TDataType
Data type definition.
Definition: convergence_criteria.h:70
TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: convergence_criteria.h:74
virtual void AssignSettings(const Parameters ThisParameters)
This method assigns settings to member variables.
Definition: convergence_criteria.h:479
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
void RecursivelyAddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1457
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
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
A
Definition: sensitivityMatrix.py:70