Chaste
Release::2018.1
|
#include <AbstractCardiacTissue.hpp>
Protected Member Functions | |
void | CalculateHaloNodesFromNodeExchange () |
void | SetUpHaloCells (AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > *pCellFactory) |
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) |
void | CreateIntracellularConductivityTensor () |
Friends | |
class | boost::serialization::access |
class | TestMonodomainTissue |
Class containing "tissue-like" functionality used in monodomain and bidomain problems.
Contains the cardiac cells (ODE systems for each node of the mesh) and conductivity tensors (dependent on fibre directions).
Also contains knowledge of parallelisation in the form of the distributed vector factory. This class deals with created a distributed vector of cells, and getting the ionic current and stimuli from these cells and putting them in replicated arrays for the PDE solvers to call.
Definition at line 78 of file AbstractCardiacTissue.hpp.
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue | ( | AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > * | pCellFactory, |
bool | exchangeHalos = false |
||
) |
This constructor is called from the Initialise() method of the CardiacProblem class. It creates all the cell objects, and sets up the conductivities.
Note that pCellFactory contains a pointer to the mesh
pCellFactory | factory to use to create cardiac cells. If this is actually an AbstractPurkinjeCellFactory it creates purkinje cells. |
exchangeHalos | used in state-variable interpolation. Defaults to false. |
Definition at line 53 of file AbstractCardiacTissue.cpp.
References GenericEventHandler< 16, HeartEventHandler >::BeginEvent(), AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::CreateCardiacCellForNode(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::CreateIntracellularConductivityTensor(), AbstractPurkinjeCellFactory< ELEMENT_DIM, SPACE_DIM >::CreatePurkinjeCellForNode(), GenericEventHandler< 16, HeartEventHandler >::EndEvent(), EXCEPTION, AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::FinaliseCellCreation(), AbstractPurkinjeCellFactory< ELEMENT_DIM, SPACE_DIM >::FinalisePurkinjeCellCreation(), DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLocalOwnership(), DistributedVectorFactory::GetLow(), AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::GetMesh(), HeartConfig::GetMeshName(), AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::GetNumberOfCells(), HeartConfig::Instance(), PetscTools::IsSequential(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mCellsDistributed, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mExchangeHalos, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mFibreFilePathNoExtension, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mHasPurkinje, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mIionicCacheReplicated, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mIntracellularStimulusCacheReplicated, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mpDistributedVectorFactory, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mpMesh, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mPurkinjeCellsDistributed, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mPurkinjeIionicCacheReplicated, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mPurkinjeIntracellularStimulusCacheReplicated, PetscTools::ReplicateBool(), PetscTools::ReplicateException(), ReplicatableVector::Resize(), and AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::SetUpHaloCells().
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue | ( | AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * | pMesh | ) |
This constructor is called by the archiver only.
pMesh | a pointer to the AbstractTetrahedral mesh. |
Definition at line 181 of file AbstractCardiacTissue.cpp.
References AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::CreateIntracellularConductivityTensor(), ArchiveLocationInfo::GetArchiveDirectory(), ArchiveLocationInfo::GetMeshFilename(), DistributedVectorFactory::GetProblemSize(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mFibreFilePathNoExtension, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mIionicCacheReplicated, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mIntracellularStimulusCacheReplicated, AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::mpDistributedVectorFactory, and ReplicatableVector::Resize().
|
virtual |
Virtual destructor
Definition at line 197 of file AbstractCardiacTissue.cpp.
|
protected |
If the mesh is a tetrahedral mesh then all elements and nodes are known. The halo nodes to the ones which are actually used as cardiac cells must be calculated explicitly.
Definition at line 423 of file AbstractCardiacTissue.cpp.
References PetscTools::GetNumProcs().
Referenced by AbstractCardiacTissue< SPACE_DIM >::load().
|
private |
Convenience method for intracellular conductivity tensor creation
Definition at line 240 of file AbstractCardiacTissue.cpp.
References RelativeTo::AbsoluteOrCwd, GenericEventHandler< 16, HeartEventHandler >::BeginEvent(), GenericEventHandler< 16, HeartEventHandler >::EndEvent(), FileFinder::Exists(), HeartConfig::GetConductivityHeterogeneities(), HeartConfig::Instance(), NEVER_REACHED, and PetscTools::ReplicateException().
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue().
AbstractCardiacCellInterface * AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::GetCardiacCell | ( | unsigned | globalIndex | ) |
globalIndex | global node index for which to retrieve a cell |
Definition at line 385 of file AbstractCardiacTissue.cpp.
Referenced by CardiacSimulation::CreateAndRun().
AbstractCardiacCellInterface * AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::GetCardiacCellOrHaloCell | ( | unsigned | globalIndex | ) |
globalIndex | global node index for which to retrieve a cell |
Definition at line 402 of file AbstractCardiacTissue.cpp.
References EXCEPTION, and PetscTools::GetMyRank().
bool AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::GetDoCacheReplication | ( | ) |
Get whether or not to replicate the caches across all processors.
Definition at line 359 of file AbstractCardiacTissue.cpp.
AbstractCardiacCellInterface * AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::GetPurkinjeCell | ( | unsigned | globalIndex | ) |
globalIndex | global node index for which to retrieve a cell |
Definition at line 393 of file AbstractCardiacTissue.cpp.
References EXCEPT_IF_NOT.
bool AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::HasPurkinje | ( | ) |
Definition at line 234 of file AbstractCardiacTissue.cpp.
|
inlineprivate |
Unarchive the member variables.
archive | |
version |
Definition at line 162 of file AbstractCardiacTissue.hpp.
|
inline |
Load our tissue from an archive.
Handles the checkpoint migration case, deleting loaded cells immediately if they are not local to this process.
Also loads halo cells if we're doing halo exchange, by using the non-local cells from the archive.
archive | the process-specific archive to load from |
version | archive version |
Definition at line 563 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load().
const AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::pGetMesh | ( | ) | const |
Definition at line 775 of file AbstractCardiacTissue.cpp.
void AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::ReplicateCaches | ( | ) |
Replicate the Iionic and intracellular stimulus caches.
Definition at line 745 of file AbstractCardiacTissue.cpp.
const std::vector< AbstractCardiacCellInterface * > & AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetCellsDistributed | ( | ) | const |
Definition at line 762 of file AbstractCardiacTissue.cpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::SaveCardiacCells().
|
virtual |
elementIndex | index of the element of interest |
Reimplemented in ExtendedBidomainTissue< SPACE_DIM >, ExtendedBidomainTissue< DIM >, BidomainTissue< SPACE_DIM >, and BidomainTissue< DIM >.
Definition at line 379 of file AbstractCardiacTissue.cpp.
References EXCEPTION.
ReplicatableVector & AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetIionicCacheReplicated | ( | ) |
Definition at line 704 of file AbstractCardiacTissue.cpp.
const c_matrix< double, SPACE_DIM, SPACE_DIM > & AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetIntracellularConductivityTensor | ( | unsigned | elementIndex | ) |
elementIndex | index of the element of interest |
Definition at line 365 of file AbstractCardiacTissue.cpp.
ReplicatableVector & AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetIntracellularStimulusCacheReplicated | ( | ) |
Definition at line 710 of file AbstractCardiacTissue.cpp.
const std::vector< AbstractCardiacCellInterface * > & AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetPurkinjeCellsDistributed | ( | ) | const |
Definition at line 768 of file AbstractCardiacTissue.cpp.
References EXCEPT_IF_NOT.
Referenced by AbstractCardiacTissue< SPACE_DIM >::SaveCardiacCells().
ReplicatableVector & AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetPurkinjeIionicCacheReplicated | ( | ) |
Definition at line 716 of file AbstractCardiacTissue.cpp.
References EXCEPT_IF_NOT.
ReplicatableVector & AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::rGetPurkinjeIntracellularStimulusCacheReplicated | ( | ) |
Definition at line 723 of file AbstractCardiacTissue.cpp.
References EXCEPT_IF_NOT.
|
inlineprivate |
Archive the member variables.
archive | |
version |
Definition at line 93 of file AbstractCardiacTissue.hpp.
|
inline |
Save our tissue to an archive.
Writes:
archive | the process-specific archive to write cells to. |
version |
Definition at line 521 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::save().
void AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::SetCacheReplication | ( | bool | doCacheReplication | ) |
Set whether or not to replicate the caches across all processors.
See also mDoCacheReplication.
doCacheReplication | - true if the cache needs to be replicated |
Definition at line 353 of file AbstractCardiacTissue.cpp.
Referenced by MonodomainPurkinjeSolver< ELEMENT_DIM, SPACE_DIM >::MonodomainPurkinjeSolver(), MonodomainSolver< ELEMENT_DIM, SPACE_DIM >::MonodomainSolver(), and OperatorSplittingMonodomainSolver< ELEMENT_DIM, SPACE_DIM >::OperatorSplittingMonodomainSolver().
void AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::SetConductivityModifier | ( | AbstractConductivityModifier< ELEMENT_DIM, SPACE_DIM > * | pModifier | ) |
Set a modifier class which will be used to modifier a conductivity obtained from mpIntracellularConductivityTensors when rGetIntracellularConductivityTensor() is called. For example, it is required when conductivities become deformation-dependent.
pModifier | Pointer to the concrete modifier class |
Definition at line 781 of file AbstractCardiacTissue.cpp.
|
protected |
If mExchangeHalos is true, this method calls CalculateHaloNodesFromNodeExchange and sets up the halo cell data structures mHaloCellsDistributed and mHaloGlobalToLocalIndexMap.
pCellFactory | cell factory to use to create halo cells |
Definition at line 436 of file AbstractCardiacTissue.cpp.
References AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::CreateCardiacCellForNode(), and AbstractCardiacCellInterface::SetUsedInTissueSimulation().
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue().
|
virtual |
Integrate the cell ODEs and update ionic current etc for each of the cells, between the two times provided.
existingSolution | the current voltage solution vector |
time | the current simulation time |
nextTime | when to simulate the cells until |
updateVoltage | whether to also solve for the voltage (generally false, true for operator splitting methods). Defaults to false |
Reimplemented in ExtendedBidomainTissue< SPACE_DIM >, and ExtendedBidomainTissue< DIM >.
Definition at line 464 of file AbstractCardiacTissue.cpp.
References DistributedVector::Begin(), GenericEventHandler< 16, HeartEventHandler >::BeginEvent(), AbstractCvodeCell::ComputeExceptVoltage(), DistributedVector::End(), GenericEventHandler< 16, HeartEventHandler >::EndEvent(), PetscTools::GetMyRank(), AbstractCardiacCellInterface::GetNumberOfStateVariables(), PetscTools::GetNumProcs(), PetscVecTools::GetSize(), AbstractCardiacCellInterface::GetStdVecStateVariables(), NEVER_REACHED, PetscTools::ReplicateException(), DistributedVector::Restore(), AbstractUntemplatedParameterisedSystem::rGetStateVariableNames(), AbstractCardiacCellInterface::SetStateVariables(), and UNUSED_OPT.
void AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::UpdateCaches | ( | unsigned | globalIndex, |
unsigned | localIndex, | ||
double | nextTime | ||
) |
Update the Iionic and intracellular stimulus caches.
globalIndex | global index of the entry to update |
localIndex | local index of the entry to update |
nextTime | the next PDE time point, at which to evaluate the stimulus current |
Definition at line 730 of file AbstractCardiacTissue.cpp.
void AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::UpdatePurkinjeCaches | ( | unsigned | globalIndex, |
unsigned | localIndex, | ||
double | nextTime | ||
) |
Update the Iionic and intracellular stimulus caches for Purkinje cells.
globalIndex | global index of the entry to update |
localIndex | local index of the entry to update |
nextTime | the next PDE time point, at which to evaluate the stimulus current |
Definition at line 737 of file AbstractCardiacTissue.cpp.
|
friend |
Needed for serialization.
Definition at line 83 of file AbstractCardiacTissue.hpp.
|
protected |
The vector of cells. Distributed.
Definition at line 236 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), and AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells().
|
protected |
Whether we need to replicate the caches.
When doing matrix-based RHS assembly, we only actually need information from cells/nodes local to the processor, so replicating the caches is an unnecessary communication overhead.
Defaults to true.
Definition at line 303 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load(), and AbstractCardiacTissue< SPACE_DIM >::save().
|
protected |
Whether to exchange cell models across the halo boundaries. Used in state variable interpolation.
Definition at line 314 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), AbstractCardiacTissue< SPACE_DIM >::load(), and AbstractCardiacTissue< SPACE_DIM >::save().
|
protected |
Path to the location of the fibre file without extension.
Definition at line 282 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), and AbstractCardiacTissue< SPACE_DIM >::save().
|
protected |
The vector of halo cells. Distributed.
Definition at line 320 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load(), and AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells().
|
protected |
Map of global to local indices for halo nodes.
Definition at line 323 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load(), and AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells().
|
protected |
Vector of halo node indices for current process
Definition at line 317 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load().
|
protected |
Whether this tissue has any Purkinje cells.
Definition at line 292 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), AbstractCardiacTissue< SPACE_DIM >::load(), AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells(), and AbstractCardiacTissue< SPACE_DIM >::save().
|
protected |
Cache containing all the ionic currents for each node, replicated over all processes.
Definition at line 246 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue().
|
protected |
Cache containing all the stimulus currents for each node, replicated over all processes.
Definition at line 258 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue().
|
protected |
Whether the mesh was unarchived or got from elsewhere.
Definition at line 308 of file AbstractCardiacTissue.hpp.
|
protected |
A vector which will be of size GetNumProcs() for information to receive for process i.
Definition at line 336 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load().
|
protected |
A vector which will be of size GetNumProcs() where each internal vector except i=GetMyRank() contains an ordered list of indices of nodes to send to process i during data exchange
Definition at line 330 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load().
|
protected |
This class, if not NULL, will be used to modify the conductivity that is obtained from mpIntracellularConductivityTensors when rGetIntracellularConductivityTensor() is called. For example, it is required when conductivities become deformation dependent.
Definition at line 289 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< SPACE_DIM >::load().
|
protected |
Local pointer to the HeartConfig singleton instance, for convenience.
Definition at line 267 of file AbstractCardiacTissue.hpp.
|
protected |
Local pointer to the distributed vector factory associated with the mesh object used.
Used to retrieve node ownership range when needed.
NB: This is set from mpMesh->GetDistributedVectorFactory() and thus always equal to that. We never assume ownership of the object.
Definition at line 277 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), AbstractCardiacTissue< SPACE_DIM >::load(), AbstractCardiacTissue< SPACE_DIM >::save(), and AbstractCardiacTissue< SPACE_DIM >::SaveCardiacCells().
|
protected |
Intracellular conductivity tensors. Not archived, since it's loaded from the HeartConfig singleton.
Definition at line 233 of file AbstractCardiacTissue.hpp.
|
protected |
It's handy to keep a pointer to the mesh object
Definition at line 229 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), AbstractCardiacTissue< SPACE_DIM >::load(), AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells(), and AbstractCardiacTissue< SPACE_DIM >::save().
|
protected |
The vector of the purkinje cells. Distributed. Empty unless a AbstractPurkinjeCellFactory is given to the constructor.
Definition at line 240 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), and AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells().
|
protected |
Cache containing all the ionic currents for each purkinje node, replicated over all processes.
Definition at line 252 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), and AbstractCardiacTissue< SPACE_DIM >::load().
|
protected |
Cache containing all the stimulus currents for each Purkinje node, replicated over all processes.
Definition at line 264 of file AbstractCardiacTissue.hpp.
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue().