diff --git a/dune/elasticity/materials/material.hh b/dune/elasticity/materials/material.hh new file mode 100644 index 0000000000000000000000000000000000000000..d6f72ff563ad7c57068c0188a68629ff52ea7064 --- /dev/null +++ b/dune/elasticity/materials/material.hh @@ -0,0 +1,62 @@ +// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set ts=8 sw=4 et sts=4: +#ifndef DUNE_ELASTICITY_MATERIALS_HYPERELASTIC_MATERIAL_HH +#define DUNE_ELASTICITY_MATERIALS_HYPERELASTIC_MATERIAL_HH + +#include <dune/common/fvector.hh> +#include <dune/common/fmatrix.hh> + +#include <dune/istl/bvector.hh> + +#include <dune/fufem/functions/virtualgridfunction.hh> +#include <dune/fufem/assemblers/localfunctionalassembler.hh> +#include <dune/fufem/assemblers/localoperatorassembler.hh> + +/* \brief Base class for hyperelastic materials. */ +template <class Basis> +class Material +{ + public: + typedef Basis GlobalBasis; + typedef typename Basis::GridView::Grid GridType; + typedef typename Basis::LocalFiniteElement Lfe; + typedef typename Basis::ReturnType ReturnType; + + static const int dim = GridType::dimension; + static const int dimworld = GridType::dimensionworld; + + typedef Dune::FieldVector<ReturnType,dim> block_type; + typedef Dune::BlockVector<block_type> VectorType; + typedef LocalFunctionalAssembler<GridType,Lfe, block_type > LocalLinearization; + typedef LocalOperatorAssembler<GridType,Lfe,Lfe,Dune::FieldMatrix<ReturnType,dim,dim> > LocalHessian; + + typedef Dune::VirtualFunction<block_type,block_type> Function; + typedef VirtualGridFunction<GridType, block_type> GridFunction; + + public: + Material() {}; + + Material(const Basis& basis) + { + basis_ = &basis; + } + + + //! Evaluate the strain energy + virtual ReturnType energy(const GridFunction& displace) = 0; + + //! Return the local assembler of the first derivative of the strain energy at some displacement + virtual LocalLinearization& firstDerivative(const GridFunction& displace) = 0; + + //! Return the local assembler of the second derivative of the strain energy at some displacement + virtual LocalHessian& secondDerivative(const GridFunction& displace) = 0; + + //! Return the global basis + const Basis& basis() {return *basis_;} + + protected: + //! Global basis used for the spatial discretization + const Basis* basis_; +}; + +#endif