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/Gsl.hpp" 9 : #include "Utilities/MakeWithValue.hpp" 10 : 11 1 : namespace Elasticity::ConstitutiveRelations { 12 : 13 : /// \cond 14 : template <size_t Dim> 15 : void ConstitutiveRelation<Dim>::stress( 16 : const gsl::not_null<tnsr::IJ<DataVector, Dim>*> stress, 17 : const tnsr::ii<DataVector, Dim>& strain, 18 : const tnsr::I<DataVector, Dim>& x) const noexcept { 19 : tnsr::II<DataVector, Dim> symmetric_stress{x.begin()->size()}; 20 : this->stress(make_not_null(&symmetric_stress), strain, x); 21 : for (size_t i = 0; i < Dim; ++i) { 22 : for (size_t j = 0; j < Dim; ++j) { 23 : stress->get(i, j) = symmetric_stress.get(i, j); 24 : } 25 : } 26 : } 27 : 28 : #define DIM(data) BOOST_PP_TUPLE_ELEM(0, data) 29 : 30 : #define INSTANTIATE(_, data) template class ConstitutiveRelation<DIM(data)>; 31 : 32 : GENERATE_INSTANTIATIONS(INSTANTIATE, (2, 3)) 33 : 34 : #undef DIM 35 : #undef INSTANTIATE 36 : /// \endcond 37 : 38 : } // namespace Elasticity::ConstitutiveRelations