Commit 43cefbd6 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'feature/replace_make_functions' into 'master'

Feature/replace make functions

See merge request !201
parents 39a573a2 d64976bf
...@@ -407,16 +407,6 @@ namespace AMDiS ...@@ -407,16 +407,6 @@ namespace AMDiS
-> GridFunctionMarker<Grid, -> GridFunctionMarker<Grid,
TYPEOF( makeGridFunction(FWD(gf), grid->leafGridView()) )>; TYPEOF( makeGridFunction(FWD(gf), grid->leafGridView()) )>;
// Generator function for GridFunctionMarker class
template <class Grid, class PreGridFct>
auto makeGridFunctionMarker(std::string const& name, std::shared_ptr<Grid> const& grid,
PreGridFct&& preGridFct)
{
auto gridFct = makeGridFunction(FWD(preGridFct), grid->leafGridView());
return GridFunctionMarker<Grid,TYPEOF(gridFct)>{name, grid, std::move(gridFct)};
}
} // end namespace AMDiS } // end namespace AMDiS
#include "Marker.inc.hpp" #include "Marker.inc.hpp"
...@@ -96,20 +96,6 @@ namespace AMDiS ...@@ -96,20 +96,6 @@ namespace AMDiS
-> ProblemInstat<Traits>; -> ProblemInstat<Traits>;
// Generator for ProblemInstat with given ProblemStat
template <class Traits>
ProblemInstat<Traits> makeProblemInstat(std::string const& name, ProblemStat<Traits>& prob)
{
return {name, prob};
}
// Generator for ProblemInstat with given ProblemStat and initialization problem
template <class Traits>
ProblemInstat<Traits> makeProblemInstat(std::string const& name, ProblemStat<Traits>& prob, ProblemStatBase& initialProb)
{
return {name, prob, initialProb};
}
// mark template as explicitly instantiated in cpp file // mark template as explicitly instantiated in cpp file
extern template class ProblemInstat<YaspGridBasis<2,1>>; extern template class ProblemInstat<YaspGridBasis<2,1>>;
extern template class ProblemInstat<YaspGridBasis<2,2>>; extern template class ProblemInstat<YaspGridBasis<2,2>>;
......
...@@ -517,14 +517,6 @@ namespace AMDiS ...@@ -517,14 +517,6 @@ namespace AMDiS
-> ProblemStat<DefaultProblemTraits<GlobalBasis>>; -> ProblemStat<DefaultProblemTraits<GlobalBasis>>;
// Generator for ProblemStat with given Grid and GlobalBasis
template <class Grid, class GlobalBasis>
ProblemStat<DefaultProblemTraits<GlobalBasis>>
makeProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
{
return {name, grid, globalBasis};
}
// mark templates as explicitly instantiated in cpp file // mark templates as explicitly instantiated in cpp file
extern template class ProblemStat<YaspGridBasis<2,1>>; extern template class ProblemStat<YaspGridBasis<2,1>>;
extern template class ProblemStat<YaspGridBasis<2,2>>; extern template class ProblemStat<YaspGridBasis<2,2>>;
......
...@@ -91,12 +91,12 @@ namespace AMDiS ...@@ -91,12 +91,12 @@ namespace AMDiS
static auto create(std::string const& name, GridView const& gridView) static auto create(std::string const& name, GridView const& gridView)
{ {
return makeGlobalBasis(name, gridView, PreBasisCreator::create()); return ParallelGlobalBasis(name, gridView, PreBasisCreator::create());
} }
static auto create(GridView const& gridView) static auto create(GridView const& gridView)
{ {
return makeGlobalBasis(gridView, PreBasisCreator::create()); return ParallelGlobalBasis(gridView, PreBasisCreator::create());
} }
using GlobalBasis = decltype(create(std::declval<GridView>())); using GlobalBasis = decltype(create(std::declval<GridView>()));
......
...@@ -37,6 +37,13 @@ ...@@ -37,6 +37,13 @@
namespace AMDiS namespace AMDiS
{ {
template <class PreBasisFactory>
using MultiIndex = std::conditional_t<
(remove_cvref_t<PreBasisFactory>::requiredMultiIndexSize == 1),
Dune::Functions::FlatMultiIndex<std::size_t>,
Dune::ReservedVector<std::size_t, remove_cvref_t<PreBasisFactory>::requiredMultiIndexSize>>;
/** /**
* \brief Parallel global basis defined on a (sequential) pre-basis * \brief Parallel global basis defined on a (sequential) pre-basis
* *
...@@ -92,11 +99,11 @@ namespace AMDiS ...@@ -92,11 +99,11 @@ namespace AMDiS
, comm_(CommunicationCreator<Comm>::create(static_cast<Super const&>(*this), name + "->solver")) , comm_(CommunicationCreator<Comm>::create(static_cast<Super const&>(*this), name + "->solver"))
{} {}
/// Construct this global basis with empty name /// Construct this global basis with a preBasisFactory
template <class... Args, template <class PBF>
Dune::Functions::enableIfConstructible<PreBasis, Args...> = 0> ParallelGlobalBasis(std::string const& name, GridView const& gridView, PBF&& preBasisFactory)
ParallelGlobalBasis(Grid const& grid, Args&&... args) : ParallelGlobalBasis(name, gridView.grid(),
: ParallelGlobalBasis(std::string(""), grid, FWD(args)...) preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))
{} {}
/// Converting constructor from dune-functions style basis. /// Converting constructor from dune-functions style basis.
...@@ -105,10 +112,16 @@ namespace AMDiS ...@@ -105,10 +112,16 @@ namespace AMDiS
* argument and a new communication object is built. * argument and a new communication object is built.
*/ */
template <class GB_, template <class GB_,
Dune::disableCopyMove<Self, GB_> = 0,
REQUIRES(Concepts::GlobalBasis<GB_,GridView>)> REQUIRES(Concepts::GlobalBasis<GB_,GridView>)>
ParallelGlobalBasis(GB_&& from) ParallelGlobalBasis(std::string const& name, GB_&& from)
: ParallelGlobalBasis(std::string(""), from.gridView().grid(), from.preBasis()) : ParallelGlobalBasis(name, from.gridView().grid(), from.preBasis())
{}
/// Construct this global basis with empty name
template <class Arg, class... Args,
REQUIRES(!std::is_same_v<std::string, remove_cvref_t<Arg>>)>
ParallelGlobalBasis(Arg&& arg, Args&&... args)
: ParallelGlobalBasis(std::string(""), FWD(arg), FWD(args)...)
{} {}
/// Copy constructor /// Copy constructor
...@@ -175,29 +188,15 @@ namespace AMDiS ...@@ -175,29 +188,15 @@ namespace AMDiS
}; };
template <class MultiIndex, class GV, class PBF> // Deduction guides
auto makeGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory)
{
auto preBasis = preBasisFactory.template makePreBasis<MultiIndex>(gridView);
return ParallelGlobalBasis<TYPEOF(preBasis)>(name, gridView.grid(), std::move(preBasis));
}
template <class GV, class PBF> template <class GV, class PBF>
auto makeGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory) ParallelGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory)
{ -> ParallelGlobalBasis<decltype(
using RawPreBasisFactory = remove_cvref_t<PBF>; preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))>;
using MultiIndex = std::conditional_t<
(RawPreBasisFactory::requiredMultiIndexSize == 1),
Dune::Functions::FlatMultiIndex<std::size_t>,
Dune::ReservedVector<std::size_t, RawPreBasisFactory::requiredMultiIndexSize>>;
return makeGlobalBasis<MultiIndex, GV, PBF>(name, gridView, FWD(preBasisFactory));
}
template <class GV, class PBF> template <class GV, class PBF>
auto makeGlobalBasis(GV const& gridView, PBF&& preBasisFactory) ParallelGlobalBasis(GV const& gridView, PBF&& preBasisFactory)
{ -> ParallelGlobalBasis<decltype(
return makeGlobalBasis(std::string(""), gridView, FWD(preBasisFactory)); preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))>;
}
} // end namespace AMDiS } // end namespace AMDiS
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
auto&& nodeToRangeEntry = globalFunction_.nodeToRangeEntry_; auto&& nodeToRangeEntry = globalFunction_.nodeToRangeEntry_;
for_each_leaf_node(*subTree_, [&,this](auto const& node, auto const& tp) for_each_leaf_node(*subTree_, [&,this](auto const& node, auto const& tp)
{ {
auto localBasisCache = makeNodeCache(node); NodeCache localBasisCache(node);
auto const& shapeFunctionValues = localBasisCache.evaluateFunction(localView_.element().type(), x); auto const& shapeFunctionValues = localBasisCache.evaluateFunction(localView_.element().type(), x);
std::size_t size = node.finiteElement().size(); std::size_t size = node.finiteElement().size();
...@@ -268,7 +268,7 @@ public: ...@@ -268,7 +268,7 @@ public:
auto&& nodeToRangeEntry = this->globalFunction_.nodeToRangeEntry_; auto&& nodeToRangeEntry = this->globalFunction_.nodeToRangeEntry_;
for_each_leaf_node(*this->subTree_, [&](auto const& node, auto const& tp) for_each_leaf_node(*this->subTree_, [&](auto const& node, auto const& tp)
{ {
auto localBasis = makeLocalToGlobalBasisAdapter(node, this->geometry()); LocalToGlobalBasisAdapter localBasis(node, this->geometry());
auto const& gradients = localBasis.gradientsAt(x); auto const& gradients = localBasis.gradientsAt(x);
// Get range entry associated to this node // Get range entry associated to this node
...@@ -334,7 +334,7 @@ private: ...@@ -334,7 +334,7 @@ private:
auto&& node = *this->subTree_; auto&& node = *this->subTree_;
auto localBasis = makeLocalToGlobalBasisAdapter(node.child(0), this->geometry()); LocalToGlobalBasisAdapter localBasis(node.child(0), this->geometry());
auto const& gradients = localBasis.gradientsAt(x); auto const& gradients = localBasis.gradientsAt(x);
auto re = Dune::Functions::flatVectorView(dy); auto re = Dune::Functions::flatVectorView(dy);
...@@ -377,7 +377,7 @@ public: ...@@ -377,7 +377,7 @@ public:
auto&& nodeToRangeEntry = this->globalFunction_.nodeToRangeEntry_; auto&& nodeToRangeEntry = this->globalFunction_.nodeToRangeEntry_;
for_each_leaf_node(*this->subTree_, [&](auto const& node, auto const& tp) for_each_leaf_node(*this->subTree_, [&](auto const& node, auto const& tp)
{ {
auto localBasis = makeLocalToGlobalBasisAdapter(node, this->geometry()); LocalToGlobalBasisAdapter localBasis(node, this->geometry());
auto const& partial = localBasis.partialsAt(x, comp); auto const& partial = localBasis.partialsAt(x, comp);
// Get range entry associated to this node // Get range entry associated to this node
......
...@@ -75,11 +75,4 @@ namespace AMDiS ...@@ -75,11 +75,4 @@ namespace AMDiS
bool animation_ = false; bool animation_ = false;
}; };
/// Generator function for \ref BackupWriter
template <class SystemVector>
BackupWriter<SystemVector> makeBackupWriter(std::string const& name, std::shared_ptr<SystemVector> systemVector)
{
return {name, systemVector};
}
} // end namespace AMDiS } // end namespace AMDiS
...@@ -82,14 +82,6 @@ namespace AMDiS ...@@ -82,14 +82,6 @@ namespace AMDiS
bool animation_ = false; bool animation_ = false;
}; };
/// Generator function for \ref DuneVtkWriter
template <class GridView, class GridFunction>
DuneVtkWriter<GridView, GridFunction> makeDuneVtkWriter(std::string const& name, GridView const& gridView, GridFunction const& gridFunction)
{
return {name, gridView, gridFunction};
}
} // end namespace AMDiS } // end namespace AMDiS
#endif // HAVE_DUNE_VTK #endif // HAVE_DUNE_VTK
...@@ -70,14 +70,4 @@ namespace AMDiS ...@@ -70,14 +70,4 @@ namespace AMDiS
bool animation_ = false; bool animation_ = false;
}; };
/// Generator function for \ref GmshWriter
template <class GridView>
GmshWriter<GridView> makeGmshWriter(std::string const& name, GridView const& gridView,
std::vector<int> const& physicalEntities = std::vector<int>(),
std::vector<int> const& physicalBoundaries = std::vector<int>())
{
return {name, gridView, physicalEntities, physicalBoundaries};
}
} // end namespace AMDiS } // end namespace AMDiS
...@@ -114,12 +114,4 @@ namespace AMDiS ...@@ -114,12 +114,4 @@ namespace AMDiS
Dune::VTK::OutputType mode_ = Dune::VTK::ascii; Dune::VTK::OutputType mode_ = Dune::VTK::ascii;
}; };
/// Generator function for \ref VTKWriter
template <class GridView, class GridFunction>
VTKWriter<GridView, GridFunction> makeVTKWriter(std::string const& name, GridView const& gridView, GridFunction const& gridFunction)
{
return {name, gridView, gridFunction};
}
} // end namespace AMDiS } // end namespace AMDiS
...@@ -43,7 +43,7 @@ namespace AMDiS ...@@ -43,7 +43,7 @@ namespace AMDiS
static_assert(Node::isLeaf, "Operator can be applied to Leaf-Nodes only."); static_assert(Node::isLeaf, "Operator can be applied to Leaf-Nodes only.");
auto const& quad = this->getQuadratureRule(contextGeo.type(), node); auto const& quad = this->getQuadratureRule(contextGeo.type(), node);
auto localBasis = makeLocalToGlobalBasisAdapter(node, contextGeo.geometry()); LocalToGlobalBasisAdapter localBasis(node, contextGeo.geometry());
for (std::size_t iq = 0; iq < quad.size(); ++iq) { for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element // Position of the current quadrature point in the reference element
......
...@@ -56,7 +56,7 @@ namespace AMDiS ...@@ -56,7 +56,7 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size(); std::size_t rowSize = rowLocalFE.size();
NodeQuadCache<RN> rowCache(rowLocalFE.localBasis()); NodeQuadCache<RN> rowCache(rowLocalFE.localBasis());
auto colLocalBasis = makeLocalToGlobalBasisAdapter(colNode, contextGeo.geometry()); LocalToGlobalBasisAdapter colLocalBasis(colNode, contextGeo.geometry());
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQP(contextGeo, quad); auto const& shapeValuesCache = rowCache.evaluateFunctionAtQP(contextGeo, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) { for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element // Position of the current quadrature point in the reference element
......
...@@ -48,8 +48,8 @@ namespace AMDiS ...@@ -48,8 +48,8 @@ namespace AMDiS
auto const& quad = this->getQuadratureRule(contextGeo.type(), rowNode, colNode); auto const& quad = this->getQuadratureRule(contextGeo.type(), rowNode, colNode);
auto rowLocalBasis = makeLocalToGlobalBasisAdapter(rowNode, contextGeo.geometry()); LocalToGlobalBasisAdapter rowLocalBasis(rowNode, contextGeo.geometry());
auto colLocalBasis = makeLocalToGlobalBasisAdapter(colNode, contextGeo.geometry()); LocalToGlobalBasisAdapter colLocalBasis(colNode, contextGeo.geometry());
for (std::size_t iq = 0; iq < quad.size(); ++iq) { for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element // Position of the current quadrature point in the reference element
......
...@@ -117,13 +117,6 @@ namespace AMDiS ...@@ -117,13 +117,6 @@ namespace AMDiS
LocalBasisType const* localBasis_ = nullptr; LocalBasisType const* localBasis_ = nullptr;
}; };
/// Generator function for \ref NodeCache, \relates NodeCache.
template <class Node>
NodeCache<Node> makeNodeCache(Node const& node)
{
return NodeCache<Node>{node};
}
/// \brief Cache of LocalBasis evaluations and jacobians at quadrature points /// \brief Cache of LocalBasis evaluations and jacobians at quadrature points
/** /**
* Caching is done using the ConcurrentCache data structure with a key that * Caching is done using the ConcurrentCache data structure with a key that
...@@ -237,11 +230,4 @@ namespace AMDiS ...@@ -237,11 +230,4 @@ namespace AMDiS
LocalBasisType const* localBasis_ = nullptr; LocalBasisType const* localBasis_ = nullptr;
}; };
/// Generator function for \ref NodeQuadCache, \relates NodeQuadCache.
template <class Node>
NodeQuadCache<Node> makeNodeQuadCache(Node const& node)
{
return NodeQuadCache<Node>{node};
}
} // end namespace AMDiS } // end namespace AMDiS
...@@ -195,13 +195,4 @@ namespace AMDiS ...@@ -195,13 +195,4 @@ namespace AMDiS
std::size_t size_; std::size_t size_;
}; };
/// Generator function for the \ref LocalToGlobalBasisAdapter. \relates LocalToGlobalBasisAdapter.
template <class BasisNode, class Geometry>
LocalToGlobalBasisAdapter<BasisNode, Geometry>
makeLocalToGlobalBasisAdapter(BasisNode const& node, Geometry const& geometry)
{
return LocalToGlobalBasisAdapter<BasisNode, Geometry>{node, geometry};
}
} // namespace AMDiS } // namespace AMDiS
...@@ -42,7 +42,7 @@ auto basis = makeBasis(gv, ...@@ -42,7 +42,7 @@ auto basis = makeBasis(gv,
lagrange<2>(), blockedLexicographic() lagrange<2>(), blockedLexicographic()
)); ));
// Create a Problem with c++17, use makeProblemStat() in pre c++17 // Create a Problem
ProblemStat prob("prob", *grid, basis); ProblemStat prob("prob", *grid, basis);
prob.initialize(INIT_ALL); prob.initialize(INIT_ALL);
``` ```
......
...@@ -109,12 +109,12 @@ using Grid = Dune::YaspGrid<2>; ...@@ -109,12 +109,12 @@ using Grid = Dune::YaspGrid<2>;
Grid grid({1.0, 1.0}, {2, 2}); Grid grid({1.0, 1.0}, {2, 2});
using namespace Dune::Functions::BasisFactory; using namespace Dune::Functions::BasisFactory;
auto basis1 = makeGlobalBasis(grid.leafGridView(), lagrange<2>()); ParallelGlobalBasis basis1(grid.leafGridView(), lagrange<2>());
DOFVector<decltype(basis1)> vec0(basis1); DOFVector<decltype(basis1)> vec0(basis1);
DOFVector vec1(basis1); // C++17 only DOFVector vec1(basis1); // C++17 only
auto basis2 = makeUniquePtr(makeGlobalBasis(grid.leafGridView(), lagrange<2>())); auto basis2 = makeUniquePtr(ParallelGlobalBasis(grid.leafGridView(), lagrange<2>()));
DOFVector<Underlying_t<decltype(basis2)>> vec2(std::move(basis2)); DOFVector<Underlying_t<decltype(basis2)>> vec2(std::move(basis2));
``` ```
...@@ -251,7 +251,7 @@ underlying type is either the `remove_cvref_t` for references, or the pointed-to ...@@ -251,7 +251,7 @@ underlying type is either the `remove_cvref_t` for references, or the pointed-to
using namespace Dune::Functions::BasisFactory; using namespace Dune::Functions::BasisFactory;
// pass a reference to the basis // pass a reference to the basis
auto basis1 = makeGlobalBasis(gridView, lagrange<2>()); ParallelGlobalBasis basis1(gridView, lagrange<2>());
auto vec1 = makeDOFVector<double>(basis1); auto vec1 = makeDOFVector<double>(basis1);
// pass a smart pointer // pass a smart pointer
...@@ -391,7 +391,7 @@ Returns the const (1) or mutable (2) sub-range view of the stored DOFVector. ...@@ -391,7 +391,7 @@ Returns the const (1) or mutable (2) sub-range view of the stored DOFVector.
#### Example #### Example
```c++ ```c++
auto basis = makeGlobalBasis(gridView, power<3>(lagrange<1>())); ParallelGlobalBasis basis(gridView, power<3>(lagrange<1>()));
auto vec = makeDOFVector(basis); auto vec = makeDOFVector(basis);
auto df = makeDiscreteFunction(vec); auto df = makeDiscreteFunction(vec);
...@@ -452,7 +452,7 @@ Note, the range type of the expression must be compatible with the `Range` type ...@@ -452,7 +452,7 @@ Note, the range type of the expression must be compatible with the `Range` type
#### Example #### Example
```c++ ```c++
auto basis = makeGlobalBasis(gridView, power<3>(lagrange<1>())); ParallelGlobalBasis basis(gridView, power<3>(lagrange<1>()));
auto vec = makeDOFVector(basis); auto vec = makeDOFVector(basis);
auto df1 = vec.child(); auto df1 = vec.child();
...@@ -504,7 +504,7 @@ thereby given by the type of `makeTreePath(preTreePath)`. ...@@ -504,7 +504,7 @@ thereby given by the type of `makeTreePath(preTreePath)`.
using namespace Dune::Functions::BasisFactory; using namespace Dune::Functions::BasisFactory;
// pass a reference to the basis // pass a reference to the basis
auto basis = makeGlobalBasis(gridView, power<2>(lagrange<2>())); ParallelGlobalBasis basis(gridView, power<2>(lagrange<2>()));
auto vec = makeDOFVector<double>(basis1); auto vec = makeDOFVector<double>(basis1);
auto df1 = makeDiscreteFunction(vec); auto df1 = makeDiscreteFunction(vec);
...@@ -512,4 +512,3 @@ auto df2 = makeDiscreteFunction(vec, 1); ...@@ -512,4 +512,3 @@ auto df2 = makeDiscreteFunction(vec, 1);
auto df3 = makeDiscreteFunction(vec, _1); auto df3 = makeDiscreteFunction(vec, _1);
auto df4 = makeDiscreteFunction(vec, Dune::TypeTree::hybridTreePath(0)); auto df4 = makeDiscreteFunction(vec, Dune::TypeTree::hybridTreePath(0));
``` ```
...@@ -113,13 +113,6 @@ given in the `Traits` as `C = typename Traits::CoefficientType`. ...@@ -113,13 +113,6 @@ given in the `Traits` as `C = typename Traits::CoefficientType`.
--------------------------------|--------------------------------------------- --------------------------------|---------------------------------------------
[`oneIteration`](#function-problemstatbuildafteradapt) | A single build-solve-adapt step [`oneIteration`](#function-problemstatbuildafteradapt) | A single build-solve-adapt step
### Related functions
Function | Descriptions
--------------------------------|---------------------------------------------
[`makeProblemStat`](#function-makeproblemstat) | Constructs a new problem
## function `ProblemStat::ProblemStat` ## function `ProblemStat::ProblemStat`
```c++ ```c++
explicit ProblemStat(std::string const& name) // (1) explicit ProblemStat(std::string const& name) // (1)
...@@ -173,10 +166,6 @@ ProblemStat<LagrangeBasis<Grid, 2>> prob3("prob", grid, basis); ...@@ -173,10 +166,6 @@ ProblemStat<LagrangeBasis<Grid, 2>> prob3("prob", grid, basis);
ProblemStat prob4("prob", grid, basis); ProblemStat prob4("prob", grid, basis);
``` ```
#### See Also
- Generator function to construct a problem: [`makeProblemStat()`](#function-makeproblemstat)
## function `ProblemStat::initialize` ## function `ProblemStat::initialize`
```c++ ```c++
...@@ -378,45 +367,6 @@ prob.boundaryManager()->setBoxBoundary({1,2,2,2}); ...@@ -378,45 +367,6 @@ prob.boundaryManager()->setBoxBoundary({1,2,2,2});
prob.addDirichletBC(BoundaryType{1}, 0, 0, 0.0); prob.addDirichletBC(BoundaryType{1}, 0, 0, 0.0);
``` ```
## function `makeProblemStat`
```c++
template <class Grid, class GlobalBasis>
ProblemStat<DefaultProblemTraits<GlobalBasis>>
makeProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
```
Construct a [`ProblemStat`](#class-problemstat) with given name, grid, and basis. The `Traits` type is constructed
from the global basis type, using the wrapper `DefaultProblemTraits`
#### Arguments
`std::string name`
: The name of the problem that is used to identify parameters in the initfile.
`Grid grid`
: A grid implementing the `Dune::Grid` interface.
`GlobalBasis globalBasis`
: A basis implementing the `Dune::Functions::GlobalBasis` interface.
#### Example
```c++
using Grid = Dune::YaspGrid<2>;
Grid grid({1.0, 1.0}, {2, 2});