Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
|
#include <CellMLToSharedLibraryConverter.hpp>
Public Member Functions | |
CellMLToSharedLibraryConverter (bool preserveGeneratedSources=false, std::string component="heart") | |
DynamicCellModelLoaderPtr | Convert (const FileFinder &rFilePath, bool isCollective=true) |
void | SetOptions (const std::vector< std::string > &rArgs) |
Private Member Functions | |
void | ConvertCellmlToSo (const std::string &rCellmlFullPath, const std::string &rCellmlFolder) |
Private Attributes | |
bool | mPreserveGeneratedSources |
std::string | mComponentName |
std::string | codegen_args |
Static Private Attributes | |
static const std::string | msSoSuffix = "so" |
Friends | |
class | TestDynamicallyLoadedCellModels |
This class encapsulates all the complexity needed to generate a loadable module from a CellML file.
Definition at line 50 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 68 of file CellMLToSharedLibraryConverter.cpp.
DynamicCellModelLoaderPtr CellMLToSharedLibraryConverter::Convert | ( | const FileFinder & | rFilePath, |
bool | isCollective = true |
||
) |
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 75 of file CellMLToSharedLibraryConverter.cpp.
References RelativeTo::Absolute, ConvertCellmlToSo(), EXCEPTION, FileFinder::Exists(), FileFinder::GetAbsolutePath(), DynamicModelLoaderRegistry::GetLoader(), DynamicModelLoaderRegistry::Instance(), FileFinder::IsNewerThan(), msSoSuffix, and FileFinder::SetPath().
Referenced by HeartConfigRelatedCellFactory< SPACE_DIM >::LoadDynamicModel().
|
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 |
Definition at line 140 of file CellMLToSharedLibraryConverter.cpp.
References RelativeTo::Absolute, PetscTools::AmMaster(), ChasteBuildDirName(), RelativeTo::ChasteBuildRoot, ChasteBuildType(), RelativeTo::ChasteSourceRoot, codegen_args, FileFinder::CopyTo(), FileFinder::DangerousRemove(), EXCEPT_IF_NOT, EXCEPTION, FileFinder::Exists(), EXPECT0, FileFinder::FindMatches(), FileFinder::GetAbsolutePath(), FileFinder::GetLeafNameNoExtension(), FileFinder::GetParent(), IGNORE_RET, FileFinder::IsDir(), FileFinder::IsPathSet(), mComponentName, mPreserveGeneratedSources, msSoSuffix, PetscTools::ReplicateException(), and FileFinder::SetPath().
Referenced by Convert().
void CellMLToSharedLibraryConverter::SetOptions | ( | const std::vector< std::string > & | rArgs | ) |
Set the options to be passed to chaste_codegen for the given model.
rArgs | extra command-line arguments for the model conversion |
Definition at line 266 of file CellMLToSharedLibraryConverter.cpp.
References codegen_args.
|
friend |
Test gets access to the msSoSuffix variable
Definition at line 54 of file CellMLToSharedLibraryConverter.hpp.
|
private |
The options to pass to codegen
Definition at line 112 of file CellMLToSharedLibraryConverter.hpp.
Referenced by ConvertCellmlToSo(), and SetOptions().
|
private |
Which component to build the loadable module in.
Definition at line 106 of file CellMLToSharedLibraryConverter.hpp.
Referenced by ConvertCellmlToSo().
|
private |
Whether to save copies of generated C++ source files.
Definition at line 103 of file CellMLToSharedLibraryConverter.hpp.
Referenced by ConvertCellmlToSo().
|
staticprivate |
The .so suffix is nearly always "so" (as you might expect). On Mac OSX this is redefined to "dylib"
Set the .so suffix
Definition at line 109 of file CellMLToSharedLibraryConverter.hpp.
Referenced by Convert(), and ConvertCellmlToSo().