Documentation 6b54b78464
Loading...
Searching...
No Matches
CFileWriter Class Reference

#include <CFileWriter.hpp>

Inheritance diagram for CFileWriter:
[legend]

Public Member Functions

 CFileWriter (CParallelDataSorter *valDataSorter, string valFileExt)
 Construct a file writer using field names, the data sorter and the file extension.
 
 CFileWriter (string valFileExt)
 Construct a file writer using field names, file extension.
 
virtual ~CFileWriter ()
 Destructor.
 
virtual void WriteData (string val_filename)
 Write sorted data to file.
 
su2double GetBandwidth () const
 Get the bandwith used for the last writing.
 
su2double GetFilesize () const
 Get the filesize of the last written file.
 
su2double GetUsedTime () const
 Get the used time of the last file writing.
 

Protected Member Functions

unsigned long DetermineFilesize (std::string filename)
 Determine the file size.
 
bool WriteMPIBinaryDataAll (const void *data, unsigned long sizeInBytes, unsigned long totalSizeInBytes, unsigned long offset)
 Collectively write a binary data array distributed over all processors to file using MPI I/O.
 
bool WriteMPIBinaryData (const void *data, unsigned long sizeInBytes, unsigned short processor)
 Write a binary data array to a currently opened file using MPI I/O. Note: routine must be called collectively, although only one processor writes its data.
 
bool WriteMPIString (const std::string &str, unsigned short processor)
 Write a string to a currently opened file using MPI I/O. Note: routine must be called collectively, although only one processor writes the string.
 
std::pair< unsigned long, unsigned long > GetRankOffset (unsigned long localCount) const
 Get the position of the data of this rank in an array that holds the data of all ranks in rank order.
 
bool WriteMPIStringAll (const std::string &str)
 Write a string of each rank to the file, one after the other in rank order.
 
bool OpenMPIFile (string val_filename, bool append=false)
 Open a file to write using MPI I/O. Already existing file is deleted.
 
bool CloseMPIFile ()
 Close a file using MPI I/O.
 

Protected Attributes

int rank
 The MPI rank.
 
int size
 The MPI size, aka the number of processors.
 
std::string fileExt
 The file extension to be attached to the filename.
 
su2double startTime
 Start time for time measurement

 
su2double stopTime
 Stop time for time measurement

 
su2double usedTime
 Used time for time measurement

 
su2double bandwidth
 Used bandwidth

 
su2double fileSize
 Size of the last written file

 
CParallelDataSorter * dataSorter
 The parallel data sorter.
 
FILE * fhw
 The file handle for writing.
 

Constructor & Destructor Documentation

◆ CFileWriter() [1/2]

CFileWriter::CFileWriter ( CParallelDataSorter *  valDataSorter,
string  valFileExt 
)

Construct a file writer using field names, the data sorter and the file extension.

Parameters
[in]valDataSorter- The parallel sorted data to write
[in]valFileExt- The file extension.

◆ CFileWriter() [2/2]

CFileWriter::CFileWriter ( string  valFileExt)

Construct a file writer using field names, file extension.

Parameters
[in]valFileExt- The file extension to be attached to the filename

◆ ~CFileWriter()

CFileWriter::~CFileWriter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ CloseMPIFile()

bool CFileWriter::CloseMPIFile ( )
protected

Close a file using MPI I/O.

Returns
Boolean indicating whether the closing was successful.

◆ DetermineFilesize()

unsigned long CFileWriter::DetermineFilesize ( std::string  filename)
inlineprotected

Determine the file size.

Parameters
[in]filename- Name of the file.
Returns

◆ GetBandwidth()

su2double CFileWriter::GetBandwidth ( ) const
inline

Get the bandwith used for the last writing.

◆ GetFilesize()

su2double CFileWriter::GetFilesize ( ) const
inline

Get the filesize of the last written file.

◆ GetRankOffset()

std::pair< unsigned long, unsigned long > CFileWriter::GetRankOffset ( unsigned long  localCount) const
protected

Get the position of the data of this rank in an array that holds the data of all ranks in rank order.

Note
Collective call, all ranks must call it.
Parameters
[in]localCount- The size of the data of this rank.
Returns
The offset of this rank (the size of the data of the ranks before it) and the total size over all ranks.

◆ GetUsedTime()

su2double CFileWriter::GetUsedTime ( ) const
inline

Get the used time of the last file writing.

Returns
The time used to write to file.

◆ OpenMPIFile()

bool CFileWriter::OpenMPIFile ( string  val_filename,
bool  append = false 
)
protected

Open a file to write using MPI I/O. Already existing file is deleted.

Parameters
[in]val_filename- The name of the file
Returns
Boolean indicating whether the opening was successful.

◆ WriteData()

virtual void CFileWriter::WriteData ( string  val_filename)
inlinevirtual

◆ WriteMPIBinaryData()

bool CFileWriter::WriteMPIBinaryData ( const void *  data,
unsigned long  sizeInBytes,
unsigned short  processor 
)
protected

Write a binary data array to a currently opened file using MPI I/O. Note: routine must be called collectively, although only one processor writes its data.

Parameters
[in]data- Pointer to the beginning of the data. Can be NULL for all processors that do not write.
[in]sizeInBytes- The size of the data in bytes.
[in]processor- Rank of the processor that should write its data.
Returns
Boolean indicating whether the writing was successful.

◆ WriteMPIBinaryDataAll()

bool CFileWriter::WriteMPIBinaryDataAll ( const void *  data,
unsigned long  sizeInBytes,
unsigned long  totalSizeInBytes,
unsigned long  offset 
)
protected

Collectively write a binary data array distributed over all processors to file using MPI I/O.

Parameters
[in]data- Pointer to the data to write.
sizeInBytes- The size of the data in bytes on this processor.
totalSizeInBytes- The total size of the array accumulated over all processors.
offset- The offset in bytes of the chunk of data the current processor owns within the global array.
Returns
Boolean indicating whether the writing was successful.

◆ WriteMPIString()

bool CFileWriter::WriteMPIString ( const std::string &  str,
unsigned short  processor 
)
protected

Write a string to a currently opened file using MPI I/O. Note: routine must be called collectively, although only one processor writes the string.

Parameters
[in]str- The string to write to file.
[in]processor- Rank of the processor that should the string.
Returns

◆ WriteMPIStringAll()

bool CFileWriter::WriteMPIStringAll ( const std::string &  str)
protected

Write a string of each rank to the file, one after the other in rank order.

Parameters
[in]str- The string of this rank.
Returns
TRUE if the writing was successful.

Member Data Documentation

◆ bandwidth

su2double CFileWriter::bandwidth
protected

Used bandwidth

◆ dataSorter

CParallelDataSorter* CFileWriter::dataSorter
protected

The parallel data sorter.

◆ fhw

FILE* CFileWriter::fhw
protected

The file handle for writing.

◆ fileExt

std::string CFileWriter::fileExt
protected

The file extension to be attached to the filename.

◆ fileSize

su2double CFileWriter::fileSize
protected

Size of the last written file

◆ rank

int CFileWriter::rank
protected

The MPI rank.

◆ size

int CFileWriter::size
protected

The MPI size, aka the number of processors.

◆ startTime

su2double CFileWriter::startTime
protected

Start time for time measurement

◆ stopTime

su2double CFileWriter::stopTime
protected

Stop time for time measurement

◆ usedTime

su2double CFileWriter::usedTime
protected

Used time for time measurement


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