Commit c81efe92 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

renamed maker function discreteFunction() back to makeDiscreteFunction() for consistency

parent c2a6cdf0
...@@ -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 discreteFunction(*this, tp); return makeDiscreteFunction(*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 discreteFunction(*this, tp); return makeDiscreteFunction(*this, tp);
} }
......
...@@ -50,8 +50,8 @@ namespace AMDiS ...@@ -50,8 +50,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 discreteFunction(DOFVector<GlobalBasis, ValueType> const& dofVector, auto makeDiscreteFunction(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};
...@@ -60,8 +60,8 @@ namespace AMDiS ...@@ -60,8 +60,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 discreteFunction(DOFVector<GlobalBasis, ValueType>& dofVector, auto makeDiscreteFunction(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};
...@@ -184,7 +184,7 @@ namespace AMDiS ...@@ -184,7 +184,7 @@ namespace AMDiS
/** /**
* **Example:** * **Example:**
* ``` * ```
* auto v = discreteFunction(prob.solutionVector(),0); * auto v = makeDiscreteFunction(prob.solutionVector(),0);
* v.interpolate_noalias([](auto const& x) { return x[0]; }); * v.interpolate_noalias([](auto const& x) { return x[0]; });
* ``` * ```
**/ **/
...@@ -195,7 +195,7 @@ namespace AMDiS ...@@ -195,7 +195,7 @@ namespace AMDiS
/** /**
* **Example:** * **Example:**
* ``` * ```
* auto v = discreteFunction(prob.solutionVector(),0); * auto v = makeDiscreteFunction(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 = discreteFunction(*systemVector_, treePath); auto data = makeDiscreteFunction(*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>{});
......
...@@ -54,9 +54,9 @@ int main(int argc, char** argv) ...@@ -54,9 +54,9 @@ int main(int argc, char** argv)
auto U1 = *prob.solutionVector(); auto U1 = *prob.solutionVector();
auto U2 = *prob.solutionVector(); auto U2 = *prob.solutionVector();
auto u0 = discreteFunction(U0); auto u0 = makeDiscreteFunction(U0);
auto u1 = discreteFunction(U1); auto u1 = makeDiscreteFunction(U1);
auto u2 = discreteFunction(U2); auto u2 = makeDiscreteFunction(U2);
// Test const and mutable construction // Test const and mutable construction
auto const& U_c = *prob.solutionVector(); auto const& U_c = *prob.solutionVector();
...@@ -66,8 +66,8 @@ int main(int argc, char** argv) ...@@ -66,8 +66,8 @@ int main(int argc, char** argv)
DiscreteFunction u0_c(U_c); DiscreteFunction u0_c(U_c);
DiscreteFunction u0_m(U_m); DiscreteFunction u0_m(U_m);
#endif #endif
auto u1_c = discreteFunction(U_c); auto u1_c = makeDiscreteFunction(U_c);
auto u1_m = discreteFunction(U_m); auto u1_m = makeDiscreteFunction(U_m);
using Range = typename decltype(u0)::Range; using Range = typename decltype(u0)::Range;
...@@ -133,7 +133,7 @@ int main(int argc, char** argv) ...@@ -133,7 +133,7 @@ int main(int argc, char** argv)
} }
auto V0 = makeDOFVector<double>(prob.globalBasis()); auto V0 = makeDOFVector<double>(prob.globalBasis());
auto v0 = discreteFunction(V0); auto v0 = makeDiscreteFunction(V0);
v0 << expr1; v0 << expr1;
// test discreteFunction // test discreteFunction
...@@ -143,9 +143,9 @@ int main(int argc, char** argv) ...@@ -143,9 +143,9 @@ int main(int argc, char** argv)
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 = discreteFunction(W0, preTP1); auto w0 = makeDiscreteFunction(W0, preTP1);
auto w1 = discreteFunction(W1, preTP2); auto w1 = makeDiscreteFunction(W1, preTP2);
auto w2 = discreteFunction(W2, tp); auto w2 = makeDiscreteFunction(W2, tp);
// test discreteFunction 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]; };
...@@ -154,9 +154,9 @@ int main(int argc, char** argv) ...@@ -154,9 +154,9 @@ int main(int argc, char** argv)
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 = discreteFunction(W3, preTP1); auto w3 = makeDiscreteFunction(W3, preTP1);
auto w4 = discreteFunction(W4, preTP2); auto w4 = makeDiscreteFunction(W4, preTP2);
auto w5 = discreteFunction(W5, tp); auto w5 = makeDiscreteFunction(W5, tp);
auto w6 = prob.solution(tp); auto w6 = prob.solution(tp);
auto& W6 = *prob.solutionVector(); auto& W6 = *prob.solutionVector();
w3 << expr; w3 << expr;
...@@ -168,9 +168,9 @@ int main(int argc, char** argv) ...@@ -168,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 = discreteFunction(W7); auto w7 = makeDiscreteFunction(W7);
auto w8_0 = discreteFunction(W8, 0); auto w8_0 = makeDiscreteFunction(W8, 0);
auto w8_1 = discreteFunction(W8, 1); auto w8_1 = makeDiscreteFunction(W8, 1);
w7 << expr; w7 << expr;
w8_0 << expr; w8_0 << expr;
w8_1 << expr; w8_1 << expr;
......
...@@ -29,9 +29,9 @@ void test() ...@@ -29,9 +29,9 @@ void test()
auto uVector = makeDOFVector(basis); auto uVector = makeDOFVector(basis);
auto u = discreteFunction(uVector); auto u = makeDiscreteFunction(uVector);
auto u_0 = discreteFunction(uVector, 0); auto u_0 = makeDiscreteFunction(uVector, 0);
auto u_1 = discreteFunction(uVector, 1); auto u_1 = makeDiscreteFunction(uVector, 1);
// eval a functor at global coordinates (at quadrature points) // eval a functor at global coordinates (at quadrature points)
u_0 << evalAtQP([](auto const& x) { return x[0] + x[1]; }); u_0 << evalAtQP([](auto const& x) { return x[0] + x[1]; });
...@@ -66,9 +66,9 @@ void test() ...@@ -66,9 +66,9 @@ void test()
(integrate(partialAtQP(u_0,0) + partialAtQP(u_1,1), gridView))); (integrate(partialAtQP(u_0,0) + partialAtQP(u_1,1), gridView)));
auto vVector(uVector); auto vVector(uVector);
auto v = discreteFunction(vVector); auto v = makeDiscreteFunction(vVector);
auto v_0 = discreteFunction(vVector, 0); auto v_0 = makeDiscreteFunction(vVector, 0);
auto v_1 = discreteFunction(vVector, 1); auto v_1 = makeDiscreteFunction(vVector, 1);
// test gradient // test gradient
v << evalAtQP([](auto const& x) { v << evalAtQP([](auto const& x) {
......
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