From: Luca Heltai Date: Thu, 18 Apr 2019 17:57:37 +0000 (+0200) Subject: Added FunctionCutOffTensorProduct. X-Git-Tag: v9.1.0-rc1~180^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=454a08167dbc5d67dc43a6d91e1993e7b8405c07;p=dealii.git Added FunctionCutOffTensorProduct. --- diff --git a/include/deal.II/base/function_lib.h b/include/deal.II/base/function_lib.h index 0b36b2d4e3..ff38a07bc8 100644 --- a/include/deal.II/base/function_lib.h +++ b/include/deal.II/base/function_lib.h @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -946,6 +947,11 @@ namespace Functions const bool integrate_to_one = false, const double unitary_integral_value = 1.0); + /** + * Virtual destructor. + */ + virtual ~CutOffFunctionBase() = default; + /** * Move the center of the ball to new point p. * @@ -965,7 +971,7 @@ namespace Functions /** * Set the center of the ball to the point @p p. */ - void + virtual void set_center(const Point &p); /** @@ -973,7 +979,7 @@ namespace Functions * * @deprecated Use set_radius() instead. */ - void + virtual void set_radius(const double r); /** @@ -988,6 +994,12 @@ namespace Functions double get_radius() const; + /** + * Return a boolean indicating if this function integrates to one. + */ + bool + integrates_to_one() const; + protected: /** * Center of the integration ball. @@ -1008,7 +1020,7 @@ namespace Functions /** * Flag that controls wether we rescale the value when the radius changes. */ - const bool integrate_to_one; + bool integrate_to_one; /** * The reference integral value. Derived classes should specify what their @@ -1023,6 +1035,76 @@ namespace Functions }; + /** + * Tensor product of CutOffFunctionBase objects. + * + * Instead of using the distance to compute the cut-off function, this class + * performs a tensor product of the same CutOffFunctionBase object in each + * coordinate direction. + * + * @ingroup functions + * @author Luca Heltai, 2019. + */ + template + class CutOffFunctionTensorProduct : public CutOffFunctionBase + { + public: + /** + * Construct an empty CutOffFunctionTensorProduct object. + * + * Before you can use this class, you have to call the set_base() method + * with a class derived from the CutOffFunctionBase object. + * + * If you try to use this class before you call the set_base() method, + * and exception will be triggered. + */ + CutOffFunctionTensorProduct( + double radius = 1.0, + const Point & center = Point(), + const unsigned int n_components = 1, + const unsigned int select = CutOffFunctionBase::no_component, + const bool integrate_to_one = false); + + /** + * Initialize the class with an objet of type + * @tparam CutOffFunctionBaseType<1>. + */ + template