diff --git a/dune/gfe/cosseratvtkwriter.hh b/dune/gfe/cosseratvtkwriter.hh index 4b61207d8cfa3e425e535fc79217d8194a74af99..f693a3c7f010765010a4ee5de7d5179aa4a1bda8 100644 --- a/dune/gfe/cosseratvtkwriter.hh +++ b/dune/gfe/cosseratvtkwriter.hh @@ -180,33 +180,16 @@ public: } std::vector<int> connectivity(connectivitySize); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = basis.localIndexSet(); -#endif size_t i=0; for (const auto& element : elements(gridView, Dune::Partitions::interior)) { localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif if (element.type().isQuadrilateral()) { if (vtkOrder==2) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(2); - connectivity[i++] = localIndexSet.index(8); - connectivity[i++] = localIndexSet.index(6); - - connectivity[i++] = localIndexSet.index(1); - connectivity[i++] = localIndexSet.index(5); - connectivity[i++] = localIndexSet.index(7); - connectivity[i++] = localIndexSet.index(3); -#else connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(2); connectivity[i++] = localView.index(8); @@ -216,68 +199,37 @@ public: connectivity[i++] = localView.index(5); connectivity[i++] = localView.index(7); connectivity[i++] = localView.index(3); -#endif } else // first order { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(1); - connectivity[i++] = localIndexSet.index(3); - connectivity[i++] = localIndexSet.index(2); -#else connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(1); connectivity[i++] = localView.index(3); connectivity[i++] = localView.index(2); -#endif } } if (element.type().isTriangle()) { if (vtkOrder==2) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(2); - connectivity[i++] = localIndexSet.index(5); - connectivity[i++] = localIndexSet.index(1); - connectivity[i++] = localIndexSet.index(4); - connectivity[i++] = localIndexSet.index(3); -#else connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(2); connectivity[i++] = localView.index(5); connectivity[i++] = localView.index(1); connectivity[i++] = localView.index(4); connectivity[i++] = localView.index(3); -#endif } else // first order { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(1); - connectivity[i++] = localIndexSet.index(2); -#else connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(1); connectivity[i++] = localView.index(2); -#endif } } if (element.type().isHexahedron()) { if (vtkOrder==2) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(2); - connectivity[i++] = localIndexSet.index(5); - connectivity[i++] = localIndexSet.index(1); - connectivity[i++] = localIndexSet.index(4); - connectivity[i++] = localIndexSet.index(3); -#else // Corner dofs connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(2); @@ -304,20 +256,9 @@ public: connectivity[i++] = localView.index(11); connectivity[i++] = localView.index(17); connectivity[i++] = localView.index(15); -#endif } else // first order { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(1); - connectivity[i++] = localIndexSet.index(3); - connectivity[i++] = localIndexSet.index(2); - connectivity[i++] = localIndexSet.index(4); - connectivity[i++] = localIndexSet.index(5); - connectivity[i++] = localIndexSet.index(7); - connectivity[i++] = localIndexSet.index(6); -#else connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(1); connectivity[i++] = localView.index(3); @@ -326,7 +267,6 @@ public: connectivity[i++] = localView.index(5); connectivity[i++] = localView.index(7); connectivity[i++] = localView.index(6); -#endif } } @@ -334,25 +274,14 @@ public: { if (vtkOrder==2) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(2); - connectivity[i++] = localIndexSet.index(1); -#else connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(2); connectivity[i++] = localView.index(1); -#endif } else // first order { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - connectivity[i++] = localIndexSet.index(0); - connectivity[i++] = localIndexSet.index(1); -#else connectivity[i++] = localView.index(0); connectivity[i++] = localView.index(1); -#endif } } } @@ -518,30 +447,14 @@ public: outFile << " <Cells>" << std::endl; outFile << " <DataArray type=\"Int32\" Name=\"connectivity\" NumberOfComponents=\"1\" format=\"ascii\">" << std::endl; -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = p2DeformationBasis.localIndexSet(); -#endif + for (const auto& element : elements(gridView, Dune::Partitions::interior)) { localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif outFile << " "; if (element.type().isQuadrilateral()) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - outFile << localIndexSet.index(0) << " "; - outFile << localIndexSet.index(2) << " "; - outFile << localIndexSet.index(8) << " "; - outFile << localIndexSet.index(6) << " "; - - outFile << localIndexSet.index(1) << " "; - outFile << localIndexSet.index(5) << " "; - outFile << localIndexSet.index(7) << " "; - outFile << localIndexSet.index(3) << " "; -#else outFile << localView.index(0) << " "; outFile << localView.index(2) << " "; outFile << localView.index(8) << " "; @@ -551,7 +464,7 @@ public: outFile << localView.index(5) << " "; outFile << localView.index(7) << " "; outFile << localView.index(3) << " "; -#endif + outFile << std::endl; } } diff --git a/dune/gfe/embeddedglobalgfefunction.hh b/dune/gfe/embeddedglobalgfefunction.hh index 9dfd85040d88406320fbff638e865f15dd89a5e8..9e48b78d7df4d13e06f6c2d8c8016be89cf74e82 100644 --- a/dune/gfe/embeddedglobalgfefunction.hh +++ b/dune/gfe/embeddedglobalgfefunction.hh @@ -71,24 +71,13 @@ public: { auto localView = basis_.localView(); localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = basis_.localIndexSet(); - localIndexSet.bind(localView); - - auto numOfBaseFct = localIndexSet.size(); -#else auto numOfBaseFct = localView.size(); -#endif // Extract local coefficients std::vector<TargetSpace> localCoeff(numOfBaseFct); for (size_t i=0; i<numOfBaseFct; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localCoeff[i] = coefficients_[localIndexSet.index(i)]; -#else localCoeff[i] = coefficients_[localView.index(i)]; -#endif // create local gfe function LocalInterpolationRule localInterpolationRule(localView.tree().finiteElement(),localCoeff); @@ -108,25 +97,13 @@ public: { auto localView = basis_.localView(); localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = basis_.localIndexSet(); - localIndexSet.bind(localView); - - int numOfBaseFct = localIndexSet.size(); -#else auto numOfBaseFct = localView.size(); -#endif - // Extract local coefficients std::vector<TargetSpace> localCoeff(numOfBaseFct); for (decltype(numOfBaseFct) i=0; i<numOfBaseFct; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localCoeff[i] = coefficients_[localIndexSet.index(i)]; -#else localCoeff[i] = coefficients_[localView.index(i)]; -#endif // create local gfe function LocalInterpolationRule localInterpolationRule(localView.tree().finiteElement(),localCoeff); diff --git a/dune/gfe/geodesicfeassembler.hh b/dune/gfe/geodesicfeassembler.hh index f3332931efd552bf10bbaa923ea57001aab050f7..c6958e50a890e5a995849d64dbe119a447750e6f 100644 --- a/dune/gfe/geodesicfeassembler.hh +++ b/dune/gfe/geodesicfeassembler.hh @@ -75,17 +75,11 @@ getNeighborsPerVertex(Dune::MatrixIndexSet& nb) const // A view on the FE basis on a single element auto localView = basis_.localView(); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = basis_.localIndexSet(); -#endif for (const auto& element : elements(basis_.gridView(), Dune::Partitions::interior)) { // Bind the local FE basis view to the current element localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif const auto& lfe = localView.tree().finiteElement(); @@ -93,13 +87,8 @@ getNeighborsPerVertex(Dune::MatrixIndexSet& nb) const for (size_t j=0; j<lfe.size(); j++) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto iIdx = localIndexSet.index(i)[0]; - auto jIdx = localIndexSet.index(j)[0]; -#else auto iIdx = localView.index(i); auto jIdx = localView.index(j); -#endif nb.add(iIdx, jIdx); @@ -133,16 +122,10 @@ assembleGradientAndHessian(const std::vector<TargetSpace>& sol, // A view on the FE basis on a single element auto localView = basis_.localView(); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = basis_.localIndexSet(); -#endif for (const auto& element : elements(basis_.gridView(), Dune::Partitions::interior)) { localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif const int numOfBaseFct = localView.tree().size(); @@ -150,11 +133,7 @@ assembleGradientAndHessian(const std::vector<TargetSpace>& sol, std::vector<TargetSpace> localSolution(numOfBaseFct); for (int i=0; i<numOfBaseFct; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localSolution[i] = sol[localIndexSet.index(i)[0]]; -#else localSolution[i] = sol[localView.index(i)]; -#endif std::vector<Dune::FieldVector<double,blocksize> > localGradient(numOfBaseFct); @@ -164,19 +143,11 @@ assembleGradientAndHessian(const std::vector<TargetSpace>& sol, // Add element matrix to global stiffness matrix for(int i=0; i<numOfBaseFct; i++) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto row = localIndexSet.index(i)[0]; -#else auto row = localView.index(i); -#endif for (int j=0; j<numOfBaseFct; j++ ) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto col = localIndexSet.index(j)[0]; -#else auto col = localView.index(j); -#endif hessian[row][col] += localStiffness_->A_[i][j]; } @@ -184,11 +155,7 @@ assembleGradientAndHessian(const std::vector<TargetSpace>& sol, // Add local gradient to global gradient for (int i=0; i<numOfBaseFct; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - gradient[localIndexSet.index(i)[0]] += localGradient[i]; -#else gradient[localView.index(i)] += localGradient[i]; -#endif } @@ -207,17 +174,11 @@ assembleGradient(const std::vector<TargetSpace>& sol, // A view on the FE basis on a single element auto localView = basis_.localView(); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = basis_.localIndexSet(); -#endif // Loop over all elements for (const auto& element : elements(basis_.gridView(), Dune::Partitions::interior)) { localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif // A 1d grid has two vertices const auto nDofs = localView.tree().size(); @@ -226,11 +187,7 @@ assembleGradient(const std::vector<TargetSpace>& sol, std::vector<TargetSpace> localSolution(nDofs); for (size_t i=0; i<nDofs; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localSolution[i] = sol[localIndexSet.index(i)[0]]; -#else localSolution[i] = sol[localView.index(i)]; -#endif // Assemble local gradient std::vector<Dune::FieldVector<double,blocksize> > localGradient(nDofs); @@ -239,11 +196,7 @@ assembleGradient(const std::vector<TargetSpace>& sol, // Add to global gradient for (size_t i=0; i<nDofs; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - grad[localIndexSet.index(i)[0]] += localGradient[i]; -#else grad[localView.index(i)[0]] += localGradient[i]; -#endif } } @@ -260,17 +213,11 @@ computeEnergy(const std::vector<TargetSpace>& sol) const // A view on the FE basis on a single element auto localView = basis_.localView(); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = basis_.localIndexSet(); -#endif // Loop over all elements for (const auto& element : elements(basis_.gridView(), Dune::Partitions::interior)) { localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif // Number of degrees of freedom on this element size_t nDofs = localView.tree().size(); @@ -278,11 +225,7 @@ computeEnergy(const std::vector<TargetSpace>& sol) const std::vector<TargetSpace> localSolution(nDofs); for (size_t i=0; i<nDofs; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localSolution[i] = sol[localIndexSet.index(i)[0]]; -#else localSolution[i] = sol[localView.index(i)[0]]; -#endif energy += localStiffness_->energy(localView, localSolution); diff --git a/dune/gfe/parallel/globalp2mapper.hh b/dune/gfe/parallel/globalp2mapper.hh index 1bb6a3ede3732e9e59d3c1e50b1cc0b586ebe1f1..6bfb74428b26bf89f681210a4c65178175a3cac2 100644 --- a/dune/gfe/parallel/globalp2mapper.hh +++ b/dune/gfe/parallel/globalp2mapper.hh @@ -11,9 +11,6 @@ /** include base class functionality for the communication interface */ #include <dune/grid/common/datahandleif.hh> -// Include Dune header files -#include <dune/common/version.hh> - #include <dune/functions/functionspacebases/lagrangebasis.hh> namespace Dune { @@ -44,33 +41,19 @@ namespace Dune { size_ = globalVertexIndex.size(2) + globalEdgeIndex.size(1) + globalElementIndex.size(0); auto localView = p2Mapper_.localView(); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = p2Mapper_.localIndexSet(); -#endif // Determine for (const auto& element : elements(gridView)) { localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif // Loop over all local degrees of freedom -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - for (size_t i=0; i<localIndexSet.size(); i++) -#else for (size_t i=0; i<localView.size(); i++) -#endif { int codim = localView.tree().finiteElement().localCoefficients().localKey(i).codim(); int entity = localView.tree().finiteElement().localCoefficients().localKey(i).subEntity(); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - int localIndex = localIndexSet.index(i); -#else auto localIndex = localView.index(i); -#endif int globalIndex; switch (codim) { @@ -116,28 +99,16 @@ namespace Dune { { auto localView = p2Mapper_.localView(); localView.bind(entity); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = p2Mapper_.localIndexSet(); - localIndexSet.bind(localView); -#endif Index localIndex; bool dofFound = false; -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - for (size_t i=0; i<localIndexSet.size(); i++) -#else for (size_t i=0; i<localView.size(); i++) -#endif { if (localView.tree().finiteElement().localCoefficients().localKey(i).subEntity() == subEntity and localView.tree().finiteElement().localCoefficients().localKey(i).codim() == codim) { dofFound = true; -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndex = localIndexSet.index(i); -#else localIndex = localView.index(i); -#endif break; } } diff --git a/dune/gfe/parallel/p2mapper.hh b/dune/gfe/parallel/p2mapper.hh index 3f9384d3e290c001006b964790c47ebd4ef303c3..aa1b62cc7465d11f21e2f6a689724d965c13fff1 100644 --- a/dune/gfe/parallel/p2mapper.hh +++ b/dune/gfe/parallel/p2mapper.hh @@ -32,25 +32,13 @@ public: { auto localView = p2Basis_.localView(); localView.bind(entity); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = p2Basis_.localIndexSet(); - localIndexSet.bind(localView); -#endif -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - for (size_t i=0; i<localIndexSet.size(); i++) -#else for (size_t i=0; i<localView.size(); i++) -#endif { if (localView.tree().finiteElement().localCoefficients().localKey(i).subEntity() == subEntity and localView.tree().finiteElement().localCoefficients().localKey(i).codim() == codim) { -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - result = localIndexSet.index(i)[0]; -#else result = localView.index(i); -#endif return true; } } diff --git a/dune/gfe/rodassembler.cc b/dune/gfe/rodassembler.cc index 4d5c105c89993c14ed88f96215757dc64793dcee..797c006e8e167509ee3b61731ecfbbdd6e9b8da8 100644 --- a/dune/gfe/rodassembler.cc +++ b/dune/gfe/rodassembler.cc @@ -26,17 +26,11 @@ assembleGradient(const std::vector<RigidBodyMotion<double,3> >& sol, // A view on the FE basis on a single element auto localView = this->basis_.localView(); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = this->basis_.localIndexSet(); -#endif // Loop over all elements for (const auto& element : Dune::elements(this->basis_.gridView())) { localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localIndexSet.bind(localView); -#endif // A 1d grid has two vertices static const int nDofs = 2; @@ -45,11 +39,7 @@ assembleGradient(const std::vector<RigidBodyMotion<double,3> >& sol, std::vector<RigidBodyMotion<double,3> > localSolution(nDofs); for (int i=0; i<nDofs; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localSolution[i] = sol[localIndexSet.index(i)[0]]; -#else localSolution[i] = sol[localView.index(i)]; -#endif // Assemble local gradient std::vector<FieldVector<double,blocksize> > localGradient(nDofs); @@ -60,11 +50,7 @@ assembleGradient(const std::vector<RigidBodyMotion<double,3> >& sol, // Add to global gradient for (int i=0; i<nDofs; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - grad[localIndexSet.index(i)[0]] += localGradient[i]; -#else grad[localView.index(i)] += localGradient[i]; -#endif } diff --git a/test/adolctest.cc b/test/adolctest.cc index f6499dfd8accf9914addd182c69edccd235c9775..bb04d8fa380a0c094b7f6510b95e04a471a9def6 100644 --- a/test/adolctest.cc +++ b/test/adolctest.cc @@ -515,10 +515,6 @@ int main (int argc, char *argv[]) try auto localView = feBasis.localView(); localView.bind(element); -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - auto localIndexSet = feBasis.localIndexSet(); - localIndexSet.bind(localView); -#endif const int numOfBaseFct = localView.size(); @@ -526,11 +522,7 @@ int main (int argc, char *argv[]) try std::vector<TargetSpace> localSolution(numOfBaseFct); for (int i=0; i<numOfBaseFct; i++) -#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) - localSolution[i] = x[localIndexSet.index(i)]; -#else localSolution[i] = x[localView.index(i)]; -#endif std::vector<Dune::FieldVector<double,embeddedBlocksize> > localADGradient(numOfBaseFct); std::vector<Dune::FieldVector<double,embeddedBlocksize> > localADVMGradient(numOfBaseFct); // VM: vector-mode