From 9be78e4e1b37b2fec355049f3168b713322dc424 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Thu, 28 Jun 2012 12:47:49 +0200 Subject: [PATCH] OperatorType -> MatrixType --- src/assemblers_tmpl.cc | 12 ++++++------ src/mysolver.cc | 16 +++++++--------- src/mysolver.hh | 12 ++++++------ src/mysolver_tmpl.cc | 12 ++++++------ src/one-body-sample.cc | 12 ++++++------ 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc index a66a89c9..61fdb817 100644 --- a/src/assemblers_tmpl.cc +++ b/src/assemblers_tmpl.cc @@ -8,7 +8,7 @@ // {{{ 2D typedef Dune::FieldVector<double, 2> SmallVector2; typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2; -typedef Dune::BCRSMatrix<SmallMatrix2> OperatorType2; +typedef Dune::BCRSMatrix<SmallMatrix2> MatrixType2; typedef Dune::BlockVector<SmallVector2> VectorType2; typedef Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming> GridType2; @@ -28,8 +28,8 @@ assemble_frictional<GridType2, GridView2, SmallVector2, P1Basis2>( Dune::BitSetVector<1> const &frictionalNodes); template Dune::shared_ptr< - Dune::GlobalNonlinearity<VectorType2, OperatorType2> const> -assemble_nonlinearity<VectorType2, OperatorType2>( + Dune::GlobalNonlinearity<VectorType2, MatrixType2> const> +assemble_nonlinearity<VectorType2, MatrixType2>( Dune::ParameterTree const &parset, Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> nodalIntegrals, @@ -40,7 +40,7 @@ assemble_nonlinearity<VectorType2, OperatorType2>( // {{{ 3D typedef Dune::FieldVector<double, 3> SmallVector3; typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3; -typedef Dune::BCRSMatrix<SmallMatrix3> OperatorType3; +typedef Dune::BCRSMatrix<SmallMatrix3> MatrixType3; typedef Dune::BlockVector<SmallVector3> VectorType3; typedef Dune::ALUGrid<3, 3, Dune::simplex, Dune::nonconforming> GridType3; @@ -59,8 +59,8 @@ assemble_frictional<GridType3, GridView3, SmallVector3, P1Basis3>( Dune::BitSetVector<1> const &frictionalNodes); template Dune::shared_ptr< - Dune::GlobalNonlinearity<VectorType3, OperatorType3> const> -assemble_nonlinearity<VectorType3, OperatorType3>( + Dune::GlobalNonlinearity<VectorType3, MatrixType3> const> +assemble_nonlinearity<VectorType3, MatrixType3>( Dune::ParameterTree const &parset, Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> nodalIntegrals, diff --git a/src/mysolver.cc b/src/mysolver.cc index 33c5fd20..fc1532f9 100644 --- a/src/mysolver.cc +++ b/src/mysolver.cc @@ -10,9 +10,9 @@ #include "mysolver.hh" -template <int dim, class VectorType, class OperatorType, class GridType, +template <int dim, class VectorType, class MatrixType, class GridType, class BlockProblemType> -MySolver<dim, VectorType, OperatorType, GridType, BlockProblemType>::MySolver( +MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::MySolver( Dune::ParameterTree parset, int refinements, double solver_tolerance, GridType const &grid, Dune::BitSetVector<dim> const &ignoreNodes) : baseEnergyNorm(linearBaseSolverStep), @@ -43,22 +43,20 @@ MySolver<dim, VectorType, OperatorType, GridType, BlockProblemType>::MySolver( multigridStep->ignoreNodes_ = &ignoreNodes; } -template <int dim, class VectorType, class OperatorType, class GridType, +template <int dim, class VectorType, class MatrixType, class GridType, class BlockProblemType> -MySolver<dim, VectorType, OperatorType, GridType, - BlockProblemType>::~MySolver() { +MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::~MySolver() { for (auto &x : transferOperators) delete x; delete multigridStep; } -template <int dim, class VectorType, class OperatorType, class GridType, +template <int dim, class VectorType, class MatrixType, class GridType, class BlockProblemType> -typename MySolver<dim, VectorType, OperatorType, GridType, +typename MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::SolverType * -MySolver<dim, VectorType, OperatorType, GridType, - BlockProblemType>::getSolver() { +MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::getSolver() { return multigridStep; } diff --git a/src/mysolver.hh b/src/mysolver.hh index d80b755b..4587c767 100644 --- a/src/mysolver.hh +++ b/src/mysolver.hh @@ -13,7 +13,7 @@ #include <dune/fufem/assemblers/transferoperatorassembler.hh> #include <dune/tnnmg/iterationsteps/tnnmgstep.hh> -template <int dim, class VectorType, class OperatorType, class GridType, +template <int dim, class VectorType, class MatrixType, class GridType, class BlockProblemType> class MySolver { private: @@ -30,12 +30,12 @@ class MySolver { SolverType *getSolver(); private: - TruncatedBlockGSStep<OperatorType, VectorType> linearBaseSolverStep; - EnergyNorm<OperatorType, VectorType> baseEnergyNorm; + TruncatedBlockGSStep<MatrixType, VectorType> linearBaseSolverStep; + EnergyNorm<MatrixType, VectorType> baseEnergyNorm; LoopSolver<VectorType> linearBaseSolver; - TruncatedBlockGSStep<OperatorType, VectorType> linearPresmoother; - TruncatedBlockGSStep<OperatorType, VectorType> linearPostsmoother; - MultigridStep<OperatorType, VectorType> linearIterationStep; + TruncatedBlockGSStep<MatrixType, VectorType> linearPresmoother; + TruncatedBlockGSStep<MatrixType, VectorType> linearPostsmoother; + MultigridStep<MatrixType, VectorType> linearIterationStep; std::vector<CompressedMultigridTransfer<VectorType> *> transferOperators; NonlinearSmootherType nonlinearSmoother; SolverType *multigridStep; diff --git a/src/mysolver_tmpl.cc b/src/mysolver_tmpl.cc index 4bf91b21..44d1ab8e 100644 --- a/src/mysolver_tmpl.cc +++ b/src/mysolver_tmpl.cc @@ -12,15 +12,15 @@ typedef Dune::FieldVector<double, 2> SmallVector2; typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2; typedef Dune::BlockVector<SmallVector2> VectorType2; -typedef Dune::BCRSMatrix<SmallMatrix2> OperatorType2; +typedef Dune::BCRSMatrix<SmallMatrix2> MatrixType2; -typedef MyConvexProblem<OperatorType2, VectorType2> MyConvexProblemType2; +typedef MyConvexProblem<MatrixType2, VectorType2> MyConvexProblemType2; typedef MyBlockProblem<MyConvexProblemType2> MyBlockProblemType2; typedef Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming> GridType2; // typedef Dune::YaspGrid<2> GridType2; -template class MySolver<2, VectorType2, OperatorType2, GridType2, +template class MySolver<2, VectorType2, MatrixType2, GridType2, MyBlockProblemType2>; // }}} @@ -28,14 +28,14 @@ template class MySolver<2, VectorType2, OperatorType2, GridType2, typedef Dune::FieldVector<double, 3> SmallVector3; typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3; typedef Dune::BlockVector<SmallVector3> VectorType3; -typedef Dune::BCRSMatrix<SmallMatrix3> OperatorType3; +typedef Dune::BCRSMatrix<SmallMatrix3> MatrixType3; -typedef MyConvexProblem<OperatorType3, VectorType3> MyConvexProblemType3; +typedef MyConvexProblem<MatrixType3, VectorType3> MyConvexProblemType3; typedef MyBlockProblem<MyConvexProblemType3> MyBlockProblemType3; typedef Dune::ALUGrid<3, 3, Dune::simplex, Dune::nonconforming> GridType3; // typedef Dune::YaspGrid<3> GridType3; -template class MySolver<3, VectorType3, OperatorType3, GridType3, +template class MySolver<3, VectorType3, MatrixType3, GridType3, MyBlockProblemType3>; // }}} diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 8779d0df..ca38283c 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) { typedef Dune::FieldVector<double, dim> SmallVector; typedef Dune::FieldMatrix<double, dim, dim> SmallMatrix; - typedef Dune::BCRSMatrix<SmallMatrix> OperatorType; + typedef Dune::BCRSMatrix<SmallMatrix> MatrixType; typedef Dune::BlockVector<SmallVector> VectorType; typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType; @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) { StVenantKirchhoffAssembler<GridType, P1Basis::LocalFiniteElement, P1Basis::LocalFiniteElement> const localStiffness(E, nu); - OperatorType stiffnessMatrix; + MatrixType stiffnessMatrix; { timer.reset(); OperatorAssembler<P1Basis, P1Basis>(p1Basis, p1Basis) @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { std::cout << "Assembled stiffness matrix in " << timer.elapsed() << "s" << std::endl; } - EnergyNorm<OperatorType, VectorType> energyNorm(stiffnessMatrix); + EnergyNorm<MatrixType, VectorType> energyNorm(stiffnessMatrix); // Set up the boundary Dune::BitSetVector<dim> ignoreNodes(finestSize, false); @@ -211,11 +211,11 @@ int main(int argc, char *argv[]) { VectorType b4; // }}} - typedef MyConvexProblem<OperatorType, VectorType> MyConvexProblemType; + typedef MyConvexProblem<MatrixType, VectorType> MyConvexProblemType; typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType; // Set up TNNMG solver - MySolver<dim, VectorType, OperatorType, GridType, MyBlockProblemType> + MySolver<dim, VectorType, MatrixType, GridType, MyBlockProblemType> mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid, ignoreNodes); @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) { for (size_t state_fpi = 0; state_fpi < fixed_point_iterations; ++state_fpi) { auto myGlobalNonlinearity = - assemble_nonlinearity<VectorType, OperatorType>( + assemble_nonlinearity<VectorType, MatrixType>( parset.sub("boundary.friction"), nodalIntegrals, s4_new, h); MyConvexProblemType const myConvexProblem(stiffnessMatrix, *myGlobalNonlinearity, b4); -- GitLab