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

Function VisMFWriteHeader

Src/Extern/ProfParser/AMReX_BLWritePlotFile.cpp:279–321  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

277
278// --------------------------------------------------------------------
279long VisMFWriteHeader(const std::string &mf_name, VisMF::Header &hdr,
280 int whichPlane)
281{
282 long bytes(0);
283 std::string MFHdrFileName(mf_name);
284 MFHdrFileName += "_H";
285 VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
286 std::ofstream MFHdrFile;
287 MFHdrFile.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
288 MFHdrFile.open(MFHdrFileName.c_str(), std::ios::out|std::ios::trunc);
289 if( ! MFHdrFile.good()) {
290 FileOpenFailed(MFHdrFileName);
291 }
292 // ===============================
293 //MFHdrFile << hdr;
294 //std::ios::fmtflags oflags = MFHdrFile.flags();
295 MFHdrFile.setf(std::ios::floatfield, std::ios::scientific);
296 //int old_prec = MFHdrFile.precision(15);
297
298 MFHdrFile << hdr.m_vers << '\n';
299 MFHdrFile << int(hdr.m_how) << '\n';
300 MFHdrFile << hdr.m_ncomp << '\n';
301 MFHdrFile << hdr.m_ngrow << '\n'; ;
302
303 MFHdrFile << '(' << hdr.m_ba.size() << ' ' << 0 << '\n';
304
305 for(int i(0); i < hdr.m_ba.size(); ++i) {
306 Write2DBoxFrom3D(hdr.m_ba[i], MFHdrFile, whichPlane);
307 MFHdrFile << '\n';
308 }
309
310 MFHdrFile << ')' << '\n';
311
312
313 MFHdrFile << hdr.m_fod << '\n';
314 MFHdrFile << hdr.m_min << '\n';
315 MFHdrFile << hdr.m_max << '\n';
316
317 // ===============================
318 bytes += VisMF::FileOffset(MFHdrFile);
319 MFHdrFile.close();
320 return bytes;
321}
322
323
324// --------------------------------------------------------------------

Callers 1

WritePlotfile2DFrom3DFunction · 0.85

Calls 3

Write2DBoxFrom3DFunction · 0.85
dataPtrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected