make single-parameter constructors as explicit

to avoid unexpected implicit casts
This commit is contained in:
Arne Morten Kvarving 2017-06-06 10:31:41 +02:00
parent 3722992673
commit f2080cdf54
54 changed files with 90 additions and 90 deletions

View File

@ -69,7 +69,7 @@ namespace ExprEval
class NotFoundException : public Exception
{
public:
NotFoundException(const ::std::string &name);
explicit NotFoundException(const ::std::string &name);
};
// Already exists exception (function or value already exists)
@ -77,7 +77,7 @@ namespace ExprEval
class AlreadyExistsException : public Exception
{
public:
AlreadyExistsException(const ::std::string &name);
explicit AlreadyExistsException(const ::std::string &name);
};
// A null pointer was passed
@ -85,7 +85,7 @@ namespace ExprEval
class NullPointerException : public Exception
{
public:
NullPointerException(const ::std::string &method);
explicit NullPointerException(const ::std::string &method);
};
// A bad math error occured
@ -93,7 +93,7 @@ namespace ExprEval
class MathException : public Exception
{
public:
MathException(const ::std::string &function);
explicit MathException(const ::std::string &function);
};
// Divide by zero exception
@ -150,7 +150,7 @@ namespace ExprEval
class InvalidArgumentCountException : public Exception
{
public:
InvalidArgumentCountException(const ::std::string &function);
explicit InvalidArgumentCountException(const ::std::string &function);
};
// Assign to a constant
@ -158,7 +158,7 @@ namespace ExprEval
class ConstantAssignException : public Exception
{
public:
ConstantAssignException(const ::std::string &value);
explicit ConstantAssignException(const ::std::string &value);
};
// Pass constant by reference
@ -166,7 +166,7 @@ namespace ExprEval
class ConstantReferenceException : public Exception
{
public:
ConstantReferenceException(const ::std::string &value);
explicit ConstantReferenceException(const ::std::string &value);
};
// A general syntax exception

View File

@ -25,7 +25,7 @@ namespace ExprEval
class Node
{
public:
Node(Expression *expr);
explicit Node(Expression *expr);
virtual ~Node();
virtual double DoEvaluate() = 0;
@ -43,7 +43,7 @@ namespace ExprEval
class FunctionNode : public Node
{
public:
FunctionNode(Expression *expr);
explicit FunctionNode(Expression *expr);
~FunctionNode();
// Parse nodes and references
@ -81,7 +81,7 @@ namespace ExprEval
class MultiNode : public Node
{
public:
MultiNode(Expression *expr);
explicit MultiNode(Expression *expr);
~MultiNode();
double DoEvaluate();
@ -97,7 +97,7 @@ namespace ExprEval
class AssignNode : public Node
{
public:
AssignNode(Expression *expr);
explicit AssignNode(Expression *expr);
~AssignNode();
double DoEvaluate();
@ -114,7 +114,7 @@ namespace ExprEval
class AddNode : public Node
{
public:
AddNode(Expression *expr);
explicit AddNode(Expression *expr);
~AddNode();
double DoEvaluate();
@ -131,7 +131,7 @@ namespace ExprEval
class SubtractNode : public Node
{
public:
SubtractNode(Expression *expr);
explicit SubtractNode(Expression *expr);
~SubtractNode();
double DoEvaluate();
@ -148,7 +148,7 @@ namespace ExprEval
class MultiplyNode : public Node
{
public:
MultiplyNode(Expression *expr);
explicit MultiplyNode(Expression *expr);
~MultiplyNode();
double DoEvaluate();
@ -165,7 +165,7 @@ namespace ExprEval
class DivideNode : public Node
{
public:
DivideNode(Expression *expr);
explicit DivideNode(Expression *expr);
~DivideNode();
double DoEvaluate();
@ -182,7 +182,7 @@ namespace ExprEval
class NegateNode : public Node
{
public:
NegateNode(Expression *expr);
explicit NegateNode(Expression *expr);
~NegateNode();
double DoEvaluate();
@ -198,7 +198,7 @@ namespace ExprEval
class ExponentNode : public Node
{
public:
ExponentNode(Expression *expr);
explicit ExponentNode(Expression *expr);
~ExponentNode();
double DoEvaluate();
@ -215,7 +215,7 @@ namespace ExprEval
class VariableNode : public Node
{
public:
VariableNode(Expression *expr);
explicit VariableNode(Expression *expr);
~VariableNode();
double DoEvaluate();
@ -231,7 +231,7 @@ namespace ExprEval
class ValueNode : public Node
{
public:
ValueNode(Expression *expr);
explicit ValueNode(Expression *expr);
~ValueNode();
double DoEvaluate();

View File

@ -75,7 +75,7 @@ namespace ExprEval
public:
typedef ::std::vector<Token*>::size_type size_type;
Parser(Expression *expr);
explicit Parser(Expression *expr);
~Parser();
Node *Parse(const ::std::string &exstr);

View File

@ -68,7 +68,7 @@ public:
char RY; //!< Boundary condition code for Y-rotation
char RZ; //!< Boundary condition code for Z-rotation
//! \brief Constructor initializing a BC instance.
BC(int n) : node(n), CX(1), CY(1), CZ(1), RX(1), RY(1), RZ(1) {}
explicit BC(int n) : node(n), CX(1), CY(1), CZ(1), RX(1), RY(1), RZ(1) {}
};
typedef std::vector<BC> BCVec; //!< Nodal boundary condition container

View File

@ -32,7 +32,7 @@ class ASMmxBase
protected:
//! \brief The constructor sets the number of field variables.
//! \param[in] n_f Number of nodal variables in each field
ASMmxBase(const std::vector<unsigned char>& n_f);
explicit ASMmxBase(const std::vector<unsigned char>& n_f);
//! \brief Initializes the patch level MADOF array.
//! \param[in] MLGN Matrix of local-to-global node numbers

View File

@ -91,7 +91,7 @@ protected:
const ASMs2D& myPatch; //!< Reference to the patch being integrated
public:
//! \brief The constructor initialises the reference to current patch.
InterfaceChecker(const ASMs2D& pch) : myPatch(pch) {}
explicit InterfaceChecker(const ASMs2D& pch) : myPatch(pch) {}
//! \brief Empty destructor.
virtual ~InterfaceChecker() {}
//! \brief Returns non-zero if the specified element have contributions.

View File

@ -110,7 +110,7 @@ protected:
const ASMs3D& myPatch; //!< Reference to the patch being integrated
public:
//! \brief The constructor initialises the reference to current patch.
InterfaceChecker(const ASMs3D& pch) : myPatch(pch) {}
explicit InterfaceChecker(const ASMs3D& pch) : myPatch(pch) {}
//! \brief Empty destructor.
virtual ~InterfaceChecker() {}
//! \brief Returns non-zero if the specified element have contributions.
@ -122,7 +122,7 @@ protected:
public:
//! \brief Default constructor.
ASMs3D(unsigned char n_f = 3);
explicit ASMs3D(unsigned char n_f = 3);
//! \brief Special copy constructor for sharing of FE data.
ASMs3D(const ASMs3D& patch, unsigned char n_f);
//! \brief Default copy constructor copying everything.

View File

@ -27,7 +27,7 @@ class ASMs3DLag : public ASMs3D
{
public:
//! \brief Default constructor.
ASMs3DLag(unsigned char n_f = 3);
explicit ASMs3DLag(unsigned char n_f = 3);
//! \brief Special copy constructor for sharing of FE data.
ASMs3DLag(const ASMs3DLag& patch, unsigned char n_f);
//! \brief Default copy constructor copying everything.

View File

@ -26,7 +26,7 @@ class ASMs3DSpec : public ASMs3DLag
{
public:
//! \brief Default constructor.
ASMs3DSpec(unsigned char n_f = 3) : ASMs3DLag(n_f) {}
explicit ASMs3DSpec(unsigned char n_f = 3) : ASMs3DLag(n_f) {}
//! \brief Copy constructor.
ASMs3DSpec(const ASMs3DSpec& patch, unsigned char n_f = 0)
: ASMs3DLag(patch,n_f) {}

View File

@ -33,7 +33,7 @@ class ASMs3Dmx : public ASMs3D, private ASMmxBase
{
public:
//! \brief The constructor initializes the dimension of each basis.
ASMs3Dmx(const CharVec& n_f);
explicit ASMs3Dmx(const CharVec& n_f);
//! \brief Copy constructor.
ASMs3Dmx(const ASMs3Dmx& patch, const CharVec& n_f = CharVec(2,0));
//! \brief Empty destructor.

View File

@ -30,7 +30,7 @@ class ASMs3DmxLag : public ASMs3DLag, private ASMmxBase
{
public:
//! \brief The constructor initializes the dimension of each basis.
ASMs3DmxLag(const CharVec& n_f);
explicit ASMs3DmxLag(const CharVec& n_f);
//! \brief Copy constructor.
ASMs3DmxLag(const ASMs3DmxLag& patch, const CharVec& n_f = CharVec(2,0));
//! \brief Empty destructor.

View File

@ -47,7 +47,7 @@ namespace LR //! Utilities for LR-splines.
RealArray errors; //!< List of error indicators for the elements
//! \brief Default constructor.
RefineData(bool rs = false) : refShare(rs) {}
explicit RefineData(bool rs = false) : refShare(rs) {}
};
//! \brief Expands the basis coefficients of an LR-spline object.

View File

@ -28,7 +28,7 @@ class BDFMats : public NewmarkMats
public:
//! \brief The constructor initializes the time integration parameters.
//! param[in] bdfscheme BDF time discretization scheme
BDFMats(const TimeIntegration::BDFD2& bdfscheme) : bdf(bdfscheme) {}
explicit BDFMats(const TimeIntegration::BDFD2& bdfscheme) : bdf(bdfscheme) {}
//! \brief Empty destructor.
virtual ~BDFMats() {}

View File

@ -48,7 +48,7 @@ public:
class SlaveOrder {
public:
//! \brief The constructor initializes the DomainDecomposition reference.
SlaveOrder(const DomainDecomposition& dd_) : dd(dd_) {}
explicit SlaveOrder(const DomainDecomposition& dd_) : dd(dd_) {}
//! \brief Hide ill-formed default assignment operator.
SlaveOrder& operator=(const SlaveOrder&) { return *this; }
//! \brief Compare interfaces.

View File

@ -39,7 +39,7 @@ public:
//! by the application, but are only used to assembly the global norms.
//! To avoid the need for a global array of element norms in that case,
//! an internal array is then used instead.
ElmNorm(size_t n) : buf(n,0.0), nnv(n) { ptr = &buf.front(); }
explicit ElmNorm(size_t n) : buf(n,0.0), nnv(n) { ptr = &buf.front(); }
//! \brief Empty destructor.
virtual ~ElmNorm() {}

View File

@ -31,7 +31,7 @@ class Field
protected:
//! \brief The constructor sets the field name.
//! \param[in] name Optional name of field
Field(const char* name = nullptr) { if (name) fname = name; }
explicit Field(const char* name = nullptr) { if (name) fname = name; }
public:
//! \brief Empty destructor.

View File

@ -31,7 +31,7 @@ class FieldBase : public Field
protected:
//! \brief The constructor sets the field name.
//! \param[in] name Optional name of field
FieldBase(const char* name = nullptr) : Field(name) { nelm = nno = 0; }
explicit FieldBase(const char* name = nullptr) : Field(name) { nelm = nno = 0; }
public:
//! \brief Empty destructor.

View File

@ -36,7 +36,7 @@ class Fields
protected:
//! \brief The constructor sets the field name.
//! \param[in] name Name of field
Fields(const char* name = 0) : nf(0), nelm(0), nno(0)
explicit Fields(const char* name = 0) : nf(0), nelm(0), nno(0)
{ if (name) fname = name; }
public:

View File

@ -31,7 +31,7 @@ class GlbForceVec : public GlobalIntegral
{
public:
//! \brief The constructor only sets its reference to the SAM object.
GlbForceVec(const SAM& _sam) : sam(_sam) {}
explicit GlbForceVec(const SAM& _sam) : sam(_sam) {}
//! \brief Empty destructor.
virtual ~GlbForceVec() {}

View File

@ -93,7 +93,7 @@ public:
//! \brief Default constructor.
PerforatedPlate2D() {}
//! \brief Constructor creating a single hole.
PerforatedPlate2D(Hole2D* hole) { holes.resize(1,hole); }
explicit PerforatedPlate2D(Hole2D* hole) { holes.resize(1,hole); }
//! \brief The destructor deletes the holes.
virtual ~PerforatedPlate2D();

View File

@ -63,7 +63,7 @@ struct cell
vertex CellVerts[4]; //!< Global coordinates of the cell vertices
//! \brief Default constructor.
cell(int level = 0) : depth(level), xi(0.0), eta(0.0) {}
explicit cell(int level = 0) : depth(level), xi(0.0), eta(0.0) {}
};

View File

@ -41,7 +41,7 @@ class IntegrandBase : public Integrand
{
protected:
//! \brief The default constructor is protected to allow sub-classes only.
IntegrandBase(unsigned short int n = 0) : nsd(n), npv(1), m_mode(SIM::INIT) {}
explicit IntegrandBase(unsigned short int n = 0) : nsd(n), npv(1), m_mode(SIM::INIT) {}
public:
//! \brief Empty destructor.
@ -285,8 +285,8 @@ class NormBase : public Integrand
{
protected:
//! \brief The default constructor is protected to allow sub-classes only.
NormBase(IntegrandBase& p) : myProblem(p), projBou(false), nrcmp(0),
lints(nullptr), finalOp(ASM::SQRT) {}
explicit NormBase(IntegrandBase& p) : myProblem(p), projBou(false), nrcmp(0),
lints(nullptr), finalOp(ASM::SQRT) {}
public:
//! \brief Empty destructor.
@ -392,7 +392,7 @@ class ForceBase : public Integrand
{
protected:
//! \brief The constructor is protected to allow sub-classes only.
ForceBase(IntegrandBase& p) : myProblem(p), eBuffer(nullptr) {}
explicit ForceBase(IntegrandBase& p) : myProblem(p), eBuffer(nullptr) {}
public:
//! \brief The destructor frees the internally allocated objects.

View File

@ -39,7 +39,7 @@ class ASMu3D : public ASMunstruct, public ASM3D
{
public:
//! \brief Default constructor.
ASMu3D(unsigned char n_f = 3);
explicit ASMu3D(unsigned char n_f = 3);
//! \brief Copy constructor.
ASMu3D(const ASMu3D& patch, unsigned char n_f = 0);
//! \brief Empty destructor.

View File

@ -26,7 +26,7 @@ class Lagrange
public:
//! \brief Constructor initializing the reference to natural coordinates.
//! \param[in] p Natural interpolation point coordinates in range [-1,1]
Lagrange(const RealArray& p) : points(p) {}
explicit Lagrange(const RealArray& p) : points(p) {}
//! \brief Evaluates a 1D Lagrange polynomial.
//! \param[in] polnum Which polynomial of the basis to evaluate

View File

@ -33,7 +33,7 @@ class ISTLVector : public StdVector
{
public:
//! \brief Constructor creating an empty vector.
ISTLVector(const ProcessAdm& padm);
explicit ISTLVector(const ProcessAdm& padm);
//! \brief Constructor creating a vector of length \a n.
ISTLVector(const ProcessAdm& padm, size_t n);
//! \brief Constructor creating a vector from an array.

View File

@ -43,7 +43,7 @@ namespace ISTL
class IOp2Pre : public Dune::InverseOperator2Preconditioner<Pre<ISTL::Mat>, Dune::SolverCategory::sequential> {
typedef Dune::InverseOperator2Preconditioner<Pre<ISTL::Mat>, Dune::SolverCategory::sequential> SolverType;
public:
IOp2Pre(Pre<ISTL::Mat>* iop) : SolverType(*iop)
explicit IOp2Pre(Pre<ISTL::Mat>* iop) : SolverType(*iop)
{
m_op.reset(iop);
}

View File

@ -39,7 +39,7 @@ class PETScVector : public StdVector
{
public:
//! \brief Constructor creating an empty vector.
PETScVector(const ProcessAdm& padm);
explicit PETScVector(const ProcessAdm& padm);
//! \brief Constructor creating a vector of length \a n.
PETScVector(const ProcessAdm& padm, size_t n);
//! \brief Constructor creating a vector from an array.

View File

@ -48,13 +48,13 @@ public:
ProcessAdm();
#if defined(HAS_PETSC) || defined(HAVE_MPI)
//! \brief Construct a parallel process administrator.
ProcessAdm(MPI_Comm& mpi_comm);
explicit ProcessAdm(MPI_Comm& mpi_comm);
#endif
#ifdef HAVE_MPI
//! \brief Construct a parallel process administrator.
//! \details This overload is necessary due to MPI_COMM_WORLD being .. ickily.
ProcessAdm(bool hack);
explicit ProcessAdm(bool hack);
#endif
//! \brief The destructor releases the process administrator.

View File

@ -59,7 +59,7 @@ struct SuperLUdata
Real rpg; //!< Reciprocal pivot growth
//! \brief The constructor initializes the default input options.
SuperLUdata(int numThreads = 0)
explicit SuperLUdata(int numThreads = 0)
{
R = C = 0;
perm_r = perm_c = etree = 0;

View File

@ -126,11 +126,11 @@ public:
//! \brief Constructor creating an empty vector.
StdVector() {}
//! \brief Constructor creating a vector of length \a n.
StdVector(size_t n) : utl::vector<Real>(n) {}
explicit StdVector(size_t n) : utl::vector<Real>(n) {}
//! \brief Constructor creating a vector from an array.
StdVector(const Real* values, size_t n) : utl::vector<Real>(values,n) {}
//! \brief Overloaded copy constructor.
StdVector(const std::vector<Real>& vec)
explicit StdVector(const std::vector<Real>& vec)
{ this->insert(this->end(),vec.begin(),vec.end()); }
//! \brief Returns the vector type.

View File

@ -61,7 +61,7 @@ namespace utl //! General utility classes and functions.
//! \brief Constructor creating an empty vector.
vector<T>() {}
//! \brief Constructor creating a vector of length \a n.
vector<T>(size_t n) { this->resize(n); }
explicit vector<T>(size_t n) { this->resize(n); }
//! \brief Constructor creating a vector from an array.
vector<T>(const T* values, size_t n) { this->fill(values,n); }

View File

@ -26,7 +26,7 @@ class EigenModeSIM : public MultiStepSIM
{
public:
//! \brief The constructor initializes the FE model reference.
EigenModeSIM(SIMbase& sim);
explicit EigenModeSIM(SIMbase& sim);
//! \brief Empty destructor.
virtual ~EigenModeSIM() {}

View File

@ -25,7 +25,7 @@ class GenAlphaSIM : public NewmarkSIM
{
public:
//! \brief The constructor initializes default solution parameters.
GenAlphaSIM(SIMbase& s);
explicit GenAlphaSIM(SIMbase& s);
//! \brief Empty destructor.
virtual ~GenAlphaSIM() {}

View File

@ -175,7 +175,7 @@ class HHTSIM : public NewmarkSIM
{
public:
//! \brief The constructor initializes default solution parameters.
HHTSIM(SIMbase& sim);
explicit HHTSIM(SIMbase& sim);
//! \brief Empty destructor.
virtual ~HHTSIM() {}

View File

@ -31,7 +31,7 @@ class ModelGenerator
public:
//! \brief The constructor initializes the common members.
//!\ param elem XML element to parse
ModelGenerator(const TiXmlElement* elem) : geo(elem) {}
explicit ModelGenerator(const TiXmlElement* elem) : geo(elem) {}
//! \brief Empty destructor.
virtual ~ModelGenerator() {}
@ -69,7 +69,7 @@ class DefaultGeometry1D : public ModelGenerator
public:
//! \brief The constructor forwards to the base class.
//! \param[in] geo XML element containing geometry definition
DefaultGeometry1D(const TiXmlElement* geo) : ModelGenerator(geo) {}
explicit DefaultGeometry1D(const TiXmlElement* geo) : ModelGenerator(geo) {}
//! \brief Empty destructor.
virtual ~DefaultGeometry1D() {}
@ -93,7 +93,7 @@ class DefaultGeometry2D : public ModelGenerator
public:
//! \brief The constructor forwards to the base class.
//! \param[in] geo XML element containing geometry definition
DefaultGeometry2D(const TiXmlElement* geo) : ModelGenerator(geo) {}
explicit DefaultGeometry2D(const TiXmlElement* geo) : ModelGenerator(geo) {}
//! \brief Empty destructor.
virtual ~DefaultGeometry2D() {}
@ -117,7 +117,7 @@ class DefaultGeometry3D : public ModelGenerator
public:
//! \brief The constructor forwards to the base class.
//! \param[in] geo XML element containing geometry definition
DefaultGeometry3D(const TiXmlElement* geo) : ModelGenerator(geo) {}
explicit DefaultGeometry3D(const TiXmlElement* geo) : ModelGenerator(geo) {}
//! \brief Empty destructor.
virtual ~DefaultGeometry3D() {}

View File

@ -36,7 +36,7 @@ protected:
//! \brief The constructor initializes the FE model reference.
//! \param sim The FE model
MultiStepSIM(SIMbase& sim);
explicit MultiStepSIM(SIMbase& sim);
public:
//! \brief Empty destructor.

View File

@ -175,7 +175,7 @@ class NewmarkNLSIM : public NewmarkSIM
{
public:
//! \brief The constructor initializes default solution parameters.
NewmarkNLSIM(SIMbase& sim);
explicit NewmarkNLSIM(SIMbase& sim);
//! \brief Empty destructor.
virtual ~NewmarkNLSIM() {}

View File

@ -25,7 +25,7 @@ class NewmarkSIM : public MultiStepSIM
{
public:
//! \brief The constructor initializes default solution parameters.
NewmarkSIM(SIMbase& sim);
explicit NewmarkSIM(SIMbase& sim);
//! \brief Empty destructor.
virtual ~NewmarkSIM() {}

View File

@ -32,7 +32,7 @@ class SIMadmin : public XMLInputBase
{
protected:
//! \brief The default constructor initializes the process administrator.
SIMadmin(const char* heading = nullptr);
explicit SIMadmin(const char* heading = nullptr);
//! \brief Copy constructor.
SIMadmin(SIMadmin& anotherSIM);

View File

@ -62,7 +62,7 @@ class SIMbase : public SIMadmin, public SIMdependency
{
protected:
//! \brief The constructor initializes the pointers to dynamic data members.
SIMbase(IntegrandBase* itg = nullptr);
explicit SIMbase(IntegrandBase* itg = nullptr);
public:
//! \brief The destructor frees the dynamically allocated objects.

View File

@ -28,7 +28,7 @@ class SIMgeneric : public SIMoutput
{
protected:
//! \brief Default constructor.
SIMgeneric(IntegrandBase* itg = nullptr) : SIMoutput(itg) {}
explicit SIMgeneric(IntegrandBase* itg = nullptr) : SIMoutput(itg) {}
public:
//! \brief Empty destructor.

View File

@ -47,16 +47,16 @@ public:
//! \brief Default constructor.
ICInfo() : file_level(-1), geo_level(0), basis(1), component(0) {}
//! \brief Constructor providing the field name.
ICInfo(const std::string& f) : file_level(-1), geo_level(0),
basis(1), component(0),
sim_field(f), file_field(f) {}
explicit ICInfo(const std::string& f) : file_level(-1), geo_level(0),
basis(1), component(0),
sim_field(f), file_field(f) {}
};
typedef std::vector<ICInfo> InitialCondVec; //!< Convenience declaration
typedef std::vector<unsigned char> CharVec; //!< Convenience declaration
protected:
//! \brief The constructor just forwards to the base class constructor.
SIMinput(IntegrandBase* itg = nullptr) : SIMbase(itg), myGen(nullptr) {}
explicit SIMinput(IntegrandBase* itg = nullptr) : SIMbase(itg), myGen(nullptr) {}
public:
//! \brief Empty destructor.

View File

@ -34,7 +34,7 @@ class SIMoutput : public SIMinput
{
protected:
//! \brief The constructor just forwards to the base class constructor.
SIMoutput(IntegrandBase* itg);
explicit SIMoutput(IntegrandBase* itg);
public:
//! \brief The destructor frees the dynamically allocated VTF object.

View File

@ -65,7 +65,7 @@ public:
//! \brief Constructor initializing the symmetric stress tensor field only.
//! \param[in] sigma Symmetric stress tensor field
AnaSol(STensorFunc* sigma)
explicit AnaSol(STensorFunc* sigma)
: vecSol(nullptr), vecSecSol(nullptr), stressSol(sigma) {}
//! \brief Constructor initializing expression functions by parsing a stream.

View File

@ -29,7 +29,7 @@ namespace TimeIntegration //! Utilities for time integration.
public:
//! \brief Default constructor.
//! \param[in] order The order of the BDF scheme
BDF(int order = 0) : step(0), coefs1(1,1.0) { this->setOrder(order); }
explicit BDF(int order = 0) : step(0), coefs1(1,1.0) { this->setOrder(order); }
//! \brief Empty destructor.
virtual ~BDF() {}

View File

@ -25,7 +25,7 @@ class ElementBlock
{
public:
//! The constructor defines the number of nodes per element \a nenod.
ElementBlock(size_t nenod = 8);
explicit ElementBlock(size_t nenod = 8);
//! \brief Reallocates the internal arrays to fit a structured grid.
//! \param[in] nI Number of element in I-direction

View File

@ -32,7 +32,7 @@ class FieldFunction : public RealFunc
public:
//! \brief Default constructor.
FieldFunction(Field* f = nullptr) : field(f), pch(nullptr) {}
explicit FieldFunction(Field* f = nullptr) : field(f), pch(nullptr) {}
//! \brief Constructor creating a field from a provided HDF5 file.
//! \param[in] fileName Name of the HDF5-file
//! \param[in] basisName Name of the basis which the field values refer to

View File

@ -100,7 +100,7 @@ namespace utl
{
protected:
//! \brief The constructor is protected to allow sub-class instances only.
SpatialFunction(const Result& val) : zero(val) {}
explicit SpatialFunction(const Result& val) : zero(val) {}
public:
//! \brief Empty destructor.
@ -246,9 +246,9 @@ class TractionField : public TractionFunc
public:
//! \brief Constructor initializing the symmetric tensor function pointer.
TractionField(const STensorFunc& field);
explicit TractionField(const STensorFunc& field);
//! \brief Constructor initializing the tensor function pointer.
TractionField(const TensorFunc& field);
explicit TractionField(const TensorFunc& field);
//! \brief Empty destructor.
virtual ~TractionField() {}

View File

@ -27,7 +27,7 @@ class ConstantFunc : public ScalarFunc
public:
//! \brief Constructor initializing the function value.
ConstantFunc(Real v) : fval(v) {}
explicit ConstantFunc(Real v) : fval(v) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return fval == Real(0); }
@ -48,7 +48,7 @@ class LinearFunc : public ScalarFunc
public:
//! \brief Constructor initializing the function parameter.
LinearFunc(Real s = Real(1)) : scale(s) {}
explicit LinearFunc(Real s = Real(1)) : scale(s) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return scale == Real(0); }
@ -159,7 +159,7 @@ class ConstFunc : public RealFunc
public:
//! \brief Constructor initializing the function value.
ConstFunc(Real v) : fval(v) {}
explicit ConstFunc(Real v) : fval(v) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return fval == Real(0); }
@ -180,7 +180,7 @@ class ConstTimeFunc : public RealFunc
public:
//! \brief Constructor initializing the function value.
ConstTimeFunc(const ScalarFunc* f) : tfunc(f) {}
explicit ConstTimeFunc(const ScalarFunc* f) : tfunc(f) {}
//! \brief The destructor frees the time function.
virtual ~ConstTimeFunc() { delete tfunc; }
@ -517,7 +517,7 @@ class ConstVecFunc : public VecFunc
public:
//! \brief Constructor initializing the function value.
ConstVecFunc(const Vec3& v) : fval(v) {}
explicit ConstVecFunc(const Vec3& v) : fval(v) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return fval.isZero(0.0); }

View File

@ -6,7 +6,7 @@
class LagrangeInterpolator {
public:
LagrangeInterpolator(const std::vector<double>& grid_) :
explicit LagrangeInterpolator(const std::vector<double>& grid_) :
grid(grid_)
{
}

View File

@ -27,7 +27,7 @@ class LogStream
public:
//! \brief Default constructor.
//! \param out The output stream to wrap
LogStream(std::ostream* out = nullptr) : m_out(out) { m_ppid = m_pid = 0; }
explicit LogStream(std::ostream* out) : m_out(out) { m_ppid = m_pid = 0; }
//! \brief Constructor initializing the output stream from a reference.
//! \param out The output stream to wrap
//! \param ppid The PID to print on

View File

@ -42,7 +42,7 @@ public:
//! \details The constructor also updates the global static pointer
//! utl::profiler to point to \a *this, deleting any already pointed-to
//! object first. This means, only one Profiler object can exist at any time.
Profiler(const std::string& name);
explicit Profiler(const std::string& name);
//! \brief The destructor prints the profiling report to the console.
~Profiler();
@ -106,7 +106,7 @@ namespace utl
const char* name; //!< Name tag on the local scope to profile
public:
//! \brief The constructor starts the profiling of the named task.
prof(const char* tag) : name(tag) { if (profiler) profiler->start(name); }
explicit prof(const char* tag) : name(tag) { if (profiler) profiler->start(name); }
//! \brief The destructor stops the profiling.
~prof() { if (profiler) profiler->stop(name); }
};

View File

@ -26,7 +26,7 @@ class TensorFunc : public utl::SpatialFunction<Tensor>, public FunctionBase
{
protected:
//! \brief The constructor is protected to allow sub-class instances only.
TensorFunc(size_t n = 0) : utl::SpatialFunction<Tensor>(Tensor(n))
explicit TensorFunc(size_t n = 0) : utl::SpatialFunction<Tensor>(Tensor(n))
{
ncmp = zero.size();
}

View File

@ -438,7 +438,7 @@ namespace utl
int myValue; //!< The integer value to search for
public:
//! The constructor initializes the value to search for.
cmpInt(int value) : myValue(value) {}
explicit cmpInt(int value) : myValue(value) {}
//! \brief Returns \e true if \a value.second equals \a myValue.
bool operator()(const std::pair<int,int>& value) const
{