![]() |
GemaCoreLib
The GeMA Core library
|
Base interface class for NumSolver type plugins. More...
#include <gmNumSolver.h>
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 GmSolverMatrix * | newMatrix (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... | |
![]() | |
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 | |
![]() | |
virtual const GmLogCategory & | logger () const |
Returns the internal logger used by the plugin to emmit messages. | |
GmSimulationData * | simulationData () const |
Returns a reference to the simulation data object keeping global simulation information. | |
Base interface class for NumSolver type plugins.
GmNumSolver::GmNumSolver | ( | GmSimulationData * | simulation, |
QString | id, | ||
QString | description, | ||
const GmLogCategory & | logger | ||
) |
Constructor.
simulation | Reference to the simulation object. |
id | NumSolver id. |
description | NumSolver description. |
logger | Plugin logger object used to emmit messages |
|
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.
|
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.
|
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.