Commit 60fd92dd authored by Sébastien Villemot's avatar Sébastien Villemot

Port to C++11 override keyword

Performed using modernize-use-override from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html
parent 9656904d
......@@ -93,10 +93,10 @@ class ProductQuadrature : public QuadratureImpl<prodpit>
const OneDQuadrature &uquad;
public:
ProductQuadrature(int d, const OneDQuadrature &uq);
virtual ~ProductQuadrature()
= default;
~ProductQuadrature()
override = default;
int
numEvals(int l) const
numEvals(int l) const override
{
int res = 1;
for (int i = 0; i < dimen(); i++)
......@@ -105,7 +105,7 @@ public:
}
void designLevelForEvals(int max_eval, int &lev, int &evals) const;
protected:
prodpit begin(int ti, int tn, int level) const;
prodpit begin(int ti, int tn, int level) const override;
};
#endif
......@@ -120,7 +120,7 @@ public:
smarter. */
void
operator()()
operator()() override
{
_Tpit beg = quad.begin(ti, tn, level);
_Tpit end = quad.begin(ti+1, tn, level);
......@@ -162,7 +162,7 @@ public:
/* Just fill a thread group with workes and run it. */
void
integrate(VectorFunctionSet &fs, int level, Vector &out) const
integrate(VectorFunctionSet &fs, int level, Vector &out) const override
{
// todo: out.length()==func.outdim()
// todo: dim == func.indim()
......@@ -177,7 +177,7 @@ public:
}
void
integrate(const VectorFunction &func,
int level, int tn, Vector &out) const
int level, int tn, Vector &out) const override
{
VectorFunctionSet fs(func, tn);
integrate(fs, level, out);
......@@ -246,25 +246,25 @@ public:
{
calcOffsets();
}
virtual ~OneDPrecalcQuadrature()
= default;
~OneDPrecalcQuadrature()
override = default;
int
numLevels() const
numLevels() const override
{
return num_levels;
}
int
numPoints(int level) const
numPoints(int level) const override
{
return num_points[level-1];
}
double
point(int level, int i) const
point(int level, int i) const override
{
return points[offsets[level-1]+i];
}
double
weight(int level, int i) const
weight(int level, int i) const override
{
return weights[offsets[level-1]+i];
}
......
......@@ -206,16 +206,16 @@ public:
: QuadratureImpl<qmcpit>(d), QMCSpecification(d, l, p)
{
}
virtual ~QMCarloCubeQuadrature()
= default;
~QMCarloCubeQuadrature()
override = default;
int
numEvals(int l) const
numEvals(int l) const override
{
return l;
}
protected:
qmcpit
begin(int ti, int tn, int lev) const
begin(int ti, int tn, int lev) const override
{
return qmcpit(*this, ti*level()/tn + 1);
}
......@@ -280,16 +280,16 @@ public:
: QuadratureImpl<qmcnpit>(d), QMCSpecification(d, l, p)
{
}
virtual ~QMCarloNormalQuadrature()
= default;
~QMCarloNormalQuadrature()
override = default;
int
numEvals(int l) const
numEvals(int l) const override
{
return l;
}
protected:
qmcnpit
begin(int ti, int tn, int lev) const
begin(int ti, int tn, int lev) const override
{
return qmcnpit(*this, ti*level()/tn + 1);
}
......@@ -299,14 +299,14 @@ protected:
class WarnockPerScheme : public PermutationScheme
{
public:
int permute(int i, int base, int c) const;
int permute(int i, int base, int c) const override;
};
/* Declares reverse permutation scheme. */
class ReversePerScheme : public PermutationScheme
{
public:
int permute(int i, int base, int c) const;
int permute(int i, int base, int c) const override;
};
/* Declares no permutation (identity) scheme. */
......@@ -314,7 +314,7 @@ class IdentityPerScheme : public PermutationScheme
{
public:
int
permute(int i, int base, int c) const
permute(int i, int base, int c) const override
{
return c;
}
......
......@@ -108,12 +108,12 @@ class SmolyakQuadrature : public QuadratureImpl<smolpit>
PascalTriangle psc;
public:
SmolyakQuadrature(int d, int l, const OneDQuadrature &uq);
virtual ~SmolyakQuadrature()
= default;
virtual int numEvals(int level) const;
~SmolyakQuadrature()
override = default;
int numEvals(int level) const override;
void designLevelForEvals(int max_eval, int &lev, int &evals) const;
protected:
smolpit begin(int ti, int tn, int level) const;
smolpit begin(int ti, int tn, int level) const override;
unsigned int
numSummands() const
{
......
......@@ -153,17 +153,17 @@ public:
GaussConverterFunction(VectorFunction &f, const GeneralMatrix &vcov);
GaussConverterFunction(VectorFunction *f, const GeneralMatrix &vcov);
GaussConverterFunction(const GaussConverterFunction &f);
virtual ~GaussConverterFunction()
~GaussConverterFunction() override
{
if (delete_flag)
delete func;
}
virtual VectorFunction *
clone() const
VectorFunction *
clone() const override
{
return new GaussConverterFunction(*this);
}
virtual void eval(const Vector &point, const ParameterSignal &sig, Vector &out);
void eval(const Vector &point, const ParameterSignal &sig, Vector &out) override;
private:
double calcMultiplier() const;
void calcCholeskyFactor(const GeneralMatrix &vcov);
......
......@@ -37,11 +37,11 @@ public:
= default;
VectorFunction *
clone() const
clone() const override
{
return new MomentFunction(*this);
}
void eval(const Vector &point, const ParameterSignal &sig, Vector &out);
void eval(const Vector &point, const ParameterSignal &sig, Vector &out) override;
};
void
......@@ -72,11 +72,11 @@ public:
= default;
VectorFunction *
clone() const
clone() const override
{
return new TensorPower(*this);
}
void eval(const Vector &point, const ParameterSignal &sig, Vector &out);
void eval(const Vector &point, const ParameterSignal &sig, Vector &out) override;
};
void
......@@ -108,11 +108,11 @@ public:
{
}
VectorFunction *
clone() const
clone() const override
{
return new Function1(*this);
}
virtual void eval(const Vector &point, const ParameterSignal &sig, Vector &out);
void eval(const Vector &point, const ParameterSignal &sig, Vector &out) override;
};
void
......@@ -144,11 +144,11 @@ public:
= default;
VectorFunction *
clone() const
clone() const override
{
return new Function1Trans(*this);
}
virtual void eval(const Vector &point, const ParameterSignal &sig, Vector &out);
void eval(const Vector &point, const ParameterSignal &sig, Vector &out) override;
};
void
......@@ -438,7 +438,7 @@ public:
}
bool
run() const
run() const override
{
GeneralMatrix m(2, 2);
m.zeros(); m.get(0, 0) = 1; m.get(1, 1) = 1;
......@@ -455,7 +455,7 @@ public:
}
bool
run() const
run() const override
{
GeneralMatrix m(3, 3);
m.zeros();
......@@ -474,7 +474,7 @@ public:
}
bool
run() const
run() const override
{
GeneralMatrix m(2, 2);
m.zeros(); m.get(0, 0) = 1; m.get(1, 1) = 1;
......@@ -491,7 +491,7 @@ public:
}
bool
run() const
run() const override
{
GeneralMatrix m(3, 3);
m.zeros();
......@@ -510,7 +510,7 @@ public:
}
bool
run() const
run() const override
{
GeneralMatrix m(2, 2);
m.zeros(); m.get(0, 0) = 1; m.get(1, 1) = 1;
......@@ -527,7 +527,7 @@ public:
}
bool
run() const
run() const override
{
GeneralMatrix m(3, 3);
m.zeros();
......@@ -547,7 +547,7 @@ public:
}
bool
run() const
run() const override
{
Function1Trans f1(6);
Vector res(1); res[0] = 1.0;
......@@ -564,7 +564,7 @@ public:
}
bool
run() const
run() const override
{
Function1 f1(6);
return qmc_cube(f1, 1.0, 1.e-4, 1000000);
......
......@@ -73,7 +73,7 @@ public:
typedef StackContainer<FGSTensor>::_Ctype _Ctype;
typedef StackContainer<FGSTensor>::itype itype;
ZAuxContainer(const _Ctype *gss, int ngss, int ng, int ny, int nu);
itype getType(int i, const Symmetry &s) const;
itype getType(int i, const Symmetry &s) const override;
};
/* This class provides an interface to approximation algorithms. The
......
......@@ -126,31 +126,31 @@ public:
centralize(dr);
}
const Vector &
getSteady() const
getSteady() const override
{
return ysteady;
}
TwoDMatrix *simulate(emethod em, int np, const Vector &ystart,
ShockRealization &sr) const;
ShockRealization &sr) const override;
void evaluate(emethod em, Vector &out, const ConstVector &ys,
const ConstVector &u) const;
DecisionRule *centralizedClone(const Vector &fixpoint) const;
void writeMat(mat_t *fd, const char *prefix) const;
const ConstVector &u) const override;
DecisionRule *centralizedClone(const Vector &fixpoint) const override;
void writeMat(mat_t *fd, const char *prefix) const override;
int
nexog() const
nexog() const override
{
return nu;
}
const PartitionY &
getYPart() const
getYPart() const override
{
return ypart;
}
protected:
void fillTensors(const _Tg &g, double sigma);
void centralize(const DecisionRuleImpl &dr);
void eval(emethod em, Vector &out, const ConstVector &v) const;
void eval(emethod em, Vector &out, const ConstVector &v) const override;
};
/* Here we have to fill the tensor polynomial. This involves two
......@@ -495,8 +495,8 @@ public:
typedef typename DecisionRule::emethod emethod;
DRFixPoint(const _Tg &g, const PartitionY &yp,
const Vector &ys, double sigma);
virtual
~DRFixPoint();
~DRFixPoint() override;
bool calcFixPoint(emethod em, Vector &out);
......@@ -925,7 +925,7 @@ public:
: res(sim_res), dr(dec_rule), em(emet), np(num_per), st(start), sr(shock_r)
{
}
void operator()();
void operator()() override;
};
/* This worker simulates a given impulse |imp| to a given shock
......@@ -951,7 +951,7 @@ public:
idata(id), ishock(ishck), imp(impulse)
{
}
void operator()();
void operator()() override;
};
/* This class does the real time simulation job for
......@@ -977,7 +977,7 @@ public:
: res(sim_res), dr(dec_rule), em(emet), np(num_per), ystart(start), sr(shock_r)
{
}
void operator()();
void operator()() override;
};
/* This class generates draws from Gaussian distribution with zero mean
......@@ -999,11 +999,11 @@ public:
: mtwister(sr.mtwister), factor(sr.factor)
{
}
virtual ~RandomShockRealization()
= default;
void get(int n, Vector &out);
~RandomShockRealization()
override = default;
void get(int n, Vector &out) override;
int
numShocks() const
numShocks() const override
{
return factor.nrows();
}
......@@ -1032,9 +1032,9 @@ public:
{
}
ExplicitShockRealization(ShockRealization &sr, int num_per);
void get(int n, Vector &out);
void get(int n, Vector &out) override;
int
numShocks() const
numShocks() const override
{
return shocks.nrows();
}
......@@ -1069,9 +1069,9 @@ public:
KORD_RAISE_IF(sh.nrows() != v.nrows() || v.nrows() != v.ncols(),
"Wrong dimension of input matrix in GenShockRealization constructor");
}
void get(int n, Vector &out);
void get(int n, Vector &out) override;
int
numShocks() const
numShocks() const override
{
return RandomShockRealization::numShocks();
}
......
......@@ -74,14 +74,14 @@ protected:
public:
ResidFunction(const Approximation &app);
ResidFunction(const ResidFunction &rf);
virtual
~ResidFunction();
virtual VectorFunction *
clone() const
~ResidFunction() override;
VectorFunction *
clone() const override
{
return new ResidFunction(*this);
}
virtual void eval(const Vector &point, const ParameterSignal &sig, Vector &out);
void eval(const Vector &point, const ParameterSignal &sig, Vector &out) override;
void setYU(const Vector &ys, const Vector &xx);
};
......@@ -97,10 +97,10 @@ public:
GResidFunction(const GResidFunction &rf)
= default;
virtual ~GResidFunction()
= default;
virtual VectorFunction *
clone() const
~GResidFunction()
override = default;
VectorFunction *
clone() const override
{
return new GResidFunction(*this);
}
......
......@@ -49,7 +49,7 @@ public:
{
printHeader();
}
~Journal()
~Journal() override
{
flush();
}
......@@ -139,7 +139,7 @@ public:
{
prefix_end[0] = '\0'; journal.incrementDepth();
}
~JournalRecordPair();
~JournalRecordPair() override;
private:
void writePrefixForEnd(const SystemResourcesFlash &f);
};
......
......@@ -162,7 +162,7 @@ public:
{
}
PLUMatrix(const PLUMatrix &plu);
virtual ~PLUMatrix()
~PLUMatrix() override
{
delete [] ipiv;
}
......
......@@ -254,7 +254,7 @@ public:
: GContainer<_Ttype>(gs, ngs, nu)
{
}
itype getType(int i, const Symmetry &s) const;
itype getType(int i, const Symmetry &s) const override;
};
/* This routine corresponds to this stack:
......@@ -298,7 +298,7 @@ public:
: ZContainer<_Ttype>(gss, ngss, g, ng, ny, nu)
{
}
itype getType(int i, const Symmetry &s) const;
itype getType(int i, const Symmetry &s) const override;
};
/* This |getType| method corresponds to this stack:
......
......@@ -29,7 +29,7 @@ public:
uint32 lrand();
double drand();
double
uniform()
uniform() override
{
return drand();
}
......
......@@ -21,7 +21,7 @@ public:
class SystemRandomGenerator : public RandomGenerator
{
public:
double uniform();
double uniform() override;
void initSeed(int seed);
};
......
......@@ -343,7 +343,7 @@ public:
}
bool
run() const
run() const override
{
TwoDMatrix gy(8, 4, gy_data);
TwoDMatrix gu(8, 3, gu_data);
......@@ -366,7 +366,7 @@ public:
}
bool
run() const
run() const override
{
TwoDMatrix gy(30, 20, gy_data2);
TwoDMatrix gu(30, 10, gu_data2);
......@@ -390,7 +390,7 @@ public:
}
bool
run() const
run() const override
{
TwoDMatrix gy(30, 20, gy_data2);
TwoDMatrix gu(30, 10, gu_data2);
......
......@@ -97,14 +97,14 @@ namespace ogp
std::vector<double>(a.expr.nformulas()), aa(a)
{
}
virtual ~AtomAsgnEvaluator()
= default;
~AtomAsgnEvaluator()
override = default;
/** This sets all initial values to NaNs, all constants and
* all values set by user by call set_value. This is called by
* FormulaEvaluator::eval() method, which is called by eval()
* method passing this argument as AtomValues. So the
* ogp::EvalTree will be always this->etree. */
void setValues(EvalTree &et) const;
void setValues(EvalTree &et) const override;
/** User setting of the values. For example in initval,
* parameters are known and should be set to their values. In
* constrast endogenous variables are set initially to NaNs by
......@@ -114,7 +114,7 @@ namespace ogp
* also checks whether the i-th expression is an atom. If so,
* it sets the value of the atom in ogp::EvalTree
* this->etree. */
void load(int i, double res);
void load(int i, double res) override;
/** After the user values have been set, the assignments can
* be evaluated. For this purpose we have eval() method. The
* result is that this object as std::vector<double> will
......
......@@ -131,8 +131,8 @@ namespace ogp
SAtoms(const SAtoms &sa)
= default;
virtual ~SAtoms()
= default;
~SAtoms()
override = default;
/** This substitutes all lags and leads for all exogenous and
* all lags and leads greater than 1 for all endogenous
* variables. This is useful for perfect foresight problems
......
......@@ -100,7 +100,7 @@ namespace ogp
void import_constants(const Constants &c, OperationTree &otree, Tintintmap &tmap);
/** Implements AtomValues interface. This sets the values to
* the evaluation tree EvalTree. */
void setValues(EvalTree &et) const;
void setValues(EvalTree &et) const override;
/** This adds a constant with the given tree index. The
* constant must be checked previously and asserted that it
* does not exist. */
......@@ -169,8 +169,8 @@ namespace ogp
/** Construct empty DynamicAtoms. */
DynamicAtoms();
DynamicAtoms(const DynamicAtoms &da);
virtual ~DynamicAtoms()
= default;
~DynamicAtoms()
override = default;
/** Check the nulary term identified by its string
* representation. The nulary term can be either a constant or
* a variable. If constant, -1 is returned so that it could be
......@@ -178,19 +178,19 @@ namespace ogp
* appeared or not. If variable, then -1 is returned only if
* the variable has not been assigned an index, otherwise the
* assigned index is returned. */
int check(const char *name) const;
int check(const char *name) const override;
/** Assign the nulary term identified by its string
* representation. This method should be called when check()
* returns -1. */
void assign(const char *name, int t);
void assign(const char *name, int t) override;
/** Return a number of all variables. */
int
nvar() const
nvar() const override
{
return nv;
}
/** Return the vector of variable indices. */
vector<int> variables() const;
vector<int> variables() const override;
/** Return max lead and min lag for a variable given by the
* index. If a variable cannot be found, the method retursn
* the smallest integer as maxlead and the largest integer as
......@@ -254,7 +254,7 @@ namespace ogp
* storage. */
void unassign_variable(const char *varname, int ll, int t);
/** Debug print. */
void print() const;
void print() const override;
protected:
/** Do the check for the variable. A subclass may need to
* reimplement this so that it could raise an error if the
......
......@@ -33,12 +33,12 @@ namespace ogp
{
}
VarOrdering *
clone(const vector<const char *> &vnames, const DynamicAtoms &a) const
clone(const vector<const char *> &vnames, const DynamicAtoms &a) const override
{
return new EndoVarOrdering1(*this, vnames, a);
}
void
do_ordering()
do_ordering() override
{
do_pbspbfbf();
}
......@@ -61,12 +61,12 @@ namespace ogp
{
}
VarOrdering *
clone(const vector<const char *> &vnames, const DynamicAtoms &a) const
clone(const vector<const char *> &vnames, const DynamicAtoms &a) const override
{
return new EndoVarOrdering2(*this, vnames, a);
}
void
do_ordering()
do_ordering() override
{
do_bfspbfpb();
}
......@@ -88,12 +88,12 @@ namespace ogp
{
}
VarOrdering *
clone(const vector<const char *> &vnames, const DynamicAtoms &a) const
clone(const vector<const char *> &vnames, const DynamicAtoms &a) const override
{
return new ExoVarOrdering(*this, vnames, a);
}
void
do_ordering()
do_ordering() override
{
do_increasing_time();
}
......@@ -234,7 +234,7 @@ namespace ogp
}
FineAtoms(const FineAtoms &fa);
/** Deletes endo_order and exo_order. */
virtual ~FineAtoms()
~FineAtoms() override
{
if (endo_order)
delete endo_order;
......@@ -248,7 +248,7 @@ namespace ogp
* variable is declared by inserting it to
* DynamicAtoms::varnames. This is a responsibility of a
* subclass. */
int check_variable(const char *name) const;
int check_variable(const char *name) const override;
/** This calculates min lag and max lead of endogenous variables. */
void