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

Function VisMFWrite

Src/Extern/ProfParser/AMReX_BLWritePlotFile.cpp:215–255  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

213#include <AMReX_FPC.H>
214// --------------------------------------------------------------------
215VisMF::FabOnDisk VisMFWrite(const FArrayBox &fabIn, const std::string &filename,
216 std::ostream &os, long &bytes, int whichPlane)
217{
218 FArrayBox fab;
219 if(fabIn.box().length(whichPlane) > 1) {
220 Box b(fabIn.box());
221 b.setBig(whichPlane, b.smallEnd(whichPlane));
222 fab.resize(b, fabIn.nComp());
223 } else {
224 fab.resize(fabIn.box(), fabIn.nComp());
225 }
226 fab.copy<RunOn::Host>(fabIn);
227
228
229 VisMF::FabOnDisk fab_on_disk(filename, VisMF::FileOffset(os));
230// ====================
231 //fab.writeOn(os);
232 // ====================
233 //fabio->write_header(os, *this, num_comp);
234 //os << "FAB " << *rd;
235 //os << fab.box() << ' ' << fab.nComp() << '\n';
236 // ====================
237
238 // ====================
239 //fabio->write(os, *this, 0, fab.nComp());
240 const long base_siz = fab.box().numPts();
241 const Real *comp_ptr = fab.dataPtr(0);
242 const long siz = base_siz*fab.nComp();
243 const int *ord = FPC::reverse_double_order;
244 RealDescriptor *rd = new RealDescriptor(FPC::ieee_double, ord, 8);
245 os << "FAB " << *rd;
246 //os << fab.box();
247 Write2DBoxFrom3D(fab.box(), os, whichPlane);
248 os << ' ' << fab.nComp() << '\n';
249 RealDescriptor::convertFromNativeFormat(os, siz, comp_ptr, *rd);
250 //os.write((char *) comp_ptr, siz*sizeof(double));
251 // ====================
252// ====================
253 bytes += (VisMF::FileOffset(os) - fab_on_disk.m_head);
254 return fab_on_disk;
255}
256
257
258// --------------------------------------------------------------------

Callers 1

WritePlotfile2DFrom3DFunction · 0.85

Calls 7

Write2DBoxFrom3DFunction · 0.85
lengthMethod · 0.45
boxMethod · 0.45
resizeMethod · 0.45
nCompMethod · 0.45
numPtsMethod · 0.45
dataPtrMethod · 0.45

Tested by

no test coverage detected