Commit cc26b05c authored by oliver.sander_at_tu-dresden.de's avatar oliver.sander_at_tu-dresden.de
Browse files

Merge branch 'fix/ctype' into 'master'

LocalDensity: use `ctype` for `x` entries

See merge request !28
parents 1834dcf8 75b4e26a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Dune::Elasticity { namespace Dune::Elasticity {
template<int dim, class field_type = double> template<int dim, class field_type = double, class ctype = double>
class ExpHenckyDensity final class ExpHenckyDensity final
: public LocalDensity<dim,field_type> : public LocalDensity<dim,field_type>
{ {
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
* \param x Position of the gradient * \param x Position of the gradient
* \param gradient Deformation gradient * \param gradient Deformation gradient
*/ */
field_type operator() (const FieldVector<field_type,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const field_type operator() (const FieldVector<ctype,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const
{ {
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
// compute C = F^TF // compute C = F^TF
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Dune::Elasticity { namespace Dune::Elasticity {
template<int dim, class field_type = double> template<int dim, class field_type = double, class ctype = double>
class HenckyDensity final class HenckyDensity final
: public LocalDensity<dim,field_type> : public LocalDensity<dim,field_type>
{ {
...@@ -30,7 +30,7 @@ public: ...@@ -30,7 +30,7 @@ public:
* \param x Position of the gradient * \param x Position of the gradient
* \param gradient Deformation gradient * \param gradient Deformation gradient
*/ */
field_type operator() (const FieldVector<field_type,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const field_type operator() (const FieldVector<ctype,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const
{ {
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
// compute C = F^TF // compute C = F^TF
......
...@@ -5,8 +5,12 @@ ...@@ -5,8 +5,12 @@
namespace Dune::Elasticity { namespace Dune::Elasticity {
/** \brief A base class for energy densities to be evaluated in an integral energy */ /** \brief A base class for energy densities to be evaluated in an integral energy
template<int dim, class field_type = double> *
* \tparam field_type type of the gradient entries
* \tparam ctype type of the coordinates, i.e., the x entries
*/
template<int dim, class field_type = double, class ctype = double>
class LocalDensity class LocalDensity
{ {
...@@ -17,7 +21,7 @@ public: ...@@ -17,7 +21,7 @@ public:
* \param x Position of the gradient * \param x Position of the gradient
* \param gradient Deformation gradient * \param gradient Deformation gradient
*/ */
virtual field_type operator() (const FieldVector<field_type,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const = 0; virtual field_type operator() (const FieldVector<ctype,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const = 0;
}; };
......
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
/** \brief Constructor with a local energy density /** \brief Constructor with a local energy density
*/ */
LocalIntegralEnergy(const std::shared_ptr<LocalDensity<dim,field_type>>& ld) LocalIntegralEnergy(const std::shared_ptr<LocalDensity<dim,field_type,DT>>& ld)
: localDensity_(ld) : localDensity_(ld)
{} {}
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
const std::vector<Dune::FieldVector<field_type,gridDim> >& localConfiguration) const; const std::vector<Dune::FieldVector<field_type,gridDim> >& localConfiguration) const;
protected: protected:
const std::shared_ptr<LocalDensity<dim,field_type>> localDensity_ = nullptr; const std::shared_ptr<LocalDensity<dim,field_type,DT>> localDensity_ = nullptr;
}; };
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Dune::Elasticity { namespace Dune::Elasticity {
template<int dim, class field_type = double> template<int dim, class field_type = double, class ctype = double>
class MooneyRivlinDensity final class MooneyRivlinDensity final
: public LocalDensity<dim,field_type> : public LocalDensity<dim,field_type>
{ {
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
* \param x Position of the gradient * \param x Position of the gradient
* \param gradient Deformation gradient * \param gradient Deformation gradient
*/ */
field_type operator() (const FieldVector<field_type,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const field_type operator() (const FieldVector<ctype,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const
{ {
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
// compute C = F^TF // compute C = F^TF
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Dune::Elasticity { namespace Dune::Elasticity {
template<int dim, class field_type = double> template<int dim, class field_type = double, class ctype = double>
class NeoHookeDensity final class NeoHookeDensity final
: public LocalDensity<dim,field_type> : public LocalDensity<dim,field_type>
{ {
...@@ -30,7 +30,7 @@ public: ...@@ -30,7 +30,7 @@ public:
* \param x Position of the gradient * \param x Position of the gradient
* \param gradient Deformation gradient * \param gradient Deformation gradient
*/ */
field_type operator() (const FieldVector<field_type,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const field_type operator() (const FieldVector<ctype,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const
{ {
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
// compute C = F^TF // compute C = F^TF
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace Dune::Elasticity { namespace Dune::Elasticity {
template<int dim, class field_type = double> template<int dim, class field_type = double, class ctype = double>
class StVenantKirchhoffDensity final class StVenantKirchhoffDensity final
: public LocalDensity<dim,field_type> : public LocalDensity<dim,field_type>
{ {
...@@ -28,7 +28,7 @@ public: ...@@ -28,7 +28,7 @@ public:
* \param x Position of the gradient * \param x Position of the gradient
* \param gradient Deformation gradient * \param gradient Deformation gradient
*/ */
field_type operator() (const FieldVector<field_type,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const field_type operator() (const FieldVector<ctype,dim>& x, const FieldMatrix<field_type,dim,dim>& gradient) const
{ {
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// compute strain E = 1/2 *( F^T F - I) // compute strain E = 1/2 *( F^T F - I)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment