openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
Classes | Public Member Functions | List of all members
limpet::IonIf< T > Class Template Reference

Child class of IonIfBase specialized for each ionic model type. More...

#include <ION_IF.h>

Inheritance diagram for limpet::IonIf< T >:
Collaboration diagram for limpet::IonIf< T >:

Classes

class  LimpetArray
 Utility class for handling arrays of data used by IMPs. More...
 

Public Member Functions

 IonIf (const IonType &type, Target target, int num_node, const std::vector< std::reference_wrapper< IonType >> &plugins)
 Constructs an IonIf object. More...
 
 ~IonIf ()
 Destroy the IMP. More...
 
T::params_type * params () const
 Gets a pointer to the parameter structure for the current target. More...
 
SvTabsv_tab ()
 Gets the SV LimpetArray for the current target. More...
 
PrivateTabion_private ()
 Gets the ion private LimpetArray for the current target. More...
 
PrivateVectorTabion_private_vector ()
 
void * get_sv_address () override
 Gets the raw address of the SV array for the current target. More...
 
std::size_t get_sv_size () const override
 Gets the size of a SV structure. More...
 
void set_target (Target target) override
 Set a new execution target for this IMP. More...
 
void allocate_model_data ()
 Allocate memory for the IMP data for the current target. More...
 
void initialize (double dt, GlobalData_t **impdat) override
 Override of the initialization function to add the initialization of the private structures. More...
 
void copy_SVs_from (IonIfBase &other_base, bool alloc) override
 Copy state and private variables from another IMP. More...
 
void copy_ion_private (IonIf< T > &other, has_rosenbrock_vector_type)
 Copy the ion private array from other. More...
 
void copy_ion_private (IonIf< T > &other, has_rosenbrock_type)
 Copy the ion private array from other. More...
 
void copy_ion_private (IonIf< T > &other, no_rosenbrock_type)
 This function does nothing (overload of copy_ion_private(IonIf<T>&, has_rosenbrock_type)). More...
 
void init_ion_private (has_rosenbrock_vector_type)
 Initialize private data. More...
 
void init_ion_private (has_rosenbrock_type)
 Initialize private data. More...
 
void init_ion_private (no_rosenbrock_type)
 Doesn't do anything. More...
 
- Public Member Functions inherited from limpet::IonIfBase
 IonIfBase (const IonType &type, Target target, int num_node, const std::vector< std::reference_wrapper< IonType >> &plugins)
 Constructor for IonIfBase. More...
 
virtual ~IonIfBase ()
 Virtual destructor declaration. More...
 
const IonTypeget_type () const
 Gets this IMP's model type. More...
 
int get_num_node () const
 Gets the number of nodes handled by this IMP. More...
 
std::size_t get_num_threads () const
 Gets the number of threads used for running this IMP. More...
 
IonIfBaseparent () const
 Gets the parent IMP. More...
 
void set_parent (IonIfBase *parent)
 
std::vector< IonIfBase * > & plugins ()
 Returns a vector containing the plugins of this IMP. More...
 
uint32_t get_reqdat () const
 Gets the data flags for this IMP's required data. More...
 
uint32_t get_moddat () const
 Gets the data flags for this IMP's modified data. More...
 
void set_moddat (uint32_t data)
 Set the data flag for this IMP's modified data. More...
 
cell_geomcgeom ()
 Gets the cell geometry data. More...
 
float get_dt () const
 Gets the basic integration time step. More...
 
void set_dt (float dt)
 Sets the basic integration time step. More...
 
tsget_tstp ()
 Gets the time stepper. More...
 
std::vector< LUT > & tables ()
 Gets the array of state variables. More...
 
LUTtables_d () const
 Gets an array of LUTs. More...
 
size_t get_n_tables_d () const
 Gets the size of the array returned by IonIf::tables_d. More...
 
Target get_target () const
 
void initialize_params ()
 Initializes user modifiable parameters with default values defined in the respective ionic models. More...
 
void compute (int start, int end, GlobalData_t **data)
 Perform ionic model computation for 1 time step. More...
 
char * fill_buf (char *buf, int *n, opencarp::Salt_list *l) const
 Appends the state variables to a buffer. More...
 
int restore (opencarp::FILE_SPEC in, int n, const int *pos, IIF_Mask_t *mask, size_t *offset, IMPinfo *impinfo, const int *loc2canon)
 Reads in the state variables for an IMP. More...
 
int dump_luts (bool zipped)
 Dumps array of LUTs to file. More...
 
void destroy_luts ()
 Destroys array of LUTs. More...
 
void tune (const char *im_par, const char *plugs, const char *plug_par)
 Tunes specific IMP parameters from files. More...
 
int read_svs (FILE *file)
 Reads state variable values for one cell from a file. More...
 
int write_svs (FILE *file, int node)
 
void copy_plugins_from (IonIfBase &other)
 Copies the plugins of an IMP. More...
 
void for_each (const std::function< void(IonIfBase &)> &consumer)
 Executes the consumer functions on this IMP and each of its plugins. More...
 

Additional Inherited Members

- Public Attributes inherited from limpet::IonIfBase
int miifIdx
 imp index within miif More...
 
Target _target
 execution target for this IMP More...
 
- Protected Attributes inherited from limpet::IonIfBase
ts _tstp
 control time stepping More...
 

Detailed Description

template<typename T>
class limpet::IonIf< T >

Child class of IonIfBase specialized for each ionic model type.

The template parameter T should be an IonType class and should define some type aliases:

Definition at line 497 of file ION_IF.h.

Constructor & Destructor Documentation

◆ IonIf()

template<typename T>
limpet::IonIf< T >::IonIf ( const IonType type,
Target  target,
int  num_node,
const std::vector< std::reference_wrapper< IonType >> &  plugins 
)
inline

Constructs an IonIf object.

Note
see IonIfBase::IonIfBase for explanatiosn on the parameters

This constructor allocated all necessary memory for the IMP

Definition at line 675 of file ION_IF.h.

◆ ~IonIf()

template<typename T>
limpet::IonIf< T >::~IonIf ( )
inline

Destroy the IMP.

Note
This function should deallocate all memory used by the IMP

Definition at line 686 of file ION_IF.h.

Member Function Documentation

◆ allocate_model_data()

template<typename T>
void limpet::IonIf< T >::allocate_model_data ( )
inline

Allocate memory for the IMP data for the current target.

Definition at line 778 of file ION_IF.h.

◆ copy_ion_private() [1/3]

template<typename T>
void limpet::IonIf< T >::copy_ion_private ( IonIf< T > &  other,
has_rosenbrock_vector_type   
)
inline

Copy the ion private array from other.

Parameters
otherIMP to copy the array from
Note
this function is an overload to use for models using the vectorized private data workspace

Definition at line 842 of file ION_IF.h.

◆ copy_ion_private() [2/3]

template<typename T>
void limpet::IonIf< T >::copy_ion_private ( IonIf< T > &  other,
has_rosenbrock_type   
)
inline

Copy the ion private array from other.

Parameters
otherIMP to copy the array from
Note
this function is an overload to use for models using the private data workspace

Definition at line 859 of file ION_IF.h.

◆ copy_ion_private() [3/3]

template<typename T>
void limpet::IonIf< T >::copy_ion_private ( IonIf< T > &  other,
no_rosenbrock_type   
)
inline

This function does nothing (overload of copy_ion_private(IonIf<T>&, has_rosenbrock_type)).

This is used to avoid trying to copy data on models that don't use private data

Definition at line 868 of file ION_IF.h.

◆ copy_SVs_from()

template<typename T>
void limpet::IonIf< T >::copy_SVs_from ( IonIfBase other_base,
bool  alloc 
)
inlineoverridevirtual

Copy state and private variables from another IMP.

Precondition
other is of the same type as this (IonIf<T>)
this handles the same amount of cells as other_base (this->get_num_nodes() == other.get_num_nodes())
Parameters
other_baseIMP to copy the values from (passed as IonIfBase)
allocwhether to allocate new storage for the copied values
Warning
alloc is deprecated and is not used since the IonIf constructor should always allocate memory, and if the IMPs don't handle the same amount of cells (same size of SV table), the function should throw an exception.

Implements limpet::IonIfBase.

Definition at line 820 of file ION_IF.h.

◆ get_sv_address()

template<typename T>
void* limpet::IonIf< T >::get_sv_address ( )
inlineoverridevirtual

Gets the raw address of the SV array for the current target.

Returns
a raw pointer to the SV array

Implements limpet::IonIfBase.

Definition at line 743 of file ION_IF.h.

◆ get_sv_size()

template<typename T>
std::size_t limpet::IonIf< T >::get_sv_size ( ) const
inlineoverridevirtual

Gets the size of a SV structure.

Returns
the size of the state variable structure

Implements limpet::IonIfBase.

Definition at line 752 of file ION_IF.h.

◆ init_ion_private() [1/3]

template<typename T>
void limpet::IonIf< T >::init_ion_private ( has_rosenbrock_vector_type  )
inline

Initialize private data.

Note
Overload for the vectorized private structures

Definition at line 875 of file ION_IF.h.

◆ init_ion_private() [2/3]

template<typename T>
void limpet::IonIf< T >::init_ion_private ( has_rosenbrock_type  )
inline

Initialize private data.

Note
Overload for the private structures

Definition at line 896 of file ION_IF.h.

◆ init_ion_private() [3/3]

template<typename T>
void limpet::IonIf< T >::init_ion_private ( no_rosenbrock_type  )
inline

Doesn't do anything.

Note
Overload for models without the need for a private structure

Definition at line 909 of file ION_IF.h.

◆ initialize()

template<typename T>
void limpet::IonIf< T >::initialize ( double  dt,
GlobalData_t **  impdat 
)
inlineoverridevirtual

Override of the initialization function to add the initialization of the private structures.

Parameters
dttime step
impdatadata
Note
see IonIfBase::initialize

Reimplemented from limpet::IonIfBase.

Definition at line 801 of file ION_IF.h.

◆ ion_private()

template<typename T>
PrivateTab& limpet::IonIf< T >::ion_private ( )
inline

Gets the ion private LimpetArray for the current target.

Returns
a reference to the ion private array

Definition at line 727 of file ION_IF.h.

Here is the caller graph for this function:

◆ ion_private_vector()

template<typename T>
PrivateVectorTab& limpet::IonIf< T >::ion_private_vector ( )
inline

Definition at line 731 of file ION_IF.h.

Here is the caller graph for this function:

◆ params()

template<typename T>
T::params_type* limpet::IonIf< T >::params ( ) const
inline

Gets a pointer to the parameter structure for the current target.

Returns
a pointer to the parameters structure

Definition at line 702 of file ION_IF.h.

◆ set_target()

template<typename T>
void limpet::IonIf< T >::set_target ( Target  target)
inlineoverridevirtual

Set a new execution target for this IMP.

Parameters
targetthe new target to set

A call to this function will trigger allocation of memory on the new target and a copy of memory from the old target to the new target.

Reimplemented from limpet::IonIfBase.

Definition at line 764 of file ION_IF.h.

◆ sv_tab()

template<typename T>
SvTab& limpet::IonIf< T >::sv_tab ( )
inline

Gets the SV LimpetArray for the current target.

Returns
a reference to the SV array

Definition at line 714 of file ION_IF.h.

Here is the caller graph for this function:

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