Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
SingleTraceOutputModifier Class Reference

#include <SingleTraceOutputModifier.hpp>

+ Inheritance diagram for SingleTraceOutputModifier:
+ Collaboration diagram for SingleTraceOutputModifier:

Public Member Functions

 SingleTraceOutputModifier (const std::string &rFilename, unsigned globalIndex, double flushTime=0.0)
 
virtual void InitialiseAtStart (DistributedVectorFactory *pVectorFactory, const std::vector< unsigned > &rNodePermutation)
 
virtual void FinaliseAtEnd ()
 
virtual void ProcessSolutionAtTimeStep (double time, Vec solution, unsigned problemDim)
 
- Public Member Functions inherited from AbstractOutputModifier
 AbstractOutputModifier (const std::string &rFilename, double flushTime=0.0)
 
virtual ~AbstractOutputModifier ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 
 SingleTraceOutputModifier ()
 

Private Attributes

unsigned mGlobalIndex
 
unsigned mLocalIndex
 
out_stream mFileStream
 

Friends

class TestMonodomainProblem
 
class boost::serialization::access
 
class TestOutputModifiers
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractOutputModifier
 AbstractOutputModifier ()
 
- Protected Attributes inherited from AbstractOutputModifier
std::string mFilename
 
double mFlushTime
 

Detailed Description

Provide the trace for a transmembrane potential at a single mode of the mesh. File updated during the simulation.

WARNING: If you checkpoint this class then the file output will not be saved in the checkpoint. The state of the output file will be unchanged (up to the most recent file flush) but may be overwritten by a restarted simulation. You will need to manually move the output file before restarting the simulation and then merge the two files together at a later point.

Definition at line 54 of file SingleTraceOutputModifier.hpp.

Constructor & Destructor Documentation

◆ SingleTraceOutputModifier() [1/2]

SingleTraceOutputModifier::SingleTraceOutputModifier ( )
inlineprivate

Private constructor that resets process-specific data, for archiving

Definition at line 87 of file SingleTraceOutputModifier.hpp.

◆ SingleTraceOutputModifier() [2/2]

SingleTraceOutputModifier::SingleTraceOutputModifier ( const std::string &  rFilename,
unsigned  globalIndex,
double  flushTime = 0.0 
)
inline

Constructor

Parameters
globalIndexThe global index of the node which is to be output. This is the index *in the original mesh*. If you are running in parallel your index in the original mesh will be automatically converted to the runtime index using the node permutation in the mesh. That is, is you ask for node 5 in the original mesh then you will automatically get
unsigned new_index_for_5 = mesh.rGetNodePermutation()[5];
which is the runtime index of the same node in space.
rFilenameThe file which is eventually produced by this modifier
flushTimeThe simulation time between manual file flushes (if required)

Definition at line 109 of file SingleTraceOutputModifier.hpp.

Member Function Documentation

◆ FinaliseAtEnd()

void SingleTraceOutputModifier::FinaliseAtEnd ( )
virtual

Finalise the modifier (close the file)

Implements AbstractOutputModifier.

Definition at line 63 of file SingleTraceOutputModifier.cpp.

References mFileStream, and mLocalIndex.

◆ InitialiseAtStart()

void SingleTraceOutputModifier::InitialiseAtStart ( DistributedVectorFactory pVectorFactory,
const std::vector< unsigned > &  rNodePermutation 
)
virtual

Initialise the modifier (open a file or make some memory) 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. That is, it might have been slicker to pass in the mesh but that would require multiple templates.

Parameters
pVectorFactoryThe vector factory which is associated with the calling problem's mesh
rNodePermutationThe permutation associated with the calling problem's mesh (when running with parallel partitioning)

Implements AbstractOutputModifier.

Definition at line 41 of file SingleTraceOutputModifier.cpp.

References DistributedVectorFactory::GetLow(), HeartConfig::Instance(), DistributedVectorFactory::IsGlobalIndexLocal(), AbstractOutputModifier::mFilename, mFileStream, mGlobalIndex, mLocalIndex, and OutputFileHandler::OpenOutputFile().

◆ ProcessSolutionAtTimeStep()

void SingleTraceOutputModifier::ProcessSolutionAtTimeStep ( double  time,
Vec  solution,
unsigned  problemDim 
)
virtual

Process a solution time-step (dump a small line to file)

Parameters
timeThe current simulation time
solutionA working copy of the solution at the current time-step. This is the PETSc vector which is distributed across the processes.
problemDimThe calling problem dimension. Used here to avoid probing the size of the solution vector

Implements AbstractOutputModifier.

Definition at line 73 of file SingleTraceOutputModifier.cpp.

References mFileStream, AbstractOutputModifier::mFlushTime, and mLocalIndex.

◆ serialize()

template<class Archive >
void SingleTraceOutputModifier::serialize ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

Archive the output modifier, never used directly - boost uses this.

Parameters
archivethe archive
versionthe current version of this class

Definition at line 78 of file SingleTraceOutputModifier.hpp.

References mGlobalIndex.

Friends And Related Symbol Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 60 of file SingleTraceOutputModifier.hpp.

◆ TestMonodomainProblem

friend class TestMonodomainProblem
friend

For testing

Definition at line 58 of file SingleTraceOutputModifier.hpp.

◆ TestOutputModifiers

friend class TestOutputModifiers
friend

Definition at line 69 of file SingleTraceOutputModifier.hpp.

Member Data Documentation

◆ mFileStream

out_stream SingleTraceOutputModifier::mFileStream
private

Output file stream (remains open during solve).

Definition at line 67 of file SingleTraceOutputModifier.hpp.

Referenced by FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().

◆ mGlobalIndex

unsigned SingleTraceOutputModifier::mGlobalIndex
private

The global index of the node for which the trace is to be made. This is the index *in memory at solve time*. If you are running in parallel and you want a specific index/location in your mesh then you will need to look in the mesh permutation.

Definition at line 65 of file SingleTraceOutputModifier.hpp.

Referenced by InitialiseAtStart(), and serialize().

◆ mLocalIndex

unsigned SingleTraceOutputModifier::mLocalIndex
private

The local index of the node for which the trace is to be made - set to UINT_MAX if the node is not local to the process

Definition at line 66 of file SingleTraceOutputModifier.hpp.

Referenced by FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().


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