diff --git a/dune/gfe/assemblers/geodesicfeassemblerwrapper.hh b/dune/gfe/assemblers/geodesicfeassemblerwrapper.hh index d7129ef58df34963cb8f0e366c10700e0d1fab62..ceea08ee75822998383256bb5b15737870fc92fd 100644 --- a/dune/gfe/assemblers/geodesicfeassemblerwrapper.hh +++ b/dune/gfe/assemblers/geodesicfeassemblerwrapper.hh @@ -12,10 +12,13 @@ namespace Dune::GFE { It reimplements the same methods as these two and transfers the structure of the gradient and the Hessian */ - template <class Basis, class ScalarBasis, class TargetSpace, class MixedSpace0, class MixedSpace1> + template <class Basis, class ScalarBasis, class TargetSpace> class GeodesicFEAssemblerWrapper { + using MixedSpace0 = std::tuple_element_t<0,TargetSpace>; + using MixedSpace1 = std::tuple_element_t<1,TargetSpace>; + typedef typename Basis::GridView GridView; //! Dimension of the grid. @@ -42,9 +45,6 @@ namespace Dune::GFE { basis_(basis) { hessianMixed_ = std::make_unique<MatrixType>(); - // The two spaces from the mixed version need to have the same embeddedDim as the Target Space - assert(MixedSpace0::embeddedDim + MixedSpace1::embeddedDim == TargetSpace::embeddedDim); - assert(blocksize0 + blocksize1 == blocksize); } /** \brief Assemble the tangent stiffness matrix and the functional gradient together @@ -69,14 +69,14 @@ namespace Dune::GFE { } private: - Dune::TupleVector<std::vector<MixedSpace0>,std::vector<MixedSpace1> > splitVector(const std::vector<TargetSpace>& sol) const; + auto splitVector(const std::vector<TargetSpace>& sol) const; std::unique_ptr<MatrixType> hessianMixed_; }; // end class } //end namespace -template <class Basis, class ScalarBasis, class TargetSpace, class MixedSpace0, class MixedSpace1> -Dune::TupleVector<std::vector<MixedSpace0>,std::vector<MixedSpace1> > Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace,MixedSpace0,MixedSpace1>:: +template <class Basis, class ScalarBasis, class TargetSpace> +auto Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace>:: splitVector(const std::vector<TargetSpace>& sol) const { using namespace Indices; // Split the solution into the Deformation and the Rotational part @@ -92,8 +92,8 @@ splitVector(const std::vector<TargetSpace>& sol) const { return solutionSplit; } -template <class Basis, class ScalarBasis, class TargetSpace, class MixedSpace0, class MixedSpace1> -void Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace,MixedSpace0,MixedSpace1>:: +template <class Basis, class ScalarBasis, class TargetSpace> +void Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace>:: getNeighborsPerVertex(Dune::MatrixIndexSet& nb) const { auto n = basis_.size(); @@ -112,8 +112,8 @@ getNeighborsPerVertex(Dune::MatrixIndexSet& nb) const nb = nb00; } -template <class Basis, class ScalarBasis, class TargetSpace, class MixedSpace0, class MixedSpace1> -void Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace,MixedSpace0,MixedSpace1>:: +template <class Basis, class ScalarBasis, class TargetSpace> +void Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace>:: assembleGradientAndHessian(const std::vector<TargetSpace>& sol, Dune::BlockVector<Dune::FieldVector<double, blocksize> >& gradient, Dune::BCRSMatrix<MatrixBlock>& hessian, @@ -184,8 +184,8 @@ assembleGradientAndHessian(const std::vector<TargetSpace>& sol, } } -template <class Basis, class ScalarBasis, class TargetSpace, class MixedSpace0, class MixedSpace1> -double Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace,MixedSpace0,MixedSpace1>:: +template <class Basis, class ScalarBasis, class TargetSpace> +double Dune::GFE::GeodesicFEAssemblerWrapper<Basis, ScalarBasis, TargetSpace>:: computeEnergy(const std::vector<TargetSpace>& sol) const { using namespace Dune::TypeTree::Indices; diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc index 09da40393ab3b483d5bc3a6ad18af4994576f064..be69022f9338ded218d5affceac175e5a28ec7c1 100644 --- a/src/cosserat-continuum.cc +++ b/src/cosserat-continuum.cc @@ -580,7 +580,7 @@ int main (int argc, char *argv[]) try dirichletDofsTargetSpace[i][j] = orientationDirichletDofs[i][j-3]; } - using GFEAssemblerWrapper = Dune::GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, TargetSpace, RealTuple<double, 3>, Rotation<double,3> >; + using GFEAssemblerWrapper = Dune::GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, TargetSpace>; GFEAssemblerWrapper assembler(&mixedAssembler, deformationFEBasis); if (parameterSet.get<std::string>("solvertype", "trustRegion") == "trustRegion") { RiemannianTrustRegionSolver<DeformationFEBasis, TargetSpace, GFEAssemblerWrapper> solver; @@ -678,7 +678,7 @@ int main (int argc, char *argv[]) try dirichletDofsTargetSpace[i][j] = orientationDirichletDofs[i][j-3]; } - using GFEAssemblerWrapper = Dune::GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, TargetSpace, RealTuple<double, 3>, Rotation<double,3> >; + using GFEAssemblerWrapper = Dune::GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, TargetSpace>; GFEAssemblerWrapper assembler(&mixedAssembler, deformationFEBasis); if (parameterSet.get<std::string>("solvertype", "trustRegion") == "trustRegion") { RiemannianTrustRegionSolver<DeformationFEBasis, TargetSpace, GFEAssemblerWrapper> solver; diff --git a/src/film-on-substrate.cc b/src/film-on-substrate.cc index efd0f302a09243de149e066ac50389464756fbe5..1e6cc7b109137e1a0f839ae0d362f0da6348d8ea 100644 --- a/src/film-on-substrate.cc +++ b/src/film-on-substrate.cc @@ -594,7 +594,7 @@ int main (int argc, char *argv[]) try for (int j = dim; j < RBM::TangentVector::dimension; j ++) dirichletDofsRBM[i][j] = dirichletDofs[_1][i][j-dim]; } - typedef Dune::GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM, RealTuple<double, dim>, Rotation<double,dim> > GFEAssemblerWrapper; + typedef Dune::GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM> GFEAssemblerWrapper; GFEAssemblerWrapper assembler(&mixedAssembler, deformationFEBasis); #endif diff --git a/src/simofoxshell.cc b/src/simofoxshell.cc index f67062dd6a8f300514493519f97dcb83421315ae..389a0c16570f7a12810e34412cf366fcc9104fb3 100644 --- a/src/simofoxshell.cc +++ b/src/simofoxshell.cc @@ -398,7 +398,7 @@ int main(int argc, char *argv[]) try for (int j = 3; j < TargetSpace::TangentVector::dimension; j ++) dirichletDofsTargetSpace[i][j] = orientationDirichletDofs[i][j-3]; } - using GFEAssemblerWrapper = Dune::GFE::GeodesicFEAssemblerWrapper<decltype(compositeBasis), MidsurfaceFEBasis, TargetSpace, RealTuple<double, 3>, UnitVector<double,3> >; + using GFEAssemblerWrapper = Dune::GFE::GeodesicFEAssemblerWrapper<decltype(compositeBasis), MidsurfaceFEBasis, TargetSpace>; GFEAssemblerWrapper assemblerNotMixed(&assembler, midsurfaceFEBasis); RiemannianProximalNewtonSolver<MidsurfaceFEBasis, TargetSpace, GFEAssemblerWrapper> solver; solver.setup(*grid, diff --git a/test/filmonsubstratetest.cc b/test/filmonsubstratetest.cc index 9b543291648d950ac2fc8e628f11d89d77ac9c32..8255ca566a7fdcd1f38e12d4a62d7d8440a37f71 100644 --- a/test/filmonsubstratetest.cc +++ b/test/filmonsubstratetest.cc @@ -392,7 +392,7 @@ int main (int argc, char *argv[]) for (int j = dim; j < RBM::TangentVector::dimension; j ++) dirichletDofsRBM[i][j] = dirichletDofs[_1][i][j-dim]; } - typedef GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM, RealTuple<double, dim>, Rotation<double,dim> > GFEAssemblerWrapper; + typedef GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM> GFEAssemblerWrapper; GFEAssemblerWrapper assembler(&mixedAssembler, deformationFEBasis); #endif diff --git a/test/geodesicfeassemblerwrappertest.cc b/test/geodesicfeassemblerwrappertest.cc index 9b6cf7a7b86b47e35035debf59538a2e9ae5a6dc..94f8a7ae96d227e977d5a112ea84b1c1c676fad5 100644 --- a/test/geodesicfeassemblerwrappertest.cc +++ b/test/geodesicfeassemblerwrappertest.cc @@ -145,7 +145,7 @@ int main (int argc, char *argv[]) using DeformationFEBasis = Functions::LagrangeBasis<GridView,displacementOrder>; DeformationFEBasis deformationFEBasis(gridView); - using GFEAssemblerWrapper = GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM, RealTuple<double, dim>, Rotation<double,dim> >; + using GFEAssemblerWrapper = GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM>; GFEAssemblerWrapper assembler(&mixedAssembler, deformationFEBasis); ///////////////////////////////////////////////////////////////////////// diff --git a/test/mixedriemannianpnsolvertest.cc b/test/mixedriemannianpnsolvertest.cc index 89ddeb07e3c28c2e934efedb95ac1391bf5cb0f5..201bed5af53c70dc8178bd790642b42ecaa106cb 100644 --- a/test/mixedriemannianpnsolvertest.cc +++ b/test/mixedriemannianpnsolvertest.cc @@ -174,7 +174,7 @@ int main (int argc, char *argv[]) MixedGFEAssembler<CompositeBasis, RBM> mixedAssembler(compositeBasis, mixedLocalGFEADOLCStiffness); - using GFEAssemblerWrapper = GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM, RealTuple<double, dim>, Rotation<double,dim> >; + using GFEAssemblerWrapper = GFE::GeodesicFEAssemblerWrapper<CompositeBasis, DeformationFEBasis, RBM>; GFEAssemblerWrapper assembler(&mixedAssembler, deformationFEBasis); /////////////////////////////////////////////////////////////////////////