Page MenuHomec4science

print_series.cc
No OneTemporary

File Metadata

Created
Wed, May 22, 20:37

print_series.cc

#include <iostream>
#include <cmath>
#include <iomanip>
#include "print_series.hh"
void PrintSeries::dump(std::ostream & os){
double computed = 0.0;
double analytical = 0.0;
double error = 0.0;
for (unsigned long i = 0.0; i <= maxiter; ++i){
if (((i+1) % frequency == 0) && std::isnan(series.getAnalyticPrediction())){
computed = series.compute(i);
os << std::setprecision(dump_precision) << i << "\t" << computed << std::endl;
}
else if ((i+1) % frequency == 0){
computed = series.compute(i);
analytical = series.getAnalyticPrediction();
error = 100.0*(analytical - computed)/analytical;
os << std::setprecision(dump_precision) << i << "\t" << computed << "\t" << analytical << "\t" << error <<std::endl;
}
}
}

Event Timeline