diff --git a/dune/fufem/mechanics/tetratensor.hh b/dune/fufem/mechanics/tetratensor.hh index 7d104bb4185d4911762a563f680ae752faa061d8..947ee7dbcbc13ab9d9a0dbbf7669ca03427fbd1d 100644 --- a/dune/fufem/mechanics/tetratensor.hh +++ b/dune/fufem/mechanics/tetratensor.hh @@ -8,19 +8,19 @@ */ template <int dim> -class TetraTensor : public ElasticityTensor<dim> +class TetraTensor; + +template <> +class TetraTensor<3> : public ElasticityTensor<3> { public: - /** \brief constructor for elasticity tensors with tetragonal symmetry + /** \brief constructor for elasticity tensors with tetragonal symmetry * * Parameters are named according to Voigt notation */ TetraTensor(double C11, double C12, double C13, double C33, double C44, double C66) { - if (dim!=3) - DUNE_THROW(Dune::Exception,"Parameters given for a 3-dim tetragonal elasticity tensor but dim!=3"); - - ElasticityTensor<dim>::operator=(0.0); + ElasticityTensor<3>::operator=(0.0); (*this)[0][0] = C11; (*this)[1][1] = C11; @@ -36,14 +36,19 @@ class TetraTensor : public ElasticityTensor<dim> (*this)[2][0] = C13; (*this)[2][1] = C13; } +}; - /** \brief for computations in 2 dimensions - the tetragonal symmetry can of course not be represented in 2D */ +template <> +class TetraTensor<2> : public ElasticityTensor<2> +{ + public: + /** \brief for computations in 2 dimensions - the tetragonal symmetry can of course not be represented in 2D + * + * Parameters are named according to Voigt notation + */ TetraTensor(double C11, double C22, double C33, double C12) { - if (dim!=2) - DUNE_THROW(Dune::Exception,"Parameters given for a 2-dim tetragonal elasticity tensor but dim!=2"); - - ElasticityTensor<dim>::operator=(0.0); + ElasticityTensor<2>::operator=(0.0); (*this)[0][0] = C11; (*this)[1][1] = C22; @@ -52,8 +57,6 @@ class TetraTensor : public ElasticityTensor<dim> (*this)[0][1] = C12; (*this)[1][0] = C12; } - }; - #endif