From ee211cb308a86b2ed73b43ddb53f60dce741255e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 11 Oct 2017 13:54:30 -0600 Subject: [PATCH] Rename the scalar template type of Function and derived classes. --- include/deal.II/base/function.h | 223 +++++++------- include/deal.II/base/function.templates.h | 346 +++++++++++----------- include/deal.II/dofs/dof_tools.h | 2 +- include/deal.II/dofs/function_map.h | 2 +- include/deal.II/numerics/vector_tools.h | 2 +- 5 files changed, 293 insertions(+), 282 deletions(-) diff --git a/include/deal.II/base/function.h b/include/deal.II/base/function.h index 95006ea1a1..04d8b422fb 100644 --- a/include/deal.II/base/function.h +++ b/include/deal.II/base/function.h @@ -111,24 +111,34 @@ template class TensorFunction; * convert the former to the latter. * * - *

Functions that return different fields

+ *

Functions that return vectors of other data types

* * Most of the time, your functions will have the form $f : \Omega \rightarrow * {\mathbb R}^{n_\text{components}}$. However, there are occasions where you * want the function to return vectors (or scalars) over a different number * field, for example functions that return complex numbers or vectors of * complex numbers: $f : \Omega \rightarrow {\mathbb - * C}^{n_\text{components}}$. In such cases, you can use the second template + * C}^{n_\text{components}}$. In such cases, you can choose a value different + * than the default @p double for the second template * argument of this class: it describes the scalar type to be used for each * component of your return values. It defaults to @p double, but in the * example above, it could be set to std::complex@. * + * @tparam dim The space dimension of the range space within which the domain + * $\Omega$ of the function lies. Consequently, the function will be + * evaluated at objects of type @p Point. + * @tparam RangeNumberType The scalar type of the vector space that is the range + * (or image) of this function. As discussed above, objects of the current type + * represent functions from ${\mathbb R}^\text{dim}$ to + * $S^{n_\text{components}}$ where $S$ is the underlying scalar type of + * the vector space. The type of $S$ is given by the @p RangeNumberType template + * argument. * * @ingroup functions * @author Wolfgang Bangerth, 1998, 1999, Luca Heltai 2014 */ -template -class Function : public FunctionTime, +template +class Function : public FunctionTime, public Subscriptor { public: @@ -149,7 +159,7 @@ public: * which defaults to zero. */ Function (const unsigned int n_components = 1, - const Number initial_time = 0.0); + const RangeNumberType initial_time = 0.0); /** * Virtual destructor; absolutely necessary in this case. @@ -188,8 +198,8 @@ public: * component you want to have evaluated; it defaults to zero, i.e. the first * component. */ - virtual Number value (const Point &p, - const unsigned int component = 0) const; + virtual RangeNumberType value (const Point &p, + const unsigned int component = 0) const; /** * Return all components of a vector-valued function at a given point. @@ -199,7 +209,7 @@ public: * The default implementation will call value() for each component. */ virtual void vector_value (const Point &p, - Vector &values) const; + Vector &values) const; /** * Set values to the point values of the specified component of the @@ -211,7 +221,7 @@ public: * separately, to fill the output array. */ virtual void value_list (const std::vector > &points, - std::vector &values, + std::vector &values, const unsigned int component = 0) const; /** @@ -225,7 +235,7 @@ public: * separately, to fill the output array. */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; /** * For each component of the function, fill a vector of values, one for each @@ -236,20 +246,20 @@ public: * can be reimplemented in derived classes to speed up performance. */ virtual void vector_values (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; /** * Return the gradient of the specified component of the function at the * given point. */ - virtual Tensor<1,dim, Number> gradient (const Point &p, - const unsigned int component = 0) const; + virtual Tensor<1,dim, RangeNumberType> gradient (const Point &p, + const unsigned int component = 0) const; /** * Return the gradient of all components of the function at the given point. */ virtual void vector_gradient (const Point &p, - std::vector > &gradients) const; + std::vector > &gradients) const; /** * Set gradients to the gradients of the specified component of the @@ -258,7 +268,7 @@ public: * array. */ virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, + std::vector > &gradients, const unsigned int component = 0) const; /** @@ -270,7 +280,7 @@ public: * can be reimplemented in derived classes to speed up performance. */ virtual void vector_gradients (const std::vector > &points, - std::vector > > &gradients) const; + std::vector > > &gradients) const; /** * Set gradients to the gradients of the function at the @@ -282,60 +292,60 @@ public: * the inner loop over the different components of the function. */ virtual void vector_gradient_list (const std::vector > &points, - std::vector > > &gradients) const; + std::vector > > &gradients) const; /** * Compute the Laplacian of a given component at point p. */ - virtual Number laplacian (const Point &p, - const unsigned int component = 0) const; + virtual RangeNumberType laplacian (const Point &p, + const unsigned int component = 0) const; /** * Compute the Laplacian of all components at point p and store * them in values. */ virtual void vector_laplacian (const Point &p, - Vector &values) const; + Vector &values) const; /** * Compute the Laplacian of one component at a set of points. */ virtual void laplacian_list (const std::vector > &points, - std::vector &values, + std::vector &values, const unsigned int component = 0) const; /** * Compute the Laplacians of all components at a set of points. */ virtual void vector_laplacian_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; /** * Compute the Hessian of a given component at point p, that is the * gradient of the gradient of the function. */ - virtual SymmetricTensor<2,dim,Number> hessian (const Point &p, - const unsigned int component = 0) const; + virtual SymmetricTensor<2,dim,RangeNumberType> hessian (const Point &p, + const unsigned int component = 0) const; /** * Compute the Hessian of all components at point p and store them * in values. */ virtual void vector_hessian (const Point &p, - std::vector > &values) const; + std::vector > &values) const; /** * Compute the Hessian of one component at a set of points. */ virtual void hessian_list (const std::vector > &points, - std::vector > &values, + std::vector > &values, const unsigned int component = 0) const; /** * Compute the Hessians of all components at a set of points. */ virtual void vector_hessian_list (const std::vector > &points, - std::vector > > &values) const; + std::vector > > &values) const; /** @@ -357,60 +367,60 @@ namespace Functions * @ingroup functions * @author Wolfgang Bangerth, 1998, 1999, Lei Qiao, 2015 */ - template - class ConstantFunction : public Function + template + class ConstantFunction : public Function { public: /** * Constructor; set values of all components to the provided one. The * default number of components is one. */ - ConstantFunction (const Number value, + ConstantFunction (const RangeNumberType value, const unsigned int n_components = 1); /** - * Constructor; takes an std::vector object as an argument. + * Constructor; takes an std::vector object as an argument. * The number of components is determined by values.size(). */ - ConstantFunction (const std::vector &values); + ConstantFunction (const std::vector &values); /** - * Constructor; takes an Vector object as an argument. The + * Constructor; takes an Vector object as an argument. The * number of components is determined by values.size(). */ - ConstantFunction (const Vector &values); + ConstantFunction (const Vector &values); /** * Constructor; uses whatever stores in [begin_ptr, begin_ptr+n_components) * to initialize a new object. */ - ConstantFunction (const Number *begin_ptr, const unsigned int n_components); + ConstantFunction (const RangeNumberType *begin_ptr, const unsigned int n_components); - virtual Number value (const Point &p, - const unsigned int component = 0) const; + virtual RangeNumberType value (const Point &p, + const unsigned int component = 0) const; virtual void vector_value (const Point &p, - Vector &return_value) const; + Vector &return_value) const; virtual void value_list (const std::vector > &points, - std::vector &return_values, + std::vector &return_values, const unsigned int component = 0) const; virtual void vector_value_list (const std::vector > &points, - std::vector > &return_values) const; + std::vector > &return_values) const; - virtual Tensor<1,dim, Number> gradient (const Point &p, - const unsigned int component = 0) const; + virtual Tensor<1,dim, RangeNumberType> gradient (const Point &p, + const unsigned int component = 0) const; virtual void vector_gradient (const Point &p, - std::vector > &gradients) const; + std::vector > &gradients) const; virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, + std::vector > &gradients, const unsigned int component = 0) const; virtual void vector_gradient_list (const std::vector > &points, - std::vector > > &gradients) const; + std::vector > > &gradients) const; std::size_t memory_consumption () const; @@ -418,7 +428,7 @@ namespace Functions /** * Store the constant function value vector. */ - std::vector function_value_vector; + std::vector function_value_vector; }; @@ -435,15 +445,14 @@ namespace Functions * @ingroup functions * @author Wolfgang Bangerth, 1998, 1999 */ - template - class ZeroFunction : public ConstantFunction + template + class ZeroFunction : public ConstantFunction { public: /** * Constructor. The number of components is preset to one. */ ZeroFunction (const unsigned int n_components = 1); - }; } @@ -454,16 +463,16 @@ namespace Functions * * @deprecated use Functions::ConstantFunction instead. */ -template -using ConstantFunction DEAL_II_DEPRECATED = Functions::ConstantFunction; +template +using ConstantFunction DEAL_II_DEPRECATED = Functions::ConstantFunction; /** * Provide a function which always returns zero. * * @deprecated use Functions::ZeroFunction instead. */ -template -using ZeroFunction DEAL_II_DEPRECATED = Functions::ZeroFunction; +template +using ZeroFunction DEAL_II_DEPRECATED = Functions::ZeroFunction; @@ -481,8 +490,8 @@ using ZeroFunction DEAL_II_DEPRECATED = Functions::ZeroFunction; * @ingroup functions * @author Guido Kanschat, 2000, Wolfgang Bangerth 2006 */ -template -class ComponentSelectFunction : public ConstantFunction +template +class ComponentSelectFunction : public ConstantFunction { public: /** @@ -491,7 +500,7 @@ public: * number of vector components. */ ComponentSelectFunction (const unsigned int selected, - const Number value, + const RangeNumberType value, const unsigned int n_components); /** @@ -514,24 +523,24 @@ public: /** * Substitute function value with value of a ConstantFunction@ object and keep the current selection pattern. + * RangeNumberType@> object and keep the current selection pattern. * * This is useful if you want to have different values in different * components since the provided constructors of - * ComponentSelectFunction@ class can only have same + * ComponentSelectFunction@ class can only have same * value for all components. * * @note: we copy the underlying component value data from @p f from its * beginning. So the number of components of @p f cannot be less than the * calling object. */ - virtual void substitute_function_value_with (const Functions::ConstantFunction &f); + virtual void substitute_function_value_with (const Functions::ConstantFunction &f); /** * Return the value of the function at the given point for all components. */ virtual void vector_value (const Point &p, - Vector &return_value) const; + Vector &return_value) const; /** * Set values to the point values of the function at the @@ -540,7 +549,7 @@ public: * array. */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; /** * Return an estimate for the memory consumption, in bytes, of this object. @@ -561,7 +570,7 @@ protected: /** * This class provides a way to convert a scalar function of the kind * @code - * Number foo (const Point &); + * RangeNumberType foo (const Point &); * @endcode * into an object of type Function@. Since the argument returns a * scalar, the result is clearly a Function object for which @@ -587,11 +596,12 @@ protected: * argument. For example, if you need a Function object that returns the norm * of a point, you could write it like so: * @code - * template - * class Norm : public Function { + * template + * class Norm : public Function { * public: - * virtual Number value (const Point &p, - * const unsigned int component) const { + * virtual RangeNumberType value (const Point &p, + * const unsigned int component) const + * { * Assert (component == 0, ExcMessage ("This object is scalar!")); * return p.norm(); * } @@ -602,18 +612,19 @@ protected: * and then pass the my_norm_object around, or you could write it * like so: * @code - * ScalarFunctionFromFunctionObject my_norm_object (&Point::norm); + * ScalarFunctionFromFunctionObject my_norm_object (&Point::norm); * @endcode * * Similarly, to generate an object that computes the distance to a point * q, we could do this: * @code - * template - * class DistanceTo : public Function { + * template + * class DistanceTo : public Function { * public: * DistanceTo (const Point &q) : q(q) {} - * virtual Number value (const Point &p, - * const unsigned int component) const { + * virtual RangeNumberType value (const Point &p, + * const unsigned int component) const + * { * Assert (component == 0, ExcMessage ("This object is scalar!")); * return q.distance(p); * } @@ -626,7 +637,7 @@ protected: * @endcode * or we could write it like so: * @code - * ScalarFunctionFromFunctionObject + * ScalarFunctionFromFunctionObject * my_distance_object (std::bind (&Point::distance, * q, * std::placeholders::_1)); @@ -635,30 +646,30 @@ protected: * * @author Wolfgang Bangerth, 2011 */ -template -class ScalarFunctionFromFunctionObject : public Function +template +class ScalarFunctionFromFunctionObject : public Function { public: /** - * Given a function object that takes a Point and returns a Number value, - * convert this into an object that matches the Function + * Given a function object that takes a Point and returns a RangeNumberType value, + * convert this into an object that matches the Function * interface. */ - ScalarFunctionFromFunctionObject (const std::function &)> &function_object); + ScalarFunctionFromFunctionObject (const std::function &)> &function_object); /** * Return the value of the function at the given point. Returns the value * the function given to the constructor produces for this point. */ - virtual Number value (const Point &p, - const unsigned int component = 0) const; + virtual RangeNumberType value (const Point &p, + const unsigned int component = 0) const; private: /** * The function object which we call when this class's value() or * value_list() functions are called. */ - const std::function &)> function_object; + const std::function &)> function_object; }; @@ -683,7 +694,7 @@ private: * * To be more concrete, let us consider the following example: * @code - * Number one (const Point<2> &p) { return 1; } + * RangeNumberType one (const Point<2> &p) { return 1; } * VectorFunctionFromScalarFunctionObject<2> * component_mask (&one, 1, 3); * @endcode @@ -696,12 +707,12 @@ private: * * @author Wolfgang Bangerth, 2011 */ -template -class VectorFunctionFromScalarFunctionObject : public Function +template +class VectorFunctionFromScalarFunctionObject : public Function { public: /** - * Given a function object that takes a Point and returns a Number value, + * Given a function object that takes a Point and returns a RangeNumberType value, * convert this into an object that matches the Function@ interface. * * @param function_object The scalar function that will form one component @@ -711,7 +722,7 @@ public: * @param selected_component The single component that should be filled by * the first argument. */ - VectorFunctionFromScalarFunctionObject (const std::function &)> &function_object, + VectorFunctionFromScalarFunctionObject (const std::function &)> &function_object, const unsigned int selected_component, const unsigned int n_components); @@ -719,8 +730,8 @@ public: * Return the value of the function at the given point. Returns the value * the function given to the constructor produces for this point. */ - virtual Number value (const Point &p, - const unsigned int component = 0) const; + virtual RangeNumberType value (const Point &p, + const unsigned int component = 0) const; /** * Return all components of a vector-valued function at a given point. @@ -728,14 +739,14 @@ public: * values shall have the right size beforehand, i.e. #n_components. */ virtual void vector_value (const Point &p, - Vector &values) const; + Vector &values) const; private: /** * The function object which we call when this class's value() or * value_list() functions are called. */ - const std::function &)> function_object; + const std::function &)> function_object; /** * The vector component whose value is to be filled by the given scalar @@ -747,7 +758,7 @@ private: /** * This class is built as a means of translating the Tensor<1,dim, - * Number> values produced by objects of type TensorFunction and + * RangeNumberType> values produced by objects of type TensorFunction and * returning them as a multiple component version of the same thing as a * Vector for use in, for example, the VectorTools::interpolate or the many * other functions taking Function objects. It allows the user to place the @@ -757,11 +768,11 @@ private: * * For example: Say you created a class called * @code - * class RightHandSide : public TensorFunction + * class RightHandSide : public TensorFunction * @endcode * which extends the TensorFunction class and you have an object * @code - * RightHandSide<1,dim, Number> rhs; + * RightHandSide<1,dim, RangeNumberType> rhs; * @endcode * of that class which you want to interpolate onto your mesh using the * VectorTools::interpolate function, but the finite element you use for the @@ -771,21 +782,21 @@ private: * components. Creating such an object from the existing rhs * object is done using this piece of code: * @code - * RighHandSide<1,dim, Number> rhs; - * VectorFunctionFromTensorFunction rhs_vector_function (rhs, 0, 3*dim); + * RighHandSide<1,dim, RangeNumberType> rhs; + * VectorFunctionFromTensorFunction rhs_vector_function (rhs, 0, 3*dim); * @endcode * where the dim components of the tensor function are placed * into the first dim components of the function object. * * @author Spencer Patty, 2013 */ -template -class VectorFunctionFromTensorFunction : public Function +template +class VectorFunctionFromTensorFunction : public Function { public: /** * Given a TensorFunction object that takes a Point and returns a - * Tensor<1,dim, Number> value, convert this into an object that + * Tensor<1,dim, RangeNumberType> value, convert this into an object that * matches the Function@ interface. * * By default, create a Vector object of the same size as @@ -799,7 +810,7 @@ public: * the first argument. This should be such that the entire tensor_function * fits inside the n_component length return vector. */ - VectorFunctionFromTensorFunction (const TensorFunction<1,dim, Number> &tensor_function, + VectorFunctionFromTensorFunction (const TensorFunction<1,dim, RangeNumberType> &tensor_function, const unsigned int selected_component=0, const unsigned int n_components=dim); @@ -812,8 +823,8 @@ public: /** * Return a single component of a vector-valued function at a given point. */ - virtual Number value (const Point &p, - const unsigned int component = 0) const; + virtual RangeNumberType value (const Point &p, + const unsigned int component = 0) const; /** * Return all components of a vector-valued function at a given point. @@ -821,7 +832,7 @@ public: * values shall have the right size beforehand, i.e. #n_components. */ virtual void vector_value (const Point &p, - Vector &values) const; + Vector &values) const; /** * Return all components of a vector-valued function at a list of points. @@ -831,20 +842,20 @@ public: * function */ virtual void vector_value_list (const std::vector > &points, - std::vector > &value_list) const; + std::vector > &value_list) const; private: /** * The TensorFunction object which we call when this class's vector_value() * or vector_value_list() functions are called. */ - const TensorFunction<1,dim,Number> &tensor_function; + const TensorFunction<1,dim,RangeNumberType> &tensor_function; /** * The first vector component whose value is to be filled by the given * TensorFunction. The values will be placed in components * selected_component to selected_component+dim-1 for a - * TensorFunction<1,dim, Number> object. + * TensorFunction<1,dim, RangeNumberType> object. */ const unsigned int selected_component; }; @@ -856,9 +867,9 @@ private: // // The destructor is pure virtual so we can't default it // in the declaration. -template +template inline -Function::~Function () = default; +Function::~Function () = default; #endif diff --git a/include/deal.II/base/function.templates.h b/include/deal.II/base/function.templates.h index 834884d872..102108f9da 100644 --- a/include/deal.II/base/function.templates.h +++ b/include/deal.II/base/function.templates.h @@ -27,15 +27,15 @@ DEAL_II_NAMESPACE_OPEN -template -const unsigned int Function::dimension; +template +const unsigned int Function::dimension; -template -Function::Function (const unsigned int n_components, - const Number initial_time) +template +Function::Function (const unsigned int n_components, + const RangeNumberType initial_time) : - FunctionTime(initial_time), + FunctionTime(initial_time), n_components(n_components) { // avoid the construction of function objects that don't return any @@ -46,8 +46,8 @@ Function::Function (const unsigned int n_components, -template -Function &Function::operator= (const Function &f) +template +Function &Function::operator= (const Function &f) { (void)f; AssertDimension (n_components, f.n_components); @@ -55,18 +55,18 @@ Function &Function::operator= (const Function &f) } -template -Number Function::value (const Point &, - const unsigned int) const +template +RangeNumberType Function::value (const Point &, + const unsigned int) const { Assert (false, ExcPureFunctionCalled()); return 0; } -template -void Function::vector_value (const Point &p, - Vector &v) const +template +void Function::vector_value (const Point &p, + Vector &v) const { AssertDimension(v.size(), this->n_components); for (unsigned int i=0; in_components; ++i) @@ -74,10 +74,10 @@ void Function::vector_value (const Point &p, } -template -void Function::value_list (const std::vector > &points, - std::vector &values, - const unsigned int component) const +template +void Function::value_list (const std::vector > &points, + std::vector &values, + const unsigned int component) const { // check whether component is in the valid range is up to the derived // class @@ -89,9 +89,9 @@ void Function::value_list (const std::vector > &points, } -template -void Function::vector_value_list (const std::vector > &points, - std::vector > &values) const +template +void Function::vector_value_list (const std::vector > &points, + std::vector > &values) const { // check whether component is in the valid range is up to the derived // class @@ -103,10 +103,10 @@ void Function::vector_value_list (const std::vector > &p } -template -void Function::vector_values ( +template +void Function::vector_values ( const std::vector > &points, - std::vector > &values) const + std::vector > &values) const { const unsigned int n = this->n_components; AssertDimension (values.size(), n); @@ -115,19 +115,19 @@ void Function::vector_values ( } -template -Tensor<1,dim,Number> Function::gradient (const Point &, - const unsigned int) const +template +Tensor<1,dim,RangeNumberType> Function::gradient (const Point &, + const unsigned int) const { Assert (false, ExcPureFunctionCalled()); - return Tensor<1,dim,Number>(); + return Tensor<1,dim,RangeNumberType>(); } -template -void Function::vector_gradient ( +template +void Function::vector_gradient ( const Point &p, - std::vector > &v) const + std::vector > &v) const { AssertDimension(v.size(), this->n_components); for (unsigned int i=0; in_components; ++i) @@ -135,10 +135,10 @@ void Function::vector_gradient ( } -template -void Function::gradient_list ( +template +void Function::gradient_list ( const std::vector > &points, - std::vector > &gradients, + std::vector > &gradients, const unsigned int component) const { Assert (gradients.size() == points.size(), @@ -149,10 +149,10 @@ void Function::gradient_list ( } -template -void Function::vector_gradient_list ( +template +void Function::vector_gradient_list ( const std::vector > &points, - std::vector > > &gradients) const + std::vector > > &gradients) const { Assert (gradients.size() == points.size(), ExcDimensionMismatch(gradients.size(), points.size())); @@ -166,10 +166,10 @@ void Function::vector_gradient_list ( } -template -void Function::vector_gradients ( +template +void Function::vector_gradients ( const std::vector > &points, - std::vector > > &values) const + std::vector > > &values) const { const unsigned int n = this->n_components; AssertDimension (values.size(), n); @@ -179,28 +179,28 @@ void Function::vector_gradients ( -template -Number Function::laplacian (const Point &, - const unsigned int) const +template +RangeNumberType Function::laplacian (const Point &, + const unsigned int) const { Assert (false, ExcPureFunctionCalled()); return 0; } -template -void Function::vector_laplacian (const Point &, - Vector &) const +template +void Function::vector_laplacian (const Point &, + Vector &) const { Assert (false, ExcPureFunctionCalled()); } -template -void Function::laplacian_list ( +template +void Function::laplacian_list ( const std::vector > &points, - std::vector &laplacians, + std::vector &laplacians, const unsigned int component) const { // check whether component is in the valid range is up to the derived @@ -213,10 +213,10 @@ void Function::laplacian_list ( } -template -void Function::vector_laplacian_list ( +template +void Function::vector_laplacian_list ( const std::vector > &points, - std::vector > &laplacians) const + std::vector > &laplacians) const { // check whether component is in the valid range is up to the derived // class @@ -228,19 +228,19 @@ void Function::vector_laplacian_list ( } -template -SymmetricTensor<2,dim,Number> Function::hessian (const Point &, +template +SymmetricTensor<2,dim,RangeNumberType> Function::hessian (const Point &, const unsigned int) const { Assert (false, ExcPureFunctionCalled()); - return SymmetricTensor<2,dim,Number>(); + return SymmetricTensor<2,dim,RangeNumberType>(); } -template -void Function::vector_hessian ( +template +void Function::vector_hessian ( const Point &p, - std::vector > &v) const + std::vector > &v) const { AssertDimension(v.size(), this->n_components); for (unsigned int i=0; in_components; ++i) @@ -248,10 +248,10 @@ void Function::vector_hessian ( } -template -void Function::hessian_list ( +template +void Function::hessian_list ( const std::vector > &points, - std::vector > &hessians, + std::vector > &hessians, const unsigned int component) const { Assert (hessians.size() == points.size(), @@ -262,10 +262,10 @@ void Function::hessian_list ( } -template -void Function::vector_hessian_list ( +template +void Function::vector_hessian_list ( const std::vector > &points, - std::vector > > &hessians) const + std::vector > > &hessians) const { Assert (hessians.size() == points.size(), ExcDimensionMismatch(hessians.size(), points.size())); @@ -280,9 +280,9 @@ void Function::vector_hessian_list ( -template +template std::size_t -Function::memory_consumption () const +Function::memory_consumption () const { // only simple data elements, so use sizeof operator return sizeof (*this); @@ -295,10 +295,10 @@ Function::memory_consumption () const namespace Functions { - template - ZeroFunction::ZeroFunction (const unsigned int n_components) + template + ZeroFunction::ZeroFunction (const unsigned int n_components) : - ConstantFunction (Number(), n_components) + ConstantFunction (RangeNumberType(), n_components) {} } @@ -308,28 +308,28 @@ namespace Functions namespace Functions { - template - ConstantFunction::ConstantFunction (const Number value, - const unsigned int n_components) + template + ConstantFunction::ConstantFunction (const RangeNumberType value, + const unsigned int n_components) : - Function (n_components), + Function (n_components), function_value_vector (n_components, value) {} - template - ConstantFunction:: - ConstantFunction (const std::vector &values) + template + ConstantFunction:: + ConstantFunction (const std::vector &values) : - Function (values.size()), + Function (values.size()), function_value_vector (values) {} - template - ConstantFunction:: - ConstantFunction (const Vector &values) + template + ConstantFunction:: + ConstantFunction (const Vector &values) : - Function (values.size()), + Function (values.size()), function_value_vector (values.size()) { Assert (values.size() == function_value_vector.size(), @@ -338,11 +338,11 @@ namespace Functions } - template - ConstantFunction:: - ConstantFunction (const Number *begin_ptr, const unsigned int n_components) + template + ConstantFunction:: + ConstantFunction (const RangeNumberType *begin_ptr, const unsigned int n_components) : - Function (n_components), + Function (n_components), function_value_vector (n_components) { Assert (begin_ptr != nullptr, ExcMessage ("Null pointer encountered!")); @@ -351,9 +351,9 @@ namespace Functions - template - Number ConstantFunction::value (const Point &, - const unsigned int component) const + template + RangeNumberType ConstantFunction::value (const Point &, + const unsigned int component) const { Assert (component < this->n_components, ExcIndexRange (component, 0, this->n_components)); @@ -362,9 +362,9 @@ namespace Functions - template - void ConstantFunction::vector_value (const Point &, - Vector &return_value) const + template + void ConstantFunction::vector_value (const Point &, + Vector &return_value) const { Assert (return_value.size() == this->n_components, ExcDimensionMismatch (return_value.size(), this->n_components)); @@ -375,10 +375,10 @@ namespace Functions - template - void ConstantFunction::value_list ( + template + void ConstantFunction::value_list ( const std::vector > &points, - std::vector &return_values, + std::vector &return_values, const unsigned int component) const { // To avoid warning of unused parameter @@ -393,10 +393,10 @@ namespace Functions - template - void ConstantFunction::vector_value_list ( + template + void ConstantFunction::vector_value_list ( const std::vector > &points, - std::vector > &return_values) const + std::vector > &return_values) const { Assert (return_values.size() == points.size(), ExcDimensionMismatch(return_values.size(), points.size())); @@ -412,28 +412,28 @@ namespace Functions - template + template std::size_t - ConstantFunction::memory_consumption () const + ConstantFunction::memory_consumption () const { - // Here we assume Number is a simple type. - return (sizeof(*this) + this->n_components*sizeof(Number)); + // Here we assume RangeNumberType is a simple type. + return (sizeof(*this) + this->n_components*sizeof(RangeNumberType)); } - template - Tensor<1,dim,Number> ConstantFunction::gradient (const Point &, + template + Tensor<1,dim,RangeNumberType> ConstantFunction::gradient (const Point &, const unsigned int) const { - return Tensor<1,dim,Number>(); + return Tensor<1,dim,RangeNumberType>(); } - template - void ConstantFunction::vector_gradient ( + template + void ConstantFunction::vector_gradient ( const Point &, - std::vector > &gradients) const + std::vector > &gradients) const { Assert (gradients.size() == this->n_components, ExcDimensionMismatch(gradients.size(), this->n_components)); @@ -443,10 +443,10 @@ namespace Functions } - template - void ConstantFunction::gradient_list ( + template + void ConstantFunction::gradient_list ( const std::vector > &points, - std::vector > &gradients, + std::vector > &gradients, const unsigned int /*component*/) const { Assert (gradients.size() == points.size(), @@ -457,10 +457,10 @@ namespace Functions } - template - void ConstantFunction::vector_gradient_list ( + template + void ConstantFunction::vector_gradient_list ( const std::vector > &points, - std::vector > > &gradients) const + std::vector > > &gradients) const { Assert (gradients.size() == points.size(), ExcDimensionMismatch(gradients.size(), points.size())); @@ -478,24 +478,24 @@ namespace Functions //--------------------------------------------------------------------------- -template -ComponentSelectFunction:: +template +ComponentSelectFunction:: ComponentSelectFunction (const unsigned int selected, - const Number value, + const RangeNumberType value, const unsigned int n_components) : - ConstantFunction (value, n_components), + ConstantFunction (value, n_components), selected_components(std::make_pair(selected,selected+1)) {} -template -ComponentSelectFunction:: +template +ComponentSelectFunction:: ComponentSelectFunction (const unsigned int selected, const unsigned int n_components) : - ConstantFunction (1., n_components), + ConstantFunction (1., n_components), selected_components(std::make_pair(selected,selected+1)) { Assert (selected < n_components, @@ -504,12 +504,12 @@ ComponentSelectFunction (const unsigned int selected, -template -ComponentSelectFunction:: +template +ComponentSelectFunction:: ComponentSelectFunction (const std::pair &selected, const unsigned int n_components) : - ConstantFunction (1., n_components), + ConstantFunction (1., n_components), selected_components(selected) { Assert (selected_components.first < selected_components.second, @@ -523,10 +523,10 @@ ComponentSelectFunction (const std::pair &selected, -template +template void -ComponentSelectFunction:: -substitute_function_value_with (const ConstantFunction &f) +ComponentSelectFunction:: +substitute_function_value_with (const ConstantFunction &f) { Point p; for (unsigned int i=0; ifunction_value_vector.size(); ++i) @@ -536,10 +536,10 @@ substitute_function_value_with (const ConstantFunction &f) -template -void ComponentSelectFunction::vector_value ( +template +void ComponentSelectFunction::vector_value ( const Point &, - Vector &return_value) const + Vector &return_value) const { Assert (return_value.size() == this->n_components, ExcDimensionMismatch (return_value.size(), this->n_components)); @@ -552,48 +552,48 @@ void ComponentSelectFunction::vector_value ( -template -void ComponentSelectFunction::vector_value_list ( +template +void ComponentSelectFunction::vector_value_list ( const std::vector > &points, - std::vector > &values) const + std::vector > &values) const { Assert (values.size() == points.size(), ExcDimensionMismatch(values.size(), points.size())); for (unsigned int i=0; i::vector_value (points[i], - values[i]); + ComponentSelectFunction::vector_value (points[i], + values[i]); } -template +template std::size_t -ComponentSelectFunction::memory_consumption () const +ComponentSelectFunction::memory_consumption () const { // No new complex data structure is introduced here, just evaluate how much // more memory is used *inside* the class via sizeof() and add that value to // parent class's memory_consumption() - return (sizeof(*this) - sizeof(ConstantFunction) - + ConstantFunction::memory_consumption()); + return (sizeof(*this) - sizeof(ConstantFunction) + + ConstantFunction::memory_consumption()); } //--------------------------------------------------------------------------- -template -ScalarFunctionFromFunctionObject:: -ScalarFunctionFromFunctionObject (const std::function &)> &function_object) +template +ScalarFunctionFromFunctionObject:: +ScalarFunctionFromFunctionObject (const std::function &)> &function_object) : - Function(1), + Function(1), function_object (function_object) {} -template -Number -ScalarFunctionFromFunctionObject::value (const Point &p, - const unsigned int component) const +template +RangeNumberType +ScalarFunctionFromFunctionObject::value (const Point &p, + const unsigned int component) const { (void)component; Assert (component == 0, @@ -603,14 +603,14 @@ ScalarFunctionFromFunctionObject::value (const Point &p, -template -VectorFunctionFromScalarFunctionObject:: +template +VectorFunctionFromScalarFunctionObject:: VectorFunctionFromScalarFunctionObject ( - const std::function &)> &function_object, + const std::function &)> &function_object, const unsigned int selected_component, const unsigned int n_components) : - Function(n_components), + Function(n_components), function_object (function_object), selected_component (selected_component) { @@ -620,9 +620,9 @@ VectorFunctionFromScalarFunctionObject ( -template -Number -VectorFunctionFromScalarFunctionObject::value ( +template +RangeNumberType +VectorFunctionFromScalarFunctionObject::value ( const Point &p, const unsigned int component) const { @@ -637,11 +637,11 @@ VectorFunctionFromScalarFunctionObject::value ( -template +template void -VectorFunctionFromScalarFunctionObject:: +VectorFunctionFromScalarFunctionObject:: vector_value (const Point &p, - Vector &values) const + Vector &values) const { AssertDimension(values.size(), this->n_components); @@ -657,18 +657,18 @@ vector_value (const Point &p, * The constructor for VectorFunctionFromTensorFunction which * initiates the return vector to be size n_components. */ -template -VectorFunctionFromTensorFunction::VectorFunctionFromTensorFunction ( - const TensorFunction<1,dim,Number> &tensor_function, +template +VectorFunctionFromTensorFunction::VectorFunctionFromTensorFunction ( + const TensorFunction<1,dim,RangeNumberType> &tensor_function, const unsigned int selected_component, const unsigned int n_components) : - Function (n_components), + Function (n_components), tensor_function (tensor_function), selected_component (selected_component) { - // Verify that the Tensor<1,dim,Number> will fit in the given length + // Verify that the Tensor<1,dim,RangeNumberType> will fit in the given length // selected_components and not hang over the end of the vector. Assert (selected_component + dim - 1 < this->n_components, ExcIndexRange (selected_component, 0, this->n_components)); @@ -676,9 +676,9 @@ VectorFunctionFromTensorFunction::VectorFunctionFromTensorFunction -template +template inline -Number VectorFunctionFromTensorFunction::value (const Point &p, +RangeNumberType VectorFunctionFromTensorFunction::value (const Point &p, const unsigned int component) const { Assert (componentn_components, @@ -695,17 +695,17 @@ Number VectorFunctionFromTensorFunction::value (const Point &p // placed at the selected_component to // selected_component + dim - 1 elements of the Vector // values and pick the correct one - const Tensor<1,dim,Number> tensor_value = tensor_function.value (p); + const Tensor<1,dim,RangeNumberType> tensor_value = tensor_function.value (p); return tensor_value[component-selected_component]; } -template +template inline -void VectorFunctionFromTensorFunction::vector_value ( +void VectorFunctionFromTensorFunction::vector_value ( const Point &p, - Vector &values) const + Vector &values) const { Assert(values.size() == this->n_components, ExcDimensionMismatch(values.size(),this->n_components)); @@ -714,7 +714,7 @@ void VectorFunctionFromTensorFunction::vector_value ( // the selected_component to // selected_component + dim - 1 elements of the Vector // values. - const Tensor<1,dim,Number> tensor_value = tensor_function.value (p); + const Tensor<1,dim,RangeNumberType> tensor_value = tensor_function.value (p); // First we make all elements of values = 0 values = 0; @@ -733,10 +733,10 @@ void VectorFunctionFromTensorFunction::vector_value ( * written so as to not replicate the function definition but passes each * point on to vector_value to be evaluated. */ -template -void VectorFunctionFromTensorFunction::vector_value_list ( +template +void VectorFunctionFromTensorFunction::vector_value_list ( const std::vector > &points, - std::vector > &value_list) const + std::vector > &value_list) const { Assert (value_list.size() == points.size(), ExcDimensionMismatch (value_list.size(), points.size())); @@ -744,8 +744,8 @@ void VectorFunctionFromTensorFunction::vector_value_list ( const unsigned int n_points = points.size(); for (unsigned int p=0; p::vector_value(points[p], - value_list[p]); + VectorFunctionFromTensorFunction::vector_value(points[p], + value_list[p]); } diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index 82c9130e35..212b079148 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -35,7 +35,7 @@ DEAL_II_NAMESPACE_OPEN class BlockMask; -template class Function; +template class Function; template class FiniteElement; namespace hp { diff --git a/include/deal.II/dofs/function_map.h b/include/deal.II/dofs/function_map.h index 1fea912c55..53b4d39c85 100644 --- a/include/deal.II/dofs/function_map.h +++ b/include/deal.II/dofs/function_map.h @@ -21,7 +21,7 @@ DEAL_II_NAMESPACE_OPEN -template class Function; +template class Function; diff --git a/include/deal.II/numerics/vector_tools.h b/include/deal.II/numerics/vector_tools.h index 84036616a1..82cd6d1e9c 100644 --- a/include/deal.II/numerics/vector_tools.h +++ b/include/deal.II/numerics/vector_tools.h @@ -33,7 +33,7 @@ DEAL_II_NAMESPACE_OPEN -template class Function; +template class Function; template class Quadrature; template class QGauss; template class MatrixFree; -- 2.39.5