Chaste  Release::2017.1
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)
 
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::SingleTraceOutputModifier ( )
inlineprivate

Private constructor that resets process-specific data, for archiving

Definition at line 87 of file SingleTraceOutputModifier.hpp.

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 (assumes no permutation). This is the index *in memory at solve time*. If you are running in parallel and you want a specific location or index in your mesh then you will need to look in the mesh for node or permutation.
ChastePoint<1> point(0.05);
unsigned new_index_for_5 = mesh.GetNearestNodeIndex(point);
SingleTraceOutputModifier("trace_5.txt", new_index_for_5));
or
unsigned new_index_for_5 = mesh.rGetNodePermutation()[5];
SingleTraceOutputModifier("trace_5.txt", new_index_for_5));
rFilenameThe file which is eventually produced by this modifier
flushTimeThe simulation time between manual file flushes (if required)

Definition at line 114 of file SingleTraceOutputModifier.hpp.

References CHASTE_CLASS_EXPORT, FinaliseAtEnd(), InitialiseAtStart(), and ProcessSolutionAtTimeStep().

Member Function Documentation

void SingleTraceOutputModifier::FinaliseAtEnd ( )
virtual

Finalise the modifier (close the file)

Implements AbstractOutputModifier.

Definition at line 57 of file SingleTraceOutputModifier.cpp.

References mFileStream, and mLocalIndex.

Referenced by SingleTraceOutputModifier().

void SingleTraceOutputModifier::InitialiseAtStart ( DistributedVectorFactory pVectorFactory)
virtual

Initialise the modifier (open the file) 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.

Parameters
pVectorFactoryThe vector factory which is associated with the calling problem's mesh

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().

Referenced by SingleTraceOutputModifier().

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 67 of file SingleTraceOutputModifier.cpp.

References CHASTE_CLASS_EXPORT, Divides(), mFileStream, AbstractOutputModifier::mFlushTime, and mLocalIndex.

Referenced by SingleTraceOutputModifier().

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 Function Documentation

friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 60 of file SingleTraceOutputModifier.hpp.

friend class TestMonodomainProblem
friend

For testing

Definition at line 58 of file SingleTraceOutputModifier.hpp.

Member Data Documentation

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().

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().

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: