diff --git a/include/aspect/utilities.h b/include/aspect/utilities.h index 5a7c9802634..22c45e35966 100644 --- a/include/aspect/utilities.h +++ b/include/aspect/utilities.h @@ -1246,25 +1246,22 @@ namespace aspect namespace Tensors { /** - * Convert a vector of doubles to a SymmetricTensor of the same size. + * Convert a series of doubles to a SymmetricTensor of the same size. */ template inline SymmetricTensor<2,dim> to_symmetric_tensor(const ArrayView &values) { - // Assemble stress tensor if elastic behavior is enabled SymmetricTensor<2,dim> output; for (unsigned int i=0; i < SymmetricTensor<2,dim>::n_independent_components; ++i) output[SymmetricTensor<2,dim>::unrolled_to_component_indices(i)] = values[i]; return output; - }; - - + } - /** - * Convert a vector of doubles to a SymmetricTensor of the same size. + /** + * Unroll a SymmetricTensor into a series of doubles. */ template inline @@ -1274,7 +1271,7 @@ namespace aspect { for (unsigned int i=0; i < SymmetricTensor<2,dim>::n_independent_components; ++i) values[i] = tensor[SymmetricTensor<2,dim>::unrolled_to_component_indices(i)]; - }; + } /** * Rotate a 3D 4th order tensor representing the full stiffnexx matrix using a 3D 2nd order rotation tensor diff --git a/source/particle/property/cpo_elastic_tensor.cc b/source/particle/property/cpo_elastic_tensor.cc index a0415d91b0f..fab573e69bb 100644 --- a/source/particle/property/cpo_elastic_tensor.cc +++ b/source/particle/property/cpo_elastic_tensor.cc @@ -174,7 +174,7 @@ namespace aspect CpoElasticTensor::get_elastic_tensor(unsigned int cpo_data_position, const ArrayView &data) { - ArrayView elastic_values(&data[cpo_data_position],SymmetricTensor<2,6>::n_independent_components); + const ArrayView elastic_values(&data[cpo_data_position],SymmetricTensor<2,6>::n_independent_components); return Utilities::Tensors::to_symmetric_tensor<6>(elastic_values); } @@ -187,7 +187,7 @@ namespace aspect const SymmetricTensor<2,6> &elastic_tensor) { const ArrayView elastic_values(&data[cpo_data_position],SymmetricTensor<2,6>::n_independent_components); - Utilities::Tensors::unroll(elastic_tensor, data); + Utilities::Tensors::unroll(elastic_tensor, elastic_values); }