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

[factory] Adapt to function.hh deprecation

parent 995e0a13
No related branches found
No related tags found
No related merge requests found
Pipeline #25187 failed
......@@ -6,6 +6,8 @@
#include <memory>
#include <dune/common/fmatrix.hh>
#define DUNE_FUNCTION_HH_SILENCE_DEPRECATION
#include <dune/common/function.hh>
#include <dune/foamgrid/foamgrid/foamgridvertex.hh>
......@@ -181,6 +183,7 @@ namespace Dune {
bool isNew_;
/** \brief The element parametrization */
// TODO after deprecation period (release 2.8) change this to std::function
std::shared_ptr<VirtualFunction<FieldVector<ctype, dimgrid>, FieldVector<ctype, dimworld> > > elementParametrization_;
/** \brief This flag is set by postGrow() if the element looses its right to coarsen
......@@ -366,6 +369,7 @@ namespace Dune {
FoamGridEntityImp<dimgrid, dimgrid ,dimworld, ctype>* father_;
/** \brief The element parametrization */
// TODO after deprecation period (release 2.8) change this to std::function
std::shared_ptr<VirtualFunction<FieldVector<ctype, dimgrid>, FieldVector<ctype, dimworld> > > elementParametrization_;
/** \brief This flag is set by postGrow() if the element looses its right to coarsen
......
......@@ -11,8 +11,11 @@
#include <vector>
#include <memory>
#include <unordered_map>
#include <functional>
#include <dune/common/deprecated.hh>
#include <dune/common/version.hh>
#define DUNE_FUNCTION_HH_SILENCE_DEPRECATION
#include <dune/common/function.hh>
#include <dune/common/fvector.hh>
#include <dune/common/hash.hh>
......@@ -189,11 +192,13 @@ template <int dimworld, class ct>
);
}
DUNE_NO_DEPRECATED_BEGIN
/** \brief Insert a parametrized element into the coarse grid
\param type The GeometryType of the new element
\param vertices The vertices of the new element, using the DUNE numbering
\param elementParametrization A function prescribing the shape of this element
*/
[[deprecated("After Dune 2.7: VirtualFunction is deprecated: use overload taking std::function!")]]
void insertElement(const GeometryType& type,
const std::vector<unsigned int>& vertices,
const std::shared_ptr<VirtualFunction<FieldVector<ctype,dimgrid>,FieldVector<ctype,dimworld> > >& elementParametrization) override
......@@ -208,6 +213,26 @@ template <int dimworld, class ct>
std::get<dimgrid>(this->grid_->entityImps_[0]).push_back(newElement);
}
DUNE_NO_DEPRECATED_END
/** \brief Insert a parametrized element into the coarse grid
\param type The GeometryType of the new element
\param vertices The vertices of the new element, using the DUNE numbering
\param elementParametrization A function prescribing the shape of this element
*/
void insertElement(const GeometryType& type,
const std::vector<unsigned int>& vertices,
std::function<FieldVector<ctype,dimworld>(FieldVector<ctype,dimgrid>)>& elementParametrization) override
{
// for the deprecation period forward to the deprecated interface
// after release 2.8 remove old interface and adapt internal implementation to use std::function
using D = FieldVector<ctype,dimgrid>;
using R = FieldVector<ctype,dimworld>;
DUNE_NO_DEPRECATED_BEGIN
auto f = makeVirtualFunction<D,R>(std::move(elementParametrization));
insertElement(type, vertices, std::make_unique<decltype(f)>(std::move(f)));
DUNE_NO_DEPRECATED_END
}
/** \brief Finalize grid creation and hand over the grid
......
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