Sierra Toolkit  Version of the Day
DiagWriter.hpp
1 #ifndef stk_mesh_DiagWriter_h
2 #define stk_mesh_DiagWriter_h
3 
4 #ifdef STK_MESH_TRACE_ENABLED
5 
6 #include <stk_util/diag/Trace.hpp>
7 #include <stk_util/diag/Writer.hpp>
8 #include <stk_util/diag/WriterOStream.hpp>
9 #include <stk_util/diag/WriterParser.hpp>
10 
11 #include <stk_mesh/base/DiagWriter_fwd.hpp>
12 #include <stk_mesh/base/Part.hpp>
13 
14 // Note, this classes/functions in this header are for internal use only.
15 // The API for tracing is defined in Trace.hpp
16 
17 namespace stk_classic {
18 namespace mesh {
19 
20 class Part;
21 class Entity;
22 union EntityKey;
23 
24 // Must be called before theDiagWriter/meshlog
25 void initDiagWriter(std::ostream& stream);
26 
27 stk_classic::diag::Writer &theDiagWriter();
28 #define meshlog stk_classic::mesh::theDiagWriter()
29 
30 class DiagWriterParser : public diag::WriterParser
31 {
32 public:
33  DiagWriterParser();
34 };
35 
36 DiagWriterParser &theDiagWriterParser();
37 
38 typedef diag::Tracespec Tracespec;
39 typedef diag::Traceback Traceback;
40 
46 class Trace : public diag::Trace
47 {
48 public:
49  explicit Trace(const char *message)
50  : diag::Trace(meshlog, message)
51  {}
52 
53  Trace(const char *message, int print_mask)
54  : diag::Trace(meshlog, message, print_mask)
55  {}
56 
57  Trace(const char *message, int print_mask, bool do_trace)
58  : diag::Trace(meshlog, message, print_mask, do_trace)
59  {}
60 };
61 
62 // If Writer does not know how to output an object you want to trace, you
63 // can address that here by defining an operator<< for that object. Note
64 // that Writer handles vectors and pointers automatically.
65 
67 
68 stk_classic::diag::Writer& operator<<(stk_classic::diag::Writer& writer, const Entity& entity);
69 
70 stk_classic::diag::Writer& operator<<(stk_classic::diag::Writer& writer, const EntityKey& key);
71 
73 
74 } // namespace mesh
75 } // namespace stk_classic
76 
77 #endif // STKMESH_TRACE_ENABLED
78 
79 #endif // stk_mesh_DiagWriter_h
std::pair< Entity *, unsigned > EntityProc
Pairing of an entity with a processor rank.
Definition: Types.hpp:111
std::ostream & operator<<(std::ostream &s, const Bucket &k)
Print the part names for which this bucket is a subset.
Definition: Bucket.cpp:239
Sierra Toolkit.
Class Writer implements a runtime selectable diagnostic output writer to aid in the development and d...
Definition: Writer.hpp:49