openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
Public Types | Public Member Functions | List of all members
limpet::IonType Class Referenceabstract

Abstract class representing an ionic model type. More...

#include <ion_type.h>

Collaboration diagram for limpet::IonType:

Public Types

using params_type = void
 type of this model's parameter structure More...
 
using state_type = void
 type of this model's state variable structure More...
 
using private_type = void
 type of this model's private structure More...
 
using private_type_vector = void
 

Public Member Functions

 IonType (std::string name, bool plugin)
 
const std::string & get_name () const
 Gets the model name. More...
 
bool is_plugin () const
 Returns whether this model is a plugin or not. More...
 
virtual size_t params_size () const =0
 Gets the size in bytes needed to represent the parameters of this model. More...
 
virtual size_t dlo_vector_size () const =0
 Gets the vector size when using data layout optimization (DLO). More...
 
virtual uint32_t reqdat () const =0
 Gets data flags for this IMP's required data. More...
 
virtual uint32_t moddat () const =0
 Gets data flags for this IMP's modified data. More...
 
virtual void initialize_params (IonIfBase &imp) const =0
 Initializes the parameters in the given IMP. More...
 
virtual void construct_tables (IonIfBase &imp) const =0
 Contructs lookup tables. More...
 
virtual void destroy (IonIfBase &imp) const =0
 Destroys the given IMP. More...
 
virtual void initialize_sv (IonIfBase &imp, GlobalData_t **data) const =0
 Initializes the state variables of the given IMP. More...
 
virtual Target select_target (Target target) const =0
 Gets a supported target from the given target. More...
 
virtual void compute (Target target, int start, int end, IonIfBase &imp, GlobalData_t **data) const =0
 Performs computation for 1 time step. More...
 
virtual bool has_trace () const =0
 Returns whether the trace method is available or not. More...
 
virtual void trace (IonIfBase &imp, int node, FILE *file, GlobalData_t **data) const =0
 Write the values of traced variables to file. More...
 
virtual void tune (IonIfBase &imp, const char *im_par) const =0
 Handles setting of this model's parameters. More...
 
virtual int read_svs (IonIfBase &imp, FILE *file) const =0
 Reads state variable values for one cell from a file. More...
 
virtual int write_svs (IonIfBase &imp, FILE *file, int node) const =0
 Write state variable values for one cell to a file/. More...
 
virtual SVgetfcn get_sv_offset (const char *svname, int *off, int *sz) const =0
 Get the offset and size of a state variable of the model, as well as an access function. More...
 
virtual int get_sv_list (char ***list) const =0
 Returns a list of SVs. More...
 
virtual int get_sv_type (const char *svname, int *type, char **type_name) const =0
 Determines the type of a SV. More...
 
virtual void print_params () const =0
 Prints the parameters of this model. More...
 
virtual void print_metadata () const =0
 Prints the metadata of this model. More...
 
virtual IonIfBasemake_ion_if (Target target, int num_node, const std::vector< std::reference_wrapper< IonType >> &plugins) const =0
 Generate an IonIf object from this type. More...
 
virtual void destroy_ion_if (IonIfBase *imp) const =0
 Destroy an IonIf object. More...
 
bool operator== (const IonType &other) const
 
bool operator!= (const IonType &other) const
 

Detailed Description

Abstract class representing an ionic model type.

This class acts as an interface for ionic models. Each ionic model generated from EasyML or some other language will define this class' abstract functions and used data types.

Definition at line 59 of file ion_type.h.

Member Typedef Documentation

◆ params_type

type of this model's parameter structure

Definition at line 61 of file ion_type.h.

◆ private_type

type of this model's private structure

Definition at line 63 of file ion_type.h.

◆ private_type_vector

Definition at line 64 of file ion_type.h.

◆ state_type

type of this model's state variable structure

Definition at line 62 of file ion_type.h.

Constructor & Destructor Documentation

◆ IonType()

limpet::IonType::IonType ( std::string  name,
bool  plugin 
)
inline

Definition at line 70 of file ion_type.h.

Member Function Documentation

◆ compute()

virtual void limpet::IonType::compute ( Target  target,
int  start,
int  end,
IonIfBase imp,
GlobalData_t **  data 
) const
pure virtual

Performs computation for 1 time step.

State and private variables of imp will be updated as well as external variables (data) for nodes that are in the start to end range.

Parameters
targetto run the computation on (see limpet::Target)
startindex of the first node (cell) to compute
endindex of the last node (cell) to compute
impIMP holding all necessary data
dataexternal variables
Here is the caller graph for this function:

◆ construct_tables()

virtual void limpet::IonType::construct_tables ( IonIfBase imp) const
pure virtual

Contructs lookup tables.

Parameters
impIMP structure to constructure the tables in
Here is the caller graph for this function:

◆ destroy()

virtual void limpet::IonType::destroy ( IonIfBase imp) const
pure virtual

Destroys the given IMP.

This frees the lookup tables and state variables.

Parameters
impIMP to destroy
Here is the caller graph for this function:

◆ destroy_ion_if()

virtual void limpet::IonType::destroy_ion_if ( IonIfBase imp) const
pure virtual

Destroy an IonIf object.

Parameters
impIMP to destroy
Note
This should only be used to destroy IMPS created with the IonIfBase::make_ion_if function of the same model type
Here is the caller graph for this function:

◆ dlo_vector_size()

virtual size_t limpet::IonType::dlo_vector_size ( ) const
pure virtual

Gets the vector size when using data layout optimization (DLO).

Return values
1if DLO isn't used (or if vector size is 1)
Returns
the vector size otherwise
Here is the caller graph for this function:

◆ get_name()

const std::string & limpet::IonType::get_name ( ) const

Gets the model name.

Returns
the name of this model

Definition at line 23 of file ion_type.cc.

Here is the caller graph for this function:

◆ get_sv_list()

virtual int limpet::IonType::get_sv_list ( char ***  list) const
pure virtual

Returns a list of SVs.

Parameters
listlist of SVs
Returns
number of SVs
Postcondition
list is allocated and may be freed
Here is the caller graph for this function:

◆ get_sv_offset()

virtual SVgetfcn limpet::IonType::get_sv_offset ( const char *  svname,
int *  off,
int *  sz 
) const
pure virtual

Get the offset and size of a state variable of the model, as well as an access function.

Parameters
svnameof the state variable
[out]offoffset of the variable (or 0 if svname is "ALL_SV")
[out]szsize of the state variable (or size of the SV structure if svname is "ALL_SV"), not the size of the whole sv array in case of DLO e.g. if vector size is 8, sz is still 4 for a float and not 32
Returns
an access fonction that will return a state variable from an offset and a cell number, always as GlobalData_t. (see SVgetfcn)
Here is the caller graph for this function:

◆ get_sv_type()

virtual int limpet::IonType::get_sv_type ( const char *  svname,
int *  type,
char **  type_name 
) const
pure virtual

Determines the type of a SV.

Parameters
svnamename of the sv
typetype of a sv
type_namename of the type
Return values
0the combination imp_id/svname was found
1the combination imp_id/svname was not found
Here is the caller graph for this function:

◆ has_trace()

virtual bool limpet::IonType::has_trace ( ) const
pure virtual

Returns whether the trace method is available or not.

Returns
true if the trace method is available, or false otherwise
Here is the caller graph for this function:

◆ initialize_params()

virtual void limpet::IonType::initialize_params ( IonIfBase imp) const
pure virtual

Initializes the parameters in the given IMP.

Parameters
impIMP to initialize the parameters of
Here is the caller graph for this function:

◆ initialize_sv()

virtual void limpet::IonType::initialize_sv ( IonIfBase imp,
GlobalData_t **  data 
) const
pure virtual

Initializes the state variables of the given IMP.

Parameters
impIMP to initialize the SVs of
dataexternal variables data (can be written by this functions)
Precondition
data is allocated and initialized
Here is the caller graph for this function:

◆ is_plugin()

bool limpet::IonType::is_plugin ( ) const

Returns whether this model is a plugin or not.

Returns
true if this model is a plugin, or false otherwise

Definition at line 27 of file ion_type.cc.

Here is the caller graph for this function:

◆ make_ion_if()

virtual IonIfBase* limpet::IonType::make_ion_if ( Target  target,
int  num_node,
const std::vector< std::reference_wrapper< IonType >> &  plugins 
) const
pure virtual

Generate an IonIf object from this type.

Note
The generated instance should always be used with this type only.
Returns
a child class of IonIfBase that is specific to this IonType
Here is the caller graph for this function:

◆ moddat()

virtual uint32_t limpet::IonType::moddat ( ) const
pure virtual

Gets data flags for this IMP's modified data.

Returns
a bitmap of external variables modified by the IMP
Here is the caller graph for this function:

◆ operator!=()

bool limpet::IonType::operator!= ( const IonType other) const

Definition at line 35 of file ion_type.cc.

Here is the caller graph for this function:

◆ operator==()

bool limpet::IonType::operator== ( const IonType other) const

Definition at line 31 of file ion_type.cc.

Here is the caller graph for this function:

◆ params_size()

virtual size_t limpet::IonType::params_size ( ) const
pure virtual

Gets the size in bytes needed to represent the parameters of this model.

Returns
the size in bytes of the parameters of this model
Here is the caller graph for this function:

◆ print_metadata()

virtual void limpet::IonType::print_metadata ( ) const
pure virtual

Prints the metadata of this model.

Here is the caller graph for this function:

◆ print_params()

virtual void limpet::IonType::print_params ( ) const
pure virtual

Prints the parameters of this model.

Here is the caller graph for this function:

◆ read_svs()

virtual int limpet::IonType::read_svs ( IonIfBase imp,
FILE *  file 
) const
pure virtual

Reads state variable values for one cell from a file.

Return values
0good
1temporary table allocated
>1error
Here is the caller graph for this function:

◆ reqdat()

virtual uint32_t limpet::IonType::reqdat ( ) const
pure virtual

Gets data flags for this IMP's required data.

Returns
a bitmap of external variables used but unchanged by the IMP
Here is the caller graph for this function:

◆ select_target()

virtual Target limpet::IonType::select_target ( Target  target) const
pure virtual

Gets a supported target from the given target.

If the given target is Target::AUTO the returned target will be the first available, else for other targets it either returns the same if supported or Target::UNKNOWN.

Parameters
targetthe given target
Returns
the selected target, or Target::UNKNOWN if the selection failed
Here is the caller graph for this function:

◆ trace()

virtual void limpet::IonType::trace ( IonIfBase imp,
int  node,
FILE *  file,
GlobalData_t **  data 
) const
pure virtual

Write the values of traced variables to file.

Parameters
impIMP holding model data
nodenode for which to trace the data
filefile to write to
dataexternal variables array
Here is the caller graph for this function:

◆ tune()

virtual void limpet::IonType::tune ( IonIfBase imp,
const char *  im_par 
) const
pure virtual

Handles setting of this model's parameters.

Parameters
impIMP holding this model's data
im_parstring to be parsed for parameter initialization
Here is the caller graph for this function:

◆ write_svs()

virtual int limpet::IonType::write_svs ( IonIfBase imp,
FILE *  file,
int  node 
) const
pure virtual

Write state variable values for one cell to a file/.

Parameters
impIMP holding the model's data
outfile to write to
nodenumber for the cell we want to write the SVs of
Here is the caller graph for this function:

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