|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 #ifndef stk_util_use_cases_UseCaseEnvironement_hpp 00010 #define stk_util_use_cases_UseCaseEnvironement_hpp 00011 00012 #include <stk_util/parallel/Parallel.hpp> 00013 #include <stk_util/parallel/BroadcastArg.hpp> 00014 00015 #include <stk_util/diag/Writer_fwd.hpp> 00016 #include <stk_util/diag/Timer.hpp> 00017 00018 #include <stk_util/environment/OutputLog.hpp> 00019 #include <stk_util/environment/ProgramOptions.hpp> 00020 #include <stk_util/environment/ReportHandler.hpp> 00021 #include <stk_util/environment/RuntimeWarning.hpp> 00022 #include <stk_util/environment/RuntimeDoomed.hpp> 00023 00024 #include <iosfwd> 00025 00026 namespace use_case { 00027 00028 enum LogMask { 00029 LOG_ALWAYS = stk_classic::LOG_ALWAYS, 00030 LOG_TRACE = stk_classic::LOG_TRACE, 00031 LOG_TRACE_STATS = stk_classic::LOG_TRACE_STATS, 00032 LOG_TRACE_SUB_CALLS = stk_classic::LOG_TRACE_SUB_CALLS, 00033 LOG_MEMBERS = stk_classic::LOG_MEMBERS, 00034 00035 LOG_SEARCH = 0x0000010, 00036 LOG_TRANSFER = 0x0000020, 00037 LOG_TIMER = 0x0000040 00038 }; 00039 00044 enum message_type { 00045 MSG_WARNING = stk_classic::MSG_WARNING, 00046 MSG_FATAL = stk_classic::MSG_DOOMED, 00047 MSG_INFORMATION, 00048 MSG_EXCEPTION, 00049 MSG_PARALLEL_EXCEPTION 00050 }; 00051 00052 00057 enum message_throttle_type { 00058 MSG_APPLICATION = stk_classic::MSG_APPLICATION, 00059 MSG_TIME_STEP 00060 }; 00061 00062 enum TimerSetMask { 00063 TIMER_MESH = 0x00000001, 00064 TIMER_MESH_IO = 0x00000002, 00065 TIMER_SEARCH = 0x00000004, 00066 TIMER_TRANSFER = 0x00000008, 00067 TIMER_ALL = 0xFFFFFFFF, 00068 00069 TIMER_FORCE = 0x00000000 00070 }; 00071 00072 std::ostream &out(); 00073 std::ostream &dout(); 00074 std::ostream &pout(); 00075 std::ostream &tout(); 00076 00077 std::ostream &dwout(); 00078 00079 stk_classic::diag::Writer &dw(); 00080 00081 stk_classic::diag::TimerSet &timerSet(); 00082 00083 stk_classic::diag::Timer &timer(); 00084 00085 void my_report_handler(const char *message, int type); 00086 00094 bool print_status(stk_classic::ParallelMachine comm, bool success); 00095 00096 struct UseCaseEnvironment 00097 { 00098 // Will initialize a comm 00099 UseCaseEnvironment(int *argc, char ***argv); 00100 00101 // Assumes already-initialized comm 00102 UseCaseEnvironment(int *argc, char ***argv, stk_classic::ParallelMachine comm); 00103 00104 // shared constructor implementation; do not call directly 00105 void initialize(int* argc, char ***argv); 00106 00107 ~UseCaseEnvironment(); 00108 00109 const stk_classic::ParallelMachine m_comm; 00110 std::string m_workingDirectory; 00111 bool m_need_to_finalize; 00112 }; 00113 00114 } // namespace use_case 00115 00116 #endif // stk_util_use_cases_UseCaseEnvironement_hpp