]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a note on the Tensor class to step-7.
authorDavid Wells <wellsd2@rpi.edu>
Sun, 17 Jul 2016 19:37:32 +0000 (15:37 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Fri, 29 Jul 2016 00:21:04 +0000 (20:21 -0400)
This is the first tutorial program where we explicitly use Tensor, so we
should say a bit about it.

examples/step-7/step-7.cc
examples/step-8/doc/tooltip

index 75fbc6952ed45bf0549bc0c6b2832f0f04fb3863..308c2ac4b04213e2e6d28c534cc13dbfd33285e5 100644 (file)
@@ -166,7 +166,20 @@ namespace Step7
   // base class. Note that the gradient of a function in <code>dim</code>
   // space dimensions is a vector of size <code>dim</code>, i.e. a tensor of
   // rank 1 and dimension <code>dim</code>. As for so many other things, the
-  // library provides a suitable class for this.
+  // library provides a suitable class for this. One new thing about this
+  // class is that it explicitly uses the Tensor objects, which previously
+  // appeared as intermediate terms in step-3 and step-4. A tensor is a
+  // generalization of scalars (rank zero tensors), vectors (rank one
+  // tensors), and matrices (rank two tensors), as well as higher dimensional
+  // objects. The Tensor class requires two template arguments: the tensor
+  // rank and tensor dimension. For example, here we use tensors of rank one
+  // (vectors) with dimension <code>dim</code> (so they have <code>dim</code>
+  // entries.) While this is a bit less flexible than using Vector, the
+  // compiler can generate faster code when the length of the vector is known
+  // at compile time. Additionally, specifying a Tensor of rank one and
+  // dimension <code>dim</code> guarantees that the tensor will have the right
+  // shape (since it is built into the type of the object itself), so the
+  // compiler can catch most size-related mistakes for us.
   //
   // Just as in previous examples, we are forced by the C++ language
   // specification to declare a seemingly useless default constructor.
index d8b7084988aab7ec57c0ddbb4c65927850796ef0..b57f7fe2aa0513d4b8925b2e4bdbcbd96f32bdd3 100644 (file)
@@ -1 +1 @@
-Systems of PDE. Elasticity.
+Systems of PDE. Elasticity. Tensors.

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.