Commit 3934957b authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Initial commit after copying stuff from other modules

parents
cmake_minimum_required(VERSION 3.13)
project(dune-fiber-elasticity CXX)
if(NOT (dune-common_DIR OR dune-common_ROOT OR
"${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
string(REPLACE ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
${PROJECT_BINARY_DIR})
endif()
#find dune-common and set the module path
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
${dune-common_MODULE_PATH})
#include the dune macros
include(DuneMacros)
# start a dune project with information from dune.module
dune_project()
dune_enable_all_packages()
add_subdirectory(cmake/modules)
add_subdirectory(dune/fiber-elasticity)
add_subdirectory(src)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
Welcome to dune-fiber-elasticity!
install(FILES DuneFiberElasticityMacros.cmake
DESTINATION ${DUNE_INSTALL_MODULEDIR}
)
# This file can be used to perform build system checks for
# this Dune module. These checks will be performed upon configuration
# of this module, as well as upon configuration of any dependent module.
find_package(yaml-cpp 0.6 REQUIRED)
dune_register_package_flags(LIBRARIES yaml-cpp)
/* begin dune-fiber-elasticity
put the definitions for config.h specific to
your project here. Everything above will be
overwritten
*/
/* begin private */
/* Name of package */
#define PACKAGE "@DUNE_MOD_NAME@"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@DUNE_MAINTAINER@"
/* Define to the full name of this package. */
#define PACKAGE_NAME "@DUNE_MOD_NAME@"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "@DUNE_MOD_NAME@ @DUNE_MOD_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@DUNE_MOD_NAME@"
/* Define to the home page for this package. */
#define PACKAGE_URL "@DUNE_MOD_URL@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@DUNE_MOD_VERSION@"
/* end private */
/* Define to the version of dune-foo */
#define DUNE_FIBER_ELASTICITY_VERSION "@DUNE_FIBER_ELASTICITY_VERSION@"
/* Define to the major version of dune-foo */
#define DUNE_FIBER_ELASTICITY_VERSION_MAJOR @DUNE_FIBER_ELASTICITY_VERSION_MAJOR@
/* Define to the minor version of dune-foo */
#define DUNE_FIBER_ELASTICITY_VERSION_MINOR @DUNE_FIBER_ELASTICITY_VERSION_MINOR@
/* Define to the revision of dune-foo */
#define DUNE_FIBER_ELASTICITY_VERSION_REVISION @DUNE_FIBER_ELASTICITY_VERSION_REVISION@
/* end dune-fiber-elasticity
Everything below here will be overwritten
*/
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
CXX=@CXX@
CC=@CC@
DEPENDENCIES=@REQUIRES@
Name: @PACKAGE_NAME@
Version: @VERSION@
Description: dune-fiber-elasticity module
URL: http://dune-project.org/
Requires: dune-pdelab
Libs: -L${libdir}
Cflags: -I${includedir}
################################
# Dune module information file #
################################
# Name of the module
Module: dune-fiber-elasticity
Version: 2.7
Maintainer: Dominic Kempf
# Required build dependencies
Depends: dune-pdelab
# Optional build dependencies
#ifndef DUNE_BLOCKLAB_CONSTRUCTION_CALLABLETREE_HH
#define DUNE_BLOCKLAB_CONSTRUCTION_CALLABLETREE_HH
/** A utility to construct a function tree of callables
* from a flat array of callables (one callable per leaf
* node). This extends the PDELab functionality of
* makeGridFunctionFromCallable to systems.
*/
#include<dune/pdelab/constraints/common/constraints.hh>
#include<dune/pdelab/function/callableadapter.hh>
#include<dune/pdelab/gridfunctionspace/tags.hh>
#include<dune/typetree/simpletransformationdescriptors.hh>
#include<dune/typetree/utility.hh>
#include<memory>
namespace Dune::BlockLab {
namespace impl {
// The implementation details for makeGridFunctionTreeFromCallable
template<typename SourceNode, typename Transformation>
struct InterpolationLeafNodeTransformation
{
static const bool recursive = false;
typedef decltype(Dune::PDELab::makeGridFunctionFromCallable(std::declval<SourceNode>().gridView(),
std::declval<typename Transformation::Function>()
)
) transformed_type;
typedef std::shared_ptr<transformed_type> transformed_storage_type;
static transformed_type transform(const SourceNode& s, Transformation& t)
{
return Dune::PDELab::makeGridFunctionFromCallable(s.gridView(), t.lambdas[t.offset++]);
}
static transformed_storage_type transform_storage(std::shared_ptr<const SourceNode> s, Transformation& t)
{
return std::make_shared<transformed_type>(Dune::PDELab::makeGridFunctionFromCallable(s->gridView(), t.lambdas[t.offset++]));
}
};
template<typename RootGFS>
struct GFStoGFTransformation
{
using Function = std::function<double(typename RootGFS::Traits::GridViewType::template Codim<0>::Entity,
typename RootGFS::Traits::GridViewType::template Codim<0>::Entity::Geometry::LocalCoordinate)>;
using FunctionArray = std::array<Function, Dune::TypeTree::TreeInfo<RootGFS>::leafCount>;
template<typename... FUNCS>
GFStoGFTransformation(FUNCS... lambdas)
: offset(0), lambdas{lambdas...}
{}
int offset;
FunctionArray lambdas;
};
template<typename GFS, typename RootGFS>
InterpolationLeafNodeTransformation<GFS, GFStoGFTransformation<RootGFS>>
registerNodeTransformation(GFS* gfs, GFStoGFTransformation<RootGFS>* t, Dune::PDELab::LeafGridFunctionSpaceTag* tag);
template<typename GFS, typename RootGFS>
Dune::TypeTree::SimplePowerNodeTransformation<GFS, GFStoGFTransformation<RootGFS>, Dune::PDELab::PowerGridFunction>
registerNodeTransformation(GFS* gfs, GFStoGFTransformation<RootGFS>* t, Dune::PDELab::PowerGridFunctionSpaceTag* tag);
template<typename GFS, typename RootGFS>
Dune::TypeTree::SimpleCompositeNodeTransformation<GFS, GFStoGFTransformation<RootGFS>, Dune::PDELab::CompositeGridFunction>
registerNodeTransformation(GFS* gfs, GFStoGFTransformation<RootGFS>* t, Dune::PDELab::CompositeGridFunctionSpaceTag* tag);
// The implementation details for makeInstationaryGridFunctionTreeFromCallables
template<typename P, typename SourceNode, typename Transformation>
struct InstationaryInterpolationLeafNodeTransformation
{
static const bool recursive = false;
typedef decltype(Dune::PDELab::makeInstationaryGridFunctionFromCallable(std::declval<SourceNode>().gridView(),
std::declval<typename Transformation::Function>(),
std::declval<P&>()
)
) transformed_type;
typedef std::shared_ptr<transformed_type> transformed_storage_type;
static transformed_type transform(const SourceNode& s, Transformation& t)
{
return Dune::PDELab::makeInstationaryGridFunctionFromCallable(s.gridView(), t.lambdas[t.offset++], t.tc);
}
static transformed_storage_type transform_storage(std::shared_ptr<const SourceNode> s, Transformation& t)
{
return std::make_shared<transformed_type>(Dune::PDELab::makeInstationaryGridFunctionFromCallable(s->gridView(), t.lambdas[t.offset++], t.tc));
}
};
template<typename P, typename RootGFS>
struct GFStoInstationaryGFTransformation
{
using Function = std::function<double(typename RootGFS::Traits::GridViewType::template Codim<0>::Entity,
typename RootGFS::Traits::GridViewType::template Codim<0>::Entity::Geometry::LocalCoordinate)>;
using FunctionArray = std::array<Function, Dune::TypeTree::TreeInfo<RootGFS>::leafCount>;
template<typename... FUNCS>
GFStoInstationaryGFTransformation(P& tc, FUNCS... lambdas)
: tc(tc), offset(0), lambdas{lambdas...}
{}
P& tc;
int offset;
FunctionArray lambdas;
};
template<typename P, typename GFS, typename RootGFS>
InstationaryInterpolationLeafNodeTransformation<P, GFS, GFStoInstationaryGFTransformation<P, RootGFS>>
registerNodeTransformation(GFS* gfs, GFStoInstationaryGFTransformation<P, RootGFS>* t, Dune::PDELab::LeafGridFunctionSpaceTag* tag);
template<typename P, typename GFS, typename RootGFS>
Dune::TypeTree::SimplePowerNodeTransformation<GFS, GFStoInstationaryGFTransformation<P, RootGFS>, Dune::PDELab::PowerGridFunction>
registerNodeTransformation(GFS* gfs, GFStoInstationaryGFTransformation<P, RootGFS>* t, Dune::PDELab::PowerGridFunctionSpaceTag* tag);
template<typename P, typename GFS, typename RootGFS>
Dune::TypeTree::SimpleCompositeNodeTransformation<GFS, GFStoInstationaryGFTransformation<P, RootGFS>, Dune::PDELab::CompositeGridFunction>
registerNodeTransformation(GFS* gfs, GFStoInstationaryGFTransformation<P, RootGFS>* t, Dune::PDELab::CompositeGridFunctionSpaceTag* tag);
// the implementation details for makeBoundaryConditionTreeFromCallables
template<typename SourceNode, typename Transformation>
struct ConstraintsLeafNodeTransformation
{
static const bool recursive = false;
typedef decltype(Dune::PDELab::makeBoundaryConditionFromCallable(std::declval<SourceNode>().gridView(),
std::declval<typename Transformation::Function>()
)
) transformed_type;
typedef std::shared_ptr<transformed_type> transformed_storage_type;
static transformed_type transform(const SourceNode& s, Transformation& t)
{
return Dune::PDELab::makeBoundaryConditionFromCallable(s.gridView(), t.lambdas[t.offset++]);
}
static transformed_storage_type transform_storage(std::shared_ptr<const SourceNode> s, Transformation& t)
{
return std::make_shared<transformed_type>(Dune::PDELab::makeBoundaryConditionFromCallable(s->gridView(), t.lambdas[t.offset++]));
}
};
template<typename RootGFS>
struct GFStoConstraintsTransformation
{
using Function = std::function<bool(typename RootGFS::Traits::GridViewType::Intersection,
typename RootGFS::Traits::GridViewType::Intersection::Geometry::LocalCoordinate)>;
using FunctionArray = std::array<Function, Dune::TypeTree::TreeInfo<RootGFS>::leafCount>;
GFStoConstraintsTransformation(FunctionArray lambdas)
: offset(0), lambdas(lambdas)
{}
template<typename... FUNCS>
GFStoConstraintsTransformation(FUNCS... lambdas)
: offset(0), lambdas{lambdas...}
{}
int offset;
FunctionArray lambdas;
};
template<typename GFS, typename RootGFS>
ConstraintsLeafNodeTransformation<GFS, GFStoConstraintsTransformation<RootGFS>>
registerNodeTransformation(GFS* gfs, GFStoConstraintsTransformation<RootGFS>* t, Dune::PDELab::LeafGridFunctionSpaceTag* tag);
template<typename GFS, typename RootGFS>
Dune::TypeTree::SimplePowerNodeTransformation<GFS, GFStoConstraintsTransformation<RootGFS>, Dune::PDELab::PowerConstraintsParameters>
registerNodeTransformation(GFS* gfs, GFStoConstraintsTransformation<RootGFS>* t, Dune::PDELab::PowerGridFunctionSpaceTag* tag);
template<typename GFS, typename RootGFS>
Dune::TypeTree::SimpleCompositeNodeTransformation<GFS, GFStoConstraintsTransformation<RootGFS>, Dune::PDELab::CompositeConstraintsParameters>
registerNodeTransformation(GFS* gfs, GFStoConstraintsTransformation<RootGFS>* t, Dune::PDELab::CompositeGridFunctionSpaceTag* tag);
} // namespace impl
/** @brief Construct a callable tree from a flat sequence of callables
*
* @tparam GFS The @c GridFunctionSpace type
* @tparam FUNCS The variadic list of callable types
*
* @param gfs The @c GridFunctionSpace to construct a callable for
* @param funcs The variadic list of callables to construct it from
*
* PDELab's @c GridFunctionSpace has a tree structure of arbitrary depth.
* This utility allows to construct a callable for a function of that space
* from a flat sequence of callables. The tree is traversed and the callables
* are attached to the leaf function spaces of the @c GridFunctionSpace in
* iteration order.
*/
template<typename GFS, typename... FUNCS>
auto makeGridFunctionTreeFromCallables(const GFS& gfs,
FUNCS... funcs)
{
using Trafo = impl::GFStoGFTransformation<GFS>;
Trafo trafo(funcs...);
return Dune::TypeTree::TransformTree<GFS, Trafo>::transform(gfs, trafo);
}
/** @brief Construct an instationary callable tree from a flat sequence of callables
*
* @tparam P The type of the object that tracks time
* @tparam GFS The @c GridFunctionSpace type
* @tparam FUNCS The variadic list of callable types
*
* @param tc The object that tracks time, see PDELab for details.
* @param gfs The @c GridFunctionSpace to construct a callable for
* @param funcs The variadic list of callables to construct it from
*
* PDELab's @c GridFunctionSpace has a tree structure of arbitrary depth.
* This utility allows to construct a callable for a function of that space
* from a flat sequence of callables. The tree is traversed and the callables
* are attached to the leaf function spaces of the @c GridFunctionSpace in
* iteration order.
*/
template<typename P, typename GFS, typename... FUNCS>
auto makeInstationaryGridFunctionTreeFromCallables(P& tc,
const GFS& gfs,
FUNCS... funcs)
{
using Trafo = impl::GFStoInstationaryGFTransformation<P, GFS>;
Trafo trafo(tc, funcs...);
return Dune::TypeTree::TransformTree<GFS, Trafo>::transform(gfs, trafo);
}
/** @brief Construct a boundary callable tree from a flat sequence of callables
*
* @tparam GFS The @c GridFunctionSpace type
* @tparam FUNCS The variadic list of callable types
*
* @param gfs The @c GridFunctionSpace to construct a callable for
* @param funcs The variadic list of callables to construct it from
*
* PDELab's @c GridFunctionSpace has a tree structure of arbitrary depth.
* This utility allows to construct a boundary callable for a function of that space
* from a flat sequence of callables. The tree is traversed and the callables
* are attached to the leaf function spaces of the @c GridFunctionSpace in
* iteration order.
*/
template<typename GFS, typename... FUNCS>
auto makeBoundaryConditionTreeFromCallables(const GFS& gfs,
FUNCS... funcs)
{
using Trafo = impl::GFStoConstraintsTransformation<GFS>;
Trafo trafo(funcs...);
return Dune::TypeTree::TransformTree<GFS, Trafo>::transform(gfs, trafo);
}
} // namespace Dune::BlockLab
#endif
#ifndef ELASTICITY_2D_P2_OPERATOR_HH
#define ELASTICITY_2D_P2_OPERATOR_HH
// DISCLAIMER: This is a generated file!
#include "dune/pdelab/gridfunctionspace/gridfunctionspace.hh"
#include "dune/pdelab/localoperator/idefault.hh"
#include "dune/pdelab/localoperator/flags.hh"
#include "dune/pdelab/localoperator/pattern.hh"
#include "dune/common/parametertree.hh"
#include "dune/pdelab/common/quadraturerules.hh"
#include "dune/fiber-elasticity/localbasiscache.hh"
#include "dune/typetree/childextraction.hh"
#include "dune/fiber-elasticity/material.hh"
#include "dune/fiber-elasticity/virtualinterface.hh"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
template<typename GFSU, typename GFSV, typename GFS_COEFF_37, typename GFS_COEFF_38>
class Elasticity2DP2Operator
: public Dune::BlockLab::AbstractLocalOperatorInterface<GFSU, GFSV>
{
public:
Elasticity2DP2Operator(const GFSU& gfsu, const GFSV& gfsv, const Dune::ParameterTree& iniParams, std::shared_ptr<ElasticMaterialBase<typename GFSU::Traits::EntitySet, double>> material) :
_iniParams(iniParams),
material(material)
{
fillQuadraturePointsCache(gfsu.gridView().ibegin(*(gfsu.gridView().template begin<0>()))->geometry(), 2, qp_dim1_order2);
fillQuadratureWeightsCache(gfsu.gridView().ibegin(*(gfsu.gridView().template begin<0>()))->geometry(), 2, qw_dim1_order2);
fillQuadraturePointsCache(gfsu.gridView().template begin<0>()->geometry(), 2, qp_dim2_order2);
fillQuadratureWeightsCache(gfsu.gridView().template begin<0>()->geometry(), 2, qw_dim2_order2);
}
public:
const Dune::ParameterTree& _iniParams;
public:
enum { doPatternVolume = true };
public:
enum { isLinear = true };
public:
mutable std::vector<typename Dune::QuadraturePoint<double, 1>::Vector> qp_dim1_order2;
public:
mutable std::vector<typename Dune::QuadraturePoint<double, 1>::Field> qw_dim1_order2;
public:
using GFSV_0 = Dune::TypeTree::Child<GFSV,0>;
public:
using P2_LocalBasis = typename GFSV_0::Traits::FiniteElementMap::Traits::FiniteElementType::Traits::LocalBasisType;
public:
LocalBasisCacheWithoutReferences<P2_LocalBasis> cache_CG2;
public:
using Coefficient_LFS38 = Dune::PDELab::LocalFunctionSpace<GFS_COEFF_38>;
public:
mutable std::shared_ptr<Coefficient_LFS38> coefficient_lfs_38;
public:
using Coefficient_Vector_38 = Dune::PDELab::Backend::Vector<GFS_COEFF_38, double>;
public:
mutable std::shared_ptr<Coefficient_Vector_38> coefficient_vector_38;
public:
mutable std::shared_ptr<const GFS_COEFF_38> coefficient_gfs_38;
public:
using Coefficient_LFS_Cache38 = Dune::PDELab::LFSIndexCache<Coefficient_LFS38>;
public:
mutable std::shared_ptr<Coefficient_LFS_Cache38> coefficient_lfs_cache_38;
public:
void setCoefficientTraction(std::shared_ptr<const GFS_COEFF_38> p_gfs, std::shared_ptr<Coefficient_Vector_38> p_coefficient_vector){
coefficient_gfs_38 = p_gfs;
coefficient_vector_38 = p_coefficient_vector;
coefficient_lfs_38 = std::make_shared<Coefficient_LFS38>(*coefficient_gfs_38);
coefficient_lfs_cache_38 = std::make_shared<Coefficient_LFS_Cache38>(*coefficient_lfs_38);
}
public:
using GFSV_1 = Dune::TypeTree::Child<GFSV,1>;
public:
using IG = typename Dune::BlockLab::AbstractLocalOperatorInterface<GFSU, GFSV>::IG;
public:
using LFSU = typename Dune::BlockLab::AbstractLocalOperatorInterface<GFSU, GFSV>::LFSU;
public:
using X = typename Dune::BlockLab::AbstractLocalOperatorInterface<GFSU, GFSV>::X;
public:
using LFSV = typename Dune::BlockLab::AbstractLocalOperatorInterface<GFSU, GFSV>::LFSV;
public:
using R = typename Dune::BlockLab::AbstractLocalOperatorInterface<GFSU, GFSV>::R;
public:
enum { doPatternBoundary = true };
public:
enum { doAlphaBoundary = true };
public:
mutable std::vector<typename Dune::QuadraturePoint<double, 2>::Vector> qp_dim2_order2;
public:
using Coefficient_LFS37 = Dune::PDELab::LocalFunctionSpace<GFS_COEFF_37>;
public:
mutable std::shared_ptr<Coefficient_LFS37> coefficient_lfs_37;
public:
using Coefficient_Vector_37 = Dune::PDELab::Backend::Vector<GFS_COEFF_37, double>;
public:
mutable std::shared_ptr<Coefficient_Vector_37> coefficient_vector_37;
public:
mutable std::shared_ptr<const GFS_COEFF_37> coefficient_gfs_37;
public:
using Coefficient_LFS_Cache37 = Dune::PDELab::LFSIndexCache<Coefficient_LFS37>;
public:
mutable std::shared_ptr<Coefficient_LFS_Cache37> coefficient_lfs_cache_37;
public:
void setCoefficientForce(std::shared_ptr<const GFS_COEFF_37> p_gfs, std::shared_ptr<Coefficient_Vector_37> p_coefficient_vector){
coefficient_gfs_37 = p_gfs;
coefficient_vector_37 = p_coefficient_vector;
coefficient_lfs_37 = std::make_shared<Coefficient_LFS37>(*coefficient_gfs_37);
coefficient_lfs_cache_37 = std::make_shared<Coefficient_LFS_Cache37>(*coefficient_lfs_37);
}
public:
void setMaterial(std::shared_ptr<ElasticMaterialBase<typename GFSU::Traits::EntitySet, double>> material_)
{
material = material_;
}
public:
std::shared_ptr<ElasticMaterialBase<typename GFSU::Traits::EntitySet, double>> material;
public:
mutable std::vector<typename Dune::QuadraturePoint<double, 2>::Field> qw_dim2_order2;
public:
using EG = typename Dune::BlockLab::AbstractLocalOperatorInterface<GFSU, GFSV>::EG;
public:
enum { doAlphaVolume = true };
public:
void alpha_boundary(const IG& ig, const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s, R& r_s) const override