Skip to content
Snippets Groups Projects
Commit 0fa7f64d authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Use INFO/WARN/ERR instead of std::cout/cerr.

parent 2612d26b
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ int main (int argc, char const* argv[]) ...@@ -98,7 +98,7 @@ int main (int argc, char const* argv[])
for (vector<string>::const_iterator it = filenames.begin(); it != filenames.end(); ++it) for (vector<string>::const_iterator it = filenames.begin(); it != filenames.end(); ++it)
{ {
string filename(*it); string filename(*it);
cout << "Opening file " << filename << " ... " << endl << flush; INFO("Opening file %s", filename.c_str());
string fileExt = getFileExt(filename); string fileExt = getFileExt(filename);
vtkXMLDataReader* reader = NULL; vtkXMLDataReader* reader = NULL;
...@@ -157,8 +157,7 @@ int main (int argc, char const* argv[]) ...@@ -157,8 +157,7 @@ int main (int argc, char const* argv[])
} }
else else
{ {
cout << "Not a valid vtk file ending (vti, vtr, vts, vtp, vtu, vtk)" << ERR("Not a valid vtk file ending (vti, vtr, vts, vtp, vtu, vtk)");
endl;
return 1; return 1;
} }
...@@ -201,7 +200,7 @@ int main (int argc, char const* argv[]) ...@@ -201,7 +200,7 @@ int main (int argc, char const* argv[])
OSG::osgExit(); OSG::osgExit();
cout << "File conversion finished" << endl; INFO("File conversion finished");
return 0; return 0;
} }
...@@ -66,14 +66,22 @@ int main (int argc, char* argv[]) ...@@ -66,14 +66,22 @@ int main (int argc, char* argv[])
if (argc < 3) if (argc < 3)
{ {
std::cout << "Moves mesh nodes and connected elements either by a given value or based on a list." << std::endl; INFO(
std::cout << std::endl; "Moves mesh nodes and connected elements either by a given value "
std::cout << "Usage: " << argv[0] << " <msh-file.msh> <keyword> [<value1>] [<value2>]" << std::endl; "or based on a list.\n");
std::cout << "Available keywords:" << std::endl; INFO("Usage: %s <msh-file.msh> <keyword> [<value1>] [<value2>]",
argv[0]);
INFO("Available keywords:");
//for (std::size_t i=0; i<keywords.size(); i++) //for (std::size_t i=0; i<keywords.size(); i++)
std::cout << "\t" << "-ALL <value1> <value2> : changes the elevation of all mesh nodes by <value2> in direction <value1> [x,y,z]." << std::endl; INFO(
std::cout << "\t" << "-MESH <value1> <value2> : changes the elevation of mesh nodes based on a second mesh <value1> with a search range of <value2>." << std::endl; "\t-ALL <value1> <value2> : changes the elevation of all mesh "
std::cout << "\t" << "-LOWPASS : applies a lowpass filter over node elevation using directly connected nodes." << std::endl; "nodes by <value2> in direction <value1> [x,y,z].");
INFO(
"\t-MESH <value1> <value2> : changes the elevation of mesh nodes "
"based on a second mesh <value1> with a search range of <value2>.");
INFO(
"\t-LOWPASS : applies a lowpass filter over node elevation using "
"directly connected nodes.");
return -1; return -1;
} }
...@@ -84,8 +92,8 @@ int main (int argc, char* argv[]) ...@@ -84,8 +92,8 @@ int main (int argc, char* argv[])
if (msh_name.substr(msh_name.length()-4, 4).compare(".msh") != 0) if (msh_name.substr(msh_name.length()-4, 4).compare(".msh") != 0)
{ {
std::cout << "Error: Parameter 1 should be a msh-file" << std::endl; ERR("Error: Parameter 1 should be a msh-file.");
std::cout << "Usage: " << argv[0] << " <msh-file.gml> <keyword> <value>" << std::endl; INFO("Usage: %s <msh-file.gml> <keyword> <value>", argv[0]);
return -1; return -1;
} }
...@@ -99,9 +107,9 @@ int main (int argc, char* argv[]) ...@@ -99,9 +107,9 @@ int main (int argc, char* argv[])
if (!is_keyword) if (!is_keyword)
{ {
std::cout << "Keyword not recognised. Available keywords:" << std::endl; ERR("Keyword not recognised. Available keywords:");
for (std::size_t i=0; i<keywords.size(); i++) for (auto const& keyword : keywords)
std::cout << keywords[i] << std::endl; INFO("\t%s", keyword.c_str());
return -1; return -1;
} }
...@@ -116,13 +124,14 @@ int main (int argc, char* argv[]) ...@@ -116,13 +124,14 @@ int main (int argc, char* argv[])
{ {
if (argc < 5) if (argc < 5)
{ {
std::cout << "Missing parameter..." << std::endl; ERR("Missing parameter...");
return -1; return -1;
} }
const std::string dir(argv[3]); const std::string dir(argv[3]);
unsigned idx = (dir.compare("x") == 0) ? 0 : (dir.compare("y") == 0) ? 1 : 2; unsigned idx = (dir.compare("x") == 0) ? 0 : (dir.compare("y") == 0) ? 1 : 2;
const double value(strtod(argv[4],0)); const double value(strtod(argv[4],0));
std::cout << "Moving all mesh nodes by " << value << " in direction " << idx << " (" << dir << ")..." << std::endl; INFO("Moving all mesh nodes by %g in direction %d (%s)...", value, idx,
dir.c_str());
//double value(-10); //double value(-10);
const std::size_t nNodes(mesh->getNNodes()); const std::size_t nNodes(mesh->getNNodes());
std::vector<MeshLib::Node*> nodes (mesh->getNodes()); std::vector<MeshLib::Node*> nodes (mesh->getNodes());
...@@ -137,7 +146,7 @@ int main (int argc, char* argv[]) ...@@ -137,7 +146,7 @@ int main (int argc, char* argv[])
{ {
if (argc < 5) if (argc < 5)
{ {
std::cout << "Missing parameter..." << std::endl; ERR("Missing parameter...");
return -1; return -1;
} }
const std::string value (argv[3]); const std::string value (argv[3]);
......
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
* *
*/ */
// ** INCLUDES **
#include "Writer.h" #include "Writer.h"
#include <iostream>
#include <fstream> #include <fstream>
#include <limits> #include <limits>
#include <logog/include/logog.hpp>
namespace BaseLib namespace BaseLib
{ {
namespace IO namespace IO
...@@ -52,7 +52,7 @@ int Writer::writeToFile(std::string const& filename) ...@@ -52,7 +52,7 @@ int Writer::writeToFile(std::string const& filename)
// check file stream // check file stream
if (!fileStream) if (!fileStream)
{ {
std::cerr << "Could not open file " << filename << " !\n"; ERR("Could not open file \"%s\"!", filename.c_str());
return 0; return 0;
} }
......
...@@ -33,7 +33,7 @@ std::vector<GeoLib::Point*> *RapidStnInterface::readStationFile(const std::strin ...@@ -33,7 +33,7 @@ std::vector<GeoLib::Point*> *RapidStnInterface::readStationFile(const std::strin
std::ifstream in(fileName.c_str()); std::ifstream in(fileName.c_str());
if (in.fail()) if (in.fail())
{ {
std::cout << "XmlStnInterface::rapidReadFile() - Can't open xml-file." << std::endl; ERR("XmlStnInterface::rapidReadFile() - Can't open xml-file.");
return NULL; return NULL;
} }
...@@ -53,7 +53,7 @@ std::vector<GeoLib::Point*> *RapidStnInterface::readStationFile(const std::strin ...@@ -53,7 +53,7 @@ std::vector<GeoLib::Point*> *RapidStnInterface::readStationFile(const std::strin
// parse content // parse content
if (std::string(doc.first_node()->name()).compare("OpenGeoSysSTN") != 0) if (std::string(doc.first_node()->name()).compare("OpenGeoSysSTN") != 0)
{ {
std::cout << "XmlStnInterface::readFile() - Unexpected XML root." << std::endl; ERR("XmlStnInterface::readFile() - Unexpected XML root.");
return NULL; return NULL;
} }
...@@ -86,7 +86,7 @@ int RapidStnInterface::rapidReadFile(const std::string &fileName) ...@@ -86,7 +86,7 @@ int RapidStnInterface::rapidReadFile(const std::string &fileName)
std::ifstream in(fileName.c_str()); std::ifstream in(fileName.c_str());
if (in.fail()) if (in.fail())
{ {
std::cout << "XmlStnInterface::rapidReadFile() - Can't open xml-file." << std::endl; ERR("XmlStnInterface::rapidReadFile() - Can't open xml-file.");
return 0; return 0;
} }
...@@ -106,7 +106,7 @@ int RapidStnInterface::rapidReadFile(const std::string &fileName) ...@@ -106,7 +106,7 @@ int RapidStnInterface::rapidReadFile(const std::string &fileName)
// parse content // parse content
if (std::string(doc.first_node()->name()).compare("OpenGeoSysSTN")) if (std::string(doc.first_node()->name()).compare("OpenGeoSysSTN"))
{ {
std::cout << "XmlStnInterface::readFile() - Unexpected XML root." << std::endl; ERR("XmlStnInterface::readFile() - Unexpected XML root.");
return 0; return 0;
} }
...@@ -195,7 +195,11 @@ void RapidStnInterface::readStations(const rapidxml::xml_node<>* station_root, s ...@@ -195,7 +195,11 @@ void RapidStnInterface::readStations(const rapidxml::xml_node<>* station_root, s
} }
} }
else else
std::cout << "XmlStnInterface::rapidReadStations() - Attribute missing in <station> tag ..." << std::endl; {
ERR(
"XmlStnInterface::rapidReadStations() - Attribute missing in "
"<station> tag ...");
}
} }
} }
...@@ -223,12 +227,19 @@ void RapidStnInterface::readStratigraphy( const rapidxml::xml_node<>* strat_root ...@@ -223,12 +227,19 @@ void RapidStnInterface::readStratigraphy( const rapidxml::xml_node<>* strat_root
depth_check = depth; depth_check = depth;
} }
else else
std::cout << "Warning: Skipped layer \"" << horizon_name << "\" in borehole \"" {
<< borehole->getName() << "\" because of thickness 0.0." << std::endl; WARN(
"Warning: Skipped layer \"%s\" in borehole \"%s\" because "
"of thickness 0.0.",
horizon_name.c_str(), borehole->getName().c_str());
}
} }
else else
std::cout << {
"XmlStnInterface::rapidReadStratigraphy() - Attribute missing in <horizon> tag ..." << std::endl; WARN(
"XmlStnInterface::rapidReadStratigraphy() - Attribute missing "
"in <horizon> tag ...");
}
} }
} }
......
...@@ -143,7 +143,7 @@ void Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(Mesh *dest_mes ...@@ -143,7 +143,7 @@ void Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(Mesh *dest_mes
} }
out_src << "#STOP" << "\n"; out_src << "#STOP" << "\n";
out_src.close(); out_src.close();
std::cerr << "no source nodes in dest element " << k << "\n"; ERR("no source nodes in dest element %d", k);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment