MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / EB_WriteMultiLevelPlotfile

Function EB_WriteMultiLevelPlotfile

Src/Base/AMReX_PlotFileUtil.cpp:382–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380}
381
382void
383EB_WriteMultiLevelPlotfile (const std::string& plotfilename, int nlevels,
384 const Vector<const MultiFab*>& mf,
385 const Vector<std::string>& varnames,
386 const Vector<Geometry>& geom, Real time, const Vector<int>& level_steps,
387 const Vector<IntVect>& ref_ratio,
388 const std::string &versionName,
389 const std::string &levelPrefix,
390 const std::string &mfPrefix,
391 const Vector<std::string>& extra_dirs)
392{
393 BL_PROFILE("WriteMultiLevelPlotfile()");
394
395 BL_ASSERT(nlevels <= mf.size());
396 BL_ASSERT(nlevels <= geom.size());
397 BL_ASSERT(nlevels <= ref_ratio.size()+1);
398 BL_ASSERT(nlevels <= level_steps.size());
399 BL_ASSERT(mf[0]->nComp() == varnames.size());
400 AMREX_ALWAYS_ASSERT_WITH_MESSAGE(mf[0]->hasEBFabFactory(),
401 "EB_WriteMultiLevelPlotfile: does not have EB Factory");
402
403 int finest_level = nlevels-1;
404
405// int saveNFiles(VisMF::GetNOutFiles());
406// VisMF::SetNOutFiles(std::max(1024,saveNFiles));
407
408 bool callBarrier(false);
409 PreBuildDirectorHierarchy(plotfilename, levelPrefix, nlevels, callBarrier);
410 if (!extra_dirs.empty()) {
411 for (const auto& d : extra_dirs) {
412 std::string ed = plotfilename;
413 ed.append("/").append(d);
414 amrex::PreBuildDirectorHierarchy(ed, levelPrefix, nlevels, callBarrier);
415 }
416 }
417 ParallelDescriptor::Barrier();
418
419 if (ParallelDescriptor::IOProcessor()) {
420 VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
421 std::string HeaderFileName(plotfilename + "/Header");
422 std::ofstream HeaderFile;
423 HeaderFile.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
424 HeaderFile.open(HeaderFileName.c_str(), std::ofstream::out |
425 std::ofstream::trunc |
426 std::ofstream::binary);
427 if( ! HeaderFile.good()) {
428 FileOpenFailed(HeaderFileName);
429 }
430
431 Vector<BoxArray> boxArrays(nlevels);
432 for(int level(0); level < boxArrays.size(); ++level) {
433 boxArrays[level] = mf[level]->boxArray();
434 }
435
436 Vector<std::string> vn = varnames;
437 vn.push_back("vfrac");
438 WriteGenericPlotfileHeader(HeaderFile, nlevels, boxArrays, vn,
439 geom, time, level_steps, ref_ratio, versionName,

Callers 1

Calls 15

BarrierFunction · 0.85
IOProcessorFunction · 0.85
CopyFunction · 0.85
MultiFabFileFullPrefixFunction · 0.85
hasEBFabFactoryMethod · 0.80
DistributionMapMethod · 0.80
FactoryMethod · 0.80
WriteFunction · 0.70
sizeMethod · 0.45
nCompMethod · 0.45

Tested by

no test coverage detected