From b6d4dfebf0cbfd02aad8e3d5dc96af5f5a31393d Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Mon, 4 Sep 2017 10:34:17 +0200 Subject: [PATCH] [refelement] Get copies as references are deprecated upstream --- dune/foamgrid/dgffoam.hh | 3 +- dune/foamgrid/foamgrid/foamgrid.cc | 8 ++--- dune/foamgrid/foamgrid/foamgridfactory.hh | 3 +- .../foamgrid/foamgridintersections.hh | 30 +++++++------------ dune/foamgrid/test/growth-test-2d.cc | 3 +- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/dune/foamgrid/dgffoam.hh b/dune/foamgrid/dgffoam.hh index 529f0b4..a1d8b7c 100644 --- a/dune/foamgrid/dgffoam.hh +++ b/dune/foamgrid/dgffoam.hh @@ -172,8 +172,7 @@ namespace Dune const auto& entity = intersection.inside(); const int face = intersection.indexInInside(); - const ReferenceElement< double, dimension > &refElem - = ReferenceElements< double, dimension >::general( entity.type() ); + const auto refElem = ReferenceElements< double, dimension >::general( entity.type() ); int corners = refElem.size( face, 1, dimension ); std::vector< unsigned int > bound( corners ); for( int i = 0; i < corners; ++i ) diff --git a/dune/foamgrid/foamgrid/foamgrid.cc b/dune/foamgrid/foamgrid/foamgrid.cc index 47d324c..c72e1c6 100644 --- a/dune/foamgrid/foamgrid/foamgrid.cc +++ b/dune/foamgrid/foamgrid/foamgrid.cc @@ -541,7 +541,7 @@ void Dune::FoamGrid<dimgrid, dimworld>::refineSimplexElement(FoamGridEntityImp<2 std::array<FoamGridEntityImp<1, dimgrid, dimworld>*, 9> nextLevelFacets; std::size_t facetIndex=0; #ifndef NDEBUG - const auto& refElement = Dune::ReferenceElements<double, dimgrid>::general(element.type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(element.type()); #endif // I am just to dumb for a general facet to vertice mapping. @@ -1167,8 +1167,7 @@ bool Dune::FoamGrid<dimgrid, dimworld>::grow() if(fIt->elements_.size() > 0) { auto element = fIt->elements_[0]; - const Dune::ReferenceElement<double,dimgrid>& refElement - = Dune::ReferenceElements<double,dimgrid>::general(element->type()); + const auto refElement = ReferenceElements<double,dimgrid>::general(element->type()); // obtain the local index of this facet std::size_t localFacetIndex = 0; @@ -1193,8 +1192,7 @@ bool Dune::FoamGrid<dimgrid, dimworld>::grow() // loop over all elements on this level for(auto eIt = std::get<dimgrid>(entityImps_[level]).begin(); eIt != std::get<dimgrid>(entityImps_[level]).end(); ++eIt) { - const Dune::ReferenceElement<double,dimgrid>& refElement - = Dune::ReferenceElements<double,dimgrid>::general(eIt->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(eIt->type()); // loop over all facets of this element for (std::size_t fIdx = 0; fIdx < eIt->facet_.size(); ++fIdx) { diff --git a/dune/foamgrid/foamgrid/foamgridfactory.hh b/dune/foamgrid/foamgrid/foamgridfactory.hh index 6cef7c8..5554895 100644 --- a/dune/foamgrid/foamgrid/foamgridfactory.hh +++ b/dune/foamgrid/foamgrid/foamgridfactory.hh @@ -324,8 +324,7 @@ template <int dimworld> FoamGridEntityImp<dimgrid, dimgrid, dimworld>* element = &(*eIt); - const Dune::ReferenceElement<double,dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(eIt->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(eIt->type()); // Loop over all edges of this element for (size_t i=0; i<element->facet_.size(); ++i) { diff --git a/dune/foamgrid/foamgrid/foamgridintersections.hh b/dune/foamgrid/foamgrid/foamgridintersections.hh index 77a8cb7..f385696 100644 --- a/dune/foamgrid/foamgrid/foamgridintersections.hh +++ b/dune/foamgrid/foamgrid/foamgridintersections.hh @@ -132,8 +132,7 @@ public: assert(center_->type().isTriangle() || center_->type().isLine()); // Compute vertices - const Dune::ReferenceElement<double, dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(center_->type()); // facet vertices (vertex in 1d, edge in 2d) int v0 = refElement.subEntity(facetIndex_, 1, 0, dimgrid); @@ -193,8 +192,7 @@ public: if(dimgrid == 2) { - const Dune::ReferenceElement<double, dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(center_->type()); // facet vertices int v0 = refElement.subEntity(facetIndex_, 1, 0, dimgrid); @@ -301,8 +299,7 @@ public: std::vector<FieldVector<double, dimgrid> > coordinates(dimgrid); // Get reference element - const Dune::ReferenceElement<double, dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(this->center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(this->center_->type()); for (int idx = 0; idx < dimgrid; ++idx) coordinates[idx] = refElement.position(refElement.subEntity(this->facetIndex_, 1, idx, dimgrid), dimgrid); @@ -318,8 +315,7 @@ public: LocalGeometry geometryInOutside (std::size_t neighborIndex = 0) const { // Get two vertices of the intersection - const Dune::ReferenceElement<double,dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(this->center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(this->center_->type()); std::array<FoamGridEntityImp<0, dimgrid, dimworld>*, dimgrid> vtx; @@ -330,8 +326,7 @@ public: // Find the intersection vertices in local numbering of the outside element // That way we get the local orientation correctly. - const Dune::ReferenceElement<double, dimgrid>& refElementOther - = Dune::ReferenceElements<double, dimgrid>::general((*this->neighbor_)->type()); + const auto refElementOther = ReferenceElements<double, dimgrid>::general((*this->neighbor_)->type()); for (std::size_t j=0; j<dimgrid; j++) for (int i=0; i<refElementOther.size(dimgrid); i++) @@ -350,8 +345,7 @@ public: std::vector<FieldVector<double, dimworld> > coordinates(dimgrid); // Get two vertices of the intersection - const Dune::ReferenceElement<double, dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(this->center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(this->center_->type()); for (std::size_t idx = 0; idx < dimgrid; ++idx) coordinates[idx] = this->center_->vertex_[refElement.subEntity(this->facetIndex_, 1, idx, dimgrid)]->pos_; @@ -470,8 +464,7 @@ public: std::vector<FieldVector<double, dimgrid> > coordinates(dimgrid); // Get reference element - const Dune::ReferenceElement<double, dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(this->center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(this->center_->type()); for (std::size_t idx = 0; idx < dimgrid; ++idx) coordinates[idx] = refElement.position(refElement.subEntity(this->facetIndex_, 1, idx, dimgrid), dimgrid); @@ -487,8 +480,7 @@ public: LocalGeometry geometryInOutside (std::size_t neighborIndex = 0) const { // Get two vertices of the intersection - const Dune::ReferenceElement<double,dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(this->center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(this->center_->type()); std::array<FoamGridEntityImp<0, dimgrid, dimworld>*, dimgrid> vtx; @@ -499,8 +491,7 @@ public: // Find the intersection vertices in local numbering of the outside element // That way we get the local orientation correctly. - const Dune::ReferenceElement<double, dimgrid>& refElementOther - = Dune::ReferenceElements<double, dimgrid>::general((*this->neighbor_)->type()); + const auto refElementOther = ReferenceElements<double, dimgrid>::general((*this->neighbor_)->type()); for (std::size_t j=0; j< dimgrid; j++) for (int i=0; i<refElementOther.size(dimgrid); i++) @@ -519,8 +510,7 @@ public: std::vector<FieldVector<double, dimworld> > coordinates(dimgrid); // Get two vertices of the intersection - const Dune::ReferenceElement<double, dimgrid>& refElement - = Dune::ReferenceElements<double, dimgrid>::general(this->center_->type()); + const auto refElement = ReferenceElements<double, dimgrid>::general(this->center_->type()); for (std::size_t idx = 0; idx < dimgrid; ++idx) coordinates[idx] = this->center_->vertex_[refElement.subEntity(this->facetIndex_, 1, idx, dimgrid)]->pos_; diff --git a/dune/foamgrid/test/growth-test-2d.cc b/dune/foamgrid/test/growth-test-2d.cc index 4e08510..5e91ec3 100644 --- a/dune/foamgrid/test/growth-test-2d.cc +++ b/dune/foamgrid/test/growth-test-2d.cc @@ -27,8 +27,7 @@ void checkGridElementGrowth(Grid& grid) for (const auto& intersection : intersections(grid.leafGridView(), element)) if(intersection.boundary() && intersection.geometry().center()[1] > 0.5) { - const Dune::ReferenceElement<double,dim>& refElement - = Dune::ReferenceElements<double,dim>::general(element.type()); + const auto refElement = ReferenceElements<double,dim>::general(element.type()); auto&& v0 = element.template subEntity<dim>(refElement.subEntity(intersection.indexInInside(), dim-1, 0, dim)); auto&& v1 = element.template subEntity<dim>(refElement.subEntity(intersection.indexInInside(), dim-1, 1, dim)); -- GitLab