GemaCoreLib
The GeMA Core library
Public Member Functions | List of all members
GmNumSolver Class Referenceabstract

Base interface class for NumSolver type plugins. More...

#include <gmNumSolver.h>

Inheritance diagram for GmNumSolver:
Inheritance graph
[legend]
Collaboration diagram for GmNumSolver:
Collaboration graph
[legend]

Public Member Functions

 GmNumSolver (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmNumSolver ()
 Virtual destructor.
 
virtual const char * pluginCategory () const
 Returns the plugin category.
 
virtual GmSolverMatrixnewMatrix (int nlin, int ncol, const GmSolverMatrix *sharedLayout, int numThreads=-1) const =0
 Creates and returns a new matrix with size nlin x ncol, of the appropriate type for use in a later call to solve(). Returns NULL if the matrix could not be allocated. More...
 
virtual bool solve (GmSolverMatrix *A, const GmVector &b, GmVector &x, bool xIsGuess=false) const =0
 Solves the linear system Ax = b, filling the vector x with the calculated result. More...
 
virtual void printParameters (const GmLogCategory &logger)
 Asks the numeric solver to print all of its parameters using the provided logger. More...
 
- Public Member Functions inherited from GmPluginObject
 GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmPluginObject ()
 Destructor.
 
QString id () const
 Returns the object id.
 
QString description () const
 Returns the object description.
 
QString pluginTypeName () const
 Returns the hierarchical type name for the plugin object type. See also pluginName() and pluginType().
 
virtual const char * pluginName () const =0
 Returns a string identifying the plugin which implements this object. Should return the SAME string as the one read from the plugin information file in the pluginName field.
 
virtual const char * pluginType () const =0
 Returns the string identifying the plugin object type. Should return the SAME string as the one read from the plugin information file in the objectTypes table. More...
 
virtual bool loadPrivateData (LuaTable &table)=0
 Function called by the model loader to give the object acess to it's private parameters. Should return false only if the received parameter set makes the use of this object impossible.
 

Additional Inherited Members

- Protected Member Functions inherited from GmPluginObject
virtual const GmLogCategorylogger () const
 Returns the internal logger used by the plugin to emmit messages.
 
GmSimulationDatasimulationData () const
 Returns a reference to the simulation data object keeping global simulation information.
 

Detailed Description

Base interface class for NumSolver type plugins.

Constructor & Destructor Documentation

◆ GmNumSolver()

GmNumSolver::GmNumSolver ( GmSimulationData simulation,
QString  id,
QString  description,
const GmLogCategory logger 
)

Constructor.

Parameters
simulationReference to the simulation object.
idNumSolver id.
descriptionNumSolver description.
loggerPlugin logger object used to emmit messages

Member Function Documentation

◆ newMatrix()

virtual GmSolverMatrix* GmNumSolver::newMatrix ( int  nlin,
int  ncol,
const GmSolverMatrix sharedLayout,
int  numThreads = -1 
) const
pure virtual

Creates and returns a new matrix with size nlin x ncol, of the appropriate type for use in a later call to solve(). Returns NULL if the matrix could not be allocated.

If given, the sharedLayout matrix should provide another matrix, with the SAME concrete object type as this one, that will share its sparse layout (position of non-zero elements) with this matrix. The number of threads parameter can be used by the sparse matrix building routines to limit the number of threads used. The deault equals to the maximum number of threads as seen by the thread manager.

◆ printParameters()

void GmNumSolver::printParameters ( const GmLogCategory logger)
virtual

Asks the numeric solver to print all of its parameters using the provided logger.

The default implementation logs the data, as seen through the access interface;

Implements GmPluginObject.

◆ solve()

virtual bool GmNumSolver::solve ( GmSolverMatrix A,
const GmVector b,
GmVector x,
bool  xIsGuess = false 
) const
pure virtual

Solves the linear system Ax = b, filling the vector x with the calculated result.

The xIsGuess parameter should be passed as true if the current contents of x should be used as an initial guess to solve the linear system, false otherwise. Passing false is always safe but can be slower if x is already close to the result.

If A is a matrix with size equal to M x N, x should have size N and b should have size M. Returns false if a solution could not be found.

IMPORTANT: For most solvers, A MUST be a matrix created with a call to the solver newMatrix() routine.

IPORTANT2: Most solvers only accept square matrices. The std Armadillo based solver accepts non square matrices only if full matrices are used. Sparse matrices must be square.


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