16 #include <AMReX_ParallelDescriptor.H>
17 #include <AMReX_PlotFileUtil.H>
20 #define INFO __FILE__, __func__, __LINE__
24 #ifndef ALAMO_SINGLE_DEFINITION
25 #define ALAMO_SINGLE_DEFINITION AMREX_ATTRIBUTE_WEAK
35 int ReplaceAll(std::string &str,
const std::string before,
const std::string after);
36 int ReplaceAll(std::string &str,
const char before,
const std::string after);
37 std::string
Wrap(std::string text,
unsigned per_line);
38 std::string
Join(std::vector<std::string> & vec,
char separator =
'_');
39 std::vector<std::string>
Split(std::string &str,
const char token =
' ');
40 bool Contains(std::string &str,
const std::string find);
44 std::complex<int>
Parse(std::string);
50 void CopyFileToOutputDir(std::string a_path,
bool fullpath =
true, std::string prefix =
"");
61 void Terminate(
const char * msg,
int signal,
bool backtrace);
63 void Abort (
const char * msg);
65 template<
typename... Args>
67 void Assert (std::string file, std::string func,
int line, std::string smt,
bool pass, Args
const &... args)
71 std::ostringstream infostream;
77 std::string info = infostream.str();
80 std::ostringstream messagestream;
82 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
83 std::string message = messagestream.str();
86 std::cout << info << message << std::endl;
92 template<
typename... Args>
93 void Abort (std::string file, std::string func,
int line, Args
const &... args)
95 if (amrex::ParallelDescriptor::IOProcessor())
97 std::ostringstream infostream;
102 std::string info = infostream.str();
104 std::ostringstream messagestream;
106 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
107 std::string message = messagestream.str();
110 std::cout << info << message << std::endl;
112 Abort(
"Fatal Error");
115 template<
typename... Args>
116 void ParallelAbort (std::string file, std::string func,
int line, Args
const &... args)
119 std::ostringstream infostream;
124 std::string info = infostream.str();
126 std::ostringstream messagestream;
128 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
129 std::string message = messagestream.str();
132 std::cout << info << message << std::endl;
134 Abort(
"Fatal Error");
137 template<
typename... Args>
138 void Message (std::string file, std::string func,
int line, Args
const &... args)
140 if (amrex::ParallelDescriptor::IOProcessor())
142 std::ostringstream infostream;
147 std::string info = infostream.str();
149 std::ostringstream messagestream;
151 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
152 std::string message = messagestream.str();
156 std::cout << info << message << std::endl;
160 template<
typename... Args>
161 void ParallelMessage (std::string file, std::string func,
int line, Args
const &... args)
163 std::ostringstream infostream;
168 std::string info = infostream.str();
169 std::ostringstream messagestream;
171 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
172 std::string message = messagestream.str();
174 std::cout << info << message << std::endl;
177 template<
typename... Args>
178 void Warning (std::string file, std::string func,
int line, Args
const &... args)
180 if (amrex::ParallelDescriptor::IOProcessor())
182 std::ostringstream infostream;
187 std::string info = infostream.str();
189 std::ostringstream messagestream;
191 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
192 std::string message = messagestream.str();
196 std::cout << info << message << std::endl;
201 template<
typename... Args>
202 void Exception (std::string file, std::string func,
int line, Args
const &... args)
204 if (amrex::ParallelDescriptor::IOProcessor())
206 std::ostringstream infostream;
210 std::string info = infostream.str();
212 std::ostringstream messagestream;
215 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
218 std::string message = messagestream.str();
222 std::cout << info << message << std::endl;
224 std::throw_with_nested(std::runtime_error(
"IO::Exception"));
228 template<
typename... Args>
230 void AssertException (std::string file, std::string func,
int line, std::string smt,
bool pass, Args
const &... args)
234 if (amrex::ParallelDescriptor::IOProcessor())
236 std::ostringstream infostream;
242 std::string info = infostream.str();
245 std::ostringstream messagestream;
247 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
248 std::string message = messagestream.str();
251 std::cout << info << message << std::endl;
259 template<
typename... Args>
261 std::string file2, std::string ,
int line2,
262 std::string fullname,
263 Args
const &... args)
265 if (amrex::ParallelDescriptor::IOProcessor())
267 std::ostringstream infostream;
271 std::string info = infostream.str();
273 std::ostringstream messagestream;
276 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
279 const std::size_t nargs =
sizeof...(Args);
281 if (nargs) messagestream <<
"\n";
286 messagestream <<
" at " << file2 <<
":" << line2;
289 std::string message = messagestream.str();
293 std::cout << info << message << std::endl;
295 std::throw_with_nested(std::runtime_error(
"IO::ParmParse Exception"));
300 std::pair<std::string,std::string>
307 int Message(std::string testname);
308 int Message(std::string testname,
int passed);
309 int SubMessage(std::string testname,
int passed);
321 BL_PROFILE(
"Util::RealFillBoundary");
322 a_mf.setMultiGhost(
true);
328 BL_PROFILE(
"Util::RealFillBoundary");
329 a_mf.setMultiGhost(
true);
334 void AverageCellcenterToNode(amrex::MultiFab& node_mf,
const int &dcomp,
const amrex::MultiFab &cell_mf,
const int &scomp,
const int &ncomp);