Commit 79f22d34 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Correct deduction of constructor arguments in Vtk::Function

parent cdfb72d2
......@@ -96,17 +96,28 @@ namespace Dune
*
* NOTE: Stores the localFunction by value.
**/
template <class LF, class... Args,
class = IsLocalFunction<LF>>
Function (LF&& localFct, std::string name, int ncomps, Args&&... args)
: Function(std::forward<LF>(localFct), std::move(name), allComponents(ncomps),
std::forward<Args>(args)...)
{}
/// (3) Construct from a LocalFunction directly.
/**
* Same as Constructor (1) or (2) but deduces the number of components from
* the static range type of the local-function. This defaults to 1 of no
* static size information could be extracted.
**/
template <class LF, class... Args,
class = IsLocalFunction<LF>,
class R = Range<LF,LocalDomain> >
Function (LF&& localFct, std::string name, Args const&... args)
: Function(std::forward<LF>(localFct), std::move(name),
allComponents(getArg<int,unsigned int,long,unsigned long>(args..., sizeOf<R>())),
getArg<Vtk::RangeTypes>(args..., Vtk::RangeTypes::UNSPECIFIED),
getArg<Vtk::DataTypes>(args..., Vtk::DataTypes::FLOAT64))
Function (LF&& localFct, std::string name, Args&&... args)
: Function(std::forward<LF>(localFct), std::move(name), sizeOf<R>(),
std::forward<Args>(args)...)
{}
/// (3) Construct from a Vtk::Function
/// (4) Construct from a Vtk::Function
template <class... Args>
explicit Function (Function<GridView> const& fct, Args&&... args)
: Function(fct.localFct_,
......@@ -116,7 +127,7 @@ namespace Dune
getArg<Vtk::DataTypes>(args..., fct.dataType_))
{}
/// (4) Construct from a GridFunction
/// (5) Construct from a GridFunction
/**
* \param fct A Grid(View)-function, providing a `localFunction(fct)`
* \param name The name to use as identification in the VTK file
......@@ -132,13 +143,13 @@ namespace Dune
: Function(localFunction(std::forward<GF>(fct)), std::move(name), std::forward<Args>(args)...)
{}
/// (5) Constructor that forwards the number of components and data type to the other constructor
/// (6) Constructor that forwards the number of components and data type to the other constructor
template <class F>
Function (F&& fct, Vtk::FieldInfo info, ...)
: Function(std::forward<F>(fct), info.name(), info.size(), info.rangeType(), info.dataType())
{}
/// (6) Construct from legacy VTKFunction
/// (7) Construct from legacy VTKFunction
/**
* \param fct The Dune::VTKFunction to wrap
**/
......@@ -155,7 +166,7 @@ namespace Dune
setRangeType(rangeTypeOf(fct->ncomps()));
}
/// (7) Default constructor. After construction, the function is an an invalid state.
/// (8) Default constructor. After construction, the function is an an invalid state.
Function () = default;
/// Create a LocalFunction
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment