-
Notifications
You must be signed in to change notification settings - Fork 407
amrex::FileStream #4550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
amrex::FileStream #4550
Conversation
This tries to fix the following error reported by @BenWibking Writing checkpoint chk02500 amrex::UtilCreateDirectory:: path errno: chk02500 :: File exists amrex::UtilCreateDirectory:: path errno: chk02500/Level_2 :: Input/output error amrex::Error::0::Couldn't create directory: chk02500/Level_2 !!!
Implement our own file stream class that is somewhat similar to std::fstream. It can be used by amrex::NFilesIter in mesh and particle data I/O. By default amrex::NFilesIter still uses std::fstream. To use amrex::FileStream, one needs to use `USE_OWN_FILE_STREAM=TRUE` for GNU Make and `AMReX_OWN_FILE_STREAM=ON` for CMake. amrex::FileStream::Read has not been tested and currently it is not being used for reading MultiFab and particles.
throw std::runtime_error("FileStream::write: bad file descriptor or bad state"); | ||
} | ||
|
||
if (m_buffer_mode == BufferMode::Read) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a quick skim of the code, I don't really understand the motivation for BufferMode
or how it works. Is there a reason to have separate modes implemented by the same function, or can different modes have separate implementations in separate functions? I can go back and read it more carefully with more context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we only need to open a stream for either write or read, but not both. If we want to support both, we will need to know the current mode of the buffer.
Implement our own file stream class that is somewhat similar to std::fstream. It can be used by amrex::NFilesIter in mesh and particle data I/O. By default amrex::NFilesIter still uses std::fstream. To use amrex::FileStream, one needs to use
USE_OWN_FILE_STREAM=TRUE
for GNU Make andAMReX_OWN_FILE_STREAM=ON
for CMake.amrex::FileStream::Read has not been tested and currently it is not being used for reading MultiFab and particles.