Skip to content

Commit

Permalink
Merge branch 'github'
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Dec 13, 2016
2 parents 16b2cf0 + 52a3399 commit c46162a
Show file tree
Hide file tree
Showing 16 changed files with 510 additions and 287 deletions.
11 changes: 11 additions & 0 deletions ReleaseNotes/release-notes-16.12.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#-*- mode: org -*-
#+STARTUP: showall

Release Notes for BoxLib 16.12.1

The development branch was merged into master on December 13, 2016.

* Changes
** Improved generic plotfile writer.
** Trapping SIGABRT
** Small changed in make
8 changes: 4 additions & 4 deletions Src/C_AMRLib/Amr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <DistributionMapping.H>
#include <FabSet.H>
#include <StateData.H>
#include <PlotFileUtil.H>

#ifdef MG_USE_FBOXLIB
#include <mg_cpp_f.h>
Expand Down Expand Up @@ -747,11 +748,10 @@ Amr::writePlotFile ()

if(precreateDirectories) { // ---- make all directories at once
BoxLib::UtilRenameDirectoryToOld(pltfile, false); // dont call barrier
BoxLib::UtilCreateCleanDirectory(pltfileTemp, false); // dont call barrier
for(int i(0); i <= finest_level; ++i) {
amr_level[i].CreateLevelDirectory(pltfileTemp);
if(ParallelDescriptor::IOProcessor()) {
std::cout << "IOIOIOIO: precreating directories for " << pltfileTemp << std::endl;
}
ParallelDescriptor::Barrier("Amr::precreate plotfile Directories");
BoxLib::PreBuildDirectorHierarchy(pltfileTemp, "Level_", finest_level + 1, true); // call barrier
} else {
BoxLib::UtilRenameDirectoryToOld(pltfile, false); // dont call barrier
BoxLib::UtilCreateCleanDirectory(pltfileTemp, true); // call barrier
Expand Down
12 changes: 8 additions & 4 deletions Src/C_AMRLib/AmrLevel.H
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ public:
//
virtual ~AmrLevel ();
//
// Get the level direcotory names
// Create the Level_ directory for checkpoint and plot files
// Set if the Level_ directory was created or to clear the value.
// CreateLevelDirectory sets levelDirectoryCreated = true
// Get the level directory names
//
virtual void LevelDirectoryNames (const std::string &dir,
std::string &LevelDir,
std::string &FullPath);
//
// Create the Level_ directory for checkpoint and plot files
//
virtual void CreateLevelDirectory (const std::string &dir);
//
// Set if the Level_ directory was created or to clear the value.
// CreateLevelDirectory sets levelDirectoryCreated = true
//
void SetLevelDirectoryCreated(bool ldc) { levelDirectoryCreated = ldc; }
//
// A string written as the first item in writePlotFile() at
Expand Down
3 changes: 1 addition & 2 deletions Src/C_AMRLib/AmrLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1948,8 +1948,7 @@ AmrLevel::LevelDirectoryNames(const std::string &dir,
// Now for the full pathname of that directory.
//
FullPath = dir;
if( ! FullPath.empty() && FullPath[FullPath.length()-1] != '/')
{
if( ! FullPath.empty() && FullPath.back() != '/') {
FullPath += '/';
}
FullPath += LevelDir;
Expand Down
16 changes: 10 additions & 6 deletions Src/C_BaseLib/BLBackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ BLBackTrace::print_backtrace_info (FILE* f)
fclose(fp);
have_addr2line = 1;
}
cmd += " -Cfie " + BoxLib::exename;
if (have_addr2line) {
fprintf(f, "=== Please note that the line number reported by addr2line may not be accurate.\n");
fprintf(f, " If necessary, one can use 'readelf -wl my_exefile | grep my_line_address'\n");
fprintf(f, " to find out the offset for that line.\n\n");
}
cmd += " -Cfie " + BoxLib::exename;

fprintf(f, "=== If no file names and line numbers are shown below, one can run\n");
fprintf(f, " addr2line -Cfie my_exefile my_line_address\n");
fprintf(f, " to convert `my_line_address` (e.g., 0x4a6b) into file name and line number.\n\n");
fprintf(f, "=== Please note that the line number reported by addr2line may not be accurate.\n");
fprintf(f, " One can use\n");
fprintf(f, " readelf -wl my_exefile | grep my_line_address'\n");
fprintf(f, " to find out the offset for that line.\n\n");

for (int i = 0; i < nptrs; ++i) {
std::string line = strings[i];
line += "\n";
Expand Down
68 changes: 59 additions & 9 deletions Src/C_BaseLib/PlotFileUtil.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,65 @@

namespace BoxLib
{
void WriteSingleLevelPlotfile (const std::string& plotfilename,
const MultiFab& mf, const Array<std::string>& varnames,
const Geometry& geom, Real t, int level_step);

void WriteMultiLevelPlotfile (const std::string& plotfilename, int nlevels,
const Array<const MultiFab*>& mf,
const Array<std::string>& varnames,
const Array<Geometry>& geom, Real time, const Array<int>& level_steps,
const Array<IntVect>& ref_ratio);
// ---- return the name of the level directory, e.g., Level_5
std::string LevelPath (int level, const std::string &levelPrefix = "Level_");

// ---- return the path of the multifab to write to the header, e.g., Level_5/Cell
std::string MultiFabHeaderPath (int level,
const std::string &levelPrefix = "Level_",
const std::string &mfPrefix = "Cell");

// ---- return the full path of the level directory, e.g., plt00005/Level_5
std::string LevelFullPath (int level,
const std::string &plotfilename,
const std::string &levelPrefix = "Level_");

// ---- return the full path multifab prefix, e.g., plt00005/Level_5/Cell
std::string MultiFabFileFullPrefix (int level,
const std::string &plotfilename,
const std::string &levelPrefix = "Level_",
const std::string &mfPrefix = "Cell");

// ---- prebuild a hierarchy of directories
// ---- dirName is built first. if dirName exists, it is renamed. then build
// ---- dirName/subDirPrefix_0 .. dirName/subDirPrefix_nSubDirs-1
// ---- if callBarrier is true, call ParallelDescriptor::Barrier()
// ---- after all directories are built
// ---- ParallelDescriptor::IOProcessor() creates the directories
void PreBuildDirectorHierarchy (const std::string &dirName,
const std::string &subDirPrefix,
int nSubDirs,
bool callBarrier);

// ---- write a generic plot file header to the file plotfilename/Header
// ---- the plotfilename directory must already exist
void WriteGenericPlotfileHeader (std::ostream &HeaderFile,
int nlevels,
const Array<BoxArray> &bArray,
const Array<std::string> &varnames,
const Array<Geometry> &geom,
Real time,
const Array<int> &level_steps,
const Array<IntVect> &ref_ratio,
const std::string &versionName = "HyperCLaw-V1.1",
const std::string &levelPrefix = "Level_",
const std::string &mfPrefix = "Cell");

void WriteSingleLevelPlotfile (const std::string &plotfilename,
const MultiFab &mf,
const Array<std::string> &varnames,
const Geometry &geom,
Real t,
int level_step);

void WriteMultiLevelPlotfile (const std::string &plotfilename,
int nlevels,
const Array<const MultiFab*> &mf,
const Array<std::string> &varnames,
const Array<Geometry> &geom,
Real time,
const Array<int> &level_steps,
const Array<IntVect> &ref_ratio);
}

#endif
Loading

0 comments on commit c46162a

Please sign in to comment.