![]() |
Chaste Commit::333233612e3dcc941d260418acd7b5ccdc30390e
|
#include <AbstractPerElementWriter.hpp>
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 |
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.
|
inline |
Constructor
pMesh | The mesh whose elements we are going to write out data for. |
Definition at line 130 of file AbstractPerElementWriter.hpp.
|
inlinevirtual |
Empty virtual destructor for abstract class
Definition at line 243 of file AbstractPerElementWriter.hpp.
|
inlineprotectedvirtual |
Method that can be overridden to do any pre-calculations necessary to write out data.
rOutputDirectory | The 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< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData().
|
inline |
Switch to write binary fibre file
(set to write ascii files in the constructor)
binary | Whether to write as binary (defaults to true). |
Definition at line 235 of file AbstractPerElementWriter.hpp.
References AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mFileIsBinary.
|
protectedpure virtual |
How to associate an element with some data Must be over-ridden by the derived class.
pElement | a locally-owned element for which to calculate or lookup some data |
localElementIndex | the index of pElement in the local vector. Used in subclasses which look up data from a separate structure ordered by local indices |
rData | the double-precision data to write to file (output from the method) |
Referenced by AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData().
|
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.
rHandler | specify the directory in which to place the output file |
rFileName | the file name |
Definition at line 149 of file AbstractPerElementWriter.hpp.
References PetscTools::AmMaster(), ChasteBuildInfo::GetProvenanceString(), AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mFileIsBinary, AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mpMasterFile, AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mpMesh, OutputFileHandler::OpenOutputFile(), AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::PreWriteCalculations(), AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::Visit(), AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteElementOnMaster(), and AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteHeaderOnMaster().
Referenced by AbstractNonlinearElasticitySolver< DIM >::WriteCurrentAverageElementStresses().
|
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.
rData | the double-precision data to write to file |
Definition at line 85 of file AbstractPerElementWriter.hpp.
References AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mFileIsBinary, and AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::mpMasterFile.
Referenced by AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData().
|
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< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData().
|
private |
Whether all data is to be written as binary
Definition at line 52 of file AbstractPerElementWriter.hpp.
Referenced by AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::SetWriteFileAsBinary(), AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData(), and AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteElementOnMaster().
|
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< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData(), and AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteElementOnMaster().
|
protected |
The mesh. Set by the constructor.
Definition at line 58 of file AbstractPerElementWriter.hpp.
Referenced by AbstractPerElementWriter< ELEMENT_DIM, SPACE_DIM, DATA_SIZE >::WriteData().