Loading Unstructured_mesh/Unstructured_mesh.pro.user +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> <!-- Written by QtCreator 4.10.0, 2019-10-02T13:13:57. --> <!-- Written by QtCreator 4.10.0, 2019-10-03T23:49:08. --> <qtcreator> <data> <variable>EnvironmentId</variable> Loading Unstructured_mesh/main.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -693,19 +693,23 @@ void testDebug() { {"treti", 3} }; ConsoleLogger::writeVar(__LINE__, __FILE__, "r", r, "i", i, "c", c, "list", list, "vec", vec, "b", b, "map", m); ConsoleLogger::writeVar(__LINE__, __FILE__,"---", {5,4,3,2}); DBGVAR(r, i, c, list, vec, b, m); } int main() { //testMesh2D(); //testMesh2DLoadAndWrite(); testMesh3D(); //testMesh3D(); //test3DMeshDeformedPrisms(); //testMeshDataContainer(); //testTemplate(); //UnstructuredMesh<5, size_t, double, 6,5,4> m; //m.ComputeElementMeasures(); testDebug(); } debug/consolelogger.h +69 −4 Original line number Diff line number Diff line Loading @@ -4,11 +4,30 @@ #include <fstream> #include <string> /* TODO prefer exportable class to iterable namespace Detail { constexpr bool is_exportable(...) { return false; } template <typename T1> constexpr auto is_exportable(const T1&) -> typename std::enable_if<std::is_class< typename std::remove_reference<decltype(std::cerr << std::declval<const T1&>())>::type >::value ,bool>::type { return true; } }*/ /** * @brief The ConsoleLogger class */ class ConsoleLogger { static void _writeWar(...) { std::cerr << "variable is not exportable" << std::endl; Loading @@ -19,7 +38,9 @@ class ConsoleLogger { static auto _writeWar(const T& b) -> typename std::enable_if<std::is_class< typename std::remove_reference<decltype(std::cerr << b)>::type>::value && !std::is_same<T, bool>::value !std::is_same<T, bool>::value && !std::is_same<T, std::string>::value && !std::is_same<T, const char*>::value >::type { std::cerr << b; Loading @@ -32,12 +53,25 @@ class ConsoleLogger { std::cerr << (b == true ? "true" : "false"); } static void _writeWar(const std::string& str) { std::cerr << '"' << str << '"'; } static void _writeWar(const char* str) { std::cerr << '"' << str << '"'; } template<typename T1, typename T2> static auto _writeWar(const std::pair<T1,T2>& b) { std::cerr << "{ "; _writeWar(b.first); std::cerr << " => "; std::cerr << ", "; _writeWar(b.second); std::cerr << "}"; } template<typename T> Loading @@ -59,6 +93,23 @@ class ConsoleLogger { } } template<typename T> static void _writeWar(const std::initializer_list<T> &list) { auto it = list.begin(); std::cerr << "[ "; while (it != list.end()){ _writeWar(*it); if (++it == list.end()){ std::cerr << " ]"; } else { std::cerr << ", "; } } } public: Loading @@ -80,14 +131,28 @@ public: template<typename VAR_NAME, typename VAR, typename ... REST> static void writeVar(int line, const char* cppFile, VAR_NAME name, VAR value, REST ... rest){ static void writeVar(int line, const char* cppFile, VAR_NAME name,const VAR& value, REST ... rest){ writeVar(line, cppFile, name, value); writeVar(line, cppFile, rest...); } template<typename VAR_NAME, typename VAR> static void writeVar(int line, const char* cppFile, VAR_NAME name, VAR value){ static void writeVar(int line, const char* cppFile, VAR_NAME name,const VAR& value){ #ifdef __linux__ std::cerr << "In file " << cppFile << " at line " << line << " variable \033[0;33m" << name << "\033[0m has value of \033[0;31m"; _writeWar(value); std::cerr << "\033[0m\n"; #else std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; _writeWar(value); std::cerr << "\n"; #endif } template<typename VAR_NAME, typename VAR> static void writeVar(int line, const char* cppFile, VAR_NAME name,const std::initializer_list<VAR>& value){ #ifdef __linux__ std::cerr << "In file " << cppFile << " at line " << line << " variable \033[0;33m" << name << "\033[0m has value of \033[0;31m"; Loading Loading
Unstructured_mesh/Unstructured_mesh.pro.user +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> <!-- Written by QtCreator 4.10.0, 2019-10-02T13:13:57. --> <!-- Written by QtCreator 4.10.0, 2019-10-03T23:49:08. --> <qtcreator> <data> <variable>EnvironmentId</variable> Loading
Unstructured_mesh/main.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -693,19 +693,23 @@ void testDebug() { {"treti", 3} }; ConsoleLogger::writeVar(__LINE__, __FILE__, "r", r, "i", i, "c", c, "list", list, "vec", vec, "b", b, "map", m); ConsoleLogger::writeVar(__LINE__, __FILE__,"---", {5,4,3,2}); DBGVAR(r, i, c, list, vec, b, m); } int main() { //testMesh2D(); //testMesh2DLoadAndWrite(); testMesh3D(); //testMesh3D(); //test3DMeshDeformedPrisms(); //testMeshDataContainer(); //testTemplate(); //UnstructuredMesh<5, size_t, double, 6,5,4> m; //m.ComputeElementMeasures(); testDebug(); }
debug/consolelogger.h +69 −4 Original line number Diff line number Diff line Loading @@ -4,11 +4,30 @@ #include <fstream> #include <string> /* TODO prefer exportable class to iterable namespace Detail { constexpr bool is_exportable(...) { return false; } template <typename T1> constexpr auto is_exportable(const T1&) -> typename std::enable_if<std::is_class< typename std::remove_reference<decltype(std::cerr << std::declval<const T1&>())>::type >::value ,bool>::type { return true; } }*/ /** * @brief The ConsoleLogger class */ class ConsoleLogger { static void _writeWar(...) { std::cerr << "variable is not exportable" << std::endl; Loading @@ -19,7 +38,9 @@ class ConsoleLogger { static auto _writeWar(const T& b) -> typename std::enable_if<std::is_class< typename std::remove_reference<decltype(std::cerr << b)>::type>::value && !std::is_same<T, bool>::value !std::is_same<T, bool>::value && !std::is_same<T, std::string>::value && !std::is_same<T, const char*>::value >::type { std::cerr << b; Loading @@ -32,12 +53,25 @@ class ConsoleLogger { std::cerr << (b == true ? "true" : "false"); } static void _writeWar(const std::string& str) { std::cerr << '"' << str << '"'; } static void _writeWar(const char* str) { std::cerr << '"' << str << '"'; } template<typename T1, typename T2> static auto _writeWar(const std::pair<T1,T2>& b) { std::cerr << "{ "; _writeWar(b.first); std::cerr << " => "; std::cerr << ", "; _writeWar(b.second); std::cerr << "}"; } template<typename T> Loading @@ -59,6 +93,23 @@ class ConsoleLogger { } } template<typename T> static void _writeWar(const std::initializer_list<T> &list) { auto it = list.begin(); std::cerr << "[ "; while (it != list.end()){ _writeWar(*it); if (++it == list.end()){ std::cerr << " ]"; } else { std::cerr << ", "; } } } public: Loading @@ -80,14 +131,28 @@ public: template<typename VAR_NAME, typename VAR, typename ... REST> static void writeVar(int line, const char* cppFile, VAR_NAME name, VAR value, REST ... rest){ static void writeVar(int line, const char* cppFile, VAR_NAME name,const VAR& value, REST ... rest){ writeVar(line, cppFile, name, value); writeVar(line, cppFile, rest...); } template<typename VAR_NAME, typename VAR> static void writeVar(int line, const char* cppFile, VAR_NAME name, VAR value){ static void writeVar(int line, const char* cppFile, VAR_NAME name,const VAR& value){ #ifdef __linux__ std::cerr << "In file " << cppFile << " at line " << line << " variable \033[0;33m" << name << "\033[0m has value of \033[0;31m"; _writeWar(value); std::cerr << "\033[0m\n"; #else std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; _writeWar(value); std::cerr << "\n"; #endif } template<typename VAR_NAME, typename VAR> static void writeVar(int line, const char* cppFile, VAR_NAME name,const std::initializer_list<VAR>& value){ #ifdef __linux__ std::cerr << "In file " << cppFile << " at line " << line << " variable \033[0;33m" << name << "\033[0m has value of \033[0;31m"; Loading