Loading...
Searching...
No Matches
UPstream::File Class Reference

An opaque wrapper for MPI_File methods without any <mpi.h> header dependency. More...

#include <UPstreamFile.H>

Classes

class  Impl

Public Member Functions

 File (const File &&)=delete
 No copy construct.
 File (File &&) noexcept
 Move construct.
Fileoperator= (const File &)=delete
 No copy assignment.
Fileoperator= (File &&) noexcept
 Move assignment.
 File ()
 Default construct.
 ~File ()
 Destructor. Non-default in header (incomplete types).
const fileNamename () const
 The name of the open stream.
bool is_open () const
 True if allocated and open has been called.
bool open_write (const int communicator, const fileName &pathname, IOstreamOption::atomicType=IOstreamOption::NON_ATOMIC)
 MPI_File_open [collective] : open file in write-only mode, no-append.
bool close ()
 MPI_File_close [collective].
bool set_size (std::streamsize num_bytes)
 Set the (output) file size [collective].
bool write (std::string_view sv)
 MPI_File_write [non-collective] : write data.
template<class Type>
bool write (const Type *buffer, std::streamsize count)
 MPI_File_write [non-collective] : write data.
bool write_at (std::streamsize offset, std::string_view sv)
 MPI_File_write_at [non-collective] : write data at specified offset.
template<class Type>
bool write_at (std::streamsize offset, const Type *buffer, std::streamsize count)
 MPI_File_write_at [non-collective] : write data at specified offset.
bool write_all (std::string_view sv)
 MPI_File_write_all [collective] : write data.
template<class Type>
bool write_all (const Type *buffer, std::streamsize count)
 MPI_File_write_all [collective] : write data.
bool write_at_all (std::streamsize offset, std::string_view sv)
 MPI_File_write_at_all [collective] : write data at specified offset.
template<class Type>
bool write_at_all (std::streamsize offset, const Type *buffer, std::streamsize count)
 MPI_File_write_at_all [collective] : write data at specified offset.

Static Public Member Functions

static bool supported ()
 True if MPI/IO appears to be supported.

Protected Member Functions

bool write_data (const void *buffer, std::streamsize count, const UPstream::dataTypes dataTypeId)
 MPI_File_write [non-collective] : write data.
bool write_data_at (std::streamsize offset, const void *buffer, std::streamsize count, const UPstream::dataTypes dataTypeId)
 MPI_File_write_at [non-collective] : write data at specified offset.
bool write_data_all (const void *buffer, std::streamsize count, const UPstream::dataTypes dataTypeId)
 MPI_File_write_all [collective] : write data.
bool write_data_at_all (std::streamsize offset, const void *buffer, std::streamsize count, const UPstream::dataTypes dataTypeId)
 MPI_File_write_at_all [collective] : write data at specified offset.

Detailed Description

An opaque wrapper for MPI_File methods without any <mpi.h> header dependency.

Note
Not included as part of UPstream.H - only include locally as required
Source files

Definition at line 51 of file UPstreamFile.H.

Constructor & Destructor Documentation

◆ File() [1/3]

File ( const File && )
delete

No copy construct.

References File().

Referenced by File(), File(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ File() [2/3]

File ( File && )
noexcept

Move construct.

References File(), and Foam::noexcept.

Here is the call graph for this function:

◆ File() [3/3]

File ( )

Default construct.

Definition at line 48 of file UPstreamFile.C.

◆ ~File()

~File ( )

Destructor. Non-default in header (incomplete types).

Definition at line 53 of file UPstreamFile.C.

Member Function Documentation

◆ write_data()

bool write_data ( const void * buffer,
std::streamsize count,
const UPstream::dataTypes dataTypeId )
protected

MPI_File_write [non-collective] : write data.

Parameters
bufferSource buffer
countThe data count - number of elements

Definition at line 106 of file UPstreamFile.C.

References NotImplemented.

◆ write_data_at()

bool write_data_at ( std::streamsize offset,
const void * buffer,
std::streamsize count,
const UPstream::dataTypes dataTypeId )
protected

MPI_File_write_at [non-collective] : write data at specified offset.

Parameters
offsetThe offset - number of 'view' elements (default: byte)
bufferSource buffer
countThe data count - number of elements

Definition at line 118 of file UPstreamFile.C.

References NotImplemented.

◆ write_data_all()

bool write_data_all ( const void * buffer,
std::streamsize count,
const UPstream::dataTypes dataTypeId )
protected

MPI_File_write_all [collective] : write data.

Parameters
bufferSource buffer
countThe data count - number of elements

Definition at line 131 of file UPstreamFile.C.

References NotImplemented.

◆ write_data_at_all()

bool write_data_at_all ( std::streamsize offset,
const void * buffer,
std::streamsize count,
const UPstream::dataTypes dataTypeId )
protected

MPI_File_write_at_all [collective] : write data at specified offset.

Parameters
offsetThe offset - number of 'view' elements (default: byte)
bufferSource buffer
countThe data count - number of elements

Definition at line 143 of file UPstreamFile.C.

References NotImplemented.

◆ operator=() [1/2]

File & operator= ( const File & )
delete

No copy assignment.

References File().

Here is the call graph for this function:

◆ operator=() [2/2]

File & operator= ( File && )
noexcept

Move assignment.

References close(), File(), is_open(), name(), Foam::noexcept, open_write(), set_size(), and supported().

Here is the call graph for this function:

◆ supported()

bool supported ( )
static

True if MPI/IO appears to be supported.

Definition at line 40 of file UPstreamFile.C.

Referenced by operator=(), collatedFileOperation::printBanner(), and collatedFileOperation::writeObject().

Here is the caller graph for this function:

◆ name()

const Foam::fileName & name ( ) const

The name of the open stream.

Definition at line 59 of file UPstreamFile.C.

References fileName::null.

Referenced by operator=().

Here is the caller graph for this function:

◆ is_open()

bool is_open ( ) const

True if allocated and open has been called.

Definition at line 65 of file UPstreamFile.C.

Referenced by operator=().

Here is the caller graph for this function:

◆ open_write()

bool open_write ( const int communicator,
const fileName & pathname,
IOstreamOption::atomicType atomicType = IOstreamOption::NON_ATOMIC )

MPI_File_open [collective] : open file in write-only mode, no-append.

Parameters
communicatorThe OpenFOAM communicator index
pathnameFull file path (parent directory must exist before calling)
atomicTypeSimulated atomic file handling

Definition at line 94 of file UPstreamFile.C.

References NotImplemented.

Referenced by operator=().

Here is the caller graph for this function:

◆ close()

bool close ( )

MPI_File_close [collective].

Definition at line 71 of file UPstreamFile.C.

Referenced by operator=().

Here is the caller graph for this function:

◆ set_size()

bool set_size ( std::streamsize num_bytes)

Set the (output) file size [collective].

Definition at line 156 of file UPstreamFile.C.

References NotImplemented.

Referenced by operator=().

Here is the caller graph for this function:

◆ write() [1/2]

bool write ( std::string_view sv)
inline

MPI_File_write [non-collective] : write data.

A no-op and return true if content is empty

References write().

Referenced by write(), and write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [2/2]

template<class Type>
bool write ( const Type * buffer,
std::streamsize count )
inline

MPI_File_write [non-collective] : write data.

A no-op and return true if buffer is nullptr or count is zero

Parameters
bufferThe content
countThe data count - number of elements

References write().

Here is the call graph for this function:

◆ write_at() [1/2]

bool write_at ( std::streamsize offset,
std::string_view sv )
inline

MPI_File_write_at [non-collective] : write data at specified offset.

A no-op and return true if content is empty

References write_at().

Referenced by write_at(), and write_at().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_at() [2/2]

template<class Type>
bool write_at ( std::streamsize offset,
const Type * buffer,
std::streamsize count )
inline

MPI_File_write_at [non-collective] : write data at specified offset.

A no-op and return true if buffer is nullptr or count is zero

Parameters
offsetThe offset within the file - number of 'view' elements
bufferThe content
countThe data count - number of elements

References write_at().

Here is the call graph for this function:

◆ write_all() [1/2]

bool write_all ( std::string_view sv)
inline

MPI_File_write_all [collective] : write data.

References write_all().

Referenced by write_all(), and write_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_all() [2/2]

template<class Type>
bool write_all ( const Type * buffer,
std::streamsize count )
inline

MPI_File_write_all [collective] : write data.

Parameters
bufferThe content
countThe data count - number of elements

References write_all().

Here is the call graph for this function:

◆ write_at_all() [1/2]

bool write_at_all ( std::streamsize offset,
std::string_view sv )
inline

MPI_File_write_at_all [collective] : write data at specified offset.

Parameters
offsetThe offset within the file - number of 'view' elements
svThe content

References write_at_all().

Referenced by write_at_all(), and write_at_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_at_all() [2/2]

template<class Type>
bool write_at_all ( std::streamsize offset,
const Type * buffer,
std::streamsize count )
inline

MPI_File_write_at_all [collective] : write data at specified offset.

Parameters
offsetThe offset within the file - number of 'view' elements
bufferThe content
countThe data count - number of elements

References write_at_all().

Here is the call graph for this function:

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