diff --git a/dune/fufem/assemblers/localassemblers/subgridh1functionalassembler.hh b/dune/fufem/assemblers/localassemblers/subgridh1functionalassembler.hh index 2b79f892d11102b8179ee21fe5fbfbe00106a26a..f1996f596e8d0938f517e6786ab4c1202a60ff57 100644 --- a/dune/fufem/assemblers/localassemblers/subgridh1functionalassembler.hh +++ b/dune/fufem/assemblers/localassemblers/subgridh1functionalassembler.hh @@ -76,7 +76,7 @@ class SubgridH1FunctionalAssembler : return; } - typedef typename GridType::template Codim<0>::Geometry::Jacobian GeoJacobianInvTransposed; + typedef typename GridType::template Codim<0>::Geometry::JacobianInverseTransposed GeoJacobianInvTransposed; typedef typename TrialLocalFE::Traits::LocalBasisType::Traits::JacobianType LocalBasisJacobianType; // Make sure we got suitable shape functions @@ -95,9 +95,9 @@ class SubgridH1FunctionalAssembler : std::vector<LocalBasisJacobianType> referenceGradients(tFE.localBasis().size()); std::vector<GlobalCoordinate> gradients(tFE.localBasis().size()); - if (hostelement->isLeaf()) + if (hostelement.isLeaf()) { - bool hostGFIsRefined = hostBasisGridFunctionInfo_ and hostBasisGridFunctionInfo_->isRefinedLocalFiniteElement(*hostelement); + bool hostGFIsRefined = hostBasisGridFunctionInfo_ and hostBasisGridFunctionInfo_->isRefinedLocalFiniteElement(hostelement); // get quadrature rule const Dune::template QuadratureRule<double, dim>& quad = QuadratureRuleCache<double, dim>::rule(element.type(), order_, (trialSpaceIsRefined or hostGFIsRefined) ); @@ -123,7 +123,7 @@ class SubgridH1FunctionalAssembler : // compute values of function FRangeType f_pos; - fAsHostGridFunction_->evaluateLocal(*hostelement, quadPos, f_pos); + fAsHostGridFunction_->evaluateLocal(hostelement, quadPos, f_pos); // and vector entries for (size_t i=0; i<gradients.size(); ++i) @@ -137,8 +137,8 @@ class SubgridH1FunctionalAssembler : else // corresponding hostgrid element is not in hostgrid leaf { typename GridType::HostGridType& hostgrid = grid_.getHostGrid(); - typename GridType::HostGridType::HierarchicIterator lastDescendant = hostelement->hend(hostgrid.maxLevel()); - typename GridType::HostGridType::HierarchicIterator descElement = hostelement->hbegin(hostgrid.maxLevel()); + typename GridType::HostGridType::HierarchicIterator lastDescendant = hostelement.hend(hostgrid.maxLevel()); + typename GridType::HostGridType::HierarchicIterator descElement = hostelement.hbegin(hostgrid.maxLevel()); for (; descElement!=lastDescendant; ++descElement) { diff --git a/dune/fufem/test/common.hh b/dune/fufem/test/common.hh index 78cdf7d8687924bb12ca455984af5136788b4933..37fb98f3f28faa8ceffb9cfc25c2445f512b1d70 100644 --- a/dune/fufem/test/common.hh +++ b/dune/fufem/test/common.hh @@ -381,7 +381,7 @@ bool checkWithSubGrid(TestSuite& suite, int uniformRefinements, int localRefinem grid.createEnd(); /* make sure these requirements are met */ - passed = passed and grid.size(0)!=hostgrid.size(0); + assert(grid.size(0)!=hostgrid.size(0)); std::cout << "Running test on " << name << " with " << grid.size(0) << " elements." << std::endl; @@ -414,8 +414,8 @@ bool checkWithStandardAdaptiveGrids(TestSuite& suite) passed = passed and checkWithAdaptiveGrid<Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming> >(suite, 3, 3); passed = passed and checkWithAdaptiveGrid<Dune::ALUGrid<3, 3, Dune::simplex, Dune::nonconforming> >(suite, 1, 2); #if HAVE_DUNE_SUBGRID - passed = passed and checkWithSubGrid<Dune::ALUGrid<2,2, Dune::simplex, Dune::nonconforming> >(suite, 3, 3); - passed = passed and checkWithSubGrid<Dune::ALUGrid<3,3, Dune::simplex, Dune::nonconforming> >(suite, 1, 2); + passed = passed and checkWithSubGrid<Dune::ALUGrid<2,2, Dune::simplex, Dune::nonconforming> >(suite, 3, 3, "SubGrid< 2,ALUGrid<...> >"); + passed = passed and checkWithSubGrid<Dune::ALUGrid<3,3, Dune::simplex, Dune::nonconforming> >(suite, 1, 2, "SubGrid< 3,ALUGrid<...> >"); #endif #endif diff --git a/dune/fufem/test/subgridxyfunctionalassemblertest.cc b/dune/fufem/test/subgridxyfunctionalassemblertest.cc index e72906da161858e8b94c609595475b8411faa77d..2d5650ad8c9bc7e9a71641c5262070b3545761bd 100644 --- a/dune/fufem/test/subgridxyfunctionalassemblertest.cc +++ b/dune/fufem/test/subgridxyfunctionalassemblertest.cc @@ -45,8 +45,8 @@ void setupSubgridToHostgridTransfer(TransferOperatorType& matrix, const SubGridB { typedef typename SubGridBasis::GridView::Grid SubGridType; typedef typename SubGridType::HostGridType HostGridType; - typedef typename HostGridType::LeafGridView::template Codim<0>::Entity HostElement; - typedef typename SubGridType::LeafGridView::template Codim<0>::Iterator ElementIterator; + //typedef typename HostGridType::LeafGridView::template Codim<0>::Entity HostElement; + //typedef typename SubGridType::LeafGridView::template Codim<0>::Iterator ElementIterator; typedef typename HostGridType::template Codim<0>::Entity::HierarchicIterator HierarchicIterator; typedef std::map<int, double> LinearCombination; typedef std::vector<LinearCombination> BasisTransformation; @@ -57,7 +57,7 @@ void setupSubgridToHostgridTransfer(TransferOperatorType& matrix, const SubGridB static const int dim = SubGridType::dimension; const SubGridType& subgrid=subgridbasis.getGridView().grid(); - HostGridType& hostgrid=subgrid.getHostGrid(); + // HostGridType& hostgrid=subgrid.getHostGrid(); BasisTransformation transformation(hostgridbasis.size()); @@ -65,20 +65,17 @@ void setupSubgridToHostgridTransfer(TransferOperatorType& matrix, const SubGridB Dune::BitSetVector<1> processed(hostgridbasis.size(),false); // loop over all elements of current level - ElementIterator cIt = subgrid.leafGridView().template begin<0>(); - ElementIterator cEnd = subgrid.leafGridView().template end<0>(); - for(; cIt!=cEnd; ++cIt) + for(const auto& c : elements(subgrid.leafGridView())) { - HostElement hostElement = *subgrid.template getHostEntity<0>(*cIt); - - const CLFE& coarseFE = subgridbasis.getLocalFiniteElement(*cIt); + const auto& hostElement = subgrid.template getHostEntity<0>(c); + const CLFE& coarseFE = subgridbasis.getLocalFiniteElement(c); // if element is leaf the transfer to the next level is locally the identity if (hostElement.isLeaf()) { for (size_t j=0; j<coarseFE.localBasis().size(); ++j) { - int coarseIndex = subgridbasis.index(*cIt, j); + int coarseIndex = subgridbasis.index(c, j); int fineIndex = hostgridbasis.index(hostElement, j); // visit each host node only once @@ -91,12 +88,12 @@ void setupSubgridToHostgridTransfer(TransferOperatorType& matrix, const SubGridB } else { - int level = cIt->level(); + int level = c.level(); // store coarse node indices since we need them often std::vector<int> coarseIndex(coarseFE.localBasis().size()); for (size_t i=0; i<coarseFE.localBasis().size(); ++i) - coarseIndex[i] = subgridbasis.index(*cIt, i); + coarseIndex[i] = subgridbasis.index(c, i); std::vector<CFERange> valuesAtPosition(coarseFE.localBasis().size()); @@ -201,8 +198,8 @@ struct SubgridL2FunctionalAssemblerTestSuite static const int block_size=2; - typedef typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename GridType::LeafGridView>> NCBasis; - typedef typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename HostGridType::LeafGridView>> NCHostBasis; + typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename GridType::LeafGridView>> NCBasis; + typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename HostGridType::LeafGridView>> NCHostBasis; typedef ConformingBasis<NCBasis> Basis; typedef ConformingBasis<NCHostBasis> HostBasis; typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,block_size,block_size> > Transfer; @@ -296,8 +293,8 @@ struct SubgridH1FunctionalAssemblerTestSuite static const int block_size=1; - typedef typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename GridType::LeafGridView>> NCBasis; - typedef typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename HostGridType::LeafGridView>> NCHostBasis; + typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename GridType::LeafGridView>> NCBasis; + typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename HostGridType::LeafGridView>> NCHostBasis; typedef ConformingBasis<NCBasis> Basis; typedef ConformingBasis<NCHostBasis> HostBasis; typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,block_size,block_size> > Transfer; diff --git a/dune/fufem/test/sumfunctiontest.cc b/dune/fufem/test/sumfunctiontest.cc index 7ec69450121c60d4ed798bff5a4d575358d95633..f10f9e988ede3ab5bac0edbbb882505db488651d 100644 --- a/dune/fufem/test/sumfunctiontest.cc +++ b/dune/fufem/test/sumfunctiontest.cc @@ -221,7 +221,7 @@ int main(int argc, char** argv) if (not passed) std::cout << "SumGridFunction test failed on locally refined UGGrid<2>." << std::endl; #if HAVE_DUNE_SUBGRID - passed = passed and checkWithSubGrid<Dune::UGGrid<2> >(sgftests, 3, 3); + passed = passed and checkWithSubGrid<Dune::UGGrid<2> >(sgftests, 3, 3, "SubGrid< 2,UGGrid<2> >"); if (not passed) std::cout << "SumGridFunction test failed on locally refined SubGrid< 2,UGGrid<2> >." << std::endl; #endif @@ -232,7 +232,7 @@ int main(int argc, char** argv) if (not passed) std::cout << "SumGridFunction test failed on locally refined ALUGrid<2,2,simplex,nonconforming>." << std::endl; #if HAVE_DUNE_SUBGRID - passed = passed and checkWithSubGrid<Dune::ALUGrid<2,2, Dune::simplex, Dune::nonconforming> >(sgftests, 3, 3); + passed = passed and checkWithSubGrid<Dune::ALUGrid<2,2, Dune::simplex, Dune::nonconforming> >(sgftests, 3, 3, "SubGrid< 3,ALUGrid<...> >"); if (not passed) std::cout << "SumGridFunction test failed on locally refined SubGrid< 2,ALUGrid<2,2,simplex,nonconforming> >." << std::endl; #endif