Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit d64976bf authored by Müller, Felix's avatar Müller, Felix
Browse files

Remove makeGlobalBasis

parent ccde07a0
Pipeline #4558 passed with stage
in 42 minutes and 59 seconds
......@@ -91,12 +91,12 @@ namespace AMDiS
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)
{
return makeGlobalBasis(gridView, PreBasisCreator::create());
return ParallelGlobalBasis(gridView, PreBasisCreator::create());
}
using GlobalBasis = decltype(create(std::declval<GridView>()));
......
......@@ -37,6 +37,13 @@
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
*
......@@ -92,11 +99,11 @@ namespace AMDiS
, comm_(CommunicationCreator<Comm>::create(static_cast<Super const&>(*this), name + "->solver"))
{}
/// Construct this global basis with empty name
template <class... Args,
Dune::Functions::enableIfConstructible<PreBasis, Args...> = 0>
ParallelGlobalBasis(Grid const& grid, Args&&... args)
: ParallelGlobalBasis(std::string(""), grid, FWD(args)...)
/// Construct this global basis with a preBasisFactory
template <class PBF>
ParallelGlobalBasis(std::string const& name, GridView const& gridView, PBF&& preBasisFactory)
: ParallelGlobalBasis(name, gridView.grid(),
preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))
{}
/// Converting constructor from dune-functions style basis.
......@@ -105,10 +112,16 @@ namespace AMDiS
* argument and a new communication object is built.
*/
template <class GB_,
Dune::disableCopyMove<Self, GB_> = 0,
REQUIRES(Concepts::GlobalBasis<GB_,GridView>)>
ParallelGlobalBasis(GB_&& from)
: ParallelGlobalBasis(std::string(""), from.gridView().grid(), from.preBasis())
ParallelGlobalBasis(std::string const& name, GB_&& from)
: 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
......@@ -175,29 +188,15 @@ namespace AMDiS
};
template <class MultiIndex, class GV, class PBF>
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));
}
// Deduction guides
template <class GV, class PBF>
auto makeGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory)
{
using RawPreBasisFactory = remove_cvref_t<PBF>;
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));
}
ParallelGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory)
-> ParallelGlobalBasis<decltype(
preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))>;
template <class GV, class PBF>
auto makeGlobalBasis(GV const& gridView, PBF&& preBasisFactory)
{
return makeGlobalBasis(std::string(""), gridView, FWD(preBasisFactory));
}
ParallelGlobalBasis(GV const& gridView, PBF&& preBasisFactory)
-> ParallelGlobalBasis<decltype(
preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))>;
} // end namespace AMDiS
......@@ -109,12 +109,12 @@ using Grid = Dune::YaspGrid<2>;
Grid grid({1.0, 1.0}, {2, 2});
using namespace Dune::Functions::BasisFactory;
auto basis1 = makeGlobalBasis(grid.leafGridView(), lagrange<2>());
ParallelGlobalBasis basis1(grid.leafGridView(), lagrange<2>());
DOFVector<decltype(basis1)> vec0(basis1);
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));
```
......@@ -251,7 +251,7 @@ underlying type is either the `remove_cvref_t` for references, or the pointed-to
using namespace Dune::Functions::BasisFactory;
// pass a reference to the basis
auto basis1 = makeGlobalBasis(gridView, lagrange<2>());
ParallelGlobalBasis basis1(gridView, lagrange<2>());
auto vec1 = makeDOFVector<double>(basis1);
// pass a smart pointer
......@@ -391,7 +391,7 @@ Returns the const (1) or mutable (2) sub-range view of the stored DOFVector.
#### Example
```c++
auto basis = makeGlobalBasis(gridView, power<3>(lagrange<1>()));
ParallelGlobalBasis basis(gridView, power<3>(lagrange<1>()));
auto vec = makeDOFVector(basis);
auto df = makeDiscreteFunction(vec);
......@@ -452,7 +452,7 @@ Note, the range type of the expression must be compatible with the `Range` type
#### Example
```c++
auto basis = makeGlobalBasis(gridView, power<3>(lagrange<1>()));
ParallelGlobalBasis basis(gridView, power<3>(lagrange<1>()));
auto vec = makeDOFVector(basis);
auto df1 = vec.child();
......@@ -504,7 +504,7 @@ thereby given by the type of `makeTreePath(preTreePath)`.
using namespace Dune::Functions::BasisFactory;
// 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 df1 = makeDiscreteFunction(vec);
......@@ -512,4 +512,3 @@ auto df2 = makeDiscreteFunction(vec, 1);
auto df3 = makeDiscreteFunction(vec, _1);
auto df4 = makeDiscreteFunction(vec, Dune::TypeTree::hybridTreePath(0));
```
......@@ -119,7 +119,7 @@ using namespace Dune::Functions::BasisFactory;
// create a power basis of 3 lagrange bases with local polynomial degree 2
// on the leaf elements of the grid
auto basis1 = makeGlobalBasis(grid2->leafGridView(), power<3>(lagrange<2>()));
ParallelGlobalBasis basis1(grid2->leafGridView(), power<3>(lagrange<2>()));
```
or by using some predefined wrappers:
......@@ -139,8 +139,7 @@ auto basis2 = BasisCreator::create(grid2->leafGridView());
grid refinement or by repartitioning. Additionally, it stores a communication object
to construct global DOFMappings for distributed data structured.
This `ParallelGlobalBasis` is automatically constructed with `makeGlobalBasis` and
can be converted from a `DefaultGlobalBasis` of dune-functions.
This `ParallelGlobalBasis` can be converted from a `DefaultGlobalBasis` of dune-functions.
A [`DOFVector`](../reference/DOFVector.md) takes a global basis and provides the coefficient vector as data member.
......
......@@ -72,7 +72,7 @@ int main(int argc, char** argv)
auto preBasis = composite(power<2>(lagrange<2>(), flatInterleaved()),
lagrange<1>(),
flatLexicographic());
auto basis = makeGlobalBasis(gridView, preBasis);
ParallelGlobalBasis basis(gridView, preBasis);
using Basis = decltype(basis);
......
......@@ -22,9 +22,9 @@ void test()
// use T as range type for basis
using namespace Dune::Functions::BasisFactory;
#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7)
auto basis = makeGlobalBasis(grid.leafGridView(), power<1>(lagrange<1>(), flatLexicographic()));
ParallelGlobalBasis basis(grid.leafGridView(), power<1>(lagrange<1>(), flatLexicographic()));
#else
auto basis = makeGlobalBasis(grid.leafGridView(), power<1>(lagrange<1,T>(), flatLexicographic()));
ParallelGlobalBasis basis(grid.leafGridView(), power<1>(lagrange<1,T>(), flatLexicographic()));
#endif
using Basis = decltype(basis);
......
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