Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
PostProcessingWriter< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <PostProcessingWriter.hpp>

+ Collaboration diagram for PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

 PostProcessingWriter (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, const FileFinder &rDirectory, const std::string &rHdf5FileName, const std::string &rVoltageName="V", hsize_t hdf5DataWriterChunkSize=0)
 
void WritePostProcessingFiles ()
 
 ~PostProcessingWriter ()
 
void WriteAboveThresholdDepolarisationFile (double threshold)
 

Private Member Functions

void WriteVariablesOverTimeAtNodes (std::vector< unsigned > &rNodeIndices)
 
void WriteApdMapFile (double repolarisationPercentage, double threshold)
 
void WriteUpstrokeTimeMap (double threshold)
 
void WriteMaxUpstrokeVelocityMap (double threshold)
 
void WriteConductionVelocityMap (unsigned originNode, std::vector< double > distancesFromOriginNode)
 
void WriteGenericFileToMeshalyzer (std::vector< std::vector< double > > &rDataPayload, const std::string &rFolder, const std::string &rFileName)
 
void WriteOutputDataToHdf5 (const std::vector< std::vector< double > > &rDataPayload, const std::string &rDatasetName, const std::string &rDatasetUnit, const std::string &rUnlimitedVariableName="PaceNumber", const std::string &rUnlimitedVariableUnit="dimensionless")
 
std::string ConvertToHdf5FriendlyString (double threshold)
 

Private Attributes

FileFinder mDirectory
 
std::string mHdf5File
 
std::string mVoltageName
 
Hdf5DataReadermpDataReader
 
PropagationPropertiesCalculatormpCalculator
 
unsigned mLo
 
unsigned mHi
 
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & mrMesh
 
hsize_t mHdf5DataWriterChunkSize
 

Friends

class TestPostProcessingWriter
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >

Write out physiological parameters at the end of a simulation

  • APD map
  • Upstroke time map
  • Upstroke Velocity map
  • Conduction Velocity map

N.B. You should only ever have one PostProcessingWriter around at once, as multiple Hdf5Readers (a member variable of this class) seem to cause problems.

Definition at line 57 of file PostProcessingWriter.hpp.

Constructor & Destructor Documentation

◆ PostProcessingWriter()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter ( AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh,
const FileFinder rDirectory,
const std::string &  rHdf5FileName,
const std::string &  rVoltageName = "V",
hsize_t  hdf5DataWriterChunkSize = 0 
)

Constructor

Parameters
rMeshA reference to the mesh used to calculate the distance map to pass to the conduction velocity calculator.
rDirectoryThe directory the data is in. The output is written to <directory>/output
rHdf5FileNameThe file the data is in.
rVoltageName(Optional) The name of the variable representing the membrane potential. It is used in the creation of the PropagationPropertiesCalculator object. Defaults to "V".
hdf5DataWriterChunkSize(Optional) Chunk size and alignment parameter to pass to Hdf5DataWriter

Definition at line 52 of file PostProcessingWriter.cpp.

References Hdf5DataReader::GetNumberOfRows(), PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mDirectory, PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mHdf5File, PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mHi, PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mLo, PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mpCalculator, PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mpDataReader, PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mrMesh, and PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mVoltageName.

◆ ~PostProcessingWriter()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::~PostProcessingWriter ( )

Destructor

Definition at line 160 of file PostProcessingWriter.cpp.

Member Function Documentation

◆ ConvertToHdf5FriendlyString()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::ConvertToHdf5FriendlyString ( double  threshold)
private

Convert a string with numbers in it into alphanumeric plus underscores.

e.g. 20 -> "_20" -20 -> "_minus_20" 30.2 -> "_30pt20" -11.238 -> "_minus_11pt23" (always does decimals to (floor) 2d.p.)

Parameters
thresholdA numerical threshold which may contain minuses or a decimal point.
Returns
A string version of the number without minuses or decimal points.

Definition at line 394 of file PostProcessingWriter.cpp.

◆ WriteAboveThresholdDepolarisationFile()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteAboveThresholdDepolarisationFile ( double  threshold)

Method for opening a file and writing one row per node: line 1: <number of upstrokes for node 0> <number of above-threshold depolarisations for node 0> line 2: <number of upstrokes for node 1> <number of above-threshold depolarisations for node 1> etc.

For the nodes where the threshold isn't crossed, the 'number of upstrokes' will be 0 (so will the number of above-threshold depolarisations for that node)

Todo:
This method ought to be private and called by the WritePostProcessingFiles method if the user requests for it. This will be possible after modifying the schema and specifying Get and Set methods in HeartConfig to check whether the user wants this file or not
Parameters
threshold- used to signify the upstroke (mV) AND to specify above which voltage value the depolarisations are counted

Definition at line 340 of file PostProcessingWriter.cpp.

◆ WriteApdMapFile()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteApdMapFile ( double  repolarisationPercentage,
double  threshold 
)
private

Method for opening an APD map file and writing one row per node line 1: <first APD for node 0> <second APD for node 0> ... line 2: <first APD for node 1> <second APD for node 1> ... etc.

Nodes where there is no APD are respresented by a single 0

Parameters
repolarisationPercentageeg. 90.0 for APD90
threshold- Vm used to signify the upstroke (mV)

Definition at line 248 of file PostProcessingWriter.cpp.

◆ WriteConductionVelocityMap()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteConductionVelocityMap ( unsigned  originNode,
std::vector< double distancesFromOriginNode 
)
private

Write out conduction velocity map from the given node the rest of the mesh:

line 1: <conduction velocity for node 0 and AP 0> <conduction velocity for node 0 and AP 1> ... line 2: <conduction velocity for node 1 and AP 0> <conduction velocity for node 1 and AP 1> ... etc.

Note: the line corresponding to node number originNode will contain ...

Parameters
originNode- Node to compute the conduction velocity from
distancesFromOriginNode- Distance map from originNode to all the nodes in the simulation. Typically calculated with DistanceMapCalculator

Definition at line 314 of file PostProcessingWriter.cpp.

◆ WriteGenericFileToMeshalyzer()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteGenericFileToMeshalyzer ( std::vector< std::vector< double > > &  rDataPayload,
const std::string &  rFolder,
const std::string &  rFileName 
)
private

Method for opening a file and writing one row per node line 1: <first scalar data for node 0> <second scalar data for node 0> ... line 2: <first scalar data for node 1> <second scalar data for node 1> ... etc.

Parameters
rDataPayloadvector data for each node. Each node's data are represented by a vector of scalars (variable length)
rFoldersubfolder for postprocessing in which to put the data.
rFileNamewhere to put the data.

Definition at line 466 of file PostProcessingWriter.cpp.

References PetscTools::AmMaster(), PetscTools::AmTopMost(), PetscTools::BeginRoundRobin(), PetscTools::EndRoundRobin(), ChasteBuildInfo::GetProvenanceString(), HeartConfig::Instance(), and OutputFileHandler::OpenOutputFile().

◆ WriteMaxUpstrokeVelocityMap()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteMaxUpstrokeVelocityMap ( double  threshold)
private

Write out velocities of each max upstroke for each node:

line 1: <first upstroke velocity for node 0> <second upstroke velocity for node 0> ... line 2: <first upstroke velocity for node 1> <second upstroke velocity for node 1> ... etc.

If there is no upstroke then there will a blank line

Parameters
threshold- Vm used to signify the upstroke (mV)

Definition at line 288 of file PostProcessingWriter.cpp.

◆ WriteOutputDataToHdf5()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteOutputDataToHdf5 ( const std::vector< std::vector< double > > &  rDataPayload,
const std::string &  rDatasetName,
const std::string &  rDatasetUnit,
const std::string &  rUnlimitedVariableName = "PaceNumber",
const std::string &  rUnlimitedVariableUnit = "dimensionless" 
)
private

Put the post-processed data into the main HDF5 results file.

Parameters
rDataPayloadThe postprocessed quantities
rDatasetNameThe name of the quantities
rDatasetUnitThe unit of the quantities
rUnlimitedVariableNameThe name of the unlimited variable (defaults to "PaceNumber")
rUnlimitedVariableUnitThe unlimited variable units (defaults to "dimensionless")

Definition at line 167 of file PostProcessingWriter.cpp.

References Hdf5DataWriter::AdvanceAlongUnlimitedDimension(), DistributedVector::Begin(), RelativeTo::ChasteTestOutput, Hdf5DataWriter::Close(), DistributedVectorFactory::CreateDistributedVector(), DistributedVectorFactory::CreateVec(), Hdf5DataWriter::DefineFixedDimension(), Hdf5DataWriter::DefineUnlimitedDimension(), Hdf5DataWriter::DefineVariable(), PetscTools::Destroy(), Hdf5DataWriter::EmptyDataset(), DistributedVector::End(), Hdf5DataWriter::EndDefineMode(), Hdf5DataWriter::GetVariableByName(), Hdf5DataWriter::IsInDefineMode(), Hdf5DataWriter::PutUnlimitedVariable(), Hdf5DataWriter::PutVector(), and Hdf5DataWriter::SetTargetChunkSize().

◆ WritePostProcessingFiles()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WritePostProcessingFiles ( )

◆ WriteUpstrokeTimeMap()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteUpstrokeTimeMap ( double  threshold)
private

Write out times of each upstroke for each node:

line 1: <first upstroke time for node 0> <second upstroke time for node 0> ... line 2: <first upstroke time for node 1> <second upstroke time for node 1> ... etc.

If there is no upstroke then there will a blank line

Parameters
threshold- Vm used to signify the upstroke (mV)

Definition at line 262 of file PostProcessingWriter.cpp.

◆ WriteVariablesOverTimeAtNodes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteVariablesOverTimeAtNodes ( std::vector< unsigned > &  rNodeIndices)
private

Method that extrapolates the output variables over time at specified nodes and output all to file. The use of this method is intended as follows: the user supplies a list of node indices (rNodeIndices). This method outputs the time series at each node in rNodeIndices (one time series per column). The node numbering is referred to the original mesh.

Regardless of the permutation that was used in the simulation, this method will have the same output.

There will be one file per variable contained in the hdf5 file. For each file, the name will be NodalTraces_VARIABLENAME.dat. So for example, in a bidomain simulation with default variable names, output files will be:

NodalTraces_V.dat NodalTraces_Phi_e.dat

Each output file will look like (taking variable V as an example):

Line 1: <V at time 0, Node 0> <V at time 0, Node 1> <V at time 0, Node 2> etc... Line 2: <V at time 1, Node 0> <V at time 1, Node 1> <V at time 1, Node 2> etc... etc...

where Node 0, Node 1, Node 2 are the nodes included in the rIndices vector and "V" is the name of the variable.

Parameters
rNodeIndicesthe node indices (in the unpermuted mesh) that we want the output for.

Definition at line 419 of file PostProcessingWriter.cpp.

References PetscTools::AmMaster(), HeartConfig::GetOutputUsingOriginalNodeOrdering(), and HeartConfig::Instance().

Friends And Related Symbol Documentation

◆ TestPostProcessingWriter

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class TestPostProcessingWriter
friend

Definition at line 59 of file PostProcessingWriter.hpp.

Member Data Documentation

◆ mDirectory

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
FileFinder PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mDirectory
private

The directory the HDF5 file is in

Definition at line 62 of file PostProcessingWriter.hpp.

Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter().

◆ mHdf5DataWriterChunkSize

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
hsize_t PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mHdf5DataWriterChunkSize
private

Chunk size parameter for Hdf5DataWriter

Definition at line 71 of file PostProcessingWriter.hpp.

◆ mHdf5File

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mHdf5File
private

The name of the HDF5 file to post-process

Definition at line 63 of file PostProcessingWriter.hpp.

Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter().

◆ mHi

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mHi
private

Cache of mHi from the mesh DitributedVectorFactory

Definition at line 69 of file PostProcessingWriter.hpp.

Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter().

◆ mLo

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mLo
private

Cache of mLo from the mesh DitributedVectorFactory

Definition at line 68 of file PostProcessingWriter.hpp.

Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter().

◆ mpCalculator

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
PropagationPropertiesCalculator* PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mpCalculator
private

◆ mpDataReader

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
Hdf5DataReader* PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mpDataReader
private

An HDF5 reader from which to build the PropagationPropertiesCalculator

Definition at line 66 of file PostProcessingWriter.hpp.

Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter().

◆ mrMesh

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>& PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mrMesh
private

A mesh used to calculate the distance map to pass to the conduction velocity calculator

Definition at line 70 of file PostProcessingWriter.hpp.

Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter().

◆ mVoltageName

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::mVoltageName
private

The name of the variable representing the membrane potential

Definition at line 64 of file PostProcessingWriter.hpp.

Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter().


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