Skip to content
Snippets Groups Projects
Commit ade802ff authored by Uli Sack's avatar Uli Sack Committed by usack
Browse files

make positivity tolerance variable, to be set in constructor

[[Imported from SVN: r6271]]
parent 800b6a1b
Branches
No related tags found
No related merge requests found
...@@ -28,14 +28,14 @@ ...@@ -28,14 +28,14 @@
/** \brief The type used for the result */ /** \brief The type used for the result */
typedef typename DiscFuncType::field_type field_type; typedef typename DiscFuncType::field_type field_type;
EnergyNorm() : iterationStep_(NULL), matrix_(NULL) {} EnergyNorm(const double tol=1e-10 ) : iterationStep_(NULL), matrix_(NULL), tol_(tol) {}
EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it) EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it, const double tol=1e-10)
: iterationStep_(&it), matrix_(NULL) : iterationStep_(&it), matrix_(NULL), tol_(tol)
{} {}
EnergyNorm(const OperatorType& matrix) EnergyNorm(const OperatorType& matrix, const double tol=1e-10)
: iterationStep_(NULL), matrix_(&matrix) : iterationStep_(NULL), matrix_(&matrix), tol_(tol)
{} {}
void setMatrix(const OperatorType* matrix) { void setMatrix(const OperatorType* matrix) {
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
if (ret < 0) if (ret < 0)
{ {
if (ret < -1e-13) if (ret < -tol_)
{ {
char msg[1024]; char msg[1024];
sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret); sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret);
...@@ -96,7 +96,8 @@ ...@@ -96,7 +96,8 @@
/** \brief Compute the squared norm for a given vector and matrix /** \brief Compute the squared norm for a given vector and matrix
\todo This could be implemented without the temporary. */ \todo This could be implemented without the temporary. */
static field_type normSquared(const DiscFuncType& u, static field_type normSquared(const DiscFuncType& u,
const OperatorType& A) const OperatorType& A,
const double tol=1e-10)
{ {
DiscFuncType tmp(u.size()); DiscFuncType tmp(u.size());
tmp = 0; tmp = 0;
...@@ -106,7 +107,7 @@ ...@@ -106,7 +107,7 @@
if (ret < 0) if (ret < 0)
{ {
if (ret < -1e-13) if (ret < -tol)
{ {
char msg[1024]; char msg[1024];
sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret); sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret);
...@@ -125,6 +126,8 @@ ...@@ -125,6 +126,8 @@
const OperatorType* matrix_; const OperatorType* matrix_;
const double tol_;
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment