diff --git a/dune/elasticity/assemblers/CMakeLists.txt b/dune/elasticity/assemblers/CMakeLists.txt index c8dfa5298b2eb879b9ab12e98feb28be3385f913..fe27d4d8ca292eee6ab5f8f4e7daec03a5b759b9 100644 --- a/dune/elasticity/assemblers/CMakeLists.txt +++ b/dune/elasticity/assemblers/CMakeLists.txt @@ -1,6 +1,7 @@ install(FILES feassembler.hh localadolcstiffness.hh + localenergy.hh localfestiffness.hh neohookefunctionalassembler.hh neohookeoperatorassembler.hh diff --git a/dune/elasticity/assemblers/localenergy.hh b/dune/elasticity/assemblers/localenergy.hh new file mode 100644 index 0000000000000000000000000000000000000000..475ed7f340e276b67e4b0d2c50f3709a7badd54e --- /dev/null +++ b/dune/elasticity/assemblers/localenergy.hh @@ -0,0 +1,37 @@ +#ifndef DUNE_ELASTICITY_ASSEMBLERS_LOCALENERGY_HH +#define DUNE_ELASTICITY_ASSEMBLERS_LOCALENERGY_HH + +#include <vector> + +namespace Dune { + +namespace Elasticity { + +/** \brief Base class for energies defined by integrating over one grid element */ +template<class GridView, class LocalFiniteElement, class VectorType> +class LocalEnergy +{ + typedef typename VectorType::value_type::field_type RT; + typedef typename GridView::template Codim<0>::Entity Element; + +public: + + /** \brief Compute the energy + * + * \param element A grid element + * \param LocalFiniteElement A finite element on the reference element + * \param localConfiguration The coefficients of a FE function on the current element + */ + /** \brief Compute the energy at the current configuration */ + virtual RT energy (const Element& element, + const LocalFiniteElement& localFiniteElement, + const VectorType& localConfiguration) const = 0; + +}; + +} // namespace Elasticity + +} // namespace Dune + +#endif // DUNE_ELASTICITY_ASSEMBLERS_LOCALENERGY_HH + diff --git a/dune/elasticity/assemblers/localfestiffness.hh b/dune/elasticity/assemblers/localfestiffness.hh index abb5c52ee9511cc8600323c2bf2cc2009310b809..f8a62e89116b0b833aaf374c52553233fd1c6285 100644 --- a/dune/elasticity/assemblers/localfestiffness.hh +++ b/dune/elasticity/assemblers/localfestiffness.hh @@ -4,9 +4,11 @@ #include <dune/common/fmatrix.hh> #include <dune/istl/matrix.hh> +#include <dune/elasticity/assemblers/localenergy.hh> template<class GridView, class LocalFiniteElement, class VectorType> class LocalFEStiffness +: public Dune::Elasticity::LocalEnergy<GridView, LocalFiniteElement, VectorType> { // grid types typedef typename GridView::Grid::ctype DT; @@ -28,11 +30,6 @@ public: const VectorType& localConfiguration, VectorType& localGradient); - /** \brief Compute the energy at the current configuration */ - virtual RT energy (const Entity& e, - const LocalFiniteElement& localFiniteElement, - const VectorType& localConfiguration) const = 0; - // assembled data Dune::Matrix<Dune::FieldMatrix<RT,blocksize,blocksize> > A_;