diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 32935f927bdf02f77f280fbf8d82385b81b0ff1d..1477fa7f5192f4352fec78d263f01f8774dcb757 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -68,9 +68,8 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, MeshLib::Mesh* const mesh = MeshLib::IO::readMeshFromFile(mesh_file); if (!mesh) { - ERR("Could not read mesh from \'%s\' file. No mesh added.", + OGS_FATAL("Could not read mesh from \'%s\' file. No mesh added.", mesh_file.c_str()); - std::abort(); } _mesh_vec.push_back(mesh); @@ -193,8 +192,7 @@ void ProjectData::buildProcesses() } else { - ERR("Unknown process type: %s", type.c_str()); - std::abort(); + OGS_FATAL("Unknown process type: %s", type.c_str()); } } @@ -299,9 +297,8 @@ void ProjectData::parseParameters(BaseLib::ConfigTree const& parameters_config) } else { - ERR("Cannot construct property of given type \'%s\'.", + OGS_FATAL("Cannot construct property of given type \'%s\'.", type.c_str()); - std::abort(); } } } @@ -338,8 +335,7 @@ void ProjectData::parseTimeStepping(BaseLib::ConfigTree const& timestepping_conf if (!_time_loop) { - ERR("Initialization of time loop failed."); - std::abort(); + OGS_FATAL("Initialization of time loop failed."); } } @@ -391,13 +387,11 @@ createPiecewiseLinearInterpolation(BaseLib::ConfigTree const& config) auto values = config.getConfParam<std::vector<double>>("values"); if (coords.empty() || values.empty()) { - ERR("The given co-ordinates or values vector is empty."); - std::abort(); + OGS_FATAL("The given co-ordinates or values vector is empty."); } if (coords.size() != values.size()) { - ERR("The given co-ordinates and values vector sizes are different."); - std::abort(); + OGS_FATAL("The given co-ordinates and values vector sizes are different."); } return std::unique_ptr<MathLib::PiecewiseLinearInterpolation>{ diff --git a/Applications/ApplicationsLib/UncoupledProcessesTimeLoop.h b/Applications/ApplicationsLib/UncoupledProcessesTimeLoop.h index 0a14ed9db546ac161537f3779cfb789be0386256..ee12027dba70c443f34cad9574e048b14c23ae78 100644 --- a/Applications/ApplicationsLib/UncoupledProcessesTimeLoop.h +++ b/Applications/ApplicationsLib/UncoupledProcessesTimeLoop.h @@ -136,14 +136,12 @@ private: *nonlinear_solver_newton, time_disc, *ode_newton }; } else { - ERR("You are trying to solve a non-Newton-ready ODE with the" + OGS_FATAL("You are trying to solve a non-Newton-ready ODE with the" " Newton-Raphson method. Aborting"); - std::abort(); } } else { - ERR("Encountered unknown nonlinear solver type. Aborting"); - std::abort(); + OGS_FATAL("Encountered unknown nonlinear solver type. Aborting"); } } @@ -242,8 +240,7 @@ createUncoupledProcessesTimeLoop(BaseLib::ConfigTree const& conf) } else if (type == "FixedTimeStepping") { timestepper = NumLib::FixedTimeStepping::newInstance(conf); } else { - ERR("Unknown timestepper type: `%s'.", type.c_str()); - std::abort(); + OGS_FATAL("Unknown timestepper type: `%s'.", type.c_str()); } using TimeLoop = UncoupledProcessesTimeLoop<Matrix, Vector>; diff --git a/Applications/Utils/MeshGeoTools/ComputeSurfaceNodeIDsInPolygonalRegion.cpp b/Applications/Utils/MeshGeoTools/ComputeSurfaceNodeIDsInPolygonalRegion.cpp index b76d00b4ef9a205f4679dd0a137266bae65ea7b7..6f953933fd80c0b45abdd8241303a8db5fc655bc 100644 --- a/Applications/Utils/MeshGeoTools/ComputeSurfaceNodeIDsInPolygonalRegion.cpp +++ b/Applications/Utils/MeshGeoTools/ComputeSurfaceNodeIDsInPolygonalRegion.cpp @@ -18,7 +18,7 @@ #include "Applications/ApplicationsLib/LogogSetup.h" -#include "BaseLib/StringTools.h" +#include "BaseLib/Error.h" #include "BaseLib/FileTools.h" #include "MeshLib/IO/readMeshFromFile.h" @@ -39,13 +39,11 @@ void writeToFile(std::string const& id_area_fname, std::string const& csv_fname, { std::ofstream ids_and_area_out(id_area_fname); if (!ids_and_area_out) { - ERR("Unable to open the file \"%s\" - aborting.", id_area_fname.c_str()); - std::abort(); + OGS_FATAL("Unable to open the file \"%s\" - aborting.", id_area_fname.c_str()); } std::ofstream csv_out(csv_fname); if (!csv_out) { - ERR("Unable to open the file \"%s\" - aborting.", csv_fname.c_str()); - std::abort(); + OGS_FATAL("Unable to open the file \"%s\" - aborting.", csv_fname.c_str()); } ids_and_area_out << std::setprecision(20); diff --git a/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp b/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp index 26bb6c6fab797410de3c453fc6b9e0df67fd58c6..94c6b95f5b9dd7e88d362c5f037a1a86aa89c557 100644 --- a/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp +++ b/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp @@ -18,6 +18,7 @@ #include "Applications/ApplicationsLib/LogogSetup.h" +#include "BaseLib/Error.h" #include "BaseLib/FileTools.h" #include "MeshLib/IO/readMeshFromFile.h" @@ -33,13 +34,11 @@ void writeToFile(std::string const& id_area_fname, std::string const& csv_fname, { std::ofstream ids_and_area_out(id_area_fname); if (!ids_and_area_out) { - ERR("Unable to open the file \"%s\" - aborting.", id_area_fname.c_str()); - std::abort(); + OGS_FATAL("Unable to open the file \"%s\" - aborting.", id_area_fname.c_str()); } std::ofstream csv_out(csv_fname); if (!csv_out) { - ERR("Unable to open the file \"%s\" - aborting.", csv_fname.c_str()); - std::abort(); + OGS_FATAL("Unable to open the file \"%s\" - aborting.", csv_fname.c_str()); } ids_and_area_out.precision(std::numeric_limits<double>::digits10); diff --git a/BaseLib/ConfigTree.cpp b/BaseLib/ConfigTree.cpp index c43f8ff73a32e90c29d17bfc1c00d36b47f4c3ec..da168192aa5fd50bf1499709135d86f9e538ba7f 100644 --- a/BaseLib/ConfigTree.cpp +++ b/BaseLib/ConfigTree.cpp @@ -7,9 +7,12 @@ * */ -#include <logog/include/logog.hpp> #include "ConfigTree.h" +#include <logog/include/logog.hpp> + +#include "Error.h" + // Explicitly instantiate the boost::property_tree::ptree which is a typedef to // the following basic_ptree. template class boost::property_tree::basic_ptree<std::string, std::string, @@ -30,12 +33,10 @@ ConfigTree(PTree const& tree, : _tree(&tree), _filename(filename), _onerror(error_cb), _onwarning(warning_cb) { if (!_onerror) { - ERR("ConfigTree: No valid error handler provided."); - std::abort(); + OGS_FATAL("ConfigTree: No valid error handler provided."); } if (!_onwarning) { - ERR("ConfigTree: No valid warning handler provided."); - std::abort(); + OGS_FATAL("ConfigTree: No valid warning handler provided."); } } @@ -193,7 +194,6 @@ void ConfigTree::ignoreConfParamAll(const std::string ¶m) const void ConfigTree::error(const std::string& message) const { _onerror(_filename, _path, message); - std::abort(); } void ConfigTree::warning(const std::string& message) const @@ -205,9 +205,8 @@ void ConfigTree::warning(const std::string& message) const void ConfigTree::onerror(const std::string& filename, const std::string& path, const std::string& message) { - ERR("ConfigTree: In file `%s' at path <%s>: %s", + OGS_FATAL("ConfigTree: In file `%s' at path <%s>: %s", filename.c_str(), path.c_str(), message.c_str()); - std::abort(); } void ConfigTree::onwarning(const std::string& filename, const std::string& path, diff --git a/BaseLib/ConfigTree.h b/BaseLib/ConfigTree.h index e2f637ba46f6b045430a74e3d99c9ee414f7d766..8629025be33be30d7f9ea465a9361459d2395abc 100644 --- a/BaseLib/ConfigTree.h +++ b/BaseLib/ConfigTree.h @@ -496,7 +496,7 @@ public: ~ConfigTree(); //! Default error callback function - //! Will print an error message and call std::abort() + //! Will throw std::runtime_error static void onerror(std::string const& filename, std::string const& path, std::string const& message); @@ -532,11 +532,7 @@ private: /*! Called if an error occurs. Will call the error callback. * - * This method only acts as a helper method. - * - * This method finally calls <tt>std::abort()</tt>. In order to prevent that, - * a custom error callback that breaks out of the normal control flow---e.g., by throwing - * an exception---must be provided. + * This method only acts as a helper method and throws std::runtime_error. */ #if defined(_MSC_VER) && _MSC_VER < 1900 // 1900 == MSCV 14.0 == Visual Studio 2015 diff --git a/BaseLib/ConfigTreeUtil.cpp b/BaseLib/ConfigTreeUtil.cpp index f85898d12f88c54c469d0f1207f4c81d97d70a23..fcb8af597263e27bef96ac55518dc69fb552be8a 100644 --- a/BaseLib/ConfigTreeUtil.cpp +++ b/BaseLib/ConfigTreeUtil.cpp @@ -7,10 +7,12 @@ * */ +#include "ConfigTreeUtil.h" + #include <boost/property_tree/xml_parser.hpp> #include <logog/include/logog.hpp> -#include "ConfigTreeUtil.h" +#include "Error.h" namespace BaseLib { @@ -57,9 +59,8 @@ makeConfigTree(const std::string& filepath, const bool be_ruthless, boost::property_tree::xml_parser::no_comments | boost::property_tree::xml_parser::trim_whitespace); } catch (boost::property_tree::xml_parser_error e) { - ERR("Error while parsing XML file `%s' at line %lu: %s.", + OGS_FATAL("Error while parsing XML file `%s' at line %lu: %s.", e.filename().c_str(), e.line(), e.message().c_str()); - std::abort(); } DBUG("Project configuration from file \'%s\' read.", filepath.c_str()); @@ -67,9 +68,8 @@ makeConfigTree(const std::string& filepath, const bool be_ruthless, if (auto child = ptree.get_child_optional(toplevel_tag)) { return ConfigTreeTopLevel(filepath, be_ruthless, std::move(*child)); } else { - ERR("Tag <%s> has not been found in file `%s'.", + OGS_FATAL("Tag <%s> has not been found in file `%s'.", toplevel_tag.c_str(), filepath.c_str()); - std::abort(); } } diff --git a/BaseLib/uniqueInsert.h b/BaseLib/uniqueInsert.h index 2db9220bfb2bd17413c94b60d40807a357358ecf..6211283edf5d835bbb73ba3401e9fc8c8c31bc45 100644 --- a/BaseLib/uniqueInsert.h +++ b/BaseLib/uniqueInsert.h @@ -17,7 +17,7 @@ #include <algorithm> -#include "StringTools.h" +#include "Error.h" namespace BaseLib { @@ -39,8 +39,7 @@ void insertIfKeyUniqueElseError( { auto const inserted = map.emplace(key, std::forward<Value>(value)); if (!inserted.second) { // insertion failed, i.e., key already exists - ERR("%s Key `%s' already exists.", error_message.c_str(), tostring(key).c_str()); - std::abort(); + OGS_FATAL("%s Key `%s' already exists.", error_message.c_str(), tostring(key).c_str()); } } @@ -58,14 +57,12 @@ void insertIfKeyValueUniqueElseError( if (std::find_if(map.cbegin(), map.cend(), value_compare) != map.cend()) { - ERR("%s Value `%s' already exists.", error_message.c_str(), tostring(value).c_str()); - std::abort(); + OGS_FATAL("%s Value `%s' already exists.", error_message.c_str(), tostring(value).c_str()); } auto const inserted = map.emplace(key, std::forward<Value>(value)); if (!inserted.second) { // insertion failed, i.e., key already exists - ERR("%s Key `%s' already exists.", error_message.c_str(), tostring(key).c_str()); - std::abort(); + OGS_FATAL("%s Key `%s' already exists.", error_message.c_str(), tostring(key).c_str()); } } @@ -81,8 +78,7 @@ getOrError( { auto it = map.find(key); if (it == map.end()) { - ERR("%s Key `%s' does not exist.", error_message.c_str(), tostring(key).c_str()); - std::abort(); + OGS_FATAL("%s Key `%s' does not exist.", error_message.c_str(), tostring(key).c_str()); } return it->second; @@ -96,8 +92,7 @@ getOrError( { auto it = map.find(key); if (it == map.end()) { - ERR("%s Key `%s' does not exist.", error_message.c_str(), tostring(key).c_str()); - std::abort(); + OGS_FATAL("%s Key `%s' does not exist.", error_message.c_str(), tostring(key).c_str()); } return it->second; diff --git a/GeoLib/AABB.h b/GeoLib/AABB.h index 403364e7a0bc4abf81e3d058a4d8626346d73713..6643a1bb1befb2bbd1b5e405a64a29c6a7d6bbaf 100644 --- a/GeoLib/AABB.h +++ b/GeoLib/AABB.h @@ -27,6 +27,7 @@ #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "MathLib/Point3d.h" #include "MathLib/MathTools.h" @@ -88,8 +89,7 @@ public: { if (std::distance(first,last) <= 0) { - ERR("AABB::AABB(InputIterator first, InputIterator last): first > last"); - std::abort(); + OGS_FATAL("AABB::AABB(InputIterator first, InputIterator last): first > last"); } init(*first); InputIterator it(first); diff --git a/GeoLib/AnalyticalGeometry.cpp b/GeoLib/AnalyticalGeometry.cpp index 48226fd895f0edf40395969728632244a56552e5..3855ca0970bc18d0fd46c0d3a755d1fdc24298fb 100644 --- a/GeoLib/AnalyticalGeometry.cpp +++ b/GeoLib/AnalyticalGeometry.cpp @@ -20,6 +20,8 @@ #include <logog/include/logog.hpp> +#include "BaseLib/StringTools.h" + #include "Polyline.h" #include "PointVec.h" @@ -622,11 +624,10 @@ std::vector<MathLib::Point3d> lineSegmentIntersect2d( std::stringstream err; err.precision(std::numeric_limits<double>::digits10); err << ab << " x " << cd; - ERR( + OGS_FATAL( "The case of parallel line segments (%s) is not handled yet. " "Aborting.", err.str().c_str()); - std::abort(); } // check if d in (ab) @@ -651,11 +652,10 @@ std::vector<MathLib::Point3d> lineSegmentIntersect2d( std::stringstream err; err.precision(std::numeric_limits<double>::digits10); err << ab << " x " << cd; - ERR( + OGS_FATAL( "The case of parallel line segments (%s) " "is not handled yet. Aborting.", err.str().c_str()); - std::abort(); } return std::vector<MathLib::Point3d>(); } diff --git a/GeoLib/GeoType.cpp b/GeoLib/GeoType.cpp index 4162b062e83fc1d7435301619533b462f675e9c8..d91b632db1a310d8afe5a6e45b1ee8499d5fd3ab 100644 --- a/GeoLib/GeoType.cpp +++ b/GeoLib/GeoType.cpp @@ -16,6 +16,8 @@ #include <cstdlib> +#include "BaseLib/Error.h" + namespace GeoLib { @@ -28,8 +30,9 @@ std::string convertGeoTypeToString (GEOTYPE geo_type) case GEOTYPE::SURFACE: return "SURFACE"; } - std::abort(); // Cannot happen, because switch covers all cases. - // Used to silence compiler warning. + // Cannot happen, because switch covers all cases. + // Used to silence compiler warning. + OGS_FATAL("convertGeoTypeToString(): Given geo type is not supported"); } } // end namespace GeoLib diff --git a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp index 6c476c09d98132b43f4f996add767f9be952e85d..ed14e6cfe3d1a06278beb5d2b35ea1c54701955c 100644 --- a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp @@ -12,11 +12,11 @@ * */ +#include "BoostXmlGmlInterface.h" + #include <boost/property_tree/xml_parser.hpp> #include <logog/include/logog.hpp> -#include "BoostXmlGmlInterface.h" - #include "BaseLib/ConfigTreeUtil.h" #include "BaseLib/uniqueInsert.h" #include "GeoLib/GEOObjects.h" @@ -61,8 +61,7 @@ bool BoostXmlGmlInterface::readFile(const std::string &fname) auto geo_name = doc->getConfParam<std::string>("name"); if (geo_name.empty()) { - ERR("BoostXmlGmlInterface::readFile(): <name> tag is empty."); - std::abort(); + OGS_FATAL("BoostXmlGmlInterface::readFile(): <name> tag is empty."); } //! \ogs_file_param{gml__points} @@ -128,8 +127,7 @@ void BoostXmlGmlInterface::readPoints(BaseLib::ConfigTree const& pointsRoot, if (auto const p_name = pt.getConfAttributeOptional<std::string>("name")) { if (p_name->empty()) { - ERR("Empty point name found in geometry file."); - std::abort(); + OGS_FATAL("Empty point name found in geometry file."); } BaseLib::insertIfKeyUniqueElseError(pnt_names, *p_name, p_size, @@ -160,8 +158,7 @@ void BoostXmlGmlInterface::readPolylines( if (auto const p_name = pl.getConfAttributeOptional<std::string>("name")) { if (p_name->empty()) { - ERR("Empty polyline name found in geometry file."); - std::abort(); + OGS_FATAL("Empty polyline name found in geometry file."); } BaseLib::insertIfKeyUniqueElseError(ply_names, *p_name, polylines.size()-1, @@ -201,8 +198,7 @@ void BoostXmlGmlInterface::readSurfaces( if (auto const s_name = sfc.getConfAttributeOptional<std::string>("name")) { if (s_name->empty()) { - ERR("Empty surface name found in geometry file."); - std::abort(); + OGS_FATAL("Empty surface name found in geometry file."); } BaseLib::insertIfKeyUniqueElseError(sfc_names, *s_name, surfaces.size()-1, diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index c00836551df11e2f21e1238230596e7d88bf40eb..efcd5d72ba6a83009e79e0c48756e0d73ab7c5dc 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -12,12 +12,11 @@ * */ -// STL -#include <algorithm> +#include "Polyline.h" +#include <algorithm> #include <logog/include/logog.hpp> - -#include "Polyline.h" +#include "BaseLib/Error.h" #include "AnalyticalGeometry.h" namespace GeoLib @@ -512,7 +511,7 @@ Polyline::SegmentIterator& Polyline::SegmentIterator::operator+=( static_cast<std::vector<GeoLib::Point>::size_type>(n); } if (_segment_number > _polyline->getNumberOfSegments()) - std::abort(); + OGS_FATAL(""); return *this; } @@ -535,7 +534,7 @@ Polyline::SegmentIterator& Polyline::SegmentIterator::operator-=( static_cast<std::vector<GeoLib::Point>::size_type>(-n); } if (_segment_number > _polyline->getNumberOfSegments()) - std::abort(); + OGS_FATAL(""); return *this; } diff --git a/GeoLib/SurfaceGrid.cpp b/GeoLib/SurfaceGrid.cpp index a109aa1b43e8e36a245fdc53d7f30904f16e9a2e..aaddaa4b457b1667b3128186f35126fb6ec7920f 100644 --- a/GeoLib/SurfaceGrid.cpp +++ b/GeoLib/SurfaceGrid.cpp @@ -15,11 +15,13 @@ #include <logog/include/logog.hpp> -#include "Surface.h" -#include "Triangle.h" +#include "BaseLib/Error.h" #include "MathLib/Point3d.h" +#include "Surface.h" +#include "Triangle.h" + namespace GeoLib { SurfaceGrid::SurfaceGrid(Surface const*const sfc) : @@ -124,7 +126,7 @@ void SurfaceGrid::sortTrianglesInGridCells(Surface const*const sfc) "grid.", l, p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2] ); - std::abort(); + OGS_FATAL(""); } } } diff --git a/GeoLib/TemplateVec.h b/GeoLib/TemplateVec.h index c10fc8a2c29174e3037feefc907230301eb1f359..6e9e98a7ddd814f8b1e21c9be518cfaddffe4131 100644 --- a/GeoLib/TemplateVec.h +++ b/GeoLib/TemplateVec.h @@ -25,6 +25,8 @@ #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" + namespace GeoLib { /** @@ -60,8 +62,7 @@ public: { if (_data_vec == nullptr) { - ERR("Constructor TemplateVec: vector of data elements is a nullptr."); - std::abort(); + OGS_FATAL("Constructor TemplateVec: vector of data elements is a nullptr."); } if (!_name_id_map) diff --git a/MaterialsLib/Adsorption/Reaction.cpp b/MaterialsLib/Adsorption/Reaction.cpp index 0a571b1ba3b540cc6ff3b2d3ce23161f82893410..ae6f19a9c2c81936b72debbc14a2760abf7dbcb7 100644 --- a/MaterialsLib/Adsorption/Reaction.cpp +++ b/MaterialsLib/Adsorption/Reaction.cpp @@ -9,6 +9,8 @@ #include <logog/include/logog.hpp> +#include "BaseLib/StringTools.h" + #include "Reaction.h" #include "Density100MPa.h" @@ -58,8 +60,7 @@ newInstance(BaseLib::ConfigTree const& conf) else if (type == "CaOH2") return std::unique_ptr<Reaction>(new ReactionCaOH2(conf)); - ERR("Unknown reactive system: %s.", type.c_str()); - std::abort(); + OGS_FATAL("Unknown reactive system: %s.", type.c_str()); return nullptr; } diff --git a/MaterialsLib/Adsorption/ReactionCaOH2.cpp b/MaterialsLib/Adsorption/ReactionCaOH2.cpp index fc3df793dc66050ee82e8b938d88e9c1e5184689..89c3191e3e6af23cdfcda686795713530c17eb47 100644 --- a/MaterialsLib/Adsorption/ReactionCaOH2.cpp +++ b/MaterialsLib/Adsorption/ReactionCaOH2.cpp @@ -10,6 +10,7 @@ #include "ReactionCaOH2.h" #include <cassert> #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "MaterialsLib/PhysicalConstant.h" #include "Adsorption.h" @@ -40,9 +41,7 @@ ReactionCaOH2::getEnthalpy(const double, const double, const double) const double ReactionCaOH2::getReactionRate(const double, const double, const double, const double) const { - ERR("get_reaction_rate do not call directly"); - std::abort(); - return -1.0; + OGS_FATAL("get_reaction_rate do not call directly"); } diff --git a/MaterialsLib/Adsorption/ReactionInert.h b/MaterialsLib/Adsorption/ReactionInert.h index 7d53a28eec83381ada00e109182c709c8c673b15..48f4a03761e287138f90ce6dcdd06374dc13c513 100644 --- a/MaterialsLib/Adsorption/ReactionInert.h +++ b/MaterialsLib/Adsorption/ReactionInert.h @@ -10,6 +10,8 @@ #ifndef MATERIALSLIB_ADSORPTION_REACTIONINERT_H #define MATERIALSLIB_ADSORPTION_REACTIONINERT_H +#include "BaseLib/Error.h" + #include "Reaction.h" namespace Adsorption @@ -27,9 +29,7 @@ public: double getReactionRate(const double /*p_Ads*/, const double /*T_Ads*/, const double /*M_Ads*/, const double /*loading*/) const override { - ERR("Method getReactionRate() should never be called directly"); - std::abort(); - return 0.0; + OGS_FATAL("Method getReactionRate() should never be called directly") } }; diff --git a/MaterialsLib/Adsorption/ReactionSinusoidal.h b/MaterialsLib/Adsorption/ReactionSinusoidal.h index 42415991a39e1afec229368819d84f67f313bf6b..71f24a728859d3d7e125e4e1117ae383898964b3 100644 --- a/MaterialsLib/Adsorption/ReactionSinusoidal.h +++ b/MaterialsLib/Adsorption/ReactionSinusoidal.h @@ -14,6 +14,7 @@ #include "Reaction.h" #include "BaseLib/ConfigTree.h" +#include "BaseLib/StringTools.h" namespace Adsorption { @@ -36,9 +37,7 @@ public: double getReactionRate(const double /*p_Ads*/, const double /*T_Ads*/, const double /*M_Ads*/, const double /*loading*/) const override { - ERR("Method getReactionRate() should never be called directly"); - std::abort(); - return 0.0; + OGS_FATAL("Method getReactionRate() should never be called directly"); } private: diff --git a/MathLib/InterpolationAlgorithms/LinearIntervalInterpolation.h b/MathLib/InterpolationAlgorithms/LinearIntervalInterpolation.h index 08c94b4fa85f8e05ccfa6986d949c00fceb0c051..bfd861295375fb257f89872c52f3c662b5903f7d 100644 --- a/MathLib/InterpolationAlgorithms/LinearIntervalInterpolation.h +++ b/MathLib/InterpolationAlgorithms/LinearIntervalInterpolation.h @@ -15,7 +15,7 @@ #ifndef LINEARINTERVALINTERPOLATION_H_ #define LINEARINTERVALINTERPOLATION_H_ -#include <stdexcept> +#include "BaseLib/Error.h" namespace MathLib { @@ -66,7 +66,7 @@ LinearIntervalInterpolation<NUMERIC_TYPE>::LinearIntervalInterpolation(NUMERIC_T _m (d-c), _n(0.0) { if (b == a) { - throw std::runtime_error("LinearIntervalInterpolation::LinearIntervalInterpolation: a == b, empty interval"); + OGS_FATAL("LinearIntervalInterpolation::LinearIntervalInterpolation: a == b, empty interval"); } _m /= (b-a); _n = c - _m * a; diff --git a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp index e519610b7dcdd1277e263a9caad823d060810ab1..2ff70a8b99202ba26dde215aefe81ab566e37909 100644 --- a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp +++ b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp @@ -133,8 +133,7 @@ EigenLinearSolver::EigenLinearSolver( break; } case EigenOption::SolverType::INVALID: - ERR("Invalid Eigen linear solver type. Aborting."); - std::abort(); + OGS_FATAL("Invalid Eigen linear solver type. Aborting."); } } diff --git a/MathLib/LinAlg/Eigen/EigenTools.h b/MathLib/LinAlg/Eigen/EigenTools.h index 9d533e70de4db171721a13bd83d0c785175296bc..7f18e8c959aa5a3182adae6e8191611fc2aed205 100644 --- a/MathLib/LinAlg/Eigen/EigenTools.h +++ b/MathLib/LinAlg/Eigen/EigenTools.h @@ -13,6 +13,7 @@ #include <vector> #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "EigenMatrix.h" // for EigenMatrix::IndexType namespace MathLib @@ -41,8 +42,7 @@ void applyKnownSolution(Eigen::MatrixXd &A, Eigen::VectorXd &b, Eigen::VectorXd (void) A; (void) b; (void) _vec_knownX_id; (void) _vec_knownX_x; (void) penalty_scaling; - ERR("Method not implemented."); // TODO implement - std::abort(); + OGS_FATAL("Method not implemented."); // TODO implement } } // MathLib diff --git a/MathLib/LinAlg/Lis/LisMatrix.cpp b/MathLib/LinAlg/Lis/LisMatrix.cpp index 40d78d655e7add78905f3644e8e5be66136de2af..9b324f503aa76b875e60d8aa3d94dd0f35fdc370 100644 --- a/MathLib/LinAlg/Lis/LisMatrix.cpp +++ b/MathLib/LinAlg/Lis/LisMatrix.cpp @@ -19,6 +19,7 @@ #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "LisVector.h" #include "LisCheck.h" @@ -109,8 +110,7 @@ void LisMatrix::write(const std::string &filename) const { if (!_is_assembled) { - ERR("LisMatrix::write(): matrix not assembled."); - std::abort(); + OGS_FATAL("LisMatrix::write(): matrix not assembled."); } lis_output_matrix(_AA, LIS_FMT_MM, const_cast<char*>(filename.c_str())); } @@ -137,8 +137,7 @@ void LisMatrix::multiply(const LisVector &x, LisVector &y) const { if (!_is_assembled) { - ERR("LisMatrix::multiply(): matrix not assembled."); - std::abort(); + OGS_FATAL("LisMatrix::multiply(): matrix not assembled."); } int ierr = lis_matvec(_AA, const_cast<LisVector*>(&x)->getRawVector(), y.getRawVector()); checkLisError(ierr); diff --git a/MathLib/Nonlinear/Root1D.h b/MathLib/Nonlinear/Root1D.h index f015d66417ca1d8addfc54f3152e7f0254fbeda5..d5798d668af4eb1c21ed28c6ad987e8301f6222c 100644 --- a/MathLib/Nonlinear/Root1D.h +++ b/MathLib/Nonlinear/Root1D.h @@ -15,6 +15,7 @@ #include <limits> #include <type_traits> #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" namespace MathLib { @@ -62,9 +63,8 @@ public: } else if (detail::almost_zero(_fb)) { _a = _b; } else if (detail::same_sign(_fa, _fb)) { - ERR("Regula falsi cannot be done, because the function values" + OGS_FATAL("Regula falsi cannot be done, because the function values" " at the interval ends have the same sign."); - std::abort(); } } diff --git a/MathLib/ODE/CVodeSolver.cpp b/MathLib/ODE/CVodeSolver.cpp index 97112d43b16a1923f1e58b6e1aa2112182985bcf..3a41d5f210cea76f132129af7315814946343050 100644 --- a/MathLib/ODE/CVodeSolver.cpp +++ b/MathLib/ODE/CVodeSolver.cpp @@ -34,9 +34,8 @@ void check_error(std::string const& f_name, int const error_flag) { if (error_flag != CV_SUCCESS) { - ERR("CVodeSolver: %s failed with error flag %d.", f_name.c_str(), - error_flag); - std::abort(); + OGS_FATAL("CVodeSolver: %s failed with error flag %d.", f_name.c_str(), + error_flag)); } } @@ -148,8 +147,7 @@ CVodeSolverImpl::CVodeSolverImpl(const BaseLib::ConfigTree& config, } else { - ERR("unknown linear multistep method: %s", param->c_str()); - std::abort(); + OGS_FATAL("unknown linear multistep method: %s", param->c_str())); } } @@ -169,8 +167,7 @@ CVodeSolverImpl::CVodeSolverImpl(const BaseLib::ConfigTree& config, } else { - ERR("unknown nonlinear solver iteration: %s", param->c_str()); - std::abort(); + OGS_FATAL("unknown nonlinear solver iteration: %s", param->c_str())); } } @@ -183,8 +180,7 @@ CVodeSolverImpl::CVodeSolverImpl(const BaseLib::ConfigTree& config, if (_cvode_mem == nullptr || _y == nullptr || _abstol == nullptr) { - ERR("couldn't allocate storage for CVode solver."); - std::abort(); + OGS_FATAL("couldn't allocate storage for CVode solver.")); } auto f_wrapped = [](const realtype t, const N_Vector y, N_Vector ydot, diff --git a/MathLib/ODE/ODESolverBuilder.h b/MathLib/ODE/ODESolverBuilder.h index 48ddb3a769cb4e4d7ac8d1cbf4e107796fa11aa9..9853faea4d1d50772597163e5aa7a4c50ae5782e 100644 --- a/MathLib/ODE/ODESolverBuilder.h +++ b/MathLib/ODE/ODESolverBuilder.h @@ -12,6 +12,7 @@ #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "ODESolver.h" #include "ConcreteODESolver.h" @@ -45,10 +46,9 @@ std::unique_ptr<ODESolver<NumEquations>> createODESolver( #endif (void)config; // Unused parameter warning if no library is available. - ERR( + OGS_FATAL( "No ODE solver could be created. Maybe it is because you did not build" " OGS6 with support for any external ODE solver library."); - std::abort(); } //! @} diff --git a/MeshLib/IO/VtkIO/PVDFile.cpp b/MeshLib/IO/VtkIO/PVDFile.cpp index 0dbc8167981cdce6b0c9307c02d0bbf7f0cd6a41..ff896e68817d80494b8fe9b3e6b77db5df9e0480 100644 --- a/MeshLib/IO/VtkIO/PVDFile.cpp +++ b/MeshLib/IO/VtkIO/PVDFile.cpp @@ -13,6 +13,7 @@ #include <iomanip> #include <limits> #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" namespace MeshLib { @@ -25,8 +26,7 @@ void PVDFile::addVTUFile(const std::string &vtu_fname, double timestep) std::ofstream fh(_pvd_filename.c_str()); if (!fh) { - ERR("could not open file `%s'", _pvd_filename.c_str()); - std::abort(); + OGS_FATAL("could not open file `%s'", _pvd_filename.c_str()); } fh << std::setprecision(std::numeric_limits<double>::digits10); diff --git a/MeshLib/MeshSearch/MeshElementGrid.cpp b/MeshLib/MeshSearch/MeshElementGrid.cpp index 358ea28d18499ba1ea15ac37ab2e8cf6604d2e6a..4123618f5c20cc414728a9d7878b4ffab3ddb2f4 100644 --- a/MeshLib/MeshSearch/MeshElementGrid.cpp +++ b/MeshLib/MeshSearch/MeshElementGrid.cpp @@ -114,9 +114,8 @@ void MeshElementGrid::sortElementsInGridCells(MeshLib::Mesh const& sfc_mesh) { for (auto const element : sfc_mesh.getElements()) { if (! sortElementInGridCells(*element)) { - ERR("Sorting element (id=%d) into mesh element grid.", + OGS_FATAL("Sorting element (id=%d) into mesh element grid.", element->getID()); - std::abort(); } } } diff --git a/MeshLib/MeshSubsets.h b/MeshLib/MeshSubsets.h index ec0a9ddbf2d90f8b9c55009ddae5928a1a76eb1f..bc2ec50a821aa05dbe03c19b9dbf900d077b3350 100644 --- a/MeshLib/MeshSubsets.h +++ b/MeshLib/MeshSubsets.h @@ -21,6 +21,7 @@ #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "MeshSubset.h" namespace MeshLib @@ -48,8 +49,7 @@ public: { if (!areMeshSubsetMeshesUnique()) { - ERR("Mesh ids of input mesh subsets are not unique."); - std::abort(); + OGS_FATAL("Mesh ids of input mesh subsets are not unique."); } _n_total_items = std::accumulate(first, last, 0u, diff --git a/NumLib/DOF/MeshComponentMap.cpp b/NumLib/DOF/MeshComponentMap.cpp index 7b1cf68dfeb491700f7ab76dde0d957c947fdb8c..e7c393f9ab2246b56c1aa5396969c4b0fb8d73ed 100644 --- a/NumLib/DOF/MeshComponentMap.cpp +++ b/NumLib/DOF/MeshComponentMap.cpp @@ -310,8 +310,7 @@ GlobalIndexType MeshComponentMap::getLocalIndex( _ghosts_indices.end(), -global_index); if (ghost_index_it == _ghosts_indices.end()) { - ERR("index %d not found in ghost_indices", -global_index); - std::abort(); + OGS_FATAL("index %d not found in ghost_indices", -global_index); } // Using std::distance on a std::vector is O(1). As long as _ghost_indices diff --git a/NumLib/DOF/SimpleMatrixVectorProvider-impl.h b/NumLib/DOF/SimpleMatrixVectorProvider-impl.h index f35879c2027f712282f32a8549cabd357a1da6b6..8e0672aec4236f1429d0299f4ce2633c33ed7642 100644 --- a/NumLib/DOF/SimpleMatrixVectorProvider-impl.h +++ b/NumLib/DOF/SimpleMatrixVectorProvider-impl.h @@ -10,6 +10,7 @@ #include <cassert> #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "MathLib/LinAlg/BLAS.h" #include "MathLib/LinAlg/MatrixVectorTraits.h" #include "SimpleMatrixVectorProvider.h" @@ -63,11 +64,10 @@ get_(std::size_t& id, Args&&... args) { if (id >= _next_id) { - ERR("An obviously uninitialized id argument has been passed." + OGS_FATAL("An obviously uninitialized id argument has been passed." " This might not be a serious error for the current implementation," " but it might become one in the future." " Hence, I will abort now."); - std::abort(); } if (do_search) @@ -162,8 +162,7 @@ releaseMatrix(Matrix const& A) { auto it = _used_matrices.find(const_cast<Matrix*>(&A)); if (it == _used_matrices.end()) { - ERR("The given matrix has not been found. Cannot release it. Aborting."); - std::abort(); + OGS_FATAL("The given matrix has not been found. Cannot release it. Aborting."); } else { ::detail::transfer(_used_matrices, _unused_matrices, it); } @@ -245,8 +244,7 @@ releaseVector(Vector const& x) { auto it = _used_vectors.find(const_cast<Vector*>(&x)); if (it == _used_vectors.end()) { - ERR("The given vector has not been found. Cannot release it. Aborting."); - std::abort(); + OGS_FATAL("The given vector has not been found. Cannot release it. Aborting."); } else { ::detail::transfer(_used_vectors, _unused_vectors, it); } diff --git a/NumLib/ODESolver/NonlinearSolver-impl.h b/NumLib/ODESolver/NonlinearSolver-impl.h index 6edfa7f3295ca5508f94c8bdd40687823fdcbc5b..51df5e5921f93e1589f9b0a9e261a1e1a55b2de0 100644 --- a/NumLib/ODESolver/NonlinearSolver-impl.h +++ b/NumLib/ODESolver/NonlinearSolver-impl.h @@ -13,6 +13,7 @@ // #include <iostream> #include "BaseLib/ConfigTree.h" +#include "BaseLib/Error.h" #include "MathLib/LinAlg/BLAS.h" #include "MathLib/LinAlg/VectorNorms.h" #include "NumLib/DOF/GlobalMatrixProviders.h" @@ -283,7 +284,7 @@ createNonlinearSolver(MathLib::LinearSolver<Matrix, Vector>& linear_solver, return std::make_pair(std::unique_ptr<AbstractNLS>( new ConcreteNLS{linear_solver, tol, max_iter}), tag); } - std::abort(); + OGS_FATAL("Unsupported nonlinear solver type"); } diff --git a/NumLib/ODESolver/TimeDiscretizationBuilder.h b/NumLib/ODESolver/TimeDiscretizationBuilder.h index 7acda0aea8b4e24e33418de0e3699a36748048df..9e703b323030d1d201766a45a44416be22f6023a 100644 --- a/NumLib/ODESolver/TimeDiscretizationBuilder.h +++ b/NumLib/ODESolver/TimeDiscretizationBuilder.h @@ -44,8 +44,7 @@ createTimeDiscretization(BaseLib::ConfigTree const& config) using ConcreteTD = BackwardDifferentiationFormula<Vector>; return T(new ConcreteTD(order)); } else { - ERR("Unrecognized time discretization type `%s'", type.c_str()); - std::abort(); + OGS_FATAL("Unrecognized time discretization type `%s'", type.c_str()); } } diff --git a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp index ea4e0e61eb4d0cad5b17a8e4e5d1912ada19b8e1..36fdabbdb1393464e58672315bfd84c1957edc17 100644 --- a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp +++ b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.cpp @@ -20,6 +20,7 @@ #include <logog/include/logog.hpp> #include "BaseLib/ConfigTree.h" +#include "BaseLib/Error.h" namespace NumLib { @@ -53,8 +54,7 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config) //! \ogs_file_param{prj__time_stepping__FixedTimeStepping__timesteps__pair} auto const range = delta_ts.getConfSubtreeList("pair"); if (range.begin() == range.end()) { - ERR("no timesteps have been given"); - std::abort(); + OGS_FATAL("no timesteps have been given"); } for (auto const pair : range) { @@ -64,12 +64,10 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config) delta_t = pair.getConfParam<double>("delta_t"); if (repeat == 0) { - ERR("<repeat> is zero."); - std::abort(); + OGS_FATAL("<repeat> is zero."); } if (delta_t <= 0.0) { - ERR("timestep <delta_t> is <= 0.0."); - std::abort(); + OGS_FATAL("timestep <delta_t> is <= 0.0."); } if (t_curr <= t_end) { diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h b/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h index 96fb30f1a55c646945a3a03ff6c15bc9d6ece4c0..94d9a22fec9afedaeffa1239249dbc59f5ace03c 100644 --- a/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h +++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h @@ -138,7 +138,7 @@ public: return _darcy_velocities[2]; } - std::abort(); + OGS_FATAL(""); } private: diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h index 92f9d83c756df436a98b63d81c8f47911d32e97a..ea233091b33f3e740c651c963935c429eff06dfe 100644 --- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h +++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h @@ -53,14 +53,13 @@ public: if (dynamic_cast<NumLib::ForwardEuler<GlobalVector>*>( &Base::getTimeDiscretization()) != nullptr) { - ERR("GroundwaterFlowProcess can not be solved with the ForwardEuler" + OGS_FATAL("GroundwaterFlowProcess can not be solved with the ForwardEuler" " time discretization scheme. Aborting"); // Because the M matrix is not assembled. Thus, the linearized system // would be singular. The same applies to CrankNicolson with theta = 0.0, // but this case is not checked here. // Anyway, the GroundwaterFlowProcess shall be transferred to a simpler // ODESystemTag in the future. - std::abort(); } } diff --git a/ProcessLib/InitialCondition.cpp b/ProcessLib/InitialCondition.cpp index d3abd14fb7cdd9acb701adb62245f7b8499e0611..99f9ac9e80012c042a39abb2de15dfb91c1db1a5 100644 --- a/ProcessLib/InitialCondition.cpp +++ b/ProcessLib/InitialCondition.cpp @@ -12,11 +12,13 @@ #include <boost/optional.hpp> #include <logog/include/logog.hpp> +#include "BaseLib/ConfigTree.h" +#include "BaseLib/Error.h" + #include "MathLib/Point3d.h" #include "MeshLib/Elements/Element.h" #include "MeshLib/Mesh.h" -#include "BaseLib/ConfigTree.h" namespace ProcessLib { @@ -48,26 +50,23 @@ std::unique_ptr<InitialCondition> createMeshPropertyInitialCondition( if (!mesh.getProperties().hasPropertyVector(field_name)) { - ERR("The required property %s does not exists in the mesh.", + OGS_FATAL("The required property %s does not exists in the mesh.", field_name.c_str()); - std::abort(); } auto const& property = mesh.getProperties().template getPropertyVector<double>(field_name); if (!property) { - ERR("The required property %s is not of the requested type.", + OGS_FATAL("The required property %s is not of the requested type.", field_name.c_str()); - std::abort(); } if (property->getNumberOfComponents() != static_cast<std::size_t>(n_components)) { - ERR("The required property %s has different number of components %d, " + OGS_FATAL("The required property %s has different number of components %d, " "expected %d.", field_name.c_str(), property->getNumberOfComponents(), n_components); - std::abort(); } return std::unique_ptr<InitialCondition>( new MeshPropertyInitialCondition(*property)); diff --git a/ProcessLib/LocalAssemblerInterface.h b/ProcessLib/LocalAssemblerInterface.h index 788ba9fbab39c4cb48b2e632a659e7c0e448b17a..338faa9376d3a32c70a3d5a8bd299b05496c3c37 100644 --- a/ProcessLib/LocalAssemblerInterface.h +++ b/ProcessLib/LocalAssemblerInterface.h @@ -33,20 +33,18 @@ public: virtual void assembleJacobian(double const /*t*/, std::vector<double> const& /*local_x*/) { - ERR( + OGS_FATAL( "assembleJacobian function is not implemented in the local " "assembler."); - std::abort(); } virtual void addJacobianToGlobal(NumLib::LocalToGlobalIndexMap:: RowColumnIndices const& /*indices*/, GlobalMatrix& /*Jac*/) const { - ERR( + OGS_FATAL( "addJacobianToGlobal function is not implemented in the local " "assembler."); - std::abort(); } virtual void preTimestep(std::vector<double> const& /*local_x*/, diff --git a/ProcessLib/Output.cpp b/ProcessLib/Output.cpp index 9fb85ad84f15f8f061bfc2363f9c482d1667df0e..b1560b4f2a843d280fd98eda168e24cce9b1adf0 100644 --- a/ProcessLib/Output.cpp +++ b/ProcessLib/Output.cpp @@ -7,11 +7,11 @@ * */ -#include<fstream> #include "Output.h" -#include<cassert> -#include<vector> +#include <cassert> +#include <fstream> +#include <vector> #include <logog/include/logog.hpp> @@ -69,9 +69,8 @@ newInstance(const BaseLib::ConfigTree &config, std::string const& output_directo } if (out->_repeats_each_steps.empty()) { - ERR("You have not given any pair (<repeat/>, <each_steps/>) that defines" + OGS_FATAL("You have not given any pair (<repeat/>, <each_steps/>) that defines" " at which timesteps output shall be written. Aborting."); - std::abort(); } } else @@ -107,9 +106,8 @@ doOutputAlways(Process<GlobalSetup> const& process, { auto spd_it = _single_process_data.find(&process); if (spd_it == _single_process_data.end()) { - ERR("The given process is not contained in the output configuration." + OGS_FATAL("The given process is not contained in the output configuration." " Aborting."); - std::abort(); } auto& spd = spd_it->second; diff --git a/ProcessLib/Parameter.cpp b/ProcessLib/Parameter.cpp index 33b937d0a3f7acb2c1cc9a7bf61d8348e6938c44..b0a305aaca6041a59ab664ae7872e0c57740359f 100644 --- a/ProcessLib/Parameter.cpp +++ b/ProcessLib/Parameter.cpp @@ -12,6 +12,7 @@ #include <boost/optional.hpp> #include <logog/include/logog.hpp> +#include "BaseLib/Error.h" #include "MeshLib/Elements/Element.h" namespace ProcessLib @@ -39,17 +40,15 @@ std::unique_ptr<ParameterBase> createMeshPropertyParameter( if (!mesh.getProperties().hasPropertyVector(field_name)) { - ERR("The required property %s does not exists in the mesh.", + OGS_FATAL("The required property %s does not exists in the mesh.", field_name.c_str()); - std::abort(); } auto const& property = mesh.getProperties().template getPropertyVector<double>(field_name); if (!property) { - ERR("The required property %s is not of the requested type.", + OGS_FATAL("The required property %s is not of the requested type.", field_name.c_str()); - std::abort(); } return std::unique_ptr<ParameterBase>( diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 4a1c20e50221d85abed3f302e8064b6f76ba9cd5..afdf5e69effef13e839d78a9721e57b1772406e3 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -28,11 +28,10 @@ ProcessVariable& findProcessVariable( if (variable == variables.end()) { - ERR( + OGS_FATAL( "Could not find process variable '%s' in the provided variables " "list for config tag <%s>.", name.c_str(), tag.c_str()); - std::abort(); } DBUG("Found process variable \'%s\' for config tag <%s>.", variable->getName().c_str(), tag.c_str()); diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index 78a66cf118f7694bc492d71d7d82d131d5247bd5..aec50fb6581dd1453281f59bf00d664b119f14eb 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -201,11 +201,10 @@ private: const double /*dx_dx*/, GlobalMatrix const& /*K*/, GlobalMatrix& /*Jac*/) { - ERR("The concrete implementation of this Process did not override the" + OGS_FATAL("The concrete implementation of this Process did not override the" " assembleJacobianConcreteProcess() method." " Hence, no analytical Jacobian is provided for this process" " and the Newton-Raphson method cannot be used to solve it."); - std::abort(); } void constructDofTable() @@ -385,11 +384,10 @@ Parameter<ParameterArgs...>& findParameter( if (parameter_it == parameters.end()) { - ERR( + OGS_FATAL( "Could not find parameter '%s' in the provided parameters list for " "config tag <%s>.", name.c_str(), tag.c_str()); - std::abort(); } DBUG("Found parameter \'%s\'.", (*parameter_it)->name.c_str()); @@ -398,8 +396,7 @@ Parameter<ParameterArgs...>& findParameter( dynamic_cast<Parameter<ParameterArgs...>*>(parameter_it->get()); if (!parameter) { - ERR("The read parameter is of incompatible type."); - std::abort(); + OGS_FATAL("The read parameter is of incompatible type."); } return *parameter; } diff --git a/ProcessLib/ProcessOutput.h b/ProcessLib/ProcessOutput.h index 03e7279899a1605d67aa32616aae1cff11451364..52f3c3e6e21e2558ecb454ee0a802e241bbb230a 100644 --- a/ProcessLib/ProcessOutput.h +++ b/ProcessLib/ProcessOutput.h @@ -35,8 +35,7 @@ struct ProcessOutput final { if (output_variables.find(out_var) != output_variables.cend()) { - ERR("output variable `%s' specified more than once.", out_var.c_str()); - std::abort(); + OGS_FATAL("output variable `%s' specified more than once.", out_var.c_str()); } auto pred = [&out_var](ProcessVariable const& pv) { @@ -50,9 +49,8 @@ struct ProcessOutput final if (pcs_var == process_variables.cend() && !secondary_variables.variableExists(out_var)) { - ERR("Output variable `%s' is neither a process variable nor a" + OGS_FATAL("Output variable `%s' is neither a process variable nor a" " secondary variable", out_var.c_str()); - std::abort(); } DBUG("adding output variable `%s'", out_var.c_str()); diff --git a/ProcessLib/TES/TESReactionAdaptor.cpp b/ProcessLib/TES/TESReactionAdaptor.cpp index 78199eb199e0bbaffdfa9cf44315e358ec5350c4..0524a4faa25e16a5447d1f586b6b127c4071c8a5 100644 --- a/ProcessLib/TES/TESReactionAdaptor.cpp +++ b/ProcessLib/TES/TESReactionAdaptor.cpp @@ -51,8 +51,7 @@ std::unique_ptr<TESFEMReactionAdaptor> TESFEMReactionAdaptor::newInstance( new TESFEMReactionAdaptorCaOH2(data)); } - ERR("No suitable TESFEMReactionAdaptor found. Aborting."); - std::abort(); + OGS_FATAL("No suitable TESFEMReactionAdaptor found. Aborting."); return std::unique_ptr<TESFEMReactionAdaptor>(nullptr); } diff --git a/ProcessLib/Utils/CreateLocalAssemblers.h b/ProcessLib/Utils/CreateLocalAssemblers.h index 081478cee2aea9f9a4d802e4585822c79501a66a..c5eaae8a7ff981741270e9c931017d7fef0d8066 100644 --- a/ProcessLib/Utils/CreateLocalAssemblers.h +++ b/ProcessLib/Utils/CreateLocalAssemblers.h @@ -115,8 +115,7 @@ void createLocalAssemblers( std::forward<ExtraCtorArgs>(extra_ctor_args)...); break; default: - ERR("Meshes with dimension greater than three are not supported."); - std::abort(); + OGS_FATAL("Meshes with dimension greater than three are not supported."); } } diff --git a/ProcessLib/Utils/LocalDataInitializer.h b/ProcessLib/Utils/LocalDataInitializer.h index 0172936204529718d967f800412afd9bc5e638c0..3f644c31556085363cf65783cded9febd83377f9 100644 --- a/ProcessLib/Utils/LocalDataInitializer.h +++ b/ProcessLib/Utils/LocalDataInitializer.h @@ -263,10 +263,9 @@ public: mesh_item, num_local_dof, integration_order, std::forward<ConstructorArgs>(args)...); } else { - ERR("You are trying to build a local assembler for an unknown mesh element type (%s)." + OGS_FATAL("You are trying to build a local assembler for an unknown mesh element type (%s)." " Maybe you have disabled this mesh element type in your build configuration.", type_idx.name()); - std::abort(); } } diff --git a/Tests/NumLib/TestExtrapolation.cpp b/Tests/NumLib/TestExtrapolation.cpp index 62262b063c27989e86809ce8c70b1ef56bd78ed0..76f932eff12cc109504d712de921815d45be973d 100644 --- a/Tests/NumLib/TestExtrapolation.cpp +++ b/Tests/NumLib/TestExtrapolation.cpp @@ -125,7 +125,7 @@ public: return cache; } - std::abort(); + OGS_FATAL(""); } void interpolateNodalValuesToIntegrationPoints(