Chaste  Release::3.4
AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE > Class Template Referenceabstract

#include <AbstractPerElementWriter.hpp>

+ Inheritance diagram for AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >:
+ Collaboration diagram for AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >:

Public Member Functions

 AbstractPerElementWriter (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 
void WriteData (OutputFileHandler &rHandler, const std::string &rFileName)
 
void SetWriteFileAsBinary (bool binary=true)
 
virtual ~AbstractPerElementWriter ()
 

Protected Member Functions

virtual void Visit (Element< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned localElementIndex, c_vector< double, DATA_SIZE > &rData)=0
 
virtual void WriteElementOnMaster (const c_vector< double, DATA_SIZE > &rData)
 
virtual void WriteHeaderOnMaster ()
 
virtual void PreWriteCalculations (OutputFileHandler &rOutputDirectory)
 

Protected Attributes

AbstractTetrahedralMesh
< ELEMENT_DIM, SPACE_DIM > * 
mpMesh
 
out_stream mpMasterFile
 

Private Attributes

bool mFileIsBinary
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
class AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >

An abstract writer class for writing stuff on a "per element" basis. This class will "visit" all the locally owned elements and concentrate data back to the master.

Definition at line 49 of file AbstractPerElementWriter.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::AbstractPerElementWriter ( AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *  pMesh)
inline

Constructor

Parameters
pMeshThe mesh whose elements we are going to write out data for.

Definition at line 130 of file AbstractPerElementWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
virtual AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::~AbstractPerElementWriter ( )
inlinevirtual

Empty virtual destructor for abstract class

Definition at line 243 of file AbstractPerElementWriter.hpp.

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
virtual void AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::PreWriteCalculations ( OutputFileHandler rOutputDirectory)
inlineprotectedvirtual

Method that can be overridden to do any pre-calculations necessary to write out data.

Parameters
rOutputDirectoryThe folder data is going to be written into (mostly for debugging to be written into).

Reimplemented in StreeterFibreGenerator< SPACE_DIM >.

Definition at line 119 of file AbstractPerElementWriter.hpp.

Referenced by AbstractPerElementWriter< SPACE_DIM, SPACE_DIM, SPACE_DIM *SPACE_DIM >::WriteData().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
void AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::SetWriteFileAsBinary ( bool  binary = true)
inline

Switch to write binary fibre file

(set to write ascii files in the constructor)

Parameters
binaryWhether to write as binary (defaults to true).

Definition at line 235 of file AbstractPerElementWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
virtual void AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::Visit ( Element< ELEMENT_DIM, SPACE_DIM > *  pElement,
unsigned  localElementIndex,
c_vector< double, DATA_SIZE > &  rData 
)
protectedpure virtual

How to associate an element with some data Must be over-ridden by the derived class.

Parameters
pElementa locally-owned element for which to calculate or lookup some data
localElementIndexthe index of pElement in the local vector. Used in subclasses which look up data from a separate structure ordered by local indices
rDatathe double-precision data to write to file (output from the method)

Referenced by AbstractPerElementWriter< SPACE_DIM, SPACE_DIM, SPACE_DIM *SPACE_DIM >::WriteData().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
void AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData ( OutputFileHandler rHandler,
const std::string &  rFileName 
)
inline

Writes data about each element in parallel Data about each element is retrieved by the Visit() method. Writing is done by the master process using the WriteElement() method. Any element not owned by the master is communicated by the unique designated owner.

MUST BE CALLED IN PARALLEL.

Parameters
rHandlerspecify the directory in which to place the output file
rFileNamethe file name
Todo:
See if this can be speeded up with #2351.

Definition at line 149 of file AbstractPerElementWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
virtual void AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteElementOnMaster ( const c_vector< double, DATA_SIZE > &  rData)
inlineprotectedvirtual

How to write an element's worth of data to the file. By default writes tab-separated data to a single line, but can be over-ridden. This is only called by the master process.

Parameters
rDatathe double-precision data to write to file

Definition at line 85 of file AbstractPerElementWriter.hpp.

Referenced by AbstractPerElementWriter< SPACE_DIM, SPACE_DIM, SPACE_DIM *SPACE_DIM >::WriteData().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
virtual void AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteHeaderOnMaster ( )
inlineprotectedvirtual

How to write the header information to the file. By default writes nothing. This is only called by the master process. This should NOT end the line (eg:
or std::endl) as we need to say whether the file is binary or not.

Reimplemented in StreeterFibreGenerator< SPACE_DIM >.

Definition at line 109 of file AbstractPerElementWriter.hpp.

Referenced by AbstractPerElementWriter< SPACE_DIM, SPACE_DIM, SPACE_DIM *SPACE_DIM >::WriteData().

Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
bool AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mFileIsBinary
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
out_stream AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mpMasterFile
protected

The output file (only valid on master process). Set by the public method WriteData and used by WriteElementOnMaster

Definition at line 64 of file AbstractPerElementWriter.hpp.

Referenced by AbstractPerElementWriter< SPACE_DIM, SPACE_DIM, SPACE_DIM *SPACE_DIM >::WriteData(), and AbstractPerElementWriter< SPACE_DIM, SPACE_DIM, SPACE_DIM *SPACE_DIM >::WriteElementOnMaster().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned DATA_SIZE>
AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>* AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mpMesh
protected

The mesh. Set by the constructor.

Definition at line 58 of file AbstractPerElementWriter.hpp.

Referenced by AbstractPerElementWriter< SPACE_DIM, SPACE_DIM, SPACE_DIM *SPACE_DIM >::WriteData().


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