Commit 84888091 authored by Bryan Berthou's avatar Bryan Berthou
Browse files

refs#16

In NumA++ (trunk) :
- Replace std::runtime_error by CustomException.
parent ca797995
#include <ElementaryUtils/logger/LoggerManager.h>
#include <stddef.h>
#include <cmath>
#include <stdexcept>
//#include <stdexcept>
#include <vector>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
......@@ -26,9 +27,8 @@ public:
fcur = ((*object).*function)(xcur, funcParameters);
if ((fpre * fcur) > 0.) {
std::runtime_error(
"(Brent::solve) the root is not bracketed ; verify your interval [a,b]");
return 0.;
throw ElemUtils::CustomException("Brent", __func__,
"The root is not bracketed ; verify your interval [a,b]");
}
if (fpre == 0.) {
return xpre;
......
......@@ -8,11 +8,11 @@
* @version 1.0
*/
#include <ElementaryUtils/logger/CustomException.h>
#include <stddef.h>
#include <cmath>
#include <iostream>
#include <stdexcept>
#include <vector>
#include <stddef.h>
namespace NumA {
......@@ -36,11 +36,12 @@ public:
const size_t maxIteration = 50) {
if (absTolerance <= 0.) {
throw std::runtime_error("(Newton::solve) tolerance too small");
throw ElemUtils::CustomException("Newton", __func__,
"Tolerance too small");
}
if (maxIteration < 1) {
throw std::runtime_error(
"(Newton::solve) number of maximum iteration must be greater than 0");
throw ElemUtils::CustomException("Newton", __func__,
"Number of maximum iteration must be greater than 0");
}
std::vector<double> variable(1, 0.);
......
......@@ -4,14 +4,14 @@
/**
* @file Interval.h
* @author Bryan BERTHOU (SPhN / CEA Saclay)
* @date 23 July 2014
* @date July 23, 2014
* @version 1.0
*/
#include <ElementaryUtils/logger/CustomException.h>
#include <stddef.h>
#include <cmath>
#include <stdexcept>
#include <vector>
#include <cstddef>
namespace NumA {
......@@ -53,8 +53,8 @@ public:
break;
}
default:
throw std::runtime_error(
"(Interval::computeSteps) Unknown step mode");
throw ElemUtils::CustomException("Interval", __func__,
"Unknown step mode");
break;
}
......@@ -82,8 +82,8 @@ public:
}
break;
default:
throw std::runtime_error(
"(Interval::computeNodes) Unknown step mode");
throw ElemUtils::CustomException("Interval", __func__,
"Unknown step mode");
break;
}
return nodes;
......
#include "../../../../include/NumA/integration/one_dimension/Integrator1D.h"
#include <ElementaryUtils/logger/CustomException.h>
#include <ElementaryUtils/parameters/GenericType.h>
#include <ElementaryUtils/parameters/Parameters.h>
#include <stdexcept>
#include <string>
#include "../../../../include/NumA/integration/one_dimension/DExpIntegrator1D.h"
......@@ -47,8 +47,8 @@ Integrator1D* Integrator1D::newIntegrator(
return new GaussKronrodAdaptive();
break;
default:
std::runtime_error(
"(OneDimIntergator::newIntegrator) Unknown or undefined integrator.");
throw ElemUtils::CustomException("Integrator1D", __func__,
"Unknown or undefined integrator.");
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment