14 #if !defined(KRATOS_OR_CRITERIA_H)
15 #define KRATOS_OR_CRITERIA_H
54 template<
class TSparseSpace,
106 KRATOS_ERROR <<
"IMPLEMENTATION PENDING IN CONSTRUCTOR WITH PARAMETERS" << std::endl;
119 mpFirstCriterion(pFirstCriterion),
120 mpSecondCriterion(pSecondCriterion)
132 mpFirstCriterion(rOther.mpFirstCriterion),
133 mpSecondCriterion(rOther.mpSecondCriterion)
159 return Kratos::make_shared<ClassType>(ThisParameters);
173 mpFirstCriterion->SetEchoLevel(Level);
174 mpSecondCriterion->SetEchoLevel(Level);
194 const bool first_criterion_result = mpFirstCriterion ->PreCriteria(rModelPart,rDofSet,
A,Dx,
b);
195 const bool second_criterion_result = mpSecondCriterion ->PreCriteria(rModelPart,rDofSet,
A,Dx,
b);
197 return (first_criterion_result || second_criterion_result);
217 const bool first_criterion_result = mpFirstCriterion ->PostCriteria(rModelPart,rDofSet,
A,Dx,
b);
218 const bool second_criterion_result = mpSecondCriterion ->PostCriteria(rModelPart,rDofSet,
A,Dx,
b);
220 return (first_criterion_result || second_criterion_result);
229 mpFirstCriterion->Initialize(rModelPart);
230 mpSecondCriterion->Initialize(rModelPart);
249 mpFirstCriterion->InitializeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
250 mpSecondCriterion->InitializeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
269 mpFirstCriterion->InitializeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
270 mpSecondCriterion->InitializeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
289 mpFirstCriterion->FinalizeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
290 mpSecondCriterion->FinalizeSolutionStep(rModelPart,rDofSet,
A,Dx,
b);
309 mpFirstCriterion->FinalizeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
310 mpSecondCriterion->FinalizeNonLinearIteration(rModelPart,rDofSet,
A,Dx,
b);
324 const int check1 = mpFirstCriterion->Check(rModelPart);
325 const int check2 = mpSecondCriterion->Check(rModelPart);
327 return check1 + check2;
340 "name" : "or_criteria",
341 "first_criterion_settings" : {
342 "name" : "residual_criteria",
343 "residual_absolute_tolerance" : 1.0e-4,
344 "residual_relative_tolerance" : 1.0e-9
346 "second_criterion_settings" : {
347 "name" : "displacement_criteria",
348 "displacement_relative_tolerance" : 1.0e-4,
349 "displacement_absolute_tolerance" : 1.0e-9
356 return default_parameters;
365 return "or_criteria";
381 std::string
Info()
const override
383 return "Or_Criteria";
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 convergence criteria checks simultaneously two convergence criteria (one of them must be satisfi...
Definition: or_criteria.h:59
Or_Criteria()
Definition: or_criteria.h:89
void FinalizeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function finalizes the solution step.
Definition: or_criteria.h:281
void SetEchoLevel(int Level) override
It sets the level of echo for the solving strategy.
Definition: or_criteria.h:170
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: or_criteria.h:393
TSparseSpace SparseSpaceType
Definition: or_criteria.h:72
Or_Criteria(Or_Criteria const &rOther)
Definition: or_criteria.h:130
BaseType::DofsArrayType DofsArrayType
Definition: or_criteria.h:76
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: or_criteria.h:209
void FinalizeNonLinearIteration(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function finalizes the non linear iteration.
Definition: or_criteria.h:301
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: or_criteria.h:363
BaseType::Pointer Create(Parameters ThisParameters) const override
Create method.
Definition: or_criteria.h:157
Or_Criteria(ConvergenceCriteriaPointerType pFirstCriterion, ConvergenceCriteriaPointerType pSecondCriterion)
Default constructor.
Definition: or_criteria.h:115
Or_Criteria< TSparseSpace, TDenseSpace > ClassType
The definition of the current class.
Definition: or_criteria.h:70
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: or_criteria.h:387
BaseType::TDataType TDataType
Definition: or_criteria.h:74
KRATOS_CLASS_POINTER_DEFINITION(Or_Criteria)
Or_Criteria(Kratos::Parameters ThisParameters)
Default constructor. (with parameters)
Definition: or_criteria.h:99
void InitializeNonLinearIteration(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function initializes the non linear iteration.
Definition: or_criteria.h:261
ConvergenceCriteria< TSparseSpace, TDenseSpace > BaseType
Definition: or_criteria.h:67
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: or_criteria.h:336
std::string Info() const override
Turn back information as a string.
Definition: or_criteria.h:381
int Check(ModelPart &rModelPart) override
This function is designed to be called once to perform all the checks needed on the input provided.
Definition: or_criteria.h:320
BaseType::TSystemMatrixType TSystemMatrixType
Definition: or_criteria.h:78
BaseType::TSystemVectorType TSystemVectorType
Definition: or_criteria.h:80
void Initialize(ModelPart &rModelPart) override
This function initialize the convergence criteria.
Definition: or_criteria.h:227
~Or_Criteria() override
Definition: or_criteria.h:142
void InitializeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
This function initializes the solution step.
Definition: or_criteria.h:241
ConvergenceCriteria< TSparseSpace, TDenseSpace >::Pointer ConvergenceCriteriaPointerType
Definition: or_criteria.h:82
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: or_criteria.h:186
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