9 #ifdef STK_MESH_TRACE_ENABLED 11 #include <stk_util/util/Bootstrap.hpp> 13 #include <stk_mesh/base/DiagWriter.hpp> 14 #include <stk_mesh/base/Entity.hpp> 15 #include <stk_mesh/base/Bucket.hpp> 16 #include <stk_mesh/base/MetaData.hpp> 27 void initDiagWriter(std::ostream& stream)
30 theDiagWriterParser().parse(std::getenv(
"MESHLOG")));
35 ThrowRequireMsg(s_diagWriter != NULL,
"Please call initDiagWwriter before theDiagWriter");
39 DiagWriterParser & theDiagWriterParser()
41 static DiagWriterParser parser;
46 DiagWriterParser::DiagWriterParser()
49 mask(
"entity", (
unsigned long) (LOG_ENTITY),
"Display entity diagnostic information");
50 mask(
"bucket", (
unsigned long) (LOG_BUCKET),
"Display bucket diagnostic information");
51 mask(
"part", (
unsigned long) (LOG_PART),
"Display bucket diagnostic information");
52 mask(
"field", (
unsigned long) (LOG_FIELD),
"Display bucket diagnostic information");
74 return "Marked deleted";
77 ThrowRequireMsg(
false,
"Unknown log " << log);
88 return writer <<
"Part[" << part.name() <<
", " << part.mesh_meta_data_ordinal() <<
"]";
94 Bucket* bucket = NULL;
96 bucket = &(entity.bucket());
100 std::string ownership_info =
"unregistered";
101 std::string entity_key_str;
102 EntityKey key = entity.key();
104 MetaData& meta_data = MetaData::get(*bucket);
105 Part & owned = meta_data.locally_owned_part();
106 Part & shared = meta_data.globally_shared_part();
107 if (bucket->member(owned)) {
108 ownership_info =
"owned";
110 else if (bucket->member(shared)) {
111 ownership_info =
"shared";
113 else if (bucket->size() == 0) {
114 ownership_info =
"marked deleted";
117 ownership_info =
"ghosted";
119 entity_key_str = print_entity_key(meta_data, key);
122 std::ostringstream
out;
123 out <<
"(rank:" << key.rank() <<
",id:" << key.id() <<
")";
124 entity_key_str =
out.str();
127 writer <<
"Entity[key:" << entity_key_str <<
128 ", ownership:" << ownership_info <<
129 ", log:" << log_to_str(entity.log_query()) <<
130 ", owner:" << entity.owner_rank();
133 writer <<
", COMM: ";
135 for ( ; !comm_itr.empty(); ++comm_itr ) {
136 writer <<
"(ghost:" << comm_itr->ghost_id <<
", proc:" << comm_itr->proc <<
") ";
138 return writer <<
"]";
143 return writer <<
"Entity[rank:" << key.rank() <<
", id:" << key.id() <<
"]";
148 return writer <<
"EntityProc[entity:" << *entity_proc.first <<
", proc: " << entity_proc.second <<
"]";
155 int dummy_DiagWriter()
161 #endif // STK_MESH_TRACE_ENABLED
std::ostream & out()
Normal output stream.
std::pair< Entity *, unsigned > EntityProc
Pairing of an entity with a processor rank.
std::ostream & operator<<(std::ostream &s, const Bucket &k)
Print the part names for which this bucket is a subset.
Class Writer implements a runtime selectable diagnostic output writer to aid in the development and d...
Class Bootstrap serves as a bootstrapping mechanism for products in the sierra toolkit and elsewhere...
PairIter< std::vector< EntityCommInfo >::const_iterator > PairIterEntityComm
Span of ( communication-subset-ordinal , process-rank ) pairs for the communication of an entity...