]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement a few things about rank-4 tensors.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 28 Mar 2005 23:08:13 +0000 (23:08 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 28 Mar 2005 23:08:13 +0000 (23:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@10270 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/symmetric_tensor.h

index d9af8844feca704d4ba0cd31d0dde7c41907a5fd..26d870d5c15824352c803f3a066a5e50fcbeb086 100644 (file)
@@ -36,6 +36,13 @@ namespace internal
                                       * symmetric rank-2 tensors into
                                       * symmetric rank-2 tensors, so they can
                                       * be represented as matrices, etc.
+                                      *
+                                      * This information is probably of little
+                                      * interest to all except the accessor
+                                      * classes that need it. In particular,
+                                      * you shouldn't make any assumptions
+                                      * about the storage format in your
+                                      * application programs.
                                       */
     template <int rank, int dim>
     struct StorageType;
@@ -50,25 +57,48 @@ namespace internal
                                          /**
                                           * Number of independent components of a
                                           * symmetric tensor of rank 2. We store
-                                          * only the upper right half of it. This
-                                          * information is probably of little
-                                          * interest to all except the accessor
-                                          * classes that need it.
+                                          * only the upper right half of it.
                                           */
         static const unsigned int
         n_independent_components = (dim*dim + dim)/2;
 
                                          /**
                                           * Declare the type in which we actually
-                                          * store the data. This information is
-                                          * probably of little interest to all
-                                          * except the accessor classes that need
-                                          * it. In particular, you shouldn't make
-                                          * any assumptions about the storage
-                                          * format in your application programs.
+                                          * store the data.
                                           */
         typedef Tensor<1,n_independent_components> base_tensor_type;
     };
+
+
+
+                                     /**
+                                      * Specialization of StorageType for
+                                      * rank-4 tensors.
+                                      */
+    template <int dim>
+    struct StorageType<4,dim> 
+    {
+                                         /**
+                                          * Number of independent components
+                                          * of a symmetric tensor of rank
+                                          * 2. Since rank-4 tensors are
+                                          * mappings between such objects, we
+                                          * need this information.
+                                          */
+        static const unsigned int
+        n_rank2_components = (dim*dim + dim)/2;
+
+                                         /**
+                                          * Declare the type in which we
+                                          * actually store the data. Symmetric
+                                          * rank-4 tensors are mappings
+                                          * between symmetric rank-2 tensors,
+                                          * so we can represent the data as a
+                                          * matrix if we represent the rank-2
+                                          * tensors as vectors.
+                                          */
+        typedef Tensor<2,n_rank2_components> base_tensor_type;
+    };
     
     
     

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.