Commit 13a9fc32 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

renamed makeDiscreteFunction to discreteFunction

parent 0e947c5c
...@@ -88,14 +88,14 @@ namespace AMDiS ...@@ -88,14 +88,14 @@ namespace AMDiS
auto child(TreePath const& path = {}) auto child(TreePath const& path = {})
{ {
auto&& tp = makeTreePath(path); auto&& tp = makeTreePath(path);
return makeDiscreteFunction(*this, tp); return discreteFunction(*this, tp);
} }
template <class TreePath = RootTreePath> template <class TreePath = RootTreePath>
auto child(TreePath const& path = {}) const auto child(TreePath const& path = {}) const
{ {
auto&& tp = makeTreePath(path); auto&& tp = makeTreePath(path);
return makeDiscreteFunction(*this, tp); return discreteFunction(*this, tp);
} }
......
...@@ -47,8 +47,8 @@ namespace AMDiS ...@@ -47,8 +47,8 @@ namespace AMDiS
/// A Generator for a const \ref DiscreteFunction /// A Generator for a const \ref DiscreteFunction
template <class GlobalBasis, class ValueType, template <class GlobalBasis, class ValueType,
class PreTreePath = Dune::TypeTree::HybridTreePath<>> class PreTreePath = Dune::TypeTree::HybridTreePath<>>
auto makeDiscreteFunction(DOFVector<GlobalBasis, ValueType> const& dofVector, auto discreteFunction(DOFVector<GlobalBasis, ValueType> const& dofVector,
PreTreePath const& preTreePath = {}) PreTreePath const& preTreePath = {})
{ {
auto treePath = makeTreePath(preTreePath); auto treePath = makeTreePath(preTreePath);
return DiscreteFunction<GlobalBasis, ValueType, decltype(treePath), true>{dofVector, treePath}; return DiscreteFunction<GlobalBasis, ValueType, decltype(treePath), true>{dofVector, treePath};
...@@ -57,8 +57,8 @@ namespace AMDiS ...@@ -57,8 +57,8 @@ namespace AMDiS
/// A Generator for a mutable \ref DiscreteFunction /// A Generator for a mutable \ref DiscreteFunction
template <class GlobalBasis, class ValueType, template <class GlobalBasis, class ValueType,
class PreTreePath = Dune::TypeTree::HybridTreePath<>> class PreTreePath = Dune::TypeTree::HybridTreePath<>>
auto makeDiscreteFunction(DOFVector<GlobalBasis, ValueType>& dofVector, auto discreteFunction(DOFVector<GlobalBasis, ValueType>& dofVector,
PreTreePath const& preTreePath = {}) PreTreePath const& preTreePath = {})
{ {
auto treePath = makeTreePath(preTreePath); auto treePath = makeTreePath(preTreePath);
return DiscreteFunction<GlobalBasis, ValueType, decltype(treePath), false>{dofVector, treePath}; return DiscreteFunction<GlobalBasis, ValueType, decltype(treePath), false>{dofVector, treePath};
...@@ -181,7 +181,7 @@ namespace AMDiS ...@@ -181,7 +181,7 @@ namespace AMDiS
/** /**
* **Example:** * **Example:**
* ``` * ```
* auto v = makeDiscreteFunction(prob.solutionVector(),0); * auto v = discreteFunction(prob.solutionVector(),0);
* v.interpolate_noalias([](auto const& x) { return x[0]; }); * v.interpolate_noalias([](auto const& x) { return x[0]; });
* ``` * ```
**/ **/
...@@ -192,7 +192,7 @@ namespace AMDiS ...@@ -192,7 +192,7 @@ namespace AMDiS
/** /**
* **Example:** * **Example:**
* ``` * ```
* auto v = makeDiscreteFunction(prob.solutionVector(),0); * auto v = discreteFunction(prob.solutionVector(),0);
* v.interpolate(v + [](auto const& x) { return x[0]; }); * v.interpolate(v + [](auto const& x) { return x[0]; });
* ``` * ```
* Allows to have a reference to the DOFVector in the expression, e.g. as * Allows to have a reference to the DOFVector in the expression, e.g. as
......
...@@ -44,7 +44,7 @@ namespace AMDiS ...@@ -44,7 +44,7 @@ namespace AMDiS
std::unique_ptr<FileWriterInterface> std::unique_ptr<FileWriterInterface>
create(std::string type, std::string prefix, TreePath treePath = {}) const create(std::string type, std::string prefix, TreePath treePath = {}) const
{ {
auto data = makeDiscreteFunction(*systemVector_, treePath); auto data = discreteFunction(*systemVector_, treePath);
using Range = typename TYPEOF(data)::Range; using Range = typename TYPEOF(data)::Range;
return create_impl(std::move(type), std::move(prefix), data, ValueCategory_t<Range>{}); return create_impl(std::move(type), std::move(prefix), data, ValueCategory_t<Range>{});
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/gridfunctions/DiscreteFunction.hpp> #include <amdis/gridfunctions/DiscreteFunction.hpp>
#include <amdis/gridfunctions/DOFVectorView.hpp>
#include <amdis/typetree/TreePath.hpp> #include <amdis/typetree/TreePath.hpp>
#include "Tests.hpp" #include "Tests.hpp"
...@@ -55,9 +54,20 @@ int main(int argc, char** argv) ...@@ -55,9 +54,20 @@ int main(int argc, char** argv)
auto U1 = *prob.solutionVector(); auto U1 = *prob.solutionVector();
auto U2 = *prob.solutionVector(); auto U2 = *prob.solutionVector();
auto u0 = makeDOFVectorView(U0); auto u0 = discreteFunction(U0);
auto u1 = makeDOFVectorView(U1); auto u1 = discreteFunction(U1);
auto u2 = makeDOFVectorView(U2); auto u2 = discreteFunction(U2);
// Test const and mutable construction
auto const& U_c = *prob.solutionVector();
auto& U_m = *prob.solutionVector();
#if DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
DiscreteFunction u0_c(U_c);
DiscreteFunction u0_m(U_m);
#endif
auto u1_c = discreteFunction(U_c);
auto u1_m = discreteFunction(U_m);
using Range = typename decltype(u0)::Range; using Range = typename decltype(u0)::Range;
...@@ -123,30 +133,30 @@ int main(int argc, char** argv) ...@@ -123,30 +133,30 @@ int main(int argc, char** argv)
} }
auto V0 = makeDOFVector<double>(prob.globalBasis()); auto V0 = makeDOFVector<double>(prob.globalBasis());
auto v0 = makeDOFVectorView(V0); auto v0 = discreteFunction(V0);
v0 << expr1; v0 << expr1;
// test makeDiscreteFunction // test discreteFunction
int preTP1 = 0; int preTP1 = 0;
std::integral_constant<std::size_t, 0> preTP2; std::integral_constant<std::size_t, 0> preTP2;
auto tp = treepath(preTP1); auto tp = treepath(preTP1);
auto W0 = *prob.solutionVector(); auto W0 = *prob.solutionVector();
auto W1 = *prob.solutionVector(); auto W1 = *prob.solutionVector();
auto W2 = *prob.solutionVector(); auto W2 = *prob.solutionVector();
auto w0 = makeDiscreteFunction(W0, preTP1); auto w0 = discreteFunction(W0, preTP1);
auto w1 = makeDiscreteFunction(W1, preTP2); auto w1 = discreteFunction(W1, preTP2);
auto w2 = makeDiscreteFunction(W2, tp); auto w2 = discreteFunction(W2, tp);
// test makeDOFVectorView with (pre)treepath argument // test discreteFunction with (pre)treepath argument
auto expr = [](auto const& x) { return 1 + x[0] + x[1]; }; auto expr = [](auto const& x) { return 1 + x[0] + x[1]; };
auto W3 = *prob.solutionVector(); auto W3 = *prob.solutionVector();
auto W4 = *prob.solutionVector(); auto W4 = *prob.solutionVector();
auto W5 = *prob.solutionVector(); auto W5 = *prob.solutionVector();
auto W7 = *prob.solutionVector(); auto W7 = *prob.solutionVector();
auto W8 = *prob.solutionVector(); auto W8 = *prob.solutionVector();
auto w3 = makeDOFVectorView(W3, preTP1); auto w3 = discreteFunction(W3, preTP1);
auto w4 = makeDOFVectorView(W4, preTP2); auto w4 = discreteFunction(W4, preTP2);
auto w5 = makeDOFVectorView(W5, tp); auto w5 = discreteFunction(W5, tp);
auto w6 = prob.solution(tp); auto w6 = prob.solution(tp);
auto& W6 = *prob.solutionVector(); auto& W6 = *prob.solutionVector();
w3 << expr; w3 << expr;
...@@ -158,9 +168,9 @@ int main(int argc, char** argv) ...@@ -158,9 +168,9 @@ int main(int argc, char** argv)
AMDIS_TEST( comp(W3, W6) ); AMDIS_TEST( comp(W3, W6) );
// test interpolation on subbasis // test interpolation on subbasis
auto w7 = makeDOFVectorView(W7); auto w7 = discreteFunction(W7);
auto w8_0 = makeDOFVectorView(W8, 0); auto w8_0 = discreteFunction(W8, 0);
auto w8_1 = makeDOFVectorView(W8, 1); auto w8_1 = discreteFunction(W8, 1);
w7 << expr; w7 << expr;
w8_0 << expr; w8_0 << expr;
w8_1 << expr; w8_1 << expr;
......
Markdown is supported
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