commit a4a61232fe85d7bb2d2937baefce8496bf6ee001
parent 094549ca2a051b6995452d9c60edfc06b24028aa
Author: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Date: Fri, 18 Dec 2020 23:36:39 +0100
Fix warnings
Diffstat:
8 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/include/ArgumentParser.h b/include/ArgumentParser.h
@@ -118,8 +118,10 @@ public:
return mapArguments.find(arg) != mapArguments.end();
}
- CommandlineParser(const int argc, const char ** argv) : mapArguments(), iArgC(argc), vArgV(argv), bStrictMode(false), bVerbose(true)
- {
+ CommandlineParser(const int argc, const char **argv)
+ : iArgC(argc), vArgV(argv), bStrictMode(false), bVerbose(true),
+ mapArguments()
+ {
for (int i=1; i<argc; i++)
if (argv[i][0] == '-')
{
diff --git a/include/GnuplotDump.h b/include/GnuplotDump.h
@@ -72,7 +72,8 @@ private:
out << "plot '" << m_fname+".dat" << "' using 1:2 with lines" << std::endl;
else
{
- out << "plot '" << m_fname+".bin" << "' binary format='\%" << m_N;
+ out << "plot '" << m_fname + ".bin"
+ << "' binary format='%" << m_N;
if (sizeof(GPfloat) == 4)
out << "float";
else
diff --git a/include/TimeStepper/explicit/Euler.h b/include/TimeStepper/explicit/Euler.h
@@ -31,7 +31,8 @@ public:
++(m_settings.step);
if (m_settings.step % m_settings.reportGranularity == 0)
- std::printf("Time = %e;\tStep = %d\n", m_settings.t, m_settings.step);
+ std::printf(
+ "Time = %e;\tStep = %zu\n", m_settings.t, m_settings.step);
}
};
diff --git a/include/TimeStepper/explicit/LSRK3.h b/include/TimeStepper/explicit/LSRK3.h
@@ -28,7 +28,7 @@ public:
{ }
virtual ~LSRK3() {}
- virtual void step(void const* const data=nullptr)
+ virtual void step(void const *const)
{
// stage 1
Real lsrk_data[2] = {static_cast<Real>(m_settings.dt), m_A[0]};
@@ -49,7 +49,8 @@ public:
++(m_settings.step);
if (m_settings.step % m_settings.reportGranularity == 0)
- std::printf("Time = %e;\tStep = %d\n", m_settings.t, m_settings.step);
+ std::printf(
+ "Time = %e;\tStep = %zu\n", m_settings.t, m_settings.step);
}
};
diff --git a/include/TimeStepper/explicit/RK4.h b/include/TimeStepper/explicit/RK4.h
@@ -46,7 +46,8 @@ public:
++(m_settings.step);
if (m_settings.step % m_settings.reportGranularity == 0)
- std::printf("Time = %e;\tStep = %d\n", m_settings.t, m_settings.step);
+ std::printf(
+ "Time = %e;\tStep = %zu\n", m_settings.t, m_settings.step);
}
};
diff --git a/include/common.h b/include/common.h
@@ -410,7 +410,7 @@ public:
inline T& operator()(const int ix) { assert((ix-_SS >= 0)&&(ix-_SS < static_cast<int>(_N)+_SE-_SS)); return _data[ix-_SS]; }
inline const T& operator()(const int ix) const { assert((ix-_SS >= 0)&&(ix-_SS < static_cast<int>(_N)+_SE-_SS)); return _data[ix-_SS]; }
inline T* data() { return _data; }
- inline const T * const data() const { return _data; }
+ inline T *data() const { return _data; }
};
template <typename T, typename U, int _SS, int _SE>
diff --git a/test/orderVerification/meson.build b/test/orderVerification/meson.build
@@ -1,3 +1,3 @@
executable('orderVerification', 'orderVerification.cpp',
- dependencies: header_deps,
+ dependencies: [header_deps, dependencies],
cpp_args: cpp_args)
diff --git a/test/orderVerification/orderVerification.cpp b/test/orderVerification/orderVerification.cpp
@@ -32,12 +32,16 @@ public:
Dahlquist(const Real a=1.0) : m_gp("out", GnuplotDump::ASCII), m_a(a) {}
~Dahlquist() {}
- void compute(const Tinput& U, Trhs& rhs, const Real t, void const* const data=nullptr)
+ void compute(const Tinput &U, Trhs &rhs, const Real, void const *const)
{
rhs = m_a*U;
}
- void write(const size_t step, const Real t, const Real dt, const Tinput& U, const void * const data=nullptr)
+ void write(const size_t step,
+ const Real t,
+ const Real dt,
+ const Tinput &U,
+ const void *const)
{
m_gp.write(step,
t,
@@ -56,10 +60,13 @@ public:
DahlquistLSRK3(const Real a=1.0) : Dahlquist<Tinput,Trhs>(a) {}
~DahlquistLSRK3() {}
- void compute(const Tinput& U, Trhs& rhs, const Real t, void const* const data=nullptr)
+ void compute(const Tinput &U,
+ Trhs &rhs,
+ const Real,
+ void const *const data = nullptr)
{
assert(data != nullptr);
- const Real * const LSRKData = static_cast<const Real* const>(data);
+ const Real *const LSRKData = static_cast<const Real *>(data);
const Real dt = LSRKData[0];
const Real A = LSRKData[1];
rhs = A*rhs + dt*m_a*U;
@@ -89,7 +96,7 @@ vector<Error> verify(baseStepper_t stepper, int const stages, StepperSettings& S
size_t const N = static_cast<size_t>(S.tFinal/S.dt)+1;
S.t = 0.0;
stepper->U() = 1.0;
- Real& numerical = stepper->U()[0][0];
+ Real &numerical = stepper->U()[0][0];
for (size_t i = 0; i < N; ++i)
{
stepper->step();
@@ -109,7 +116,7 @@ vector<Error> verify(baseStepper_t stepper, int const stages, StepperSettings& S
int main(int argc, const char** argv)
{
// set up solution vector
- vec_t U;
+ vec_t U(1);
// kernel instances
baseKernel_t dahlquist = new Dahlquist<vec_t>(DECAY);
@@ -135,6 +142,7 @@ int main(int argc, const char** argv)
ofstream save(timeStepperList[i].first.first + ".dat");
save.setf(std::ios::scientific, std::ios::floatfield);
auto expected = [&](const Real x){ return error[0].L1*pow(x, timeStepperList[i].first.second); };
+ save << "# dt\t1/dt\tL1\tL2\tLinf\texpected\n";
for (size_t j = 0; j < error.size(); ++j)
save << error[j].dt << '\t' << 1.0/error[j].dt << '\t' << error[j].L1 << '\t' << error[j].L2 << '\t' << error[j].Linf << '\t' << expected(error[j].dt) << endl;
save.close();