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

Function main

Tools/Postprocessing/C_Src/PlotfileToTurb.cpp:60–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60int
61main (int argc,
62 char* argv[])
63{
64 Initialize(argc,argv);
65 {
66 if (argc < 2)
67 print_usage(argc,argv);
68
69 ParmParse pp;
70
71 const std::string farg = amrex::get_command_argument(1);
72 if (farg == "-h" || farg == "--help")
73 print_usage(argc,argv);
74
75 if (pp.contains("verbose"))
76 AmrData::SetVerbose(true);
77
78 std::string ifile;
79 pp.get("ifile",ifile);
80
81 std::string ofile;
82 pp.get("ofile",ofile);
83
84 std::cout << "Reading " << ifile << " ... " << std::flush;
85
86 DataServices::SetBatchMode();
87 Amrvis::FileType fileType(Amrvis::NEWPLT);
88 DataServices dataServices(ifile, fileType);
89 std::cout << "done" << std::endl;
90
91 if (!dataServices.AmrDataOk())
92 DataServices::Dispatch(DataServices::ExitRequest, NULL);
93 AmrData& amrData = dataServices.AmrDataRef();
94
95 std::string TurbDir = ofile;
96
97 if (ParallelDescriptor::IOProcessor())
98 if (!UtilCreateDirectory(TurbDir, 0755))
99 CreateDirectoryFailed(TurbDir);
100
101 std::string Hdr = TurbDir; Hdr += "/HDR";
102 std::string Dat = TurbDir; Dat += "/DAT";
103
104 std::ofstream ifsd, ifsh;
105
106 ifsh.open(Hdr.c_str(), std::ios::out|std::ios::trunc);
107 if (!ifsh.good())
108 FileOpenFailed(Hdr);
109
110 ifsd.open(Dat.c_str(), std::ios::out|std::ios::trunc);
111 if (!ifsd.good())
112 FileOpenFailed(Dat);
113
114 const int dir = BL_SPACEDIM - 1;
115 const int finestLevel = amrData.FinestLevel();
116 const Box domain = amrData.ProbDomain()[finestLevel];
117 Box xdm = domain;

Callers

nothing calls this directly

Calls 15

IOProcessorFunction · 0.85
AbortFunction · 0.85
AmrDataOkMethod · 0.80
ProbDomainMethod · 0.80
ProbSizeMethod · 0.80
FlushGridsMethod · 0.80
StateNumberMethod · 0.80
print_usageFunction · 0.70
ExtendFunction · 0.70
InitializeFunction · 0.50
FinalizeFunction · 0.50
containsMethod · 0.45

Tested by

no test coverage detected