SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Elasticity/ConstitutiveRelations - ConstitutiveRelation.cpp Hit Total Coverage
Commit: ebec864322c50bab8dca0a90baf8d01875114261 Lines: 1 2 50.0 %
Date: 2020-11-25 20:28:50
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #include "PointwiseFunctions/Elasticity/ConstitutiveRelations/ConstitutiveRelation.hpp"
       5             : 
       6             : #include "DataStructures/Tensor/Tensor.hpp"  // IWYU pragma: keep
       7             : #include "Utilities/GenerateInstantiations.hpp"
       8             : #include "Utilities/MakeWithValue.hpp"
       9             : 
      10             : namespace Elasticity {
      11           1 : namespace ConstitutiveRelations {
      12             : 
      13             : template <size_t Dim>
      14             : tnsr::II<DataVector, Dim> ConstitutiveRelation<Dim>::stress(
      15             :     const tnsr::iJ<DataVector, Dim>& grad_displacement,
      16             :     const tnsr::I<DataVector, Dim>& x) const noexcept {
      17             :   auto strain =
      18             :       make_with_value<tnsr::ii<DataVector, Dim>>(grad_displacement, 0.);
      19             :   for (size_t i = 0; i < Dim; i++) {
      20             :     // Diagonal elements
      21             :     strain.get(i, i) = grad_displacement.get(i, i);
      22             :     // Symmetric off-diagonal elements
      23             :     for (size_t j = 0; j < i; j++) {
      24             :       strain.get(i, j) =
      25             :           0.5 * (grad_displacement.get(i, j) + grad_displacement.get(j, i));
      26             :     }
      27             :   }
      28             :   return stress(std::move(strain), x);
      29             : }
      30             : 
      31             : /// \cond
      32             : #define DIM(data) BOOST_PP_TUPLE_ELEM(0, data)
      33             : 
      34             : #define INSTANTIATE(_, data) template class ConstitutiveRelation<DIM(data)>;
      35             : 
      36             : GENERATE_INSTANTIATIONS(INSTANTIATE, (2, 3))
      37             : 
      38             : #undef DIM
      39             : #undef INSTANTIATE
      40             : /// \endcond
      41             : 
      42             : }  // namespace ConstitutiveRelations
      43             : }  // namespace Elasticity

Generated by: LCOV version 1.14