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

Function WritePlotfile

Src/Extern/ProfParser/AMReX_BLWritePlotFile.cpp:17–164  ·  view source on GitHub ↗

--------------------------------------------------------------------

Source from the content-addressed store, hash-verified

15
16// --------------------------------------------------------------------
17void WritePlotfile(const std::string &pfversion,
18 const Vector<MultiFab> &data,
19 const Real time,
20 const Vector<Real> &probLo,
21 const Vector<Real> &probHi,
22 const Vector<int> &refRatio,
23 const Vector<Box> &probDomain,
24 const Vector<Vector<Real> > &dxLevel,
25 const int coordSys,
26 const std::string &oFile,
27 const Vector<std::string> &names,
28 const bool verbose,
29 const bool isCartGrid,
30 const Real *vfeps,
31 const int *levelSteps)
32{
33 if(ParallelDescriptor::IOProcessor()) {
34 if( ! amrex::UtilCreateDirectory(oFile,0755)) {
35 amrex::CreateDirectoryFailed(oFile);
36 }
37 }
38 // Force other processors to wait until directory is built.
39 ParallelDescriptor::Barrier();
40
41 VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
42
43 std::ofstream os;
44 const int finestLevel(data.size() - 1);
45
46 if(ParallelDescriptor::IOProcessor()) {
47
48 std::string oFileHeader(oFile);
49 oFileHeader += "/Header";
50
51 //os.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
52
53 if(verbose && ParallelDescriptor::IOProcessor()) {
54 std::cout << "Opening file = " << oFileHeader << '\n';
55 }
56
57 os.open(oFileHeader.c_str(), std::ios::out|std::ios::binary);
58
59 if(os.fail()) {
60 amrex::FileOpenFailed(oFileHeader);
61 }
62 //
63 // Start writing plotfile.
64 //
65 os << pfversion << '\n';
66 int n_var = data[0].nComp();
67 os << n_var << '\n';
68 for (int n = 0; n < n_var; n++) os << names[n] << '\n';
69 os << BL_SPACEDIM << '\n';
70 os << std::setprecision(30) << time << '\n';
71 os << finestLevel << '\n';
72 for (int i = 0; i < BL_SPACEDIM; i++) os << probLo[i] << ' ';
73 os << '\n';
74 for (int i = 0; i < BL_SPACEDIM; i++) os << probHi[i] << ' ';

Callers 4

RunSendsPFMethod · 0.85
RunTimelinePFMethod · 0.85
MakeRegionPltMethod · 0.85
RunACTPFMethod · 0.85

Calls 6

IOProcessorFunction · 0.85
BarrierFunction · 0.85
WriteFunction · 0.50
sizeMethod · 0.45
nCompMethod · 0.45
boxArrayMethod · 0.45

Tested by

no test coverage detected