From b52ca9ed032b941808a209df5f5d1a318d2be500 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Thu, 15 Mar 2012 18:00:27 +0100 Subject: [PATCH] Use ALUGrid --- src/Makefile.am | 3 +++ src/assemblers_tmpl.cc | 9 ++++++--- src/mysolver_tmpl.cc | 9 ++++++--- src/one-body-sample.cc | 24 ++++++++++++++++-------- src/vtk_tmpl.cc | 9 ++++++--- 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3b07f3e5..ac90649d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,6 +57,7 @@ AM_CXXFLAGS = \ AM_CPPFLAGS = \ $(DUNE_CPPFLAGS) \ $(PYTHON_CPPFLAGS) \ + $(ALUGRID_CPPFLAGS) \ -I$(top_srcdir) # The libraries have to be given in reverse order (most basic libraries @@ -65,9 +66,11 @@ AM_CPPFLAGS = \ # here as well. LDADD = \ $(DUNE_LDFLAGS) $(DUNE_LIBS) \ + $(ALUGRID_LIBS) \ $(PYTHON_LIBS) AM_LDFLAGS = \ $(DUNE_LDFLAGS) \ + $(ALUGRID_LDFLAGS) \ $(PYTHON_LDFLAGS) # don't follow the full GNU-standard diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc index 163d8f73..cb02a52c 100644 --- a/src/assemblers_tmpl.cc +++ b/src/assemblers_tmpl.cc @@ -1,6 +1,7 @@ #include <dune/common/fmatrix.hh> #include <dune/common/fvector.hh> -#include <dune/grid/yaspgrid.hh> +// #include <dune/grid/yaspgrid.hh> +#include <dune/grid/alugrid.hh> #include <dune/fufem/functionspacebases/p1nodalbasis.hh> @@ -10,7 +11,8 @@ typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2; typedef Dune::BCRSMatrix<SmallMatrix2> OperatorType2; typedef Dune::BlockVector<SmallVector2> VectorType2; -typedef Dune::YaspGrid<2> GridType2; +typedef Dune::ALUSimplexGrid<2, 2> GridType2; +// typedef Dune::YaspGrid<2> GridType2; typedef GridType2::LeafGridView GridView2; typedef P1NodalBasis<GridView2, double> P1Basis2; @@ -41,7 +43,8 @@ typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3; typedef Dune::BCRSMatrix<SmallMatrix3> OperatorType3; typedef Dune::BlockVector<SmallVector3> VectorType3; -typedef Dune::YaspGrid<3> GridType3; +typedef Dune::ALUSimplexGrid<3, 3> GridType3; +// typedef Dune::YaspGrid<3> GridType3; typedef GridType3::LeafGridView GridView3; typedef P1NodalBasis<GridView3, double> P1Basis3; diff --git a/src/mysolver_tmpl.cc b/src/mysolver_tmpl.cc index 188501d4..a5b7b601 100644 --- a/src/mysolver_tmpl.cc +++ b/src/mysolver_tmpl.cc @@ -1,6 +1,7 @@ #include <dune/common/fmatrix.hh> #include <dune/common/fvector.hh> -#include <dune/grid/yaspgrid.hh> +//#include <dune/grid/yaspgrid.hh> +#include <dune/grid/alugrid.hh> #include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bvector.hh> @@ -16,7 +17,8 @@ typedef Dune::BCRSMatrix<SmallMatrix2> OperatorType2; typedef MyConvexProblem<OperatorType2, VectorType2> MyConvexProblemType2; typedef MyBlockProblem<MyConvexProblemType2> MyBlockProblemType2; -typedef Dune::YaspGrid<2> GridType2; +typedef Dune::ALUSimplexGrid<2, 2> GridType2; +// typedef Dune::YaspGrid<2> GridType2; template class MySolver<2, VectorType2, OperatorType2, GridType2, MyBlockProblemType2>; @@ -31,7 +33,8 @@ typedef Dune::BCRSMatrix<SmallMatrix3> OperatorType3; typedef MyConvexProblem<OperatorType3, VectorType3> MyConvexProblemType3; typedef MyBlockProblem<MyConvexProblemType3> MyBlockProblemType3; -typedef Dune::YaspGrid<3> GridType3; +typedef Dune::ALUSimplexGrid<3, 3> GridType3; +// typedef Dune::YaspGrid<3> GridType3; template class MySolver<3, VectorType3, OperatorType3, GridType3, MyBlockProblemType3>; diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index fbe1792b..15a0abf5 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -14,6 +14,10 @@ #error Python is required #endif +#if !HAVE_ALUGRID +#error ALUGRID is required +#endif + #include <exception> #include <iostream> @@ -32,7 +36,11 @@ #include <dune/common/parametertreeparser.hh> #include <dune/common/shared_ptr.hh> #include <dune/common/timer.hh> +#include <dune/grid/alugrid.hh> +#include <dune/grid/alugrid/2d/alu2dgridfactory.hh> +#include <dune/grid/alugrid/3d/alu3dgridfactory.hh> #include <dune/grid/common/mcmgmapper.hh> +#include <dune/grid/utility/structuredgridfactory.hh> #include <dune/grid/yaspgrid.hh> #include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bvector.hh> @@ -135,14 +143,14 @@ int main(int argc, char *argv[]) { verbose ? Solver::FULL : Solver::QUIET; // {{{ Set up grid - typedef Dune::YaspGrid<dim> GridType; - Dune::FieldVector<double, dim> const end_points( - 1); // nth dimension (zero-indexed) goes from 0 to end_points[n] - auto grid = Dune::make_shared<GridType>( - end_points, - Dune::FieldVector<int, dim>(1), // number of elements in each direction - Dune::FieldVector<bool, dim>(false), // non-periodic in each direction - 0); // zero overlap (whatever that is) + typedef Dune::ALUSimplexGrid<dim, dim> GridType; + Dune::FieldVector<typename GridType::ctype, dim> lowerLeft(0); + Dune::FieldVector<typename GridType::ctype, dim> upperRight(1); + Dune::array<unsigned int, dim> elements; + std::fill(elements.begin(), elements.end(), 1); + auto grid = Dune::StructuredGridFactory<GridType>::createSimplexGrid( + lowerLeft, upperRight, elements); + grid->globalRefine(refinements); size_t const finestSize = grid->size(grid->maxLevel(), dim); diff --git a/src/vtk_tmpl.cc b/src/vtk_tmpl.cc index 78679b94..182f51b6 100644 --- a/src/vtk_tmpl.cc +++ b/src/vtk_tmpl.cc @@ -2,7 +2,8 @@ #include <dune/common/fmatrix.hh> #include <dune/common/fvector.hh> -#include <dune/grid/yaspgrid.hh> +//#include <dune/grid/yaspgrid.hh> +#include <dune/grid/alugrid.hh> #include <dune/istl/bvector.hh> #include <dune/fufem/functionspacebases/p0basis.hh> @@ -15,7 +16,8 @@ typedef Dune::FieldVector<double, 2> SmallVector2; typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2; typedef Dune::BlockVector<SmallVector2> VectorType2; -typedef Dune::YaspGrid<2> GridType2; +typedef Dune::ALUSimplexGrid<2, 2> GridType2; +// typedef Dune::YaspGrid<2> GridType2; typedef GridType2::LeafGridView GridView2; typedef P1NodalBasis<GridView2, double> P1Basis2; typedef P0Basis<GridView2, double> P0Basis2; @@ -33,7 +35,8 @@ typedef Dune::FieldVector<double, 3> SmallVector3; typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3; typedef Dune::BlockVector<SmallVector3> VectorType3; -typedef Dune::YaspGrid<3> GridType3; +typedef Dune::ALUSimplexGrid<3, 3> GridType3; +// typedef Dune::YaspGrid<3> GridType3; typedef GridType3::LeafGridView GridView3; typedef P1NodalBasis<GridView3, double> P1Basis3; typedef P0Basis<GridView3, double> P0Basis3; -- GitLab