mark some constructors explicit

This commit is contained in:
Arne Morten Kvarving
2021-09-30 12:06:11 +02:00
parent ef2aca116d
commit 88bcd66794
20 changed files with 32 additions and 32 deletions

View File

@@ -31,13 +31,13 @@ public:
//! \brief Constructor for standard problems.
//! \param[in] n1 Dimension of the primary solution field
//! \param[in] checkRHS If \e true, ensure the model is in a right-hand system
SIMMultiPatchModelGen(int n1, bool checkRHS = false) : Dim(n1,checkRHS) {}
explicit SIMMultiPatchModelGen(int n1, bool checkRHS = false) : Dim(n1,checkRHS) {}
//! \brief Constructor for mixed problems.
//! \param[in] unf Dimension of the primary solution field
//! \param[in] checkRHS If \e true, ensure the model is in a right-hand system
SIMMultiPatchModelGen(const std::vector<unsigned char>& unf,
bool checkRHS = false) : Dim(unf,checkRHS) {}
explicit SIMMultiPatchModelGen(const std::vector<unsigned char>& unf,
bool checkRHS = false) : Dim(unf,checkRHS) {}
//! \brief Empty destructor.
virtual ~SIMMultiPatchModelGen() {}

View File

@@ -32,7 +32,7 @@ template<class T1> class SIMSolverStat : public SIMadmin
{
public:
//! \brief The constructor initializes the reference to the actual solver.
SIMSolverStat(T1& s1, const char* head = nullptr) : SIMadmin(head), S1(s1)
explicit SIMSolverStat(T1& s1, const char* head = nullptr) : SIMadmin(head), S1(s1)
{
exporter = nullptr;
startExpLevel = 0;

View File

@@ -37,7 +37,7 @@ class ASMs2DIB : public ASMs2D
bool alsoSW; //!< If \e true, consider south/west neighbors too
public:
//! \brief The constructor initialises the reference to current patch.
Intersected(const ASMs2DIB& pch, bool all = false, bool sw = false)
explicit Intersected(const ASMs2DIB& pch, bool all = false, bool sw = false)
: InterfaceChecker(pch), myAll(all), alsoSW(sw) {}
//! \brief Empty destructor.
virtual ~Intersected() {}

View File

@@ -26,7 +26,7 @@ class AlgEqSystem : public GlobalIntegral
{
public:
//! \brief The constructor sets its reference to SAM and ProcessAdm objects.
AlgEqSystem(const SAM& s, const ProcessAdm* a = nullptr);
explicit AlgEqSystem(const SAM& s, const ProcessAdm* a = nullptr);
//! \brief The destructor frees the dynamically allocated objects.
virtual ~AlgEqSystem() { this->clear(); }

View File

@@ -32,7 +32,7 @@ public:
//! \brief The constructor initializes the block information arrays.
//! \param[in] nBlk Number of matrix blocks (in each direction, row & column)
//! \param[in] nb Number of bases (> 1 for mixed problems)
BlockElmMats(size_t nBlk, size_t nb = 1) : blockInfo(nBlk), basisInfo(nb) {}
explicit BlockElmMats(size_t nBlk, size_t nb = 1) : blockInfo(nBlk), basisInfo(nb) {}
//! \brief Empty destructor.
virtual ~BlockElmMats() {}

View File

@@ -98,7 +98,7 @@ class MxFiniteElement : public FiniteElement
{
public:
//! \brief The constructor initializes the size of each basis.
MxFiniteElement(const std::vector<size_t>& n, size_t ip = 0);
explicit MxFiniteElement(const std::vector<size_t>& n, size_t ip = 0);
//! \brief Empty destructor.
virtual ~MxFiniteElement() {}

View File

@@ -31,7 +31,7 @@ public:
//! \brief The constructor initializes a reference to the global norm vector.
//! \param[in] v Vector of global norm quantities
//! \param[in] op Operation to be performed after accumulating element norms
GlbNorm(Vectors& v, ASM::FinalNormOp op = ASM::NONE);
explicit GlbNorm(Vectors& v, ASM::FinalNormOp op = ASM::NONE);
//! \brief The destructor applies the operation \a myOp on \a myVals.
virtual ~GlbNorm();

View File

@@ -31,9 +31,9 @@ public:
//! \brief Copy constructor.
DenseMatrix(const DenseMatrix& A);
//! \brief Special constructor taking data from a one-dimensional array.
DenseMatrix(const RealArray& data, size_t nrows = 0);
explicit DenseMatrix(const RealArray& data, size_t nrows = 0);
//! \brief Special constructor, type conversion from Matrix.
DenseMatrix(const Matrix& A, bool s = false);
explicit DenseMatrix(const Matrix& A, bool s = false);
//! \brief The destructor frees the dynamically allocated arrays.
virtual ~DenseMatrix() { if (ipiv) delete[] ipiv; }

View File

@@ -44,7 +44,7 @@ public:
//! \brief Default constructor creating an empty matrix.
SparseMatrix(SparseSolver eqSolver = NONE, int nt = 1);
//! \brief Constructor creating a \f$m \times n\f$ matrix.
SparseMatrix(size_t m, size_t n = 0);
explicit SparseMatrix(size_t m, size_t n = 0);
//! \brief Copy constructor.
SparseMatrix(const SparseMatrix& B);
//! \brief The destructor frees the dynamically allocated arrays.

View File

@@ -39,7 +39,7 @@ namespace utl
//! \brief Copy constructor.
matrix3d(const matrix3d<T>& mat) : matrixBase<T>(mat) {}
//! \brief Constructor to read a matrix from a stream.
matrix3d(std::istream& is, std::streamsize max = 10)
explicit matrix3d(std::istream& is, std::streamsize max = 10)
{
// Read size
size_t n0 = 0, n1 = 0, n2 = 0;

View File

@@ -33,7 +33,7 @@ public:
//! \brief The constructor specifies the first function to sum.
//! \param[in] f Pointer to a function to sum
//! \param[in] w Weighting factor. If negative, take max value instead.
FunctionSum(FunctionBase* f, double w = 1.0) { this->add(f,w); }
explicit FunctionSum(FunctionBase* f, double w = 1.0) { this->add(f,w); }
//! \brief Empty destructor.
virtual ~FunctionSum() {}

View File

@@ -39,7 +39,7 @@ public:
//! \brief The constructor initializes default solution parameters.
//! \param sim Pointer to the spline FE model
//! \param[in] n Which type of iteration norm to use in convergence checks
NonLinSIM(SIMbase& sim, CNORM n = ENERGY);
explicit NonLinSIM(SIMbase& sim, CNORM n = ENERGY);
//! \brief The destructor prints out the slow-converging nodes, if any.
virtual ~NonLinSIM();

View File

@@ -32,11 +32,11 @@ public:
SIM1D(unsigned char n1 = 1, bool = false);
//! \brief Constructor used for mixed problems.
//! \param[in] unf Dimension of the primary solution fields
SIM1D(const CharVec& unf, bool = false);
explicit SIM1D(const CharVec& unf, bool = false);
//! \brief Constructor that also initializes the integrand pointer.
//! \param[in] itg Pointer to the integrand of the problem to solve
//! \param[in] n Dimension of the primary solution field
SIM1D(IntegrandBase* itg, unsigned char n = 1);
explicit SIM1D(IntegrandBase* itg, unsigned char n = 1);
//! \brief Empty destructor.
virtual ~SIM1D() {}

View File

@@ -36,12 +36,12 @@ public:
//! \brief Constructor used for mixed problems.
//! \param[in] unf Dimension of the primary solution fields
//! \param[in] check If \e true, ensure the model is in a right-hand system
SIM2D(const CharVec& unf, bool check = false);
explicit SIM2D(const CharVec& unf, bool check = false);
//! \brief Constructor that also initializes the integrand pointer.
//! \param[in] itg Pointer to the integrand of the problem to solve
//! \param[in] n Dimension of the primary solution field
//! \param[in] check If \e true, ensure the model is in a right-hand system
SIM2D(IntegrandBase* itg, unsigned char n = 2, bool check = false);
explicit SIM2D(IntegrandBase* itg, unsigned char n = 2, bool check = false);
//! \brief Empty destructor.
virtual ~SIM2D() {}

View File

@@ -36,12 +36,12 @@ public:
//! \brief Constructor used for mixed problems.
//! \param[in] unf Dimension of the primary solution fields
//! \param[in] check If \e true, ensure the model is in a right-hand system
SIM3D(const CharVec& unf, bool check = false);
explicit SIM3D(const CharVec& unf, bool check = false);
//! \brief Constructor that also initializes the integrand pointer.
//! \param[in] itg Pointer to the integrand of the problem to solve
//! \param[in] n Dimension of the primary solution field
//! \param[in] check If \e true, ensure the model is in a right-hand system
SIM3D(IntegrandBase* itg, unsigned char n = 3, bool check = false);
explicit SIM3D(IntegrandBase* itg, unsigned char n = 3, bool check = false);
//! \brief Empty destructor.
virtual ~SIM3D() {}

View File

@@ -29,7 +29,7 @@ class SIMmultiCpl : public SIMadmin
{
public:
//! \brief The constructor initializes the array of base %SIM objects.
SIMmultiCpl(const std::vector<SIMoutput*>& sims);
explicit SIMmultiCpl(const std::vector<SIMoutput*>& sims);
//! \brief The destructor deletes the base %SIM objects.
virtual ~SIMmultiCpl();

View File

@@ -50,7 +50,7 @@ public:
static int numError; //!< Error counter - set by the exception handler
//! \brief The constructor parses the expression string.
EvalFunc(const char* function, const char* x = "x", Real eps = Real(1.0e-8));
explicit EvalFunc(const char* function, const char* x = "x", Real eps = Real(1.0e-8));
//! \brief The destructor frees the dynamically allocated objects.
virtual ~EvalFunc();

View File

@@ -170,7 +170,7 @@ class StepFunc : public ScalarFunc
public:
//! \brief Constructor initializing the function parameters.
StepFunc(Real a, Real x = Real(0)) : amp(a), xmax(x) {}
explicit StepFunc(Real a, Real x = Real(0)) : amp(a), xmax(x) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return amp == Real(0); }
@@ -298,7 +298,7 @@ class LinearXFunc : public RealFunc
public:
//! \brief Constructor initializing the function parameters.
LinearXFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
explicit LinearXFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return a == Real(0) && b == Real(0); }
@@ -323,7 +323,7 @@ class LinearYFunc : public RealFunc
public:
//! \brief Constructor initializing the function parameters.
LinearYFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
explicit LinearYFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return a == Real(0) && b == Real(0); }
@@ -348,7 +348,7 @@ class LinearZFunc : public RealFunc
public:
//! \brief Constructor initializing the function parameters.
LinearZFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
explicit LinearZFunc(Real A, Real B = Real(0)) : a(A), b(B) {}
//! \brief Returns whether the function is identically zero or not.
virtual bool isZero() const { return a == Real(0) && b == Real(0); }
@@ -497,7 +497,7 @@ class StepXFunc : public RealFunc
public:
//! \brief Constructor initializing the function parameters.
StepXFunc(Real v, Real X0 = Real(0), Real X1 = Real(1), char dir = 'X')
explicit StepXFunc(Real v, Real X0 = Real(0), Real X1 = Real(1), char dir = 'X')
: fv(v), x0(X0), x1(X1), d(dir) {}
//! \brief Returns whether the function is identically zero or not.
@@ -523,7 +523,7 @@ class StepXYFunc : public RealFunc
public:
//! \brief Constructor initializing the function parameters.
StepXYFunc(Real v,
explicit StepXYFunc(Real v,
Real X1 = Real(1), Real Y1 = Real(1),
Real X0 = Real(-1), Real Y0 = Real(-1))
: fv(v), x0(X0), y0(Y0), x1(X1), y1(Y1) {}

View File

@@ -32,7 +32,7 @@ public:
//! \param out The output stream to wrap
//! \param ppid The PID to print on
//! \param mypid The PID of this process
LogStream(std::ostream& out, int ppid = 0, int mypid = 0);
explicit LogStream(std::ostream& out, int ppid = 0, int mypid = 0);
//! \brief Nullifies the output stream.
void setNull() { m_out = nullptr; }

View File

@@ -34,7 +34,7 @@ namespace utl
Point() : Vec4(par) { par[0] = par[1] = par[2] = Real(0); }
//! \brief Constructor creating a point at the specified location.
Point(const Vec3& X) : Vec4(X,Real(0),par)
explicit Point(const Vec3& X) : Vec4(X,Real(0),par)
{
par[0] = par[1] = par[2] = Real(0);
}
@@ -54,7 +54,7 @@ namespace utl
}
//! \brief Constructor creating a point from the given \a std::vector.
Point(const std::vector<Real>& X) : Vec4(X,par)
explicit Point(const std::vector<Real>& X) : Vec4(X,par)
{
for (size_t i = 0; i < 3; i++)
par[i] = 3+i < X.size() ? X[3+i] : 0.0;