Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ src/exp
src/user/CylindricalDisk.cc
src/user/EllipsoidForce.cc
src/user/SLSphere.cc
_codeql_detected_source_root
68 changes: 42 additions & 26 deletions src/OutHDF5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@ void OutHDF5::initialize()
//
if (directory) {
std::ostringstream dname;
dname << outdir
<< filename << "_" << setw(5) << setfill('0') << nbeg;

if (chkpt)
dname << outdir
<< "checkpoint_" << runtag;
else
dname << outdir
<< filename << "_" << setw(5) << setfill('0') << nbeg;

std::filesystem::path dir_path = dname.str();

Expand All @@ -187,9 +192,16 @@ void OutHDF5::initialize()
}
else {
std::ostringstream fname;
fname << outdir
<< filename << "_" << setw(5) << setfill('0') << nbeg
<< ".1";

if (chkpt) {
fname << outdir
<< "checkpoint_" << runtag;
if (numprocs>1) fname << ".1";
} else {
fname << outdir
<< filename << "_" << setw(5) << setfill('0') << nbeg
<< ".1";
}

std::filesystem::path file_path = fname.str();

Expand All @@ -200,31 +212,35 @@ void OutHDF5::initialize()

// Find starting index
//
for (; nbeg<100000; nbeg++) {
// Path name
//
std::ostringstream fname;
fname << outdir
<< filename << "_" << setw(5) << setfill('0') << nbeg;

if (not directory) fname << ".1";

std::filesystem::path path = fname.str();

// See if we can open the directory or file
//
if (directory) {
if (not std::filesystem::is_directory(path)) break;
} else
if (not std::filesystem::is_regular_file(path)) break;
if (not chkpt) {
for (; nbeg<100000; nbeg++) {
// Path name
//
std::ostringstream fname;
fname << outdir
<< filename << "_" << setw(5) << setfill('0') << nbeg;

if (not directory) fname << ".1";

std::filesystem::path path = fname.str();

// See if we can open the directory or file
//
if (directory) {
if (not std::filesystem::is_directory(path)) break;
} else
if (not std::filesystem::is_regular_file(path)) break;
}

std::cout << "---- OutHDF5: found last file <" << nbeg << ">" << std::endl;
}

std::cout << "---- OutHDF5: found last file <" << nbeg << ">" << std::endl;
// END: snapshot mode loop
}
// END: root node read

// Communicate starting file index to all nodes
// Communicate starting file index to all nodes for snapshot mode
//
MPI_Bcast(&nbeg, 1, MPI_INT, 0, MPI_COMM_WORLD);
if (not chkpt) MPI_Bcast(&nbeg, 1, MPI_INT, 0, MPI_COMM_WORLD);
}

return;
Expand Down