Skip to content
Snippets Groups Projects
Commit 83c29cfa authored by Elias Pipping's avatar Elias Pipping Committed by pipping
Browse files

Use template specialisation

[[Imported from SVN: r4673]]
parent 784e44b2
Branches
Tags
No related merge requests found
......@@ -4,14 +4,16 @@
#include "elasticitytensor.hh"
template <int dim>
class CubicTensor : public ElasticityTensor<dim>
class CubicTensor;
template <>
class CubicTensor<3> : public ElasticityTensor<3>
{
public:
CubicTensor(double C11, double C12, double C44) {
ElasticityTensor<dim>::operator=(0.0);
ElasticityTensor<3>::operator=(0.0);
if (dim == 3) {
(*this)[0][0] = C11;
(*this)[1][1] = C11;
(*this)[2][2] = C11;
......@@ -25,25 +27,24 @@ class CubicTensor : public ElasticityTensor<dim>
(*this)[1][2] = C12;
(*this)[2][0] = C12;
(*this)[2][1] = C12;
}
else if (dim == 2) {
}
};
template <>
class CubicTensor<2> : public ElasticityTensor<2>
{
public:
CubicTensor(double C11, double C12, double C44) {
ElasticityTensor<2>::operator=(0.0);
(*this)[0][0] = C11;
(*this)[1][1] = C11;
(*this)[2][2] = 2*C44;
(*this)[0][1] = C12;
(*this)[1][0] = C12;
}
}
/* double getTensorEntry(const int i, const int j, const int k, const int l)
{
}
double getVoigtEntry(const int i, const int j)
{
}*/
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment