GemaCoreLib
The GeMA Core library
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
GmSparseMatrixOptions Class Reference

Set of configuration options for Sparse matrices. More...

#include <gmSparseMatrixOptions.h>

Public Member Functions

 GmSparseMatrixOptions (GmSparseMatrixLayoutMode defMode)
 Builds a default set of options with the given mode.
 
 GmSparseMatrixOptions (const GmSimulationData *simulation, GmSparseMatrixLayoutMode defMode)
 Builds a set of options with a default matrix build mode as definied in the simulation data, reverting to defMode if undefined. Other options are initialized with defaults for GeMA estimation.
 
bool loadUserDefinitions (LuaTable &table, QString &err)
 Parses from the given Lua table the user options for the sparse matrix. Empty table fields do not change options. More...
 
GmSparseMatrixLayoutMode mode () const
 Returns the mode for building the sparse matrix.
 
const char * modeStr () const
 Returns the mode for building the sparse matrix as a string.
 
bool lowMemory () const
 Returns true if the matrix should favour low memory strategies, false otherwise. If the user didn't specified a value, the default setting is based on the current memory consumption. More...
 
GmSparseMatrixTripletBufferSortStrategy tripletSortStrategy () const
 Returns the sorting strategy used to process triplet lists. If the user didn't specified a value, the default setting is based on the low memory setting. Returns a "random" value when mode is not triplet based.
 
size_t reserve () const
 Returns the user given estimate of the expected number of triplets / layout entries. Returns 0 if the value should be estimated by GeMA.
 
double resizeFactor () const
 Returns the user given metric for resizing data structures. Returns 0.0 if the value should be estimated by GeMA. This values is always greater than 1.0.
 
int numThreads () const
 The number of threads that should be used by sparse matrix building code. A value of -1 means the maximum number of threads as seen by the thread manager. More...
 
void setNumThreads (int nthreads)
 Updates the number of threads.
 
void setMode (GmSparseMatrixLayoutMode mode)
 Updates the sparse matrix building mode.
 
void setLowMemory (bool mode)
 Updates the sparse matrix low memory control (used by tests code only)
 
void setTripletSortStrategy (GmSparseMatrixTripletBufferSortStrategy st)
 Updates the trilet sort strategy control (used by tests code only)
 

Static Private Member Functions

static bool checkLowMemoryCondition (const GmSimulationData *simulation)
 
static const char * matrixModeToStr (GmSparseMatrixLayoutMode mode)
 Returns the string used to define the given matrix mode.
 
static int strToMatrixMode (const QString &str)
 Returns the matrix mode associated with the given string. Returns -1 if no match was found.
 

Private Attributes

GmSparseMatrixLayoutMode _mode
 The mode for building the sparse matrix.
 
bool _lowMemory
 User given setting to favour low memory strategies.
 
size_t _reserve
 A user given estimate of the expected number of triplets / layout entries. If 0, will be estimated by GeMA.
 
double _resizeFactor
 A user given metric for resizing data structures. If 0, will be estimated by GeMA.
 
int _nthreads
 The maximum number of threads that should be used by sparse matrix.
 
int _tripletSortStrategy
 

Detailed Description

Set of configuration options for Sparse matrices.

Member Function Documentation

◆ loadUserDefinitions()

bool GmSparseMatrixOptions::loadUserDefinitions ( LuaTable table,
QString err 
)

Parses from the given Lua table the user options for the sparse matrix. Empty table fields do not change options.

If the table contains invalid options, fills err with a message for each invalid option and returns false. Valid options are applied.

◆ lowMemory()

bool GmSparseMatrixOptions::lowMemory ( ) const
inline

Returns true if the matrix should favour low memory strategies, false otherwise. If the user didn't specified a value, the default setting is based on the current memory consumption.

When using low memory settings, the TRIPLET LIST modes will use a single atomic locked list instead of multiple lists. It will also use inplace sorting if the triplet sort strategy was not specified.

◆ numThreads()

int GmSparseMatrixOptions::numThreads ( ) const
inline

The number of threads that should be used by sparse matrix building code. A value of -1 means the maximum number of threads as seen by the thread manager.

IMPORTANT: Different from other options, this option is NOT user defined, but comes from settings from the object that creted the matrix / numerical solver.


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