Chaste  Release::2018.1
CellMLLoader Class Reference

#include <CellMLLoader.hpp>

+ Collaboration diagram for CellMLLoader:

Public Member Functions

 CellMLLoader (const FileFinder &rCellMLFile, const OutputFileHandler &rOutputFileHandler, const std::vector< std::string > &rOptions)
 
boost::shared_ptr
< AbstractCardiacCell
LoadCardiacCell (void)
 
boost::shared_ptr
< AbstractCvodeCell
LoadCvodeCell (void)
 

Private Member Functions

AbstractCardiacCellInterfaceLoadCellMLFile (bool makeCvodeCell)
 

Private Attributes

FileFinder mCellMLFile
 
OutputFileHandler mOutputFileHandler
 
std::vector< std::string > mOptions
 
boost::shared_ptr
< CellMLToSharedLibraryConverter
mpConverter
 
boost::logic::tribool mUseCvode
 

Detailed Description

A helper class which will dynamically load a CellML file and provide a method to get a pointer to a new AbstractCardiacCell (or AbstractCvodeCell if CVODE is enabled).

Note that you cannot call both LoadCardiacCell and LoadCvodeCell on the same object, since there would be filename conflicts trying to create different classes in the same output folder. Create a second loader with a different rOutputFileHandler parameter if you need both kinds of cell.

Definition at line 58 of file CellMLLoader.hpp.

Constructor & Destructor Documentation

CellMLLoader::CellMLLoader ( const FileFinder rCellMLFile,
const OutputFileHandler rOutputFileHandler,
const std::vector< std::string > &  rOptions 
)

Create a new loader for a CellML model.

Parameters
rCellMLFilethe location of a CellML file to load on the fly
rOutputFileHandlerwhere to put the generated files
rOptionsany options to be passed to PyCML e.g. "--expose-annotated-variables"

Definition at line 41 of file CellMLLoader.cpp.

Member Function Documentation

boost::shared_ptr< AbstractCardiacCell > CellMLLoader::LoadCardiacCell ( void  )

Make an AbstractCardiacCell, which will be solved with a (Forward)Euler solver, and uses the default stimulus from the CellML file (if present).

Returns
a pointer to the cell

Definition at line 108 of file CellMLLoader.cpp.

References LoadCellMLFile().

AbstractCardiacCellInterface * CellMLLoader::LoadCellMLFile ( bool  makeCvodeCell)
private

A method to make a new cell model which is then cast in the public methods to the relevant type. It copies the CellML file to the mOutputFileHandler location, writes an options file, converts to .hpp and .cpp, makes a shared library, and loads the cell.

Note that on any subsequent calls, the shared library will already exist, and so the conversion will not be performed, making the method much faster.

Parameters
makeCvodeCellwhether this cell should be an AbstractCvodeCell (false = AbstractCardiacCell)
Returns
a pointer to an AbstractCardiacCellInterface which can be cast as required.

Definition at line 50 of file CellMLLoader.cpp.

References OutputFileHandler::CopyFileTo(), EXCEPTION, FileFinder::Exists(), OutputFileHandler::FindFile(), FileFinder::GetLeafName(), FileFinder::GetLeafNameNoExtension(), AbstractCardiacCellInterface::HasCellMLDefaultStimulus(), mCellMLFile, mOptions, mOutputFileHandler, mpConverter, mUseCvode, and AbstractCardiacCellInterface::UseCellMLDefaultStimulus().

Referenced by LoadCardiacCell(), and LoadCvodeCell().

boost::shared_ptr< AbstractCvodeCell > CellMLLoader::LoadCvodeCell ( void  )

Make an AbstractCvodeCell, using the default stimulus from the CellML file (if present).

Returns
a pointer to the cell

Definition at line 116 of file CellMLLoader.cpp.

References LoadCellMLFile().

Member Data Documentation

FileFinder CellMLLoader::mCellMLFile
private

The location of the CellML file to convert

Definition at line 89 of file CellMLLoader.hpp.

Referenced by LoadCellMLFile().

std::vector<std::string> CellMLLoader::mOptions
private

A vector of options to be passed to the CellML converter (PyCML) e.g. "--expose-annotated-variables"

Definition at line 95 of file CellMLLoader.hpp.

Referenced by LoadCellMLFile().

OutputFileHandler CellMLLoader::mOutputFileHandler
private

The location of an output folder to put the converted file and shared library in

Definition at line 92 of file CellMLLoader.hpp.

Referenced by LoadCellMLFile().

boost::shared_ptr<CellMLToSharedLibraryConverter> CellMLLoader::mpConverter
private

The converter we will use

Definition at line 98 of file CellMLLoader.hpp.

Referenced by LoadCellMLFile().

boost::logic::tribool CellMLLoader::mUseCvode
private

Whether we are building 'normal' (false) or 'CVODE' (true) cells.

Definition at line 101 of file CellMLLoader.hpp.

Referenced by LoadCellMLFile().


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