Chaste  Release::2017.1
AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > Class Template Referenceabstract

#include <AbstractCardiacProblem.hpp>

+ Inheritance diagram for AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >:
+ Collaboration diagram for AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >:

Public Member Functions

 AbstractCardiacProblem (AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > *pCellFactory)
 
 AbstractCardiacProblem ()
 
virtual ~AbstractCardiacProblem ()
 
void Initialise ()
 
void SetNodesPerProcessorFilename (const std::string &rFilename)
 
void SetBoundaryConditionsContainer (BccType pBcc)
 
virtual void PreSolveChecks ()
 
virtual Vec CreateInitialCondition ()
 
void SetMesh (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 
void PrintOutput (bool rPrintOutput)
 
void SetWriteInfo (bool writeInfo=true)
 
Vec GetSolution ()
 
DistributedVector GetSolutionDistributedVector ()
 
double GetCurrentTime ()
 
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh ()
 
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * GetTissue ()
 
void Solve ()
 
void CloseFilesAndPostProcess ()
 
virtual void WriteInfo (double time)=0
 
virtual void DefineWriterColumns (bool extending)
 
void DefineExtraVariablesWriterColumns (bool extending)
 
virtual void WriteOneStep (double time, Vec voltageVec)=0
 
void WriteExtraVariablesOneStep ()
 
bool InitialiseWriter ()
 
void SetUseHdf5DataWriterCache (bool useCache=true)
 
void SetHdf5DataWriterTargetChunkSizeAndAlignment (hsize_t size)
 
void SetOutputNodes (std::vector< unsigned > &rNodesToOutput)
 
Hdf5DataReader GetDataReader ()
 
virtual void AtBeginningOfTimestep (double time)
 
virtual void OnEndOfTimestep (double time)
 
virtual void SetUpAdditionalStoppingTimes (std::vector< double > &rAdditionalStoppingTimes)
 
void SetUseTimeAdaptivityController (bool useAdaptivity, AbstractTimeAdaptivityController *pController=NULL)
 
template<class Archive >
void LoadExtraArchive (Archive &archive, unsigned version)
 
virtual bool GetHasBath ()
 
virtual void SetElectrodes ()
 
void AddOutputModifier (boost::shared_ptr< AbstractOutputModifier > pOutputModifier)
 
- Public Member Functions inherited from AbstractUntemplatedCardiacProblem
virtual ~AbstractUntemplatedCardiacProblem ()
 

Protected Member Functions

virtual AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * CreateCardiacTissue ()=0
 
virtual AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * CreateSolver ()=0
 
virtual void CreateMeshFromHeartConfig ()
 

Protected Attributes

std::string mMeshFilename
 
bool mAllocatedMemoryForMesh
 
bool mWriteInfo
 
bool mPrintOutput
 
std::vector< unsignedmNodesToOutput
 
unsigned mVoltageColumnId
 
std::vector< unsignedmExtraVariablesId
 
unsigned mTimeColumnId
 
unsigned mNodeColumnId
 
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * mpCardiacTissue
 
BccType mpBoundaryConditionsContainer
 
BccType mpDefaultBoundaryConditionsContainer
 
AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * mpSolver
 
AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > * mpCellFactory
 
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
 
Vec mSolution
 
double mCurrentTime
 
AbstractTimeAdaptivityControllermpTimeAdaptivityController
 
Hdf5DataWritermpWriter
 
bool mUseHdf5DataWriterCache
 
hsize_t mHdf5DataWriterChunkSizeAndAlignment
 
std::vector< boost::shared_ptr< AbstractOutputModifier > > mOutputModifiers
 

Private Types

typedef boost::shared_ptr< BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > > BccType
 

Private Member Functions

template<class Archive >
void save (Archive &archive, const unsigned int version) const
 
template<class Archive >
void load (Archive &archive, const unsigned int version)
 
template<class Archive >
void SaveBoundaryConditions (Archive &archive, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, BccType pBcc) const
 
template<class Archive >
BccType LoadBoundaryConditions (Archive &archive, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 

Friends

class TestBidomainWithBath
 
class TestMonodomainProblem
 
class TestCardiacSimulationArchiver
 
class boost::serialization::access
 
template<unsigned DIM, unsigned ELEC_PROB_DIM>
class CardiacElectroMechanicsProblem
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
class AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >

Base class for cardiac problems; contains code generic to mono-/bi-domain and bidomain-with-bath.

This class contains the tissue (PDEs and 'cells' ODEs), boundary conditions, and postprocessing/results writers.

It is called by CardiacSimulation, which is the outer wrapper class for running a cardiac simulation, used by the executable.

Many non-standard simulations will use this class directly, and this is the preferred method for non-executable users. See tutorials for usage.

Definition at line 113 of file AbstractCardiacProblem.hpp.

Member Typedef Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
typedef boost::shared_ptr<BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM> > AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::BccType
private

To save typing

Definition at line 121 of file AbstractCardiacProblem.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractCardiacProblem ( AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > *  pCellFactory)
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractCardiacProblem ( )

Constructor used by archiving.

Definition at line 80 of file AbstractCardiacProblem.cpp.

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AddOutputModifier ( boost::shared_ptr< AbstractOutputModifier pOutputModifier)
inline

Add an output modifier onto a list of such objects. These will be processed in the order in which they have been given. The modifier should not be destroyed before the solve loop has completed

Parameters
pOutputModifierPointer to the modifier to be added

Definition at line 799 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
virtual void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AtBeginningOfTimestep ( double  time)
inlinevirtual

Called at beginning of each time step in the main time-loop in Solve(). Empty implementation but can be overloaded by child classes.

Parameters
timethe current time

Reimplemented in BidomainProblem< DIM >.

Definition at line 726 of file AbstractCardiacProblem.hpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
virtual AbstractCardiacTissue<ELEMENT_DIM,SPACE_DIM>* AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateCardiacTissue ( )
protectedpure virtual

Subclasses must override this method to create a PDE object of the appropriate type.

This class will take responsibility for freeing the object when it is finished with.

Returns
a pointer to the newly created tissue

Implemented in ExtendedBidomainProblem< DIM >, BidomainProblem< DIM >, MonodomainProblem< ELEMENT_DIM, SPACE_DIM >, and MonodomainPurkinjeProblem< ELEMENT_DIM, SPACE_DIM >.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
Vec AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition ( )
virtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateMeshFromHeartConfig ( )
protectedvirtual

Subclasses must override this method to create a suitable mesh object.

Only needed if the subclass needs something other than a DistributedTetrahedralMesh.

This class will take responsibility for freeing the object when it is finished with.

Reimplemented in MonodomainPurkinjeProblem< ELEMENT_DIM, SPACE_DIM >.

Definition at line 219 of file AbstractCardiacProblem.cpp.

References HeartConfig::GetMeshPartitioning(), HeartConfig::Instance(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
virtual AbstractDynamicLinearPdeSolver<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM>* AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateSolver ( )
protectedpure virtual

Subclasses must override this method to create a suitable solver object.

This class will take responsibility for freeing the object when it is finished with.

Returns
pointer to newly created PDE solver

Implemented in ExtendedBidomainProblem< DIM >, BidomainProblem< DIM >, MonodomainProblem< ELEMENT_DIM, SPACE_DIM >, and MonodomainPurkinjeProblem< ELEMENT_DIM, SPACE_DIM >.

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::DefineExtraVariablesWriterColumns ( bool  extending)
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
double AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetCurrentTime ( )
Returns
the current time of the simulation

Definition at line 334 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mCurrentTime.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
Hdf5DataReader AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetDataReader ( )
Returns
a newly created data reader configured to read the results we've been outputting.

Definition at line 902 of file AbstractCardiacProblem.cpp.

References EXCEPTION, and HeartConfig::Instance().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetHasBath ( )
virtual
Returns
whether there's bath defined in this problem

Reimplemented in ExtendedBidomainProblem< DIM >, and BidomainProblem< DIM >.

Definition at line 912 of file AbstractCardiacProblem.cpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CloseFilesAndPostProcess().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
Vec AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetSolution ( )
Returns
the final solution vector. This vector is distributed over all processes.

In case of Bidomain, this is of length 2*numNodes, and of the form (V_1, phi_1, V_2, phi_2, ......, V_N, phi_N). where V_j is the voltage at node j and phi_j is the extracellular potential at node j.

Use with caution since we don't want to alter the state of the PETSc vector.

Definition at line 322 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mSolution.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
DistributedVector AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetSolutionDistributedVector ( )
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetTissue ( )
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise ( )

Initialise the system, once parameters have been set up.

Must be called before first calling Solve(). If loading from a checkpoint, do NOT call this method, as it can also be used to reset the problem to perform another simulation from time 0.

Definition at line 119 of file AbstractCardiacProblem.cpp.

References GenericEventHandler< 16, HeartEventHandler >::BeginEvent(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateCardiacTissue(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateMeshFromHeartConfig(), PetscTools::Destroy(), GenericEventHandler< 16, HeartEventHandler >::EndEvent(), EXCEPTION, HeartConfig::GetFibreLength(), HeartConfig::GetInterNodeSpace(), HeartConfig::GetMeshName(), HeartConfig::GetSheetDimensions(), Exception::GetShortMessage(), HeartConfig::GetSlabDimensions(), HeartConfig::Instance(), PetscTools::IsParallel(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mAllocatedMemoryForMesh, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mCurrentTime, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpCardiacTissue, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpCellFactory, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mSolution, NEVER_REACHED, and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetElectrodes().

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Initialise().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseWriter ( )

It creates and initialises the hdf writer from the Hdf5DataWriter class. It passes the output directory and file name to it. It is called by Solve(), if the output needs to be generated.

This method will try to open an existing .h5 file for extension if we are loading from an archive and one is present.

Returns
whether the writer is outputting to an existing file.

Definition at line 803 of file AbstractCardiacProblem.cpp.

References RelativeTo::Absolute, Hdf5DataWriter::ApplyPermutation(), PetscTools::Barrier(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::DefineWriterColumns(), Hdf5DataWriter::EndDefineMode(), EXCEPTION, FileFinder::Exists(), FileFinder::GetAbsolutePath(), OutputFileHandler::GetChasteTestOutputDirectory(), HeartConfig::GetOutputDirectory(), HeartConfig::GetOutputFilenamePrefix(), Hdf5DataReader::GetUnlimitedDimensionValues(), HeartConfig::Instance(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mCurrentTime, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mHdf5DataWriterChunkSizeAndAlignment, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpWriter, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mSolution, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mUseHdf5DataWriterCache, Hdf5DataWriter::SetAlignment(), HeartConfig::SetOutputUsingOriginalNodeOrdering(), and Hdf5DataWriter::SetTargetChunkSize().

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
template<class Archive >
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::load ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

Load the member variables.

Parameters
archive
version
Todo:
#1317 code for saving/loading mSolution is PROBLEM_DIM specific, move it into the save/load methods for Mono and BidomainProblem. (ExtendedBidomain has its own already.)
Todo:
#1317 is there a reason we can't use PETSc's load/save vector functionality?

Definition at line 224 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
template<class Archive >
BccType AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::LoadBoundaryConditions ( Archive &  archive,
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *  pMesh 
)
inlineprivate

Serialization helper method to load a boundary conditions container.

Parameters
archivethe archive to load from
pMeshthe mesh boundary conditions are to be defined on
Returns
the loaded container

Definition at line 367 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
template<class Archive >
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::LoadExtraArchive ( Archive &  archive,
unsigned  version 
)

Used when loading a set of archives written by a parallel simulation onto a single process. Loads data from the given process-specific archive (written by a non-master process) and merges it into our data.

Parameters
archivethe archive to load
versionthe archive file version
Note
The process-specific archives currently contain the following data. If the layout changes, then this method will need to be altered, since it hard-codes knowledge of the order in which things are archived.
  1. (via mpMesh) DistributedVectorFactory*
  2. (via mpCardiacTissue LoadCardiacCells) DistributedVectorFactory*
  3. (via mpCardiacTissue LoadCardiacCells) number_of_cells and sequence of AbstractCardiacCell*, possibly with Purkinje interleaved
  4. (via mpCardiacTissue) DistributedVectorFactory*
  5. mpBoundaryConditionsContainer
  6. mpDefaultBoundaryConditionsContainer
  7. (if we're a BidomainProblem) stuff in BidomainProblem::LoadExtraArchiveForBidomain

Definition at line 813 of file AbstractCardiacProblem.hpp.

References DistributedVectorFactory::GetNumProcs(), DistributedVectorFactory::GetOriginalFactory(), BidomainProblem< DIM >::LoadExtraArchiveForBidomain(), AbstractCardiacProblem< DIM, DIM, 2 >::mpBoundaryConditionsContainer, AbstractCardiacProblem< DIM, DIM, 2 >::mpCardiacTissue, and AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
virtual void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::OnEndOfTimestep ( double  time)
inlinevirtual

Called at end of each time step in the main time-loop in Solve(). Empty implementation but can be overloaded by child classes.

Parameters
timethe current time

Reimplemented in BidomainProblem< DIM >.

Definition at line 736 of file AbstractCardiacProblem.hpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PreSolveChecks ( )
virtual

Performs a series of checks before solving. It checks whether the cardiac pde has been defined, whether the simulation time is greater than zero and whether the output directory is specified (or the output is set not to be produced). It throws exceptions if any of the above checks fails.

Todo:
remove magic number? (#1884)

Reimplemented in ExtendedBidomainProblem< DIM >, and BidomainProblem< DIM >.

Definition at line 231 of file AbstractCardiacProblem.cpp.

References EXCEPTION, HeartConfig::GetPdeTimeStep(), HeartConfig::GetSimulationDuration(), HeartConfig::Instance(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mCurrentTime, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpCardiacTissue, and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mPrintOutput.

Referenced by BidomainProblem< DIM >::PreSolveChecks(), ExtendedBidomainProblem< DIM >::PreSolveChecks(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PrintOutput ( bool  rPrintOutput)

Set whether the simulation will generate results files.

Parameters
rPrintOutput

Definition at line 310 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mPrintOutput.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::rGetMesh ( )
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
template<class Archive >
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::save ( Archive &  archive,
const unsigned int  version 
) const
inlineprivate

Save the member variables.

Parameters
archive
version
Todo:
#1317 code for saving/loading mSolution is PROBLEM_DIM specific, move it into the save/load methods for Mono and BidomainProblem. Note that extended_bidomain has its own version of this code.

Definition at line 134 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
template<class Archive >
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SaveBoundaryConditions ( Archive &  archive,
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *  pMesh,
BccType  pBcc 
) const
inlineprivate

Serialization helper method to save a boundary conditions container.

Parameters
archivethe archive to save to
pMeshthe mesh boundary conditions are defined on
pBccthe container to save

Definition at line 352 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetBoundaryConditionsContainer ( BccType  pBcc)

Set the boundary conditions container.

Parameters
pBccis a pointer to a boundary conditions container

Definition at line 225 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpBoundaryConditionsContainer.

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetElectrodes ( )
virtual

Set an electrode object (which provides boundary conditions). Only valid if there is a bath.

Reimplemented in BidomainProblem< DIM >.

Definition at line 918 of file AbstractCardiacProblem.cpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetHdf5DataWriterTargetChunkSizeAndAlignment ( hsize_t  size)

Set Hdf5DataWriter target chunk size and alignment parameters.

The most likely use case for this is setting it to the stripe size on a striped filesystem. This results in the writer choosing chunk dimensions that should efficiently fit within a stripe, AND padding the chunks so each chunk fits in one stripe.

For example, if your filesystem uses 1 M stripes, call this method with argument 1048576 (or 0x100000 if you like round numbers).

NOTE: The alignment parameter is only used for NEW HDF5 files. The chunk size is only used for NEW datasets (e.g. results or postprocessing) and NOT when EXTENDING a dataset. In other words, when adding a dataset to a file the alignment parameter will be ignored. When adding to a dataset, both will be ignored. etc.

Parameters
sizesize in bytes to use for target chunk size and alignment

Definition at line 890 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mHdf5DataWriterChunkSizeAndAlignment.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetMesh ( AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *  pMesh)

This only needs to be called if a mesh filename has not been set.

Parameters
pMeshthe mesh object to use

Definition at line 297 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mAllocatedMemoryForMesh, and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh.

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Initialise().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetNodesPerProcessorFilename ( const std::string &  rFilename)

Set a file from which the nodes for each processor are read

Parameters
rFilename
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetOutputNodes ( std::vector< unsigned > &  rNodesToOutput)

Specifies which nodes in the mesh to output. This method must be called before InitialiseWriter, otherwise all nodes will still be output. If this method is called when extending an existing HDF5 file, it will be ignored.

Parameters
rNodesToOutputis a reference to a vector with the indexes of the nodes where the output is desired. If empty, the output will be for all the nodes in the mesh.

Definition at line 896 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mNodesToOutput.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
virtual void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetUpAdditionalStoppingTimes ( std::vector< double > &  rAdditionalStoppingTimes)
inlinevirtual

Allow subclasses to define additional 'stopping times' for the printing time step loop. This allows bidomain simulations to specify exactly when the Electrodes should be turned on or off.

Parameters
rAdditionalStoppingTimesto be filled in with the additional stopping times

Reimplemented in BidomainProblem< DIM >.

Definition at line 746 of file AbstractCardiacProblem.hpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetUseHdf5DataWriterCache ( bool  useCache = true)

Set whether to use caching in the Hdf5DataWriter. This tells the Hdf5DataWriter to write only whole chunks to disk, rather than every print timestep, which is much faster when running with many processes.

Parameters
useCacheWhether to use the cache

Definition at line 884 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mUseHdf5DataWriterCache.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetUseTimeAdaptivityController ( bool  useAdaptivity,
AbstractTimeAdaptivityController pController = NULL 
)
Todo:
#1704 add default adaptivity controller and allow the user just to call with true

Set whether (or not) to use a time adaptivity controller

Parameters
useAdaptivitywhether to use adaptivity
pControllerThe controller (only relevant if useAdaptivity==true)

Definition at line 357 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpTimeAdaptivityController.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetWriteInfo ( bool  writeInfo = true)

Set whether extra info will be written to stdout during computation.

Parameters
writeInfo

Definition at line 316 of file AbstractCardiacProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mWriteInfo.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve ( )

First performs some checks by calling the PreSolveChecks method. It creates an solver to which it passes the boundary conditions specified by the user (otherwise it passes the defauls bcc). It then calls the Solve method on the solver class. It also handles the output, if necessary.

Note
This method is collective, and hence must be called by all processes.

Definition at line 373 of file AbstractCardiacProblem.cpp.

References Hdf5DataWriter::AdvanceAlongUnlimitedDimension(), TimeStepper::AdvanceOneTimeStep(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AtBeginningOfTimestep(), GenericEventHandler< 16, HeartEventHandler >::BeginEvent(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CloseFilesAndPostProcess(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateSolver(), PetscTools::Destroy(), GenericEventHandler< 16, HeartEventHandler >::EndEvent(), TimeStepper::GetNextTime(), HeartConfig::GetOutputDirectory(), TimeStepper::GetTime(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseWriter(), HeartConfig::Instance(), TimeStepper::IsTimeAtEnd(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mCurrentTime, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mOutputModifiers, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpBoundaryConditionsContainer, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpDefaultBoundaryConditionsContainer, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mPrintOutput, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpSolver, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpTimeAdaptivityController, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpWriter, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mSolution, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mWriteInfo, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::OnEndOfTimestep(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PreSolveChecks(), ProgressReporter::PrintFinalising(), PetscTools::ReplicateException(), GenericEventHandler< 16, HeartEventHandler >::Reset(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetUpAdditionalStoppingTimes(), ProgressReporter::Update(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteInfo(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteOneStep().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
virtual void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteInfo ( double  time)
pure virtual

Write informative details about the progress of the simulation to standard output.

Implemented only in subclasses.

Parameters
timethe current time

Implemented in ExtendedBidomainProblem< DIM >, BidomainProblem< DIM >, MonodomainPurkinjeProblem< ELEMENT_DIM, SPACE_DIM >, and MonodomainProblem< ELEMENT_DIM, SPACE_DIM >.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
virtual void AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteOneStep ( double  time,
Vec  voltageVec 
)
pure virtual

Friends And Related Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 125 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
template<unsigned DIM, unsigned ELEC_PROB_DIM>
friend class CardiacElectroMechanicsProblem
friend

CardiacElectroMechanicsProblem needs access to mpWriter.

Definition at line 467 of file AbstractCardiacProblem.hpp.

Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mAllocatedMemoryForMesh
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
double AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mCurrentTime
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
std::vector<unsigned> AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mExtraVariablesId
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
hsize_t AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mHdf5DataWriterChunkSizeAndAlignment
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
std::string AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mMeshFilename
protected

Meshes can be read from file or instantiated and passed directly to this class, this is for the former

Definition at line 387 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
unsigned AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mNodeColumnId
protected

Used by the writer

Definition at line 406 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
std::vector<unsigned> AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mNodesToOutput
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
std::vector<boost::shared_ptr<AbstractOutputModifier> > AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mOutputModifiers
protected

A vector of user-defined output modifiers which may be used to produce lightweight on the fly output

Definition at line 487 of file AbstractCardiacProblem.hpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
BccType AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpBoundaryConditionsContainer
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>* AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpCellFactory
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
BccType AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpDefaultBoundaryConditionsContainer
protected

It is convenient to also have a separate variable for default (zero-Neumann) boundary conditions

Definition at line 414 of file AbstractCardiacProblem.hpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractDynamicLinearPdeSolver<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM>* AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpSolver
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractTimeAdaptivityController* AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpTimeAdaptivityController
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
unsigned AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mTimeColumnId
protected

Used by the writer

Definition at line 404 of file AbstractCardiacProblem.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mUseHdf5DataWriterCache
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
unsigned AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mVoltageColumnId
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mWriteInfo
protected

Whether to print some statistics (max/min voltage) to screen during the simulation

Definition at line 392 of file AbstractCardiacProblem.hpp.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetWriteInfo(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().


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