xc
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

convergence test. More...

#include <ConvergenceTest.h>

Inheritance diagram for XC::ConvergenceTest:
Inheritance graph
[legend]
Collaboration diagram for XC::ConvergenceTest:
Collaboration graph
[legend]

Public Member Functions

 ConvergenceTest (CommandEntity *owr, int classTag)
 Default constructor. More...
 
 ConvergenceTest (CommandEntity *owr, int clasTag, int maxIter, int prtFlg, int normType, int sz_norms=1)
 Constructor. More...
 
virtual ConvergenceTestgetCopy (void) const =0
 
virtual ConvergenceTestgetCopy (int iterations) const
 Virtual constructor.
 
virtual std::string getStatusMsg (const int &flag=1) const =0
 
virtual int start (void)
 This is invoked at the start of each iteration. More...
 
virtual int test (void)=0
 Return a positive number if convergence is achieved. More...
 
int getMaxNumIter (void) const
 
void setMaxNumIter (const int &)
 
int getCurrentIter (void) const
 Return the current iteration number.
 
void setCurrentIter (const int &)
 Set the current iteration number.
 
int getPrintFlag (void) const
 
void setPrintFlag (const int &)
 
int getNormType (void) const
 
void setNormType (const int &)
 
virtual int getNumTests (void) const
 
virtual int getMaxNumTests (void) const
 
virtual double getRatioNumToMax (void) const
 
virtual const VectorgetNorms (void) const
 
int sendSelf (Communicator &)
 Send the object. More...
 
int recvSelf (const Communicator &)
 Receive the object. More...
 
std::string getTestIterationMessage (void) const
 Returns a string with the name of the class and the iteration number.
 
std::string getFailedToConvergeMessage (void) const
 Returns a string with the proper failed to converge message.
 
std::string getDeltaXRMessage (void) const
 Returns a string with the values of x and b vectors.
 
std::string getDeltaXRNormsMessage (void) const
 Returns a string with the values of x and b vector norms.
 
- Public Member Functions inherited from XC::MovableObject
 MovableObject (int classTag, int dbTag)
 Constructor. More...
 
 MovableObject (int classTag)
 Constructor. More...
 
 MovableObject (const MovableObject &)
 Copy constructor. Doesn't copy the dbTag.
 
MovableObjectoperator= (const MovableObject &)
 Assignment operator. Doesn't copy the dbTag.
 
int getClassTag (void) const
 Return the class identifier.
 
int getDbTag (void) const
 Return the object identifier in the database.
 
int getDbTag (Communicator &)
 Return the object identifier in the database.
 
void setDbTag (int dbTag)
 Sets the object identifier in the database.
 
void setDbTag (Communicator &)
 Sets the object identifier in the database if not already set. More...
 
virtual int setParameter (const std::vector< std::string > &argv, Parameter &param)
 Sets the value param to the parameter argv.
 
virtual int updateParameter (int parameterID, Information &info)
 Updates the parameter identified by parameterID with info.
 
virtual int activateParameter (int parameterID)
 Activates the parameter identified by parameterID.
 
virtual int setVariable (const std::string &variable, Information &)
 Set the value of the variable idenfified by var.
 
virtual int getVariable (const std::string &variable, Information &)
 Return the value of the variable idenfified by var.
 
- Public Member Functions inherited from XC::DistributedBase
 DistributedBase (void)
 Constructor.
 
virtual ~DistributedBase (void)
 Destructor.
 
virtual DbTagDatagetDbTagData (void) const
 Returns a vector to store class dbTags.
 
const int & getDbTagDataPos (const int &i) const
 Returns the data at the i-th position.
 
void setDbTagDataPos (const int &i, const int &v)
 Sets the data at the i-th position.
 
void inicComm (const int &dataSize) const
 Initializes communication.
 
- Public Member Functions inherited from CommandEntity
 CommandEntity (CommandEntity *owr=nullptr)
 Default constructor.
 
CommandEntityOwner (void)
 Return a pointer to the object owner.
 
const CommandEntityOwner (void) const
 Return un puntero al objeto propietario de ESTE.
 
const StandardOutputWrappergetStandardOutputWrapper (void) const
 Return the regular output stream wrapper.
 
StandardOutputWrappergetStandardOutputWrapper (void)
 Return the regular output stream wrapper.
 
const std::string & getLogFileName (void) const
 Returns log file name.
 
void setLogFileName (const std::string &)
 Sets log file name.
 
const std::string & getErrFileName (void) const
 Returns err file name.
 
void setErrFileName (const std::string &)
 Sets error file name.
 
const std::string & getOutputFileName (void) const
 Returns regular output file name.
 
void setOutputFileName (const std::string &)
 Sets regular output file name.
 
boost::python::object evalPy (boost::python::object dict, const std::string &)
 Return the Python object that results from evaluating the argument.
 
boost::python::object execPy (boost::python::object dict, const std::string &)
 Return the Python objects that results from executing the code in the string argument.
 
boost::python::object execFilePy (boost::python::object dict, const std::string &)
 Return the Python object that results from executing the code in the file.
 
- Public Member Functions inherited from EntityWithProperties
 EntityWithProperties (EntityWithProperties *owr=nullptr)
 Default constructor.
 
virtual bool operator== (const EntityWithProperties &) const
 Comparison operator.
 
void clearPyProps (void)
 Clear python properties map.
 
bool hasPyProp (const std::string &)
 Returns true if property exists.
 
boost::python::object getPyProp (const std::string &str)
 Return the Python object with the name being passed as parameter.
 
void setPyProp (std::string str, boost::python::object val)
 Sets/appends a value tho the Python object's dictionary.
 
void copyPropsFrom (const EntityWithProperties &)
 Copy the properties from the argument.
 
boost::python::list getPropNames (void) const
 Return the names of the object properties weightings.
 
const PythonDict & getPropertiesDict (void) const
 Return a std::map container with the properties of the object.
 
boost::python::dict getPyDict (void) const
 Return a Python dictionary containing the object members values.
 
void setPyDict (const boost::python::dict &)
 Set the values of the object members from a Python dictionary.
 
- Public Member Functions inherited from EntityWithOwner
 EntityWithOwner (EntityWithOwner *owr=nullptr)
 Default constructor.
 
 EntityWithOwner (const EntityWithOwner &)
 Copy constructor.
 
EntityWithOwneroperator= (const EntityWithOwner &)
 Assignment operator.
 
virtual bool operator== (const EntityWithOwner &) const
 Comparison operator.
 
virtual ~EntityWithOwner (void)
 Virtual destructor.
 
virtual std::string getClassName (void) const
 Returns demangled class name.
 
void set_owner (EntityWithOwner *owr)
 Assigns the owner of the object.
 
EntityWithOwnerOwner (void)
 
const EntityWithOwnerOwner (void) const
 

Protected Member Functions

bool hasLinearSOE (void) const
 Returns true ifpuede acceder al system of equations.
 
LinearSOEgetLinearSOEPtr (void)
 Returns a pointer to the system of equations.
 
const LinearSOEgetLinearSOEPtr (void) const
 Returns a const pointer to the system of equations.
 
const VectorgetX (void) const
 Returns the vector of unknowns.
 
double getNormX (void) const
 Return the norma del vector of unknowns.
 
const VectorgetB (void) const
 Return the vector at the right hand side of the equation.
 
double getNormB (void) const
 Return the norm of the vector at the right hand side of the equation. More...
 
double getEnergyProduct (void) const
 Returns the the energy increment, which is 0.5 times the absolute value of the product of the rhs and the solution vector of the LinearSOE: |0.5*(x ^ b)|. More...
 
int sendData (Communicator &)
 Send object members through the communicator argument.
 
int recvData (const Communicator &)
 Receives object members through the communicator argument.
 
- Protected Member Functions inherited from CommandEntity
template<class T >
void string_to (T &, const std::string &) const
 

Protected Attributes

int currentIter
 number of times test() has been invokes since last start()
 
int maxNumIter
 max number of iterations
 
int printFlag
 a flag indicating if to print on test
 
int nType
 type of norm to use (1-norm, 2-norm, p-norm, max-norm)
 
Vector norms
 vector to hold the norms
 
double lastRatio
 Last calculated ratio (if any).
 
double calculatedNormX
 Last calculated |x|.
 
double calculatedNormB
 Last calculated |b|.
 
double calculatedEnergyProduct
 Last calculated |0.5*(x ^ b)|.
 

Additional Inherited Members

- Public Types inherited from EntityWithProperties
typedef std::map< std::string, boost::python::object > PythonDict
 
- Static Public Member Functions inherited from CommandEntity
static void resetStandardOutput (void)
 Reset the standard output streams to its defaults buffers.
 
- Static Public Member Functions inherited from EntityWithOwner
static int getVerbosityLevel (void)
 Get the value of the verbosity level.
 
static void setVerbosityLevel (const int &)
 Set the value of the verbosity level.
 
- Static Protected Member Functions inherited from CommandEntity
static CommandEntityentcmd_cast (boost::any &data)
 
- Static Protected Attributes inherited from EntityWithOwner
static int verbosity = 1
 Object that owns THIS ONE. More...
 

Detailed Description

convergence test.

A ConvergenceTest object is an object which can be used in an algorithmic class to test if convergence has been achieved for an iteration. The ConvergenceTest class is an abstract class, defining the interface that all subclasses must provide.

Constructor & Destructor Documentation

◆ ConvergenceTest() [1/2]

XC::ConvergenceTest::ConvergenceTest ( CommandEntity owr,
int  classTag 
)

Default constructor.

Parameters
owrobject that owns this one.
classTagclass identifier.

◆ ConvergenceTest() [2/2]

XC::ConvergenceTest::ConvergenceTest ( CommandEntity owr,
int  classTag,
int  maxIter,
int  prtFlg,
int  normType,
int  sz_norms = 1 
)

Constructor.

Parameters
owrobject that owns this one.
classTagclass identifier.
theTolthe tolerance used in test().
maxIterthe max number of iterations to be performed.
printFlagwhat, if anything, is printed on each test.
normTypetype of norm to use (1-norm, 2-norm, p-norm, max-norm).
sz_normssize of the vector that contains computed norms.

Member Function Documentation

◆ getEnergyProduct()

double XC::ConvergenceTest::getEnergyProduct ( void  ) const
protected

Returns the the energy increment, which is 0.5 times the absolute value of the product of the rhs and the solution vector of the LinearSOE: |0.5*(x ^ b)|.

◆ getNormB()

double XC::ConvergenceTest::getNormB ( void  ) const
protected

Return the norm of the vector at the right hand side of the equation.

◆ recvSelf()

int XC::ConvergenceTest::recvSelf ( const Communicator comm)
virtual

Receive the object.

Each object has to receive the data needed to be able to recreate itself in the new process after it has been sent through cp. If the object is an aggregation containing other objects, new objects of the correct type can be constructed using #theBroker. To return 0 if successful or a -1 if not.

Implements XC::MovableObject.

Reimplemented in XC::ConvergenceTestTol.

◆ sendSelf()

int XC::ConvergenceTest::sendSelf ( Communicator comm)
virtual

Send the object.

Each object has to send the data needed to be able to reproduce that object in a remote process. The object uses the methods provided by cp object to send the data to another channel at the remote actor, the address of the channel is set before this method is called. An object of similar type at the remote actor is invoked with a receiveSelf() to receive the data. Returns 0 if successful (successful in that the data got to the channel), or a - if no data was sent.

Implements XC::MovableObject.

Reimplemented in XC::ConvergenceTestTol.

◆ start()

int XC::ConvergenceTest::start ( void  )
virtual

This is invoked at the start of each iteration.

To return {0} if successful, i.e that testing can proceed, a negative number if not. Sets an integer indicating the current number of iterations, {currentNumIter} to \(1\). returns \(0\) if successful, an error message and \(-1\) are returned if no LinearSOE object has been set.

Reimplemented in XC::CTestRelativeNormUnbalance, and XC::ConvergenceTestNorm.

◆ test()

virtual int XC::ConvergenceTest::test ( void  )
pure virtual

Return a positive number if convergence is achieved.

To return a positive number if the convergence criteria defined for the object has been satisfied, the positibe number equal to the number of times since start that test() has been invoked. Otherwise a negative number is to be returned. A {-2} is returned if the test fails to meet the criteria and no more tests are to be performed due to limits set, i.e. the maximum number of iterations, otherwise a {-1} is to be returned.

Implemented in XC::CTestEnergyIncr, XC::CTestNormUnbalance, XC::CTestRelativeNormDispIncr, XC::CTestNormDispIncr, XC::CTestRelativeEnergyIncr, XC::CTestRelativeNormUnbalance, XC::CTestRelativeTotalNormDispIncr, and XC::CTestFixedNumIter.


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