22 :
private ObserverSequence<event::adapt,2>
25 using SourceBasisType = SourceBasis;
26 using TargetBasisType = TargetBasis;
34 assert(&source_->gridView().grid() == &target_->gridView().grid());
46 void updateImpl(
event::adapt e, index_t<0> i)
override {
if (update_) updateImpl2();
else update_ =
true; }
47 void updateImpl(
event::adapt e, index_t<1> i)
override {
if (update_) updateImpl2();
else update_ =
true; }
57 auto sourceLocalView = source_->localView();
58 auto targetLocalView = target_->localView();
59 for (
auto const& e : elements(source_->gridView())) {
60 sourceLocalView.bind(e);
61 targetLocalView.bind(e);
63 assert(sourceLocalView.size() == targetLocalView.size());
64 for (std::size_t i = 0, s = sourceLocalView.size(); i < s; ++i)
65 mapping_[sourceLocalView.index(i)] = targetLocalView.index(i);
77 typename TargetBasis::MultiIndex
const&
operator()(
typename SourceBasis::MultiIndex
const& mi)
const
79 return mapping_.at(mi);
83 typename TargetBasis::MultiIndex
const&
operator()(std::size_t idx)
const
86 typename SourceBasis::MultiIndex mi{idx};
87 return mapping_.at(mi);
98 std::shared_ptr<SourceBasis>
const&
source()
const
104 std::shared_ptr<TargetBasis>
const&
target()
const
111 template <
class T,
class A>
112 void resize(std::vector<T,A>& mapping)
const
114 mapping.resize(source_->dimension());
118 template <
class Container>
119 void resize(Container& mapping)
const
125 std::shared_ptr<SourceBasis> source_;
126 std::shared_ptr<TargetBasis> target_;
129 bool update_ =
false;
TargetBasis::MultiIndex const & operator()(std::size_t idx) const
Map a flat source into to a target index.
Definition BasisMapping.hpp:83
TargetBasis::MultiIndex const & operator()(typename SourceBasis::MultiIndex const &mi) const
Map a source index to a target index.
Definition BasisMapping.hpp:77