17#include <AMReX_ParallelDescriptor.H>
18#include <AMReX_PlotFileUtil.H>
21#define INFO __FILE__, __func__, __LINE__
25#ifndef ALAMO_SINGLE_DEFINITION
26#define ALAMO_SINGLE_DEFINITION AMREX_ATTRIBUTE_WEAK
49void Terminate(
const char * msg,
int signal,
bool backtrace);
51void Abort (
const char * msg);
53template<
typename... Args>
55void Assert (std::string file, std::string func,
int line, std::string smt,
bool pass, Args
const &... args)
59 std::ostringstream infostream;
65 std::string info = infostream.str();
68 std::ostringstream messagestream;
70 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
71 std::string message = messagestream.str();
74 std::cout << info << message << std::endl;
80template<
typename... Args>
81void Abort (std::string file, std::string func,
int line, Args
const &... args)
83 if (amrex::ParallelDescriptor::IOProcessor())
85 std::ostringstream infostream;
90 std::string info = infostream.str();
92 std::ostringstream messagestream;
94 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
95 std::string message = messagestream.str();
98 std::cout << info << message << std::endl;
100 Abort(
"Fatal Error");
103template<
typename... Args>
104void ParallelAbort (std::string file, std::string func,
int line, Args
const &... args)
107 std::ostringstream infostream;
112 std::string info = infostream.str();
114 std::ostringstream messagestream;
116 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
117 std::string message = messagestream.str();
120 std::cout << info << message << std::endl;
122 Abort(
"Fatal Error");
125template<
typename... Args>
126void Message (std::string file, std::string func,
int line, Args
const &... args)
128 if (amrex::ParallelDescriptor::IOProcessor())
130 std::ostringstream infostream;
135 std::string info = infostream.str();
137 std::ostringstream messagestream;
139 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
140 std::string message = messagestream.str();
144 std::cout << info << message << std::endl;
149template<
typename... Args>
150void DebugMessage (std::string file, std::string func,
int line, Args
const &... args)
152 if (amrex::ParallelDescriptor::IOProcessor())
154 std::ostringstream infostream;
159 std::string info = infostream.str();
161 std::ostringstream messagestream;
163 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
164 std::string message = messagestream.str();
168 std::cout << info << message << std::endl;
172template<
typename... Args>
181template<
typename... Args>
182void ParallelMessage (std::string file, std::string func,
int line, Args
const &... args)
184 std::ostringstream infostream;
189 std::string info = infostream.str();
190 std::ostringstream messagestream;
192 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
193 std::string message = messagestream.str();
195 std::cout << info << message << std::endl;
198template<
typename... Args>
199void Warning (std::string file, std::string func,
int line, Args
const &... args)
201 if (amrex::ParallelDescriptor::IOProcessor())
203 std::ostringstream infostream;
208 std::string info = infostream.str();
210 std::ostringstream messagestream;
212 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
213 std::string message = messagestream.str();
217 std::cout << info << message << std::endl;
222template<
typename... Args>
223void Exception (std::string file, std::string func,
int line, Args
const &... args)
225 if (amrex::ParallelDescriptor::IOProcessor())
227 std::ostringstream infostream;
231 std::string info = infostream.str();
233 std::ostringstream messagestream;
236 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
239 std::string message = messagestream.str();
243 std::cout << info << message << std::endl;
245 std::throw_with_nested(std::runtime_error(
"IO::Exception"));
249template<
typename... Args>
251void AssertException (std::string file, std::string func,
int line, std::string smt,
bool pass, Args
const &... args)
255 if (amrex::ParallelDescriptor::IOProcessor())
257 std::ostringstream infostream;
263 std::string info = infostream.str();
266 std::ostringstream messagestream;
268 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
269 std::string message = messagestream.str();
272 std::cout << info << message << std::endl;
280template<
typename... Args>
282 std::string fullname,
283 Args
const &... args)
285 if (amrex::ParallelDescriptor::IOProcessor())
287 std::ostringstream infostream;
291 std::string info = infostream.str();
293 std::ostringstream messagestream;
296 (void)List{0, ( (void)(messagestream << args), 0 ) ... };
299 const std::size_t nargs =
sizeof...(Args);
301 if (nargs) messagestream <<
"\n";
305 std::string message = messagestream.str();
309 std::cout << info << message << std::endl;
311 std::throw_with_nested(std::runtime_error(
"IO::ParmParse Exception"));
316std::pair<std::string,std::string>
323int Message(std::string testname);
324int Message(std::string testname,
int passed);
325int SubMessage(std::string testname,
int passed);
337 BL_PROFILE(
"Util::RealFillBoundary");
338 a_mf.setMultiGhost(
true);
344 BL_PROFILE(
"Util::RealFillBoundary");
345 a_mf.setMultiGhost(
true);
350void AverageCellcenterToNode(amrex::MultiFab& node_mf,
const int &dcomp,
const amrex::MultiFab &cell_mf,
const int &scomp,
const int &ncomp);
353template <
class... Ts>
354AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static std::string DarkGray
static std::string LightGreen
static std::string LightGray
static std::string Yellow
static std::string LightBlue
static std::string Underlined
AMREX_FORCE_INLINE int ReplaceAll(std::string &str, const std::string before, const std::string after)
int Message(std::string testname)
int SubMessage(std::string testname, int failed)
int SubFinalMessage(int failed)
A collection of utility routines.
std::pair< std::string, std::string > CreateCleanDirectory(const std::string &path, bool callbarrier)
void DebugMessage(std::string, std::string, int, Args const &...)
void ParallelAbort(std::string file, std::string func, int line, Args const &... args)
void ParallelMessage(std::string file, std::string func, int line, Args const &... args)
std::string GetFileName()
AMREX_FORCE_INLINE void RealFillBoundary(amrex::FabArray< amrex::BaseFab< T > > &a_mf, const amrex::Geometry &)
AMREX_FORCE_INLINE void AssertException(std::string file, std::string func, int line, std::string smt, bool pass, Args const &... args)
void Abort(const char *msg)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void IgnoreUnused(const Ts &...)
void AverageCellcenterToNode(amrex::MultiFab &node_mf, const int &dcomp, const amrex::MultiFab &cell_mf, const int &scomp, const int &ncomp)
AMREX_FORCE_INLINE void Assert(std::string file, std::string func, int line, std::string smt, bool pass, Args const &... args)
void CopyFileToOutputDir(std::string a_path, bool fullpath, std::string prefix)
void Warning(std::string file, std::string func, int line, Args const &... args)
std::pair< std::string, std::string > GetOverwrittenFile()
void Message(std::string file, std::string func, int line, Args const &... args)
void ParmParseException(std::string file, std::string func, int line, std::string fullname, Args const &... args)
void Exception(std::string file, std::string func, int line, Args const &... args)
void Terminate(const char *, int signal, bool)
void SignalHandler(int s)