KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
List of all members
Kratos::FromJSONCheckResultProcess Class Reference

This class is used in order to check results using a json file containing the solution a given model part with a certain frequency. More...

#include <from_json_check_result_process.h>

Inheritance diagram for Kratos::FromJSONCheckResultProcess:
Collaboration diagram for Kratos::FromJSONCheckResultProcess:

Public Member Functions

Life Cycle
 FromJSONCheckResultProcess (Model &rModel, Parameters ThisParameters=Parameters(R"({})"))
 Default constructor. More...
 
 FromJSONCheckResultProcess (ModelPart &rModelPart, Parameters ThisParameters=Parameters(R"({})"))
 Default constructor. More...
 
virtual ~FromJSONCheckResultProcess ()
 Destructor. More...
 
Operators
void operator() ()
 
Operations
void ExecuteInitialize () override
 This function is designed for being called at the beginning of the computations right after reading the model and the groups. More...
 
void ExecuteFinalizeSolutionStep () override
 This function will be executed at every time step AFTER performing the solve phase. More...
 
void ExecuteFinalize () override
 This function is designed for being called at the end of the computations. More...
 
int Check () override
 This function is designed for being called after ExecuteInitialize ONCE to verify that the input is correct. More...
 
bool IsCorrectResult ()
 This function returns if the result is correct. More...
 
std::string GetErrorMessage ()
 This function returns the error message. More...
 
Input and output
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. More...
 
- Public Member Functions inherited from Kratos::Process
 KRATOS_CLASS_POINTER_DEFINITION (Process)
 Pointer definition of Process. More...
 
 Process ()
 Default constructor. More...
 
 Process (const Flags options)
 
 ~Process () override
 Destructor. More...
 
void operator() ()
 This operator is provided to call the process as a function and simply calls the Execute method. More...
 
virtual Process::Pointer Create (Model &rModel, Parameters ThisParameters)
 This method creates an pointer of the process. More...
 
virtual void Execute ()
 Execute method is used to execute the Process algorithms. More...
 
virtual void ExecuteBeforeSolutionLoop ()
 This function is designed for being execute once before the solution loop but after all of the solvers where built. More...
 
virtual void ExecuteInitializeSolutionStep ()
 This function will be executed at every time step BEFORE performing the solve phase. More...
 
virtual void ExecuteBeforeOutputStep ()
 This function will be executed at every time step BEFORE writing the output. More...
 
virtual void ExecuteAfterOutputStep ()
 This function will be executed at every time step AFTER writing the output. More...
 
virtual void Clear ()
 This method clears the assignation of the conditions. More...
 
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. More...
 
- Public Member Functions inherited from Kratos::Flags
Flagsoperator= (Flags const &rOther)
 Assignment operator. More...
 
 operator bool () const
 
Flags operator~ () const
 
bool operator! () const
 
void AssignFlags (Flags const &rOther)
 
void Set (const Flags ThisFlag)
 
void Set (const Flags ThisFlag, bool Value)
 
void Reset (const Flags ThisFlag)
 
void Flip (const Flags ThisFlag)
 
void SetPosition (IndexType Position, bool Value=true)
 
bool GetPosition (IndexType Position) const
 
void FlipPosition (IndexType Position)
 
void ClearPosition (IndexType Position)
 
void Clear ()
 
Flags AsFalse () const
 
bool Is (Flags const &rOther) const
 
bool IsDefined (Flags const &rOther) const
 
bool IsNot (Flags const &rOther) const
 
bool IsNotDefined (Flags const &rOther) const
 
 KRATOS_CLASS_POINTER_DEFINITION (Flags)
 Pointer definition of Flags. More...
 
const Flagsoperator|= (const Flags &Other)
 
const Flagsoperator&= (const Flags &Other)
 
 Flags ()
 Default constructor. More...
 
 Flags (Flags const &rOther)
 Copy constructor. More...
 
virtual ~Flags ()
 Destructor. More...
 

Protected Member Functions

Protected Operations
void InitializeDatabases ()
 This initializes the databases. More...
 
void FillVariablesList (const std::vector< std::string > &rNodalVariablesNames, const std::vector< std::string > &rGPVariablesNames)
 This method fills the list of variables. More...
 
template<class TEntity >
bool CheckFlag (const TEntity &rEntity, const Flags *pFlag)
 This method checks if a flag is active in a given entity. More...
 
bool CheckValues (const double ValueEntity, const double ValueJSON)
 This method checks the results. More...
 
void FailMessage (const IndexType EntityId, const std::string &rEntityType, const double ValueEntity, const double ValueJSON, const std::string &rVariableName, const int ComponentIndex=-1, const int GPIndex=-1)
 This returns a message in case of fail. More...
 
void CheckNodeValues (IndexType &rCheckCounter)
 This method check the nodal values. More...
 
void CheckNodeHistoricalValues (IndexType &rCheckCounter)
 This method check the nodal historical values. More...
 
void CheckGPValues (IndexType &rCheckCounter)
 This method check the GP values. More...
 
SizeType SizeDatabase (const Parameters &rResults, const NodesArrayType &rNodesArray, const ElementsArrayType &rElementsArray)
 
void FillDatabase (const Parameters &rResults, const NodesArrayType &rNodesArray, const ElementsArrayType &rElementsArray, const SizeType NumberOfGP)
 
std::string GetNodeIdentifier (NodeType &rNode)
 Returns the identifier/key for saving nodal results in the json this can be either the node Id or its coordinates. More...
 
NodesArrayTypeGetNodes (const Flags *pFlag=nullptr)
 This method returns the nodes of the model part. More...
 
ElementsArrayTypeGetElements (const Flags *pFlag=nullptr)
 This method returns the elements of the model part. More...
 
std::size_t ComputeRelevantDigits (const double Value)
 This method computes the relevant digits to take into account. More...
 
const Parameters GetDefaultParameters () const override
 This method provides the defaults parameters to avoid conflicts between the different constructors. More...
 
Protected Access
const ModelPartGetModelPart () const
 This method returns the model part. More...
 
const Parameters GetSettings () const
 This method returns the settings. More...
 
const ResultDatabaseGetNodeDatabase ()
 This method returns the Nodes database. If not initialized it will try initialize again. More...
 
const ResultDatabaseGetGPDatabase ()
 This method returns the GP database. If not initialized it will try initialize again. More...
 
Protected LifeCycle
 FromJSONCheckResultProcess (ModelPart &rModelPart, Parameters Settings, Parameters DefaultSettings)
 Protected constructor with modified default settings to be defined by derived class. More...
 

Type Definitions

typedef ModelPart::NodesContainerType NodesArrayType
 This flag is used in order to check that elements database are initialized. More...
 
typedef ModelPart::ElementsContainerType ElementsArrayType
 
typedef Node NodeType
 The node type definiton. More...
 
typedef std::size_t IndexType
 The definition of the index type. More...
 
typedef std::size_t SizeType
 The definition of the sizetype. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (FromJSONCheckResultProcess)
 Pointer definition of FromJSONCheckResultProcess. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (CORRECT_RESULT)
 Local Flags. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (HISTORICAL_VALUE)
 This flag is used in order to check that the result is correct. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (CHECK_ONLY_LOCAL_ENTITIES)
 This flag is used in order to check if the values are historical. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (NODES_CONTAINER_INITIALIZED)
 This flag is used in order to check only local entities. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (ELEMENTS_CONTAINER_INITIALIZED)
 This flag is used in order to check that nodes container are initialized. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (NODES_DATABASE_INITIALIZED)
 This flag is used in order to check that elements container are initialized. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (ELEMENTS_DATABASE_INITIALIZED)
 This flag is used in order to check that nodes database are initialized. More...
 

Additional Inherited Members

- Public Types inherited from Kratos::Flags
enum  FlagsList {
  Flag0 = BlockType(1) , Flag1 = BlockType(1) << 1 , Flag2 = BlockType(1) << 2 , Flag3 = BlockType(1) << 3 ,
  Flag4 = BlockType(1) << 4 , Flag5 = BlockType(1) << 5 , Flag6 = BlockType(1) << 6 , Flag7 = BlockType(1) << 7 ,
  Flag8 = BlockType(1) << 8 , Flag9 = BlockType(1) << 9 , Flag10 = BlockType(1) << 10 , Flag11 = BlockType(1) << 11 ,
  Flag12 = BlockType(1) << 12 , Flag13 = BlockType(1) << 13 , Flag14 = BlockType(1) << 14 , Flag15 = BlockType(1) << 15 ,
  Flag16 = BlockType(1) << 16 , Flag17 = BlockType(1) << 17 , Flag18 = BlockType(1) << 18 , Flag19 = BlockType(1) << 19 ,
  Flag20 = BlockType(1) << 20 , Flag21 = BlockType(1) << 21 , Flag22 = BlockType(1) << 22 , Flag23 = BlockType(1) << 23 ,
  Flag24 = BlockType(1) << 24 , Flag25 = BlockType(1) << 25 , Flag26 = BlockType(1) << 26 , Flag27 = BlockType(1) << 27 ,
  Flag28 = BlockType(1) << 28 , Flag29 = BlockType(1) << 29 , Flag30 = BlockType(1) << 30
}
 
typedef int64_t BlockType
 
typedef int64_t FlagType
 
typedef std::size_t IndexType
 
- Static Public Member Functions inherited from Kratos::Flags
static const Flags AllDefined ()
 
static const Flags AllTrue ()
 
static Flags Create (IndexType ThisPosition, bool Value=true)
 

Detailed Description

This class is used in order to check results using a json file containing the solution a given model part with a certain frequency.

This stores the dababase in a class denominated ResultDatabase which considers Table to store the information, therefore being able to interpolate results

Author
Vicente Mataix Ferrandiz

Member Typedef Documentation

◆ ElementsArrayType

◆ IndexType

The definition of the index type.

◆ NodesArrayType

This flag is used in order to check that elements database are initialized.

Containers definition

◆ NodeType

The node type definiton.

◆ SizeType

The definition of the sizetype.

Constructor & Destructor Documentation

◆ FromJSONCheckResultProcess() [1/3]

Kratos::FromJSONCheckResultProcess::FromJSONCheckResultProcess ( Model rModel,
Parameters  ThisParameters = Parameters(R"({})") 
)

Default constructor.

Parameters
rModelThe model where the where the simulation is performed
ThisParametersThe parameters of configuration

◆ FromJSONCheckResultProcess() [2/3]

Kratos::FromJSONCheckResultProcess::FromJSONCheckResultProcess ( ModelPart rModelPart,
Parameters  ThisParameters = Parameters(R"({})") 
)

Default constructor.

Parameters
rModelPartThe model part where the simulation is performed
ThisParametersThe parameters of configuration

◆ ~FromJSONCheckResultProcess()

virtual Kratos::FromJSONCheckResultProcess::~FromJSONCheckResultProcess ( )
inlinevirtual

Destructor.

◆ FromJSONCheckResultProcess() [3/3]

Kratos::FromJSONCheckResultProcess::FromJSONCheckResultProcess ( ModelPart rModelPart,
Parameters  Settings,
Parameters  DefaultSettings 
)
protected

Protected constructor with modified default settings to be defined by derived class.

Member Function Documentation

◆ Check()

int Kratos::FromJSONCheckResultProcess::Check ( )
overridevirtual

This function is designed for being called after ExecuteInitialize ONCE to verify that the input is correct.

Reimplemented from Kratos::Process.

◆ CheckFlag()

template<class TEntity >
bool Kratos::FromJSONCheckResultProcess::CheckFlag ( const TEntity &  rEntity,
const Flags pFlag 
)
inlineprotected

This method checks if a flag is active in a given entity.

Parameters
rEntityThe entity to check
pFLagThe pointer to the flag to check

◆ CheckGPValues()

void Kratos::FromJSONCheckResultProcess::CheckGPValues ( IndexType rCheckCounter)
protected

This method check the GP values.

Parameters
rCheckCounterThe check counter

◆ CheckNodeHistoricalValues()

void Kratos::FromJSONCheckResultProcess::CheckNodeHistoricalValues ( IndexType rCheckCounter)
protected

This method check the nodal historical values.

Parameters
rCheckCounterThe check counter

◆ CheckNodeValues()

void Kratos::FromJSONCheckResultProcess::CheckNodeValues ( IndexType rCheckCounter)
protected

This method check the nodal values.

Parameters
rCheckCounterThe check counter

◆ CheckValues()

bool Kratos::FromJSONCheckResultProcess::CheckValues ( const double  ValueEntity,
const double  ValueJSON 
)
protected

This method checks the results.

Parameters
ValueEntityThe value on the entity
ValueJSONThe reference value from the JSON

◆ ComputeRelevantDigits()

std::size_t Kratos::FromJSONCheckResultProcess::ComputeRelevantDigits ( const double  Value)
protected

This method computes the relevant digits to take into account.

◆ ExecuteFinalize()

void Kratos::FromJSONCheckResultProcess::ExecuteFinalize ( )
overridevirtual

This function is designed for being called at the end of the computations.

Reimplemented from Kratos::Process.

◆ ExecuteFinalizeSolutionStep()

void Kratos::FromJSONCheckResultProcess::ExecuteFinalizeSolutionStep ( )
overridevirtual

This function will be executed at every time step AFTER performing the solve phase.

Reimplemented from Kratos::Process.

◆ ExecuteInitialize()

void Kratos::FromJSONCheckResultProcess::ExecuteInitialize ( )
overridevirtual

This function is designed for being called at the beginning of the computations right after reading the model and the groups.

Reimplemented from Kratos::Process.

◆ FailMessage()

void Kratos::FromJSONCheckResultProcess::FailMessage ( const IndexType  EntityId,
const std::string &  rEntityType,
const double  ValueEntity,
const double  ValueJSON,
const std::string &  rVariableName,
const int  ComponentIndex = -1,
const int  GPIndex = -1 
)
protected

This returns a message in case of fail.

Parameters
EntityIdThe Kratos node or element to check
rEntityTypeThe type of the entity
ValueEntityThe value on the entity
ValueJSONThe reference value from the json
rVariableNameThe name of the variable
ComponentIndexThe component index
GPIndexThe GP index

◆ FillDatabase()

void Kratos::FromJSONCheckResultProcess::FillDatabase ( const Parameters rResults,
const NodesArrayType rNodesArray,
const ElementsArrayType rElementsArray,
const SizeType  NumberOfGP 
)
protected

◆ FillVariablesList()

void Kratos::FromJSONCheckResultProcess::FillVariablesList ( const std::vector< std::string > &  rNodalVariablesNames,
const std::vector< std::string > &  rGPVariablesNames 
)
protected

This method fills the list of variables.

Parameters
rNodalVariablesNamesThe names of the nodal variables
rGPVariablesNamesThe names of the GP variables

◆ GetDefaultParameters()

const Parameters Kratos::FromJSONCheckResultProcess::GetDefaultParameters ( ) const
overrideprotectedvirtual

This method provides the defaults parameters to avoid conflicts between the different constructors.

Reimplemented from Kratos::Process.

◆ GetElements()

FromJSONCheckResultProcess::ElementsArrayType & Kratos::FromJSONCheckResultProcess::GetElements ( const Flags pFlag = nullptr)
protected

This method returns the elements of the model part.

Returns
The elements of the model part

◆ GetErrorMessage()

std::string Kratos::FromJSONCheckResultProcess::GetErrorMessage ( )
inline

This function returns the error message.

Returns
The error message

◆ GetGPDatabase()

const ResultDatabase & Kratos::FromJSONCheckResultProcess::GetGPDatabase ( )
protected

This method returns the GP database. If not initialized it will try initialize again.

Returns
The GP database

◆ GetModelPart()

const ModelPart & Kratos::FromJSONCheckResultProcess::GetModelPart ( ) const
protected

This method returns the model part.

Returns
The model part of the problem

◆ GetNodeDatabase()

const ResultDatabase & Kratos::FromJSONCheckResultProcess::GetNodeDatabase ( )
protected

This method returns the Nodes database. If not initialized it will try initialize again.

Returns
The nodes database

◆ GetNodeIdentifier()

std::string Kratos::FromJSONCheckResultProcess::GetNodeIdentifier ( NodeType rNode)
protected

Returns the identifier/key for saving nodal results in the json this can be either the node Id or its coordinates.

The coordinates can be used to check the nodal results in MPI

Parameters
rNodeThe Kratos node to get the identifier for

◆ GetNodes()

FromJSONCheckResultProcess::NodesArrayType & Kratos::FromJSONCheckResultProcess::GetNodes ( const Flags pFlag = nullptr)
protected

This method returns the nodes of the model part.

Returns
The nodes of the model part

◆ GetSettings()

const Parameters Kratos::FromJSONCheckResultProcess::GetSettings ( ) const
protected

This method returns the settings.

Returns
The settings of the problem

◆ Info()

std::string Kratos::FromJSONCheckResultProcess::Info ( ) const
inlineoverridevirtual

Turn back information as a string.

Reimplemented from Kratos::Flags.

◆ InitializeDatabases()

void Kratos::FromJSONCheckResultProcess::InitializeDatabases ( )
protected

This initializes the databases.

◆ IsCorrectResult()

bool Kratos::FromJSONCheckResultProcess::IsCorrectResult ( )
inline

This function returns if the result is correct.

Returns
If the result is correct

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::FromJSONCheckResultProcess::KRATOS_CLASS_POINTER_DEFINITION ( FromJSONCheckResultProcess  )

Pointer definition of FromJSONCheckResultProcess.

◆ KRATOS_DEFINE_LOCAL_FLAG() [1/7]

Kratos::FromJSONCheckResultProcess::KRATOS_DEFINE_LOCAL_FLAG ( CHECK_ONLY_LOCAL_ENTITIES  )

This flag is used in order to check if the values are historical.

◆ KRATOS_DEFINE_LOCAL_FLAG() [2/7]

Kratos::FromJSONCheckResultProcess::KRATOS_DEFINE_LOCAL_FLAG ( CORRECT_RESULT  )

Local Flags.

◆ KRATOS_DEFINE_LOCAL_FLAG() [3/7]

Kratos::FromJSONCheckResultProcess::KRATOS_DEFINE_LOCAL_FLAG ( ELEMENTS_CONTAINER_INITIALIZED  )

This flag is used in order to check that nodes container are initialized.

◆ KRATOS_DEFINE_LOCAL_FLAG() [4/7]

Kratos::FromJSONCheckResultProcess::KRATOS_DEFINE_LOCAL_FLAG ( ELEMENTS_DATABASE_INITIALIZED  )

This flag is used in order to check that nodes database are initialized.

◆ KRATOS_DEFINE_LOCAL_FLAG() [5/7]

Kratos::FromJSONCheckResultProcess::KRATOS_DEFINE_LOCAL_FLAG ( HISTORICAL_VALUE  )

This flag is used in order to check that the result is correct.

◆ KRATOS_DEFINE_LOCAL_FLAG() [6/7]

Kratos::FromJSONCheckResultProcess::KRATOS_DEFINE_LOCAL_FLAG ( NODES_CONTAINER_INITIALIZED  )

This flag is used in order to check only local entities.

◆ KRATOS_DEFINE_LOCAL_FLAG() [7/7]

Kratos::FromJSONCheckResultProcess::KRATOS_DEFINE_LOCAL_FLAG ( NODES_DATABASE_INITIALIZED  )

This flag is used in order to check that elements container are initialized.

◆ operator()()

void Kratos::FromJSONCheckResultProcess::operator() ( )
inline

◆ PrintData()

void Kratos::FromJSONCheckResultProcess::PrintData ( std::ostream &  rOStream) const
inlineoverridevirtual

Print object's data.

Reimplemented from Kratos::Flags.

◆ PrintInfo()

void Kratos::FromJSONCheckResultProcess::PrintInfo ( std::ostream &  rOStream) const
inlineoverridevirtual

Print information about this object.

Reimplemented from Kratos::Flags.

◆ SizeDatabase()

FromJSONCheckResultProcess::SizeType Kratos::FromJSONCheckResultProcess::SizeDatabase ( const Parameters rResults,
const NodesArrayType rNodesArray,
const ElementsArrayType rElementsArray 
)
protected

The documentation for this class was generated from the following files: