Skip to content
Snippets Groups Projects
Commit 388d1909 authored by Timo Koch's avatar Timo Koch
Browse files

[gstat] Get the mapper from outside. Mappings have to be the same!

parent b98b66c7
No related branches found
No related tags found
Loading
...@@ -71,14 +71,11 @@ public: ...@@ -71,14 +71,11 @@ public:
* *
* \param gridView the used gridView * \param gridView the used gridView
*/ */
GstatRandomField(const GridView& gridView) GstatRandomField(const GridView& gridView, const ElementMapper& elementMapper)
: gridView_(gridView), : gridView_(gridView)
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) , elementMapper_(elementMapper)
elementMapper_(gridView, Dune::mcmgElementLayout()), , data_(gridView.size(0))
#else {}
elementMapper_(gridView),
#endif
data_(gridView.size(0)) {}
/*! /*!
* \brief Creates a new field with random variables, if desired. * \brief Creates a new field with random variables, if desired.
...@@ -171,11 +168,17 @@ public: ...@@ -171,11 +168,17 @@ public:
} }
//! \brief Return an entry of the data vector //! \brief Return an entry of the data vector
Scalar data(const Element& e) Scalar data(const Element& e) const
{ {
return data_[elementMapper_.index(e)]; 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 //! \brief Write the data to a vtk file
void writeVtk(const std::string& vtkName, void writeVtk(const std::string& vtkName,
const std::string& dataName = "data") const const std::string& dataName = "data") const
...@@ -195,12 +198,12 @@ public: ...@@ -195,12 +198,12 @@ public:
} }
private: private:
GridView gridView_; const GridView gridView_;
ElementMapper elementMapper_; const ElementMapper& elementMapper_;
DataVector data_; DataVector data_;
FieldType fieldType_; FieldType fieldType_;
}; };
} } // end namespace Dumux
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment