Skip to content

Commit

Permalink
Add override keyword in various places
Browse files Browse the repository at this point in the history
As were pointed out by GCCs -Wsuggest-override
  • Loading branch information
pbauman authored and jwpeterson committed Aug 2, 2021
1 parent d7dfd7a commit 2b7d112
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion include/base/libmesh_exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class SolverException: public std::exception
/**
* Override the what() function to provide a generic error message.
*/
virtual const char * what() const noexcept
virtual const char * what() const noexcept override
{
// std::string::c_str() is noexcept in C++11, so it's safe to call
// in what() because it can't throw.
Expand Down
4 changes: 2 additions & 2 deletions include/error_estimation/adjoint_refinement_estimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class AdjointRefinementEstimator : public ErrorEstimator
virtual void estimate_error (const System & system,
ErrorVector & error_per_cell,
const NumericVector<Number> * solution_vector = nullptr,
bool estimate_parent_error = false);
bool estimate_parent_error = false) override;

/**
* This is an accessor function to access the computed global
Expand All @@ -108,7 +108,7 @@ class AdjointRefinementEstimator : public ErrorEstimator
return computed_global_QoI_errors[qoi_index];
}

virtual ErrorEstimatorType type() const;
virtual ErrorEstimatorType type() const override;

/**
* How many h refinements to perform to get the fine grid
Expand Down
6 changes: 3 additions & 3 deletions include/numerics/const_fem_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ class ConstFEMFunction : public FEMFunctionBase<Output>
ConstFEMFunction & operator= (ConstFEMFunction &&) = default;
virtual ~ConstFEMFunction () = default;

virtual std::unique_ptr<FEMFunctionBase<Output>> clone () const
virtual std::unique_ptr<FEMFunctionBase<Output>> clone () const override
{return libmesh_make_unique<ConstFEMFunction>(*this); }

virtual Output operator() (const FEMContext &,
const Point &,
const Real /* time */ = 0.)
const Real /* time */ = 0.) override
{ return _c; }

virtual void operator() (const FEMContext &,
const Point &,
const Real,
DenseVector<Output> & output)
DenseVector<Output> & output) override
{
for (auto i : index_range(output))
output(i) = _c;
Expand Down
6 changes: 3 additions & 3 deletions include/numerics/parsed_fem_function_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ class ParsedFEMFunctionParameter : public ParameterAccessor<T>
/**
* Setter: change the value of the parameter we access.
*/
virtual void set (const T & new_value) {
virtual void set (const T & new_value) override {
_func.set_inline_value(_name, new_value);
}

/**
* \returns A constant reference to the value of the parameter we access.
*/
virtual const T & get () const {
virtual const T & get () const override {
_current_val = _func.get_inline_value(_name);
return _current_val;
}

/**
* \returns A new copy of the accessor.
*/
virtual std::unique_ptr<ParameterAccessor<T>> clone() const {
virtual std::unique_ptr<ParameterAccessor<T>> clone() const override {
return libmesh_make_unique<ParsedFEMFunctionParameter<T>>(_func, _name);
}

Expand Down
6 changes: 3 additions & 3 deletions include/numerics/parsed_function_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@ class ParsedFunctionParameter : public ParameterAccessor<T>
/**
* Setter: change the value of the parameter we access.
*/
virtual void set (const T & new_value) {
virtual void set (const T & new_value) override {
_func.set_inline_value(_name, new_value);
}

/**
* Getter: get the value of the parameter we access.
*/
virtual const T & get () const {
virtual const T & get () const override {
_current_val = _func.get_inline_value(_name);
return _current_val;
}

/**
* \returns A new copy of the accessor.
*/
virtual std::unique_ptr<ParameterAccessor<T>> clone() const {
virtual std::unique_ptr<ParameterAccessor<T>> clone() const override {
return libmesh_make_unique<ParsedFunctionParameter<T>>(_func, _name);
}

Expand Down
6 changes: 3 additions & 3 deletions include/utils/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,18 @@ class Parameters
/**
* String identifying the type of parameter stored.
*/
virtual std::string type () const;
virtual std::string type () const override;
#endif // LIBMESH_HAVE_RTTI

/**
* Prints the parameter value to the specified stream.
*/
virtual void print(std::ostream &) const;
virtual void print(std::ostream &) const override;

/**
* Clone this value. Useful in copy-construction.
*/
virtual Value * clone () const;
virtual Value * clone () const override;

private:
/**
Expand Down

0 comments on commit 2b7d112

Please sign in to comment.