Skip to content
Snippets Groups Projects
Commit 23f40eae authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

use real_type instead of hard-coded 'double'

[[Imported from SVN: r11784]]
parent ec2a4a5c
No related branches found
No related tags found
No related merge requests found
...@@ -66,11 +66,11 @@ void LoopSolver<VectorType, BitVectorType>::solve() ...@@ -66,11 +66,11 @@ void LoopSolver<VectorType, BitVectorType>::solve()
std::cout << std::endl; std::cout << std::endl;
} }
double error = std::numeric_limits<double>::max(); real_type error = std::numeric_limits<real_type>::max();
double normOfOldCorrection = 1; real_type normOfOldCorrection = 1;
double normOfOldError = 0; real_type normOfOldError = 0;
double totalConvRate = 1; real_type totalConvRate = 1;
this->maxTotalConvRate_ = 0; this->maxTotalConvRate_ = 0;
int convRateCounter = 0; int convRateCounter = 0;
...@@ -88,14 +88,14 @@ void LoopSolver<VectorType, BitVectorType>::solve() ...@@ -88,14 +88,14 @@ void LoopSolver<VectorType, BitVectorType>::solve()
this->writeIterate(iterationStep_->getSol(), i); this->writeIterate(iterationStep_->getSol(), i);
// Compute error // Compute error
double oldNorm = this->errorNorm_->operator()(oldSolution); real_type oldNorm = this->errorNorm_->operator()(oldSolution);
double normOfError=std::numeric_limits<double>::quiet_NaN(); real_type normOfError=std::numeric_limits<real_type>::quiet_NaN();
// Please don't replace this call to 'diff' by computing the norm of the difference. // Please don't replace this call to 'diff' by computing the norm of the difference.
// In some nonlinear DD applications the 'diff' method may be nonlinear. // In some nonlinear DD applications the 'diff' method may be nonlinear.
double normOfCorrection = this->errorNorm_->diff(oldSolution,iterationStep_->getSol()); real_type normOfCorrection = this->errorNorm_->diff(oldSolution,iterationStep_->getSol());
double convRate = normOfCorrection / normOfOldCorrection; real_type convRate = normOfCorrection / normOfOldCorrection;
error = normOfCorrection; error = normOfCorrection;
normOfOldCorrection = normOfCorrection; normOfOldCorrection = normOfCorrection;
...@@ -115,7 +115,7 @@ void LoopSolver<VectorType, BitVectorType>::solve() ...@@ -115,7 +115,7 @@ void LoopSolver<VectorType, BitVectorType>::solve()
if (!isinf(convRate) && !isnan(convRate) && i>0) if (!isinf(convRate) && !isnan(convRate) && i>0)
{ {
totalConvRate *= convRate; totalConvRate *= convRate;
this->maxTotalConvRate_ = std::max(this->maxTotalConvRate_, std::pow(totalConvRate, 1/((double)convRateCounter+1))); this->maxTotalConvRate_ = std::max(this->maxTotalConvRate_, std::pow(totalConvRate, 1/((real_type)convRateCounter+1)));
convRateCounter++; convRateCounter++;
} }
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
template <class VectorType, class BitVectorType = Dune::BitSetVector<VectorType::block_type::dimension> > template <class VectorType, class BitVectorType = Dune::BitSetVector<VectorType::block_type::dimension> >
class LoopSolver : public IterativeSolver<VectorType, BitVectorType> class LoopSolver : public IterativeSolver<VectorType, BitVectorType>
{ {
typedef typename VectorType::field_type field_type;
// For complex-valued data
typedef typename Dune::FieldTraits<field_type>::real_type real_type;
public: public:
/** \brief Constructor taking all relevant data */ /** \brief Constructor taking all relevant data */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment