Sierra Toolkit  Version of the Day
UseCaseEnvironment.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #ifndef stk_util_use_cases_UseCaseEnvironement_hpp
10 #define stk_util_use_cases_UseCaseEnvironement_hpp
11 
12 #include <stk_util/parallel/Parallel.hpp>
13 #include <stk_util/parallel/BroadcastArg.hpp>
14 
15 #include <stk_util/diag/Writer_fwd.hpp>
16 #include <stk_util/diag/Timer.hpp>
17 
19 #include <stk_util/environment/ProgramOptions.hpp>
20 #include <stk_util/environment/ReportHandler.hpp>
21 #include <stk_util/environment/RuntimeWarning.hpp>
22 #include <stk_util/environment/RuntimeDoomed.hpp>
23 
24 #include <iosfwd>
25 
26 namespace use_case {
27 
28 enum LogMask {
29  LOG_ALWAYS = stk_classic::LOG_ALWAYS,
30  LOG_TRACE = stk_classic::LOG_TRACE,
31  LOG_TRACE_STATS = stk_classic::LOG_TRACE_STATS,
32  LOG_TRACE_SUB_CALLS = stk_classic::LOG_TRACE_SUB_CALLS,
33  LOG_MEMBERS = stk_classic::LOG_MEMBERS,
34 
35  LOG_SEARCH = 0x0000010,
36  LOG_TRANSFER = 0x0000020,
37  LOG_TIMER = 0x0000040
38 };
39 
44 enum message_type {
46  MSG_FATAL = stk_classic::MSG_DOOMED,
49  MSG_PARALLEL_EXCEPTION
50 };
51 
52 
57 enum message_throttle_type {
58  MSG_APPLICATION = stk_classic::MSG_APPLICATION,
59  MSG_TIME_STEP
60 };
61 
62 enum TimerSetMask {
63  TIMER_MESH = 0x00000001,
64  TIMER_MESH_IO = 0x00000002,
65  TIMER_SEARCH = 0x00000004,
66  TIMER_TRANSFER = 0x00000008,
67  TIMER_ALL = 0xFFFFFFFF,
68 
69  TIMER_FORCE = 0x00000000
70 };
71 
72 std::ostream &out();
73 std::ostream &dout();
74 std::ostream &pout();
75 std::ostream &tout();
76 
77 std::ostream &dwout();
78 
80 
81 stk_classic::diag::TimerSet &timerSet();
82 
84 
85 void my_report_handler(const char *message, int type);
86 
94 bool print_status(stk_classic::ParallelMachine comm, bool success);
95 
96 struct UseCaseEnvironment
97 {
98  // Will initialize a comm
99  UseCaseEnvironment(int *argc, char ***argv);
100 
101  // Assumes already-initialized comm
102  UseCaseEnvironment(int *argc, char ***argv, stk_classic::ParallelMachine comm);
103 
104  // shared constructor implementation; do not call directly
105  void initialize(int* argc, char ***argv);
106 
107  ~UseCaseEnvironment();
108 
109  const stk_classic::ParallelMachine m_comm;
110  std::string m_workingDirectory;
111  bool m_need_to_finalize;
112 };
113 
114 } // namespace use_case
115 
116 #endif // stk_util_use_cases_UseCaseEnvironement_hpp
Message is an exception.
std::ostream & dout()
Diagnostic output stream.
Definition: OutputLog.cpp:674
std::ostream & dwout()
Diagnostic writer stream.
Definition: OutputLog.cpp:690
Message is informational.
std::ostream & pout()
Per-processor output stream (See RuntimeDeferredx)
Definition: OutputLog.cpp:666
std::ostream & out()
Normal output stream.
Definition: OutputLog.cpp:658
Message is a warning.
Message is a fatal error.
Class TimerSet implements a set of timer classifications. A time classification consists of a bit mas...
Definition: Timer.hpp:117
Class Writer implements a runtime selectable diagnostic output writer to aid in the development and d...
Definition: Writer.hpp:49
MPI_Comm ParallelMachine
Definition: Parallel.hpp:32
std::ostream & tout()
Regression test textual output stream.
Definition: OutputLog.cpp:682
LogMask
Enumeration LogMask enumerates global bit assignments.
Definition: Writer_fwd.hpp:23
Class Timer implements a diagnostic timer and timer container for the collection and display of execu...
Definition: Timer.hpp:185