#include <ActivationOutputModifier.hpp>
Inherits AbstractOutputModifier.
Public Member Functions | |
ActivationOutputModifier (const std::string &rFilename, double threshold) | |
virtual void | InitialiseAtStart (DistributedVectorFactory *pVectorFactory) |
virtual void | FinaliseAtEnd () |
virtual void | ProcessSolutionAtTimeStep (double time, Vec solution, unsigned problemDim) |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &archive, const unsigned int version) |
ActivationOutputModifier () | |
Private Attributes | |
double | mThreshold |
unsigned | mLocalSize |
std::vector< double > | mFirstActivitationTimes |
std::vector< double > | mFirstRecoveryTimes |
std::vector< double > | mSecondActivitationTimes |
std::vector< double > | mSecondRecoveryTimes |
Friends | |
class | TestOutputModifiers |
class | boost::serialization::access |
Specialised class for on-the-fly calculation of activation and recovery times. This is hard-coded for the first 2 rounds of activation/recovery.
Times are relative to simulation start and are listed in node order and in 4 columns comma separated (.CSV)
node_0_activation, node_0_recovery, node_0_later_activation, node_0_later_recovery node_1_activation, node_1_recovery, node_1_later_activation, node_1_later_recovery ...
Any missing data (node was not activated a second time or did not recover) is marked with -1.
WARNING: If you checkpoint this class then the partial results will not be stored. This is because the sizes of the activation time vectors will be dependent on the number of processes involved in the parallel code. To fix this: archive as PETSc vectors? Then check ProcessSolutionAtTimeStep logic...
Definition at line 61 of file ActivationOutputModifier.hpp.
ActivationOutputModifier::ActivationOutputModifier | ( | ) | [inline, private] |
Private constructor that does nothing, for archiving
Definition at line 86 of file ActivationOutputModifier.hpp.
ActivationOutputModifier::ActivationOutputModifier | ( | const std::string & | rFilename, | |
double | threshold | |||
) | [inline] |
Constructor
rFilename | The file which is eventually produced by this modifier | |
threshold | The transmembrane voltage threshold (in mV) at which activation is deemed to have been trigged. This is also used for calculating relaxation time (this is not so sophisticated as an APD90 calculation). |
Definition at line 98 of file ActivationOutputModifier.hpp.
void ActivationOutputModifier::FinaliseAtEnd | ( | ) | [virtual] |
Finalise the modifier (write all results to the file)
Implements AbstractOutputModifier.
Definition at line 49 of file ActivationOutputModifier.cpp.
References PetscTools::AmMaster(), PetscTools::BeginRoundRobin(), PetscTools::EndRoundRobin(), HeartConfig::Instance(), AbstractOutputModifier::mFilename, mFirstActivitationTimes, mFirstRecoveryTimes, mLocalSize, mSecondActivitationTimes, mSecondRecoveryTimes, and OutputFileHandler::OpenOutputFile().
void ActivationOutputModifier::InitialiseAtStart | ( | DistributedVectorFactory * | pVectorFactory | ) | [virtual] |
Initialise the modifier (make space for local activation times) when the solve loop is starting.
Note the problem passes parameters in a non-templated fashion in order to keep the interface as lightweight as possible.
pVectorFactory | The vector factory which is associated with the calling problem's mesh |
Implements AbstractOutputModifier.
Definition at line 40 of file ActivationOutputModifier.cpp.
References DistributedVectorFactory::GetLocalOwnership(), mFirstActivitationTimes, mFirstRecoveryTimes, mLocalSize, mSecondActivitationTimes, and mSecondRecoveryTimes.
void ActivationOutputModifier::ProcessSolutionAtTimeStep | ( | double | time, | |
Vec | solution, | |||
unsigned | problemDim | |||
) | [virtual] |
Process a solution time-step (memorise all new activations)
time | The current simulation time | |
solution | A working copy of the solution at the current time-step. This is the PETSc vector which is distributed across the processes. | |
problemDim | The calling problem dimension. Used here to avoid probing the size of the solution vector |
Implements AbstractOutputModifier.
Definition at line 77 of file ActivationOutputModifier.cpp.
References mFirstActivitationTimes, mFirstRecoveryTimes, mLocalSize, mSecondActivitationTimes, mSecondRecoveryTimes, and mThreshold.
void ActivationOutputModifier::serialize | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, private] |
Archive this modifier. Just calls the base class version.
archive | the archive | |
version | the current version of this class |
Reimplemented from AbstractOutputModifier.
Definition at line 77 of file ActivationOutputModifier.hpp.
References mThreshold.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from AbstractOutputModifier.
Definition at line 74 of file ActivationOutputModifier.hpp.
std::vector<double> ActivationOutputModifier::mFirstActivitationTimes [private] |
The first activation (first time above threshold) for all local nodes on this process
Definition at line 66 of file ActivationOutputModifier.hpp.
Referenced by FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().
std::vector<double> ActivationOutputModifier::mFirstRecoveryTimes [private] |
The first recovery (first time subsequent time below threshold) for all local nodes on this process
Definition at line 67 of file ActivationOutputModifier.hpp.
Referenced by FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().
unsigned ActivationOutputModifier::mLocalSize [private] |
The number of nodes on this process (calculated in InitialiseAtStart)
Definition at line 65 of file ActivationOutputModifier.hpp.
Referenced by FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().
std::vector<double> ActivationOutputModifier::mSecondActivitationTimes [private] |
The second activation time for local nodes
Definition at line 68 of file ActivationOutputModifier.hpp.
Referenced by FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().
std::vector<double> ActivationOutputModifier::mSecondRecoveryTimes [private] |
The second recovery time for local nodes
Definition at line 69 of file ActivationOutputModifier.hpp.
Referenced by FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().
double ActivationOutputModifier::mThreshold [private] |
The user-defined threshold at which activation and recovery is to be measured
Definition at line 64 of file ActivationOutputModifier.hpp.
Referenced by ProcessSolutionAtTimeStep(), and serialize().