]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce Function better in step-4.
authorDavid Wells <wellsd2@rpi.edu>
Fri, 29 Jul 2016 00:13:35 +0000 (20:13 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Fri, 29 Jul 2016 00:14:30 +0000 (20:14 -0400)
examples/step-4/doc/tooltip
examples/step-4/step-4.cc

index 1f9439480213ea4131f2ae5fc4fee9eccef74f8a..bec9db63be47a858edaec31ed66d5e56b20c02f1 100644 (file)
@@ -1 +1 @@
-Dimension independent programming. Boundary conditions.
+Dimension independent programming. Boundary conditions. Functions.
index cf089844ad26a8f780324fc417aadf512dcf7e70..bec2af5372f1ce5bc350cce026d4bfdbde6ec860 100644 (file)
@@ -117,11 +117,19 @@ private:
 // where we want to evaluate the function. A value for the component can then
 // simply be omitted for scalar functions.
 //
-// Note that the C++ language forces us to declare and define a constructor to
-// the following classes even though they are empty. This is due to the fact
-// that the base class has no default constructor (i.e. one without
-// arguments), even though it has a constructor which has default values for
-// all arguments.
+// Function objects are used in lots of places in the library (for example, in
+// step-2 we used a ZeroFunction instance as an argument to
+// VectorTools::interpolate_boundary_values) and this is the first step where
+// we define a new class that inherits from Function. Since we only ever call
+// Function::value, we could get away with just a plain function (and this is
+// what is done in step-5), but since this is a tutorial we inherit from
+// Function for the sake of example.
+//
+// Unfortunately, some compilers (notably clang 3.8) have a bug where they
+// cannot figure out the default constructor (that is, the constructor which
+// takes no arguments) of classes derived from Function. For portability we
+// provide such constructors in all the tutorial programs so that all
+// supported compilers are happy.
 template <int dim>
 class RightHandSide : public Function<dim>
 {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.