Skip to content

Commit

Permalink
Merge pull request #5080 from masterleinad/default_constructors
Browse files Browse the repository at this point in the history
Default constructors and destructors
  • Loading branch information
bangerth committed Sep 17, 2017
2 parents 1976fcb + 3d559e1 commit 60bfd31
Show file tree
Hide file tree
Showing 132 changed files with 168 additions and 681 deletions.
15 changes: 12 additions & 3 deletions include/deal.II/algorithms/operator.h
Expand Up @@ -73,7 +73,7 @@ namespace Algorithms
/**
* The virtual destructor.
*/
~OperatorBase();
virtual ~OperatorBase() = default;

/**
* The actual operation, which is implemented in a derived class.
Expand Down Expand Up @@ -106,13 +106,22 @@ namespace Algorithms
template <typename VectorType>
class OutputOperator : public Subscriptor
{
OutputOperator(const OutputOperator<VectorType> &);
public:
/**
* Constructor initializing member variables with invalid data.
*/
OutputOperator ();

/**
* The copy constructor is deleted since objects of this class
* should not be copied.
*/
OutputOperator(const OutputOperator<VectorType> &) = delete;

/**
* Empty virtual destructor.
*/
virtual ~OutputOperator();
virtual ~OutputOperator() = default;

/**
* Set the stream @p os to which data is written. If no stream is selected
Expand Down
4 changes: 0 additions & 4 deletions include/deal.II/algorithms/operator.templates.h
Expand Up @@ -25,10 +25,6 @@ DEAL_II_NAMESPACE_OPEN

namespace Algorithms
{
template <typename VectorType>
OutputOperator<VectorType>::~OutputOperator()
{}

template <typename VectorType>
OutputOperator<VectorType>::OutputOperator()
:
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/auto_derivative_function.h
Expand Up @@ -132,7 +132,7 @@ class AutoDerivativeFunction : public Function<dim>
/**
* Virtual destructor; absolutely necessary in this case.
*/
virtual ~AutoDerivativeFunction ();
virtual ~AutoDerivativeFunction () = default;

/**
* Choose the difference formula. See the enum #DifferenceFormula for
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/convergence_table.h
Expand Up @@ -65,7 +65,7 @@ class ConvergenceTable: public TableHandler
/**
* Constructor.
*/
ConvergenceTable();
ConvergenceTable() = default;

/**
* Rate in relation to the rows.
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/data_out_base.h
Expand Up @@ -2374,7 +2374,7 @@ class DataOutInterface
* Destructor. Does nothing, but is declared virtual since this class has
* virtual functions.
*/
virtual ~DataOutInterface ();
virtual ~DataOutInterface () = default;

/**
* Obtain data through get_patches() and write it to <tt>out</tt> in OpenDX
Expand Down
11 changes: 7 additions & 4 deletions include/deal.II/base/flow_function.h
Expand Up @@ -56,7 +56,7 @@ namespace Functions
/**
* Virtual destructor.
*/
virtual ~FlowFunction();
virtual ~FlowFunction() = default;

/**
* Store an adjustment for the pressure function, such that its mean value
Expand Down Expand Up @@ -145,7 +145,8 @@ namespace Functions
*/
PoisseuilleFlow<dim> (const double r,
const double Re);
virtual ~PoisseuilleFlow();

virtual ~PoisseuilleFlow() = default;

virtual void vector_values (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const;
Expand Down Expand Up @@ -187,7 +188,8 @@ namespace Functions
* Change the viscosity and the reaction parameter.
*/
void set_parameters (const double viscosity, const double reaction);
virtual ~StokesCosine();

virtual ~StokesCosine() = default;

virtual void vector_values (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const;
Expand Down Expand Up @@ -276,7 +278,8 @@ namespace Functions
* Stokes problem.
*/
Kovasznay (const double Re, bool Stokes = false);
virtual ~Kovasznay();

virtual ~Kovasznay() = default;

virtual void vector_values (const std::vector<Point<2> > &points,
std::vector<std::vector<double> > &values) const;
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/function.h
Expand Up @@ -807,7 +807,7 @@ class VectorFunctionFromTensorFunction : public Function<dim, Number>
* This destructor is defined as virtual so as to coincide with all other
* aspects of class.
*/
virtual ~VectorFunctionFromTensorFunction();
virtual ~VectorFunctionFromTensorFunction() = default;

/**
* Return a single component of a vector-valued function at a given point.
Expand Down
10 changes: 4 additions & 6 deletions include/deal.II/base/function.templates.h
Expand Up @@ -45,9 +45,11 @@ Function<dim, Number>::Function (const unsigned int n_components,
}



// The destructor is pure virtual so we can't default it
// in the declaration.
template <int dim, typename Number>
Function<dim, Number>::~Function ()
{}
Function<dim, Number>::~Function () = default;



Expand Down Expand Up @@ -680,10 +682,6 @@ VectorFunctionFromTensorFunction<dim, Number>::VectorFunctionFromTensorFunction
}


template <int dim, typename Number>
VectorFunctionFromTensorFunction<dim, Number>::~VectorFunctionFromTensorFunction ()
{}


template <int dim, typename Number>
inline
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/function_time.h
Expand Up @@ -81,7 +81,7 @@ class FunctionTime
/**
* Virtual destructor.
*/
virtual ~FunctionTime();
virtual ~FunctionTime() = default;

/**
* Return the value of the time variable.
Expand Down
6 changes: 0 additions & 6 deletions include/deal.II/base/function_time.templates.h
Expand Up @@ -29,12 +29,6 @@ FunctionTime<Number>::FunctionTime(const Number initial_time)



template <typename Number>
FunctionTime<Number>::~FunctionTime()
{}



template <typename Number>
void
FunctionTime<Number>::set_time (const Number new_time)
Expand Down
7 changes: 1 addition & 6 deletions include/deal.II/base/parallel.h
Expand Up @@ -477,7 +477,7 @@ namespace parallel
* Destructor. Made virtual to ensure that derived classes also have
* virtual destructors.
*/
virtual ~ParallelForInteger ();
virtual ~ParallelForInteger () = default;

/**
* This function runs the for loop over the given range
Expand Down Expand Up @@ -843,11 +843,6 @@ namespace parallel
#endif


inline
ParallelForInteger::~ParallelForInteger ()
{}


inline
void
ParallelForInteger::apply_parallel (const std::size_t begin,
Expand Down
10 changes: 5 additions & 5 deletions include/deal.II/base/parameter_handler.h
Expand Up @@ -802,12 +802,12 @@ class ParameterHandler : public Subscriptor
/**
* Inhibit automatic CopyConstructor.
*/
ParameterHandler (const ParameterHandler &);
ParameterHandler (const ParameterHandler &) = delete;

/**
* Inhibit automatic assignment operator.
*/
ParameterHandler &operator= (const ParameterHandler &);
ParameterHandler &operator= (const ParameterHandler &) = delete;

public:
/**
Expand Down Expand Up @@ -863,7 +863,7 @@ class ParameterHandler : public Subscriptor
* safer as we have virtual functions. It actually does nothing
* spectacular.
*/
virtual ~ParameterHandler ();
virtual ~ParameterHandler () = default;

/**
* Parse each line from a stream until the stream returns the <tt>eof</tt>
Expand Down Expand Up @@ -1765,7 +1765,7 @@ class MultipleParameterLoop : public ParameterHandler
* Destructor. It doesn't actually do anything, but is declared to force
* derived classes to have a virtual destructor.
*/
virtual ~UserClass ();
virtual ~UserClass () = default;

/**
* <tt>create_new</tt> must provide a clean object, either by creating a
Expand All @@ -1788,7 +1788,7 @@ class MultipleParameterLoop : public ParameterHandler
* Destructor. Declare this only to have a virtual destructor, which is
* safer as we have virtual functions. It actually does nothing spectacular.
*/
virtual ~MultipleParameterLoop ();
virtual ~MultipleParameterLoop () = default;

/**
* Read input from a stream until the stream returns the <tt>eof</tt>
Expand Down
6 changes: 3 additions & 3 deletions include/deal.II/base/patterns.h
Expand Up @@ -74,7 +74,7 @@ namespace Patterns
/**
* Make destructor of this and all derived classes virtual.
*/
virtual ~PatternBase ();
virtual ~PatternBase () = default;

/**
* Return <tt>true</tt> if the given string matches the pattern.
Expand Down Expand Up @@ -787,7 +787,7 @@ namespace Patterns
* Constructor. (Allow for at least one non-virtual function in this
* class, as otherwise sometimes no virtual table is emitted.)
*/
Anything ();
Anything () = default;

/**
* Return <tt>true</tt> if the string matches its constraints, i.e.
Expand Down Expand Up @@ -919,7 +919,7 @@ namespace Patterns
/**
* Constructor.
*/
DirectoryName ();
DirectoryName () = default;

/**
* Return <tt>true</tt> if the string matches its constraints, i.e.
Expand Down
9 changes: 1 addition & 8 deletions include/deal.II/base/table.h
Expand Up @@ -452,7 +452,7 @@ class TableBase : public Subscriptor
/**
* Destructor. Free allocated memory.
*/
~TableBase ();
~TableBase () = default;

/**
* Assignment operator. Copy all elements of <tt>src</tt> into the matrix.
Expand Down Expand Up @@ -1797,13 +1797,6 @@ namespace internal



template <int N, typename T>
inline
TableBase<N,T>::~TableBase ()
{}



template <int N, typename T>
inline
TableBase<N,T> &
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/table_handler.h
Expand Up @@ -54,7 +54,7 @@ namespace internal
/**
* Default constructor.
*/
TableEntry ();
TableEntry () = default;

/**
* Constructor. Initialize this table element with the value
Expand Down
4 changes: 2 additions & 2 deletions include/deal.II/base/tensor_function.h
Expand Up @@ -75,7 +75,7 @@ class TensorFunction : public FunctionTime<Number>,
* usually not used by their true type, but rather through pointers to this
* base class.
*/
virtual ~TensorFunction ();
virtual ~TensorFunction () = default;

/**
* Return the value of the function at the given point.
Expand Down Expand Up @@ -127,7 +127,7 @@ class ConstantTensorFunction : public TensorFunction<rank, dim, Number>
ConstantTensorFunction (const dealii::Tensor<rank, dim, Number> &value,
const Number initial_time = 0.0);

virtual ~ConstantTensorFunction ();
virtual ~ConstantTensorFunction () = default;

virtual typename dealii::TensorFunction<rank, dim, Number>::value_type value (const Point<dim> &p) const;

Expand Down
8 changes: 0 additions & 8 deletions include/deal.II/base/tensor_function.templates.h
Expand Up @@ -33,10 +33,6 @@ TensorFunction<rank, dim, Number>::TensorFunction (const Number initial_time)
{}


template <int rank, int dim, typename Number>
TensorFunction<rank, dim, Number>::~TensorFunction ()
{}


template <int rank, int dim, typename Number>
typename TensorFunction<rank, dim, Number>::value_type
Expand Down Expand Up @@ -95,10 +91,6 @@ ConstantTensorFunction<rank, dim, Number>::ConstantTensorFunction (
{}


template <int rank, int dim, typename Number>
ConstantTensorFunction<rank, dim, Number>::~ConstantTensorFunction ()
{}


template <int rank, int dim, typename Number>
typename TensorFunction<rank, dim, Number>::value_type
Expand Down
8 changes: 1 addition & 7 deletions include/deal.II/base/thread_local_storage.h
Expand Up @@ -74,7 +74,7 @@ namespace Threads
* Default constructor. Initialize each thread local object using its
* default constructor.
*/
ThreadLocalStorage ();
ThreadLocalStorage () = default;

/**
* A kind of copy constructor. Initialize each thread local object by
Expand Down Expand Up @@ -179,12 +179,6 @@ namespace Threads

// ----------------- inline and template functions ----------------------------

template <typename T>
inline
ThreadLocalStorage<T>::ThreadLocalStorage()
{}


template <typename T>
inline
ThreadLocalStorage<T>::ThreadLocalStorage(const T &t)
Expand Down
6 changes: 4 additions & 2 deletions include/deal.II/base/thread_management.h
Expand Up @@ -104,7 +104,7 @@ namespace Threads
* Destructor. Unlock the mutex. Since this is a dummy mutex class, this
* of course does nothing.
*/
~ScopedLock () {}
~ScopedLock () = default;
};

/**
Expand Down Expand Up @@ -719,7 +719,9 @@ namespace Threads
private:
RT *value;
public:
inline return_value () : value(nullptr) {}
inline return_value ()
: value(nullptr)
{}

inline RT &get () const
{
Expand Down

0 comments on commit 60bfd31

Please sign in to comment.