From fd1842fde61d27d739d334d958f997e26ec255b9 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 13 May 2019 14:54:37 +0200 Subject: [PATCH 1/2] add msg level to cout of fnfreader --- libsrc/interface/read_fnf_mesh.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libsrc/interface/read_fnf_mesh.cpp b/libsrc/interface/read_fnf_mesh.cpp index d1cff5fc..3d9f0802 100644 --- a/libsrc/interface/read_fnf_mesh.cpp +++ b/libsrc/interface/read_fnf_mesh.cpp @@ -94,7 +94,7 @@ namespace netgen char ch; string name; sbuf >> ch >> name; - cout << "Title: " << name << endl; + cout << IM(3) << "Title: " << name << endl; } else if (token == "%STATISTICS") { @@ -106,7 +106,7 @@ namespace netgen } else { - cout << "SECTION HEADER, unknown field: " << buf << endl; + cout << IM(1) << "SECTION HEADER, unknown field: " << buf << endl; } } } @@ -142,7 +142,7 @@ namespace netgen } else { - cout << "SECTION ELEM_TYPE, unknown field: " << buf << endl; + cout << IM(1) << "SECTION ELEM_TYPE, unknown field: " << buf << endl; } } } @@ -219,7 +219,7 @@ namespace netgen } else { - cout << "SECTION MATERIALS, unknown field: " << buf << endl; + cout << IM(1) << "SECTION MATERIALS, unknown field: " << buf << endl; } } } @@ -271,7 +271,7 @@ namespace netgen } else { - cout << "SECTION MESH, unknown: " << buf << endl; + cout << IM(1) << "SECTION MESH, unknown: " << buf << endl; } } } @@ -349,7 +349,7 @@ namespace netgen } else { - cout << "SECTION MESH, unknown: " << buf << endl; + cout << IM(1) << "SECTION MESH, unknown: " << buf << endl; } } } @@ -378,10 +378,10 @@ namespace netgen sbuf >> lt->id >> def >> ch >> lt->name >> lt->placement >> lt->valuetype; if (lt->name == "DISPLACEMENT") - cout << "loadtype DISPLACEMENT found" << endl; + cout << IM(3) << "loadtype DISPLACEMENT found" << endl; if (lt->placement != "FACE" && lt->placement != "EDGE" && lt->placement != "NODE") - cout << "unsupported placement " << lt->placement << endl; + cout << IM(1) << "unsupported placement " << lt->placement << endl; loadtypes.Append (lt); } @@ -415,24 +415,24 @@ namespace netgen if (loadtypes[i]->placement == "FACE" && loadtypes[i]->name == "DISPLACEMENT") { mesh.SetUserData ("CONSTRAINT_DISP_FACE", loadtypes[i]->places); - cout << "constrained faces: " << loadtypes[i]->places << endl; + cout << IM(3) << "constrained faces: " << loadtypes[i]->places << endl; } if (loadtypes[i]->placement == "EDGE" && loadtypes[i]->name == "DISPLACEMENT") { mesh.SetUserData ("CONSTRAINT_DISP_EDGE", loadtypes[i]->places); - cout << "constrained edges: " << loadtypes[i]->places << endl; + cout << IM(3) << "constrained edges: " << loadtypes[i]->places << endl; } if (loadtypes[i]->placement == "NODE" && loadtypes[i]->name == "DISPLACEMENT") { mesh.SetUserData ("CONSTRAINT_DISP_NODE", loadtypes[i]->places); - cout << "constrained nodes: " << loadtypes[i]->places << endl; + cout << IM(3) << "constrained nodes: " << loadtypes[i]->places << endl; } } break; } else { - cout << "SECTION LOADS, unknown field: " << buf << endl; + cout << IM(1) << "SECTION LOADS, unknown field: " << buf << endl; } } } @@ -441,11 +441,11 @@ namespace netgen else { - cout << "unknown section " << token << endl; + cout << IM(1) << "unknown section " << token << endl; } } else - cout << "parse line: (" << buf << ")" << endl; + cout << IM(3) << "parse line: (" << buf << ")" << endl; } } } From 953c5bb57c1531466e86d533d2e83fe4d08dbc73 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 13 May 2019 18:17:53 +0200 Subject: [PATCH 2/2] fix printmessage instead of IM --- libsrc/interface/read_fnf_mesh.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/libsrc/interface/read_fnf_mesh.cpp b/libsrc/interface/read_fnf_mesh.cpp index 3d9f0802..a252fcdd 100644 --- a/libsrc/interface/read_fnf_mesh.cpp +++ b/libsrc/interface/read_fnf_mesh.cpp @@ -94,7 +94,7 @@ namespace netgen char ch; string name; sbuf >> ch >> name; - cout << IM(3) << "Title: " << name << endl; + PrintMessage(3, "Title: ", name); } else if (token == "%STATISTICS") { @@ -106,7 +106,7 @@ namespace netgen } else { - cout << IM(1) << "SECTION HEADER, unknown field: " << buf << endl; + PrintMessage(1, "SECTION HEADER, unknown field: ",buf); } } } @@ -142,7 +142,7 @@ namespace netgen } else { - cout << IM(1) << "SECTION ELEM_TYPE, unknown field: " << buf << endl; + PrintMessage(1, "SECTION ELEM_TYPE, unknown field: ", buf); } } } @@ -219,7 +219,7 @@ namespace netgen } else { - cout << IM(1) << "SECTION MATERIALS, unknown field: " << buf << endl; + PrintMessage(1, "SECTION MATERIALS, unknown field: ", buf); } } } @@ -271,7 +271,7 @@ namespace netgen } else { - cout << IM(1) << "SECTION MESH, unknown: " << buf << endl; + PrintMessage(1, "SECTION MESH, unknown: ", buf); } } } @@ -349,7 +349,7 @@ namespace netgen } else { - cout << IM(1) << "SECTION MESH, unknown: " << buf << endl; + PrintMessage(1, "SECTION MESH, unknown: ", buf); } } } @@ -378,10 +378,10 @@ namespace netgen sbuf >> lt->id >> def >> ch >> lt->name >> lt->placement >> lt->valuetype; if (lt->name == "DISPLACEMENT") - cout << IM(3) << "loadtype DISPLACEMENT found" << endl; + PrintMessage(3, "loadtype DISPLACEMENT found"); if (lt->placement != "FACE" && lt->placement != "EDGE" && lt->placement != "NODE") - cout << IM(1) << "unsupported placement " << lt->placement << endl; + PrintMessage(1, "unsupported placement ", lt->placement); loadtypes.Append (lt); } @@ -412,27 +412,29 @@ namespace netgen { for (int i = 0; i < loadtypes.Size(); i++) { + stringstream str; + str << loadtypes[i]->places; if (loadtypes[i]->placement == "FACE" && loadtypes[i]->name == "DISPLACEMENT") { mesh.SetUserData ("CONSTRAINT_DISP_FACE", loadtypes[i]->places); - cout << IM(3) << "constrained faces: " << loadtypes[i]->places << endl; + PrintMessage(3, "constrained faces: ", str.str()); } if (loadtypes[i]->placement == "EDGE" && loadtypes[i]->name == "DISPLACEMENT") { mesh.SetUserData ("CONSTRAINT_DISP_EDGE", loadtypes[i]->places); - cout << IM(3) << "constrained edges: " << loadtypes[i]->places << endl; + PrintMessage(3,"constrained edges: ", str.str()); } if (loadtypes[i]->placement == "NODE" && loadtypes[i]->name == "DISPLACEMENT") { mesh.SetUserData ("CONSTRAINT_DISP_NODE", loadtypes[i]->places); - cout << IM(3) << "constrained nodes: " << loadtypes[i]->places << endl; + PrintMessage(3, "constrained nodes: ", str.str()); } } break; } else { - cout << IM(1) << "SECTION LOADS, unknown field: " << buf << endl; + PrintMessage(1, "SECTION LOADS, unknown field: ", buf); } } } @@ -441,11 +443,11 @@ namespace netgen else { - cout << IM(1) << "unknown section " << token << endl; + PrintMessage(1, "unknown section ", token); } } else - cout << IM(3) << "parse line: (" << buf << ")" << endl; + PrintMessage(3, "parse line: (", buf, ")"); } } }