Skip to content
Snippets Groups Projects
Commit a1c4a044 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Move Voigt notation helper code to a new file

parent aec943fd
No related branches found
No related tags found
No related merge requests found
......@@ -98,8 +98,6 @@ public:
using MatrixFunc = std::function< MatrixRT(const MatrixRT&) >;
using MatrixPhase = std::function< MatrixRT(const int&) >;
// using VoigtMatrix = FieldMatrix< double, 6, 6>;
protected:
const GridView& gridView_;
......
......@@ -17,27 +17,39 @@ using VoigtMatrix = Dune::FieldMatrix<T,dim*(dim+1)/2,dim*(dim+1)/2>;
template<typename T>
static VoigtVector<T,3> strainToVoigt(const Dune::FieldMatrix<T,3,3>& G)
VoigtVector<T,3> matrixToVoigt(const Dune::FieldMatrix<T,3,3>& matrix)
{
return {G[0][0], G[1][1], G[2][2], 2.0*G[1][2], 2.0*G[0][2], 2.0*G[0][1]};
return {matrix[0][0], matrix[1][1], matrix[2][2], 2.0*matrix[1][2], 2.0*matrix[0][2], 2.0*matrix[0][1]};
}
template<typename T>
static Dune::FieldMatrix<T,3,3> voigtToStrain(const VoigtVector<T,3>& v)
Dune::FieldMatrix<T,3,3> voigtToMatrix(const VoigtVector<T,3>& v)
{
return {{v[0], v[5]/2.0, v[4]/2.0}, {v[5]/2.0, v[1], v[3]/2.0}, {v[4]/2.0, v[3]/2.0, v[2]}};
}
template<typename T>
static VoigtVector<T,3> stressToVoigt(const Dune::FieldMatrix<T,3,3>& G)
VoigtVector<T,3> strainToVoigt(const Dune::FieldMatrix<T,3,3>& G)
{
return {G[0][0], G[1][1], G[2][2], 2.0*G[1][2], 2.0*G[0][2], 2.0*G[0][1]};
}
template<typename T>
VoigtVector<T,3> stressToVoigt(const Dune::FieldMatrix<T,3,3>& G)
{
return {G[0][0], G[1][1], G[2][2], G[1][2], G[0][2], G[0][1]};
}
template<typename T>
static Dune::FieldMatrix<T,3,3> voigtToStress(const VoigtVector<T,3>& v)
Dune::FieldMatrix<T,3,3> voigtToStress(const VoigtVector<T,3>& v)
{
return {{v[0], v[5], v[4]}, {v[5], v[1], v[3]}, {v[4], v[3], v[2]}};
}
template<typename T>
Dune::FieldMatrix<T,3,3> voigtToStrain(const Dune::FieldVector<T,6>& v)
{
return {{v[0], v[5]/2.0, v[4]/2.0}, {v[5]/2.0, v[1], v[3]/2.0}, {v[4]/2.0, v[3]/2.0, v[2]}};
}
#endif // DUNE_MICROSTRUCTURE_VOIGTHELPER_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment