#include <CellMLToSharedLibraryConverter.hpp>
Public Member Functions | |
CellMLToSharedLibraryConverter (bool preserveGeneratedSources=false, std::string component="heart") | |
DynamicCellModelLoader * | Convert (const FileFinder &rFilePath, bool isCollective=true) |
void | CreateOptionsFile (const OutputFileHandler &rHandler, const std::string &rModelName, const std::vector< std::string > &rArgs, const std::string &rExtraXml="") |
Private Member Functions | |
void | ConvertCellmlToSo (const std::string &rCellmlFullPath, const std::string &rCellmlFolder, const std::string &rModelLeafName) |
Private Attributes | |
bool | mPreserveGeneratedSources |
std::string | mComponentName |
Definition at line 43 of file CellMLToSharedLibraryConverter.hpp.
CellMLToSharedLibraryConverter::CellMLToSharedLibraryConverter | ( | bool | preserveGeneratedSources = false , |
|
std::string | component = "heart" | |||
) |
Create a converter.
preserveGeneratedSources | whether to save copies of generated C++ source files in the directory containing the .cellml file. | |
component | the name of the Chaste component (or project) in which to build the loadable module (if required). Allows projects to have specialised base classes for dynamically loaded cell models. |
Definition at line 42 of file CellMLToSharedLibraryConverter.cpp.
DynamicCellModelLoader * CellMLToSharedLibraryConverter::Convert | ( | const FileFinder & | rFilePath, | |
bool | isCollective = true | |||
) |
Get a loadable module from the given file, and return a loader for it. The file can be a .so, in which case there isn't much to do, just create the loader. The interesting case comes when it is a .cellml file. If the file has any other extension, an exception is thrown.
rFilePath | the model to load | |
isCollective | whether this method is being called collectively. If it is not, then we require the .so to already exist, rather than trying to avoid race conditions. |
Definition at line 49 of file CellMLToSharedLibraryConverter.cpp.
References RelativeTo::Absolute, ConvertCellmlToSo(), EXCEPTION, FileFinder::Exists(), FileFinder::GetAbsolutePath(), DynamicModelLoaderRegistry::GetLoader(), DynamicModelLoaderRegistry::Instance(), and FileFinder::IsNewerThan().
void CellMLToSharedLibraryConverter::CreateOptionsFile | ( | const OutputFileHandler & | rHandler, | |
const std::string & | rModelName, | |||
const std::vector< std::string > & | rArgs, | |||
const std::string & | rExtraXml = "" | |||
) |
Create a PyCml options file for the given model.
rHandler | where to create the file | |
rModelName | base name of the model file (which will be "rModelName.cellml") | |
rArgs | extra command-line arguments for the model conversion | |
rExtraXml | any extra XML to go in the config file (e.g. LT settings) |
Definition at line 161 of file CellMLToSharedLibraryConverter.cpp.
References PetscTools::AmMaster(), PetscTools::Barrier(), and OutputFileHandler::OpenOutputFile().
void CellMLToSharedLibraryConverter::ConvertCellmlToSo | ( | const std::string & | rCellmlFullPath, | |
const std::string & | rCellmlFolder, | |||
const std::string & | rModelLeafName | |||
) | [private] |
Helper method performing the actual conversion of a .cellml file to a .so.
rCellmlFullPath | full path to the .cellml file | |
rCellmlFolder | folder containing the CellML file, with trailing slash | |
rModelLeafName | leaf name of the CellML file, minus extension (but including the .) |
Definition at line 100 of file CellMLToSharedLibraryConverter.cpp.
References RelativeTo::Absolute, PetscTools::AmMaster(), ChasteBuildDirName(), ChasteBuildRootDir(), ChasteBuildType(), EXCEPT_IF_NOT, EXCEPTION, EXPECT0, Exception::GetMessage(), mComponentName, mPreserveGeneratedSources, and PetscTools::ReplicateException().
Referenced by Convert().
bool CellMLToSharedLibraryConverter::mPreserveGeneratedSources [private] |
Whether to save copies of generated C++ source files.
Definition at line 102 of file CellMLToSharedLibraryConverter.hpp.
Referenced by ConvertCellmlToSo().
std::string CellMLToSharedLibraryConverter::mComponentName [private] |
Which component to build the loadable module in.
Definition at line 105 of file CellMLToSharedLibraryConverter.hpp.
Referenced by ConvertCellmlToSo().