This class encapsulates writing to nfiles. More...
#include <AMReX_NFiles.H>
Public Member Functions | |
| NFilesIter (int noutfiles, std::string fileprefix, bool groupsets, bool setBuf) | |
| the nfiles will be named "filePrefix" + "00000" through "filePrefix" + "noutfiles-1" the range [1, nProcs] for noutfiles is enforced | |
| void | SetDynamic (int deciderproc=-1) |
| call this to use dynamic set selection deciderproc defaults to nprocs - 1 if < 0 | |
| bool | GetDynamic () const |
| void | SetSparseFPP (const Vector< int > &ranksToWrite) |
| call this to use a file per process for a sparse set of writers. ranksToWrite.size() will set noutfiles rank ranksToWrite[n] will write to file_rank | |
| bool | GetSparseFPP () const |
| NFilesIter (std::string fileName, Vector< int > readRanks, bool setBuf=false) | |
| constructor for reading | |
| ~NFilesIter () | |
| NFilesIter (NFilesIter const &)=delete | |
| NFilesIter (NFilesIter &&)=delete | |
| NFilesIter & | operator= (NFilesIter const &)=delete |
| NFilesIter & | operator= (NFilesIter &&)=delete |
| bool | ReadyToWrite (bool appendFirst=false) |
| if appendFirst is true, the first set for this iterator will open the files in append mode | |
| bool | ReadyToRead () |
| NFilesIter & | operator++ () |
| std::fstream & | Stream () |
| std::streampos | SeekPos () |
| get the current Stream()'s seek position | |
| const std::string & | FileName () const |
| int | FileNumber () const |
| int | CoordinatorProc () const |
| this is the processor coordinating dynamic set selection | |
| Vector< int > | FileNumbersWritten () |
| these are the file numbers to which each rank wrote [rank] a rank only writes to one file | |
| const Vector< Vector< int > > & | FileNumbersWriteOrder () const |
| these are the order of ranks which wrote to each file [filenumber][ranks in order they wrote to filenumber] | |
| void | CleanUpMessages () |
Static Public Member Functions | |
| static int | LengthOfSet (int nProcs, int nOutFiles) |
| static int | WhichSetPosition (int whichproc, int nprocs, int noutfiles, bool groupsets) |
| static int | ActualNFiles (int nOutFiles) |
| this returns the actual number of files used the range [1, nProcs] is enforced | |
| static bool | CheckNFiles (int nProcs, int nOutFiles, bool groupSets) |
| this checks if nOutFiles equals the calculated number of files returns false if they do not match | |
| static int | FileNumber (int nOutFiles, int whichProc, bool groupSets) |
| static std::string | FileName (int nOutFiles, const std::string &filePrefix, int whichProc, bool groupSets) |
| static std::string | FileName (int fileNumber, const std::string &filePrefix) |
| static int | GetMinDigits () |
| static void | SetMinDigits (int md) |
Private Attributes | |
| int | myProc = -1 |
| int | nProcs = -1 |
| int | nOutFiles = -1 |
| int | nSets = -1 |
| bool | groupSets = false |
| int | mySetPosition = -1 |
| int | fileNumber = -1 |
| std::string | filePrefix |
| std::string | fullFileName |
| VisMFBuffer::IO_Buffer | io_buffer |
| std::fstream | fileStream |
| bool | finishedWriting = false |
| bool | isReading = false |
| bool | finishedReading = false |
| Vector< int > | readRanks |
| Vector< Vector< int > > | fileNumbersWriteOrder |
| [filenumber][ranks in order they wrote to filenumber] | |
| int | myReadIndex = -1 |
| bool | useStaticSetSelection = true |
| int | remainingWriters = -1 |
| int | deciderProc =-1 |
| int | coordinatorProc = -1 |
| int | deciderTag = -1 |
| int | coordinatorTag = -1 |
| int | doneTag = -1 |
| int | writeTag =-1 |
| int | stWriteTag = -1 |
| int | stReadTag = -1 |
| Vector< int > | availableDeciders |
| Vector< int > | setZeroProcs |
| bool | useSparseFPP = false |
| Vector< int > | sparseWritingRanks |
| int | mySparseFileNumber = -1 |
| Vector< std::pair< int, int > > | unreadMessages |
| these were ignored by the decider procs and need to be cleaned up | |
Static Private Attributes | |
| static int | currentDeciderIndex |
| static const int | indexUndefined = -1 |
| static int | minDigits |
| for Concatenate | |
This class encapsulates writing to nfiles.
an example:
for(NFilesIter nfi(nOutFiles, filePrefix); nfi.ReadyToWrite(); ++nfi) { // do your writing here nfi.Stream().write((const char *) data.dataPtr(), nChars); }
| amrex::NFilesIter::NFilesIter | ( | int | noutfiles, |
| std::string | fileprefix, | ||
| bool | groupsets, | ||
| bool | setBuf | ||
| ) |
the nfiles will be named "filePrefix" + "00000" through "filePrefix" + "noutfiles-1" the range [1, nProcs] for noutfiles is enforced
constructor for writing with static set selection
| noutfiles | |
| &fileprefix | |
| groupsets | |
| setBuf |
| amrex::NFilesIter::NFilesIter | ( | std::string | fileName, |
| Vector< int > | readRanks, | ||
| bool | setBuf = false |
||
| ) |
constructor for reading
| &fileName | |
| &readRanks | |
| setBuf |
| amrex::NFilesIter::~NFilesIter | ( | ) |
|
delete |
|
delete |
|
inlinestatic |
this returns the actual number of files used the range [1, nProcs] is enforced
| nOutFiles |
|
static |
this checks if nOutFiles equals the calculated number of files returns false if they do not match
| nProcs | |
| nOutFiles | |
| groupSets |
| void amrex::NFilesIter::CleanUpMessages | ( | ) |
|
inline |
this is the processor coordinating dynamic set selection
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inlinestatic |
these are the order of ranks which wrote to each file [filenumber][ranks in order they wrote to filenumber]
| Vector< int > amrex::NFilesIter::FileNumbersWritten | ( | ) |
these are the file numbers to which each rank wrote [rank] a rank only writes to one file
|
inline |
|
inlinestatic |
|
inline |
|
inlinestatic |
| NFilesIter & amrex::NFilesIter::operator++ | ( | ) |
|
delete |
|
delete |
| bool amrex::NFilesIter::ReadyToRead | ( | ) |
| bool amrex::NFilesIter::ReadyToWrite | ( | bool | appendFirst = false | ) |
if appendFirst is true, the first set for this iterator will open the files in append mode
| appendFirst |
| std::streampos amrex::NFilesIter::SeekPos | ( | ) |
get the current Stream()'s seek position
| void amrex::NFilesIter::SetDynamic | ( | int | deciderproc = -1 | ) |
call this to use dynamic set selection deciderproc defaults to nprocs - 1 if < 0
| deciderproc |
|
inlinestatic |
| void amrex::NFilesIter::SetSparseFPP | ( | const Vector< int > & | ranksToWrite | ) |
call this to use a file per process for a sparse set of writers. ranksToWrite.size() will set noutfiles rank ranksToWrite[n] will write to file_rank
| &ranksToWrite |
|
inline |
|
inlinestatic |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
[filenumber][ranks in order they wrote to filenumber]
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
staticprivate |
for Concatenate
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
these were ignored by the decider procs and need to be cleaned up
[](tag, nmessages)
|
private |
|
private |
|
private |