3#ifndef DUNE_PDELAB_CONSTRAINTS_COMMON_CONSTRAINTSTRANSFORMATION_HH
4#define DUNE_PDELAB_CONSTRAINTS_COMMON_CONSTRAINTSTRANSFORMATION_HH
7#include <unordered_map>
17 template<
typename DI,
typename CI,
typename F>
19 :
public std::unordered_map<CI,std::unordered_map<CI,F> >
22 typedef std::unordered_map<CI,std::unordered_map<CI,F> > BaseT;
29 class LocalTransformation
30 :
public std::unordered_map<DI,std::unordered_map<DI,F> >
38 typedef std::unordered_map<DI,F>
RowType;
40 bool containsNonDirichletConstraints()
const
43 this->begin(), this->end(),
44 [] (
const std::pair<DI,RowType> & c)
45 ->
bool {
return (!c.second.empty()); });
51 typedef typename ConstraintsTransformation::mapped_type
RowType;
54 : _contains_non_dirichlet_constraints(false)
60 _contains_non_dirichlet_constraints =
false;
63 template<
typename IndexCache>
64 void import_local_transformation(
const LocalTransformation& local_transformation,
const IndexCache& index_cache)
66 typedef typename IndexCache::ContainerIndex ContainerIndex;
67 typedef typename ConstraintsTransformation::iterator GlobalConstraintIterator;
68 typedef typename ConstraintsTransformation::mapped_type GlobalConstraint;
70 for (
const auto& local_constraint : local_transformation)
72 const ContainerIndex& ci = index_cache.containerIndex(local_constraint.first);
74 std::pair<GlobalConstraintIterator,bool> r =
75 this->insert(make_pair(ci,GlobalConstraint()));
77 GlobalConstraint& global_constraint = r.first->second;
80 if (!r.second && global_constraint.empty())
85 if (local_constraint.second.empty())
87 global_constraint.clear();
92 _contains_non_dirichlet_constraints =
true;
95 for (
const auto& local_entry : local_constraint.second)
96 global_constraint[index_cache.containerIndex(local_entry.first)] = local_entry.second;
100 bool containsNonDirichletConstraints()
const
102 return _contains_non_dirichlet_constraints;
107 bool _contains_non_dirichlet_constraints;
111 class EmptyTransformation :
public ConstraintsTransformation<char,char,char>
116 bool containsNonDirichletConstraints()
const
Dune namespace.
Definition: alignedallocator.hh:13