4 #include <AMReX_Config.H>
43 NFilesIter(
int noutfiles, std::string fileprefix,
44 bool groupsets,
bool setBuf);
108 return ((
nProcs + (anf - 1)) / anf);
112 int noutfiles,
bool groupsets)
116 whichset = whichproc / noutfiles;
118 whichset = whichproc %
LengthOfSet(nprocs, noutfiles);
152 return(whichProc % anf);
#define BL_ASSERT(EX)
Definition: AMReX_BLassert.H:39
#define AMREX_EXPORT
Definition: AMReX_Extension.H:191
This class encapsulates writing to nfiles.
Definition: AMReX_NFiles.H:27
Vector< int > FileNumbersWritten()
these are the file numbers to which each rank wrote [rank] a rank only writes to one file
Definition: AMReX_NFiles.cpp:517
static AMREX_EXPORT int minDigits
for Concatenate
Definition: AMReX_NFiles.H:243
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
Definition: AMReX_NFiles.cpp:498
int myProc
Definition: AMReX_NFiles.H:208
static int ActualNFiles(int nOutFiles)
this returns the actual number of files used the range [1, nProcs] is enforced
Definition: AMReX_NFiles.H:130
std::string fullFileName
Definition: AMReX_NFiles.H:216
bool GetDynamic() const
Definition: AMReX_NFiles.H:54
int nOutFiles
Definition: AMReX_NFiles.H:210
static int currentDeciderIndex
Definition: AMReX_NFiles.H:236
static void SetMinDigits(int md)
Definition: AMReX_NFiles.H:204
bool GetSparseFPP() const
Definition: AMReX_NFiles.H:65
int coordinatorTag
Definition: AMReX_NFiles.H:227
Vector< int > setZeroProcs
Definition: AMReX_NFiles.H:231
NFilesIter & operator=(NFilesIter const &)=delete
static int GetMinDigits()
Definition: AMReX_NFiles.H:202
void SetSparseFPP(const Vector< int > &ranksToWrite)
call this to use a file per process for a sparse set of writers. ranksToWrite.size() will set noutfil...
Definition: AMReX_NFiles.cpp:114
NFilesIter & operator++()
Definition: AMReX_NFiles.cpp:345
static std::string FileName(int nOutFiles, const std::string &filePrefix, int whichProc, bool groupSets)
Definition: AMReX_NFiles.H:163
std::fstream & Stream()
Definition: AMReX_NFiles.H:98
~NFilesIter()
Definition: AMReX_NFiles.cpp:197
NFilesIter(int noutfiles, std::string fileprefix, bool groupsets, bool setBuf)
the nfiles will be named "filePrefix" + "00000" through "filePrefix" + "noutfiles-1" the range [1,...
Definition: AMReX_NFiles.cpp:13
static std::string FileName(int fileNumber, const std::string &filePrefix)
Definition: AMReX_NFiles.H:174
Vector< int > readRanks
Definition: AMReX_NFiles.H:222
std::fstream fileStream
Definition: AMReX_NFiles.H:218
int deciderTag
Definition: AMReX_NFiles.H:227
int deciderProc
Definition: AMReX_NFiles.H:226
std::streampos SeekPos()
get the current Stream()'s seek position
Definition: AMReX_NFiles.cpp:493
bool ReadyToWrite(bool appendFirst=false)
if appendFirst is true, the first set for this iterator will open the files in append mode
Definition: AMReX_NFiles.cpp:204
NFilesIter(NFilesIter const &)=delete
VisMFBuffer::IO_Buffer io_buffer
Definition: AMReX_NFiles.H:217
std::string filePrefix
Definition: AMReX_NFiles.H:215
int nProcs
Definition: AMReX_NFiles.H:209
Vector< int > sparseWritingRanks
Definition: AMReX_NFiles.H:233
bool finishedWriting
Definition: AMReX_NFiles.H:219
bool finishedReading
Definition: AMReX_NFiles.H:221
int writeTag
Definition: AMReX_NFiles.H:227
int coordinatorProc
Definition: AMReX_NFiles.H:226
Vector< std::pair< int, int > > unreadMessages
these were ignored by the decider procs and need to be cleaned up
Definition: AMReX_NFiles.H:239
static int LengthOfSet(int nProcs, int nOutFiles)
Definition: AMReX_NFiles.H:106
int FileNumber() const
Definition: AMReX_NFiles.H:161
bool useSparseFPP
Definition: AMReX_NFiles.H:232
Vector< int > availableDeciders
Definition: AMReX_NFiles.H:230
NFilesIter(NFilesIter &&)=delete
const std::string & FileName() const
Definition: AMReX_NFiles.H:160
void CleanUpMessages()
Definition: AMReX_NFiles.cpp:552
int stReadTag
Definition: AMReX_NFiles.H:229
int fileNumber
Definition: AMReX_NFiles.H:214
bool useStaticSetSelection
Definition: AMReX_NFiles.H:225
static const int indexUndefined
Definition: AMReX_NFiles.H:241
int doneTag
Definition: AMReX_NFiles.H:227
int mySetPosition
Definition: AMReX_NFiles.H:213
int CoordinatorProc() const
this is the processor coordinating dynamic set selection
Definition: AMReX_NFiles.H:184
const Vector< Vector< int > > & FileNumbersWriteOrder() const
these are the order of ranks which wrote to each file [filenumber][ranks in order they wrote to filen...
Definition: AMReX_NFiles.H:198
int mySparseFileNumber
Definition: AMReX_NFiles.H:234
int remainingWriters
Definition: AMReX_NFiles.H:226
int stWriteTag
Definition: AMReX_NFiles.H:228
bool groupSets
Definition: AMReX_NFiles.H:212
int myReadIndex
Definition: AMReX_NFiles.H:224
static int FileNumber(int nOutFiles, int whichProc, bool groupSets)
Definition: AMReX_NFiles.H:146
int nSets
Definition: AMReX_NFiles.H:211
bool ReadyToRead()
Definition: AMReX_NFiles.cpp:325
Vector< Vector< int > > fileNumbersWriteOrder
[filenumber][ranks in order they wrote to filenumber]
Definition: AMReX_NFiles.H:223
static int WhichSetPosition(int whichproc, int nprocs, int noutfiles, bool groupsets)
Definition: AMReX_NFiles.H:111
void SetDynamic(int deciderproc=-1)
call this to use dynamic set selection deciderproc defaults to nprocs - 1 if < 0
Definition: AMReX_NFiles.cpp:69
bool isReading
Definition: AMReX_NFiles.H:220
int NProcs() noexcept
return the number of MPI ranks local to the current Parallel Context
Definition: AMReX_ParallelDescriptor.H:243
@ min
Definition: AMReX_ParallelReduce.H:18
@ max
Definition: AMReX_ParallelReduce.H:17
Definition: AMReX_Amr.cpp:49
std::string Concatenate(const std::string &root, int num, int mindigits)
Returns rootNNNN where NNNN == num.
Definition: AMReX_String.cpp:34