From 388d190989ae1a67c1d27f15f784094a08b0976d Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Fri, 17 Nov 2017 17:22:25 +0100 Subject: [PATCH] [gstat] Get the mapper from outside. Mappings have to be the same! --- .../spatialparams/gstatrandomfield.hh | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/dumux/material/spatialparams/gstatrandomfield.hh b/dumux/material/spatialparams/gstatrandomfield.hh index fbe0924f75..c6c51b8aea 100644 --- a/dumux/material/spatialparams/gstatrandomfield.hh +++ b/dumux/material/spatialparams/gstatrandomfield.hh @@ -71,14 +71,11 @@ public: * * \param gridView the used gridView */ - GstatRandomField(const GridView& gridView) - : gridView_(gridView), -#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) - elementMapper_(gridView, Dune::mcmgElementLayout()), -#else - elementMapper_(gridView), -#endif - data_(gridView.size(0)) {} + GstatRandomField(const GridView& gridView, const ElementMapper& elementMapper) + : gridView_(gridView) + , elementMapper_(elementMapper) + , data_(gridView.size(0)) + {} /*! * \brief Creates a new field with random variables, if desired. @@ -171,11 +168,17 @@ public: } //! \brief Return an entry of the data vector - Scalar data(const Element& e) + Scalar data(const Element& e) const { return data_[elementMapper_.index(e)]; } + //! \brief Return the data vector for analysis or external vtk output + const DataVector& data() const + { + return data_; + } + //! \brief Write the data to a vtk file void writeVtk(const std::string& vtkName, const std::string& dataName = "data") const @@ -195,12 +198,12 @@ public: } private: - GridView gridView_; - ElementMapper elementMapper_; + const GridView gridView_; + const ElementMapper& elementMapper_; DataVector data_; FieldType fieldType_; }; -} +} // end namespace Dumux #endif -- GitLab