From 7d33d3466586800b350d5fc15efee200b18ec312 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 17 Jul 2016 15:37:32 -0400 Subject: [PATCH] Add a note on the Tensor class to step-7. 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 | 15 ++++++++++++++- examples/step-8/doc/tooltip | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/step-7/step-7.cc b/examples/step-7/step-7.cc index 75fbc6952e..308c2ac4b0 100644 --- a/examples/step-7/step-7.cc +++ b/examples/step-7/step-7.cc @@ -166,7 +166,20 @@ namespace Step7 // base class. Note that the gradient of a function in dim // space dimensions is a vector of size dim, i.e. a tensor of // rank 1 and dimension dim. 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 dim (so they have dim + // 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 dim 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. diff --git a/examples/step-8/doc/tooltip b/examples/step-8/doc/tooltip index d8b7084988..b57f7fe2aa 100644 --- a/examples/step-8/doc/tooltip +++ b/examples/step-8/doc/tooltip @@ -1 +1 @@ -Systems of PDE. Elasticity. +Systems of PDE. Elasticity. Tensors. -- 2.39.5