Chaste  Release::3.4
Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <Hdf5ToCmguiConverter.hpp>

+ Inheritance diagram for Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >:
+ Collaboration diagram for Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

 Hdf5ToCmguiConverter (const FileFinder &rInputDirectory, const std::string &rFileBaseName, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, bool hasBath=false, unsigned precision=0u)
 
- Public Member Functions inherited from AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >
 AbstractHdf5Converter (const FileFinder &rInputDirectory, const std::string &rFileBaseName, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, const std::string &rSubdirectoryName, unsigned precision)
 
void WriteInfoFile ()
 
 ~AbstractHdf5Converter ()
 
std::string GetSubdirectory ()
 

Private Member Functions

void Write (std::string type)
 
void WriteCmguiScript ()
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >
bool MoveOntoNextDataset ()
 
- Protected Attributes inherited from AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >
const FileFindermrH5Folder
 
boost::shared_ptr< Hdf5DataReadermpReader
 
unsigned mNumVariables
 
std::string mFileBaseName
 
std::vector< std::string > mDatasetNames
 
unsigned mOpenDatasetIndex
 
AbstractTetrahedralMesh
< ELEMENT_DIM, SPACE_DIM > * 
mpMesh
 
OutputFileHandlermpOutputFileHandler
 
std::string mRelativeSubdirectory
 
unsigned mPrecision
 

Detailed Description

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

This class converts from Hdf5 format to Cmgui format. The output will be one .exnode file per time step. The format that cmgui accepts is (after the headers):

Node: 1 Value_at_node_1 Node:2 Value_at_node_2 .....

For bidomain simulations, we will have two fields, one for Vm and one for Phie. The Cmgui format for two fields is as follows:

Node: 1 Vm_node_1 Phie_at_node_1 Node:2 Vm_at_node_2 Phie_at_node_2 .....

Definition at line 64 of file Hdf5ToCmguiConverter.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToCmguiConverter ( const FileFinder rInputDirectory,
const std::string &  rFileBaseName,
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *  pMesh,
bool  hasBath = false,
unsigned  precision = 0u 
)

Constructor, which does the conversion.

Note
This method is collective, and hence must be called by all processes.
Parameters
rInputDirectoryThe input directory, relative to CHASTE_TEST_OUTPUT, where the .h5 file has been written
rFileBaseNameThe base name of the data file.
pMeshPointer to the mesh.
hasBathwhether the mesh has a bath or not. Defaults to false.
precisionThe number of digits to use when printing to file (0u = default).
Todo:
#1660 at present this converter is hardcoded to work with "Data" using the below statement
Todo:
What if the mesh has been scaled, translated or rotated?

Definition at line 136 of file Hdf5ToCmguiConverter.cpp.

References PetscTools::Barrier(), HeartConfig::GetOutputDirectory(), HeartConfig::Instance(), AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::mDatasetNames, AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::mOpenDatasetIndex, AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::MoveOntoNextDataset(), AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::mpMesh, AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::mpReader, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetAdditionalFieldNames(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetRegionNames(), UNUSED_OPT, Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Write(), Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::WriteCmguiScript(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh(), and AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMeshReader().

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Write ( std::string  type)
private

A helper method which takes in a string, which must be 'Mono' or 'Bi' and reads the data from the hdf5 file, writing it out in Cmgui format.

Parameters
typethe type of simulation (Mono or Bi)

Definition at line 49 of file Hdf5ToCmguiConverter.cpp.

References PetscTools::AmMaster(), DistributedVectorFactory::CreateVec(), PetscTools::Destroy(), ChasteBuildInfo::GetProvenanceString(), and ReplicatableVector::GetSize().

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::WriteCmguiScript ( )
private

Writes a basic script for visualization of mesh and data.

It loads the nodes and elements. It also asks cmgui to create faces and lines (because our output files don't have the information). Data are loaded by means of a 'for' loop.

After loading the script, nodes (seen as small dots) and lines connecting them will be displayed. Both nodes and lines will be coloured according to the first variable in the Hdf5 file (usually Vm). The Cmgui default spectrum (0 to 1, blue to red) is used. This can be changed by clicking on 'graphics->spectrum editor'. Other manual modification can be made by clicking on 'graphics->scene editor'.

Definition at line 191 of file Hdf5ToCmguiConverter.cpp.

References PetscTools::AmMaster(), HeartConfig::GetOutputFilenamePrefix(), ChasteBuildInfo::GetProvenanceString(), and HeartConfig::Instance().

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


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