]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix copy constructor of SymmetricTensor.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 28 Nov 2015 21:57:16 +0000 (15:57 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 30 Nov 2015 12:49:05 +0000 (06:49 -0600)
doc/news/changes.h
include/deal.II/base/symmetric_tensor.h

index 5a951c62508196b57b0e9debcca21914ebb270b0..f215637d94041ef152f53c60727a97e00b0e1642 100644 (file)
@@ -451,6 +451,13 @@ inconvenience this causes.
 
 
 <ol>
+  <li> Fixed: The constructor of SymmetricTensor that takes an array
+  of initializing elements led to a compiler error. This is now
+  fixed.
+  <br>
+  (Wolfgang Bangerth, 2015/11/28)
+  </li>
+
   <li> Fixed: parallel::distributed::Vector now detects if the size of MPI
   messages exceeds 2GB or if the local range exceeds the size of 32-bit
   integers and throws an exception informing about the unsupported sizes.
index 2f98689dd32175c1d3bea1f71be2f118fc68f9cb..bd73ad2cd2b217039e4e4426d2a39c6615b70fb2 100644 (file)
@@ -989,8 +989,13 @@ template <int rank, int dim, typename Number>
 inline
 SymmetricTensor<rank,dim,Number>::SymmetricTensor (const Number (&array) [n_independent_components])
   :
-  data (array)
-{}
+  data (*reinterpret_cast<const typename base_tensor_type::array_type *>(array))
+{
+  // ensure that the reinterpret_cast above actually works
+  Assert (sizeof(typename base_tensor_type::array_type)
+          == sizeof(array),
+          ExcInternalError());
+}
 
 
 

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.