4#include<dune/pdelab/boilerplate/pdelab.hh>
9 template<
typename P,
typename GFS,
typename CG,
bool isFunction>
10 struct ConstraintsAssemblerHelperExterior
28 assemble(
const P& p,
const GFS& gfs, CG& cg,
const bool verbose)
31 using ES =
typename GFS::Traits::EntitySet;
33 using Intersection =
typename ES::Traits::Intersection;
35 ES es = gfs.entitySet();
38 using LFS = LocalFunctionSpace<GFS>;
40 LFSIndexCache<LFS> lfs_cache_e(lfs_e);
42 LFSIndexCache<LFS> lfs_cache_f(lfs_f);
48 for (
const auto& element : elements(es))
56 using CL =
typename CG::LocalTransformation;
61 using IntersectionWrapper = IntersectionGeometry<Intersection>;
66 unsigned int intersection_index = 0;
67 for (
const auto& intersection : intersections(es,element))
70 auto intersection_data = classifyIntersection(es,intersection);
71 auto intersection_type = std::get<0>(intersection_data);
74 switch (intersection_type) {
76 case IntersectionType::skeleton:
77 case IntersectionType::periodic:
99 case IntersectionType::boundary:
101 TypeTree::applyToTreePair(p,lfs_e,BoundaryConstraints<IntersectionWrapper,CL>(IntersectionWrapper(intersection,intersection_index),cl_self));
104 case IntersectionType::processor:
109 ++intersection_index;
112 if (!cl_self.empty())
114 lfs_cache_e.update();
115 cg.import_local_transformation(cl_self,lfs_cache_e);
122 std::cout <<
"constraints:" << std::endl;
124 std::cout << cg.size() <<
" constrained degrees of freedom" << std::endl;
126 for (
const auto& col : cg)
128 std::cout << col.first <<
": ";
129 for (
const auto& row : col.second)
130 std::cout <<
"(" << row.first <<
"," << row.second <<
") ";
131 std::cout << std::endl;
144 template<
typename P,
typename GFS,
typename CG>
145 void constraints_exterior(
const P& p,
const GFS& gfs, CG& cg,
146 const bool verbose =
false)
150 ConstraintsAssemblerHelperExterior<P, GFS, CG, IsGridFunction<P>::value>::assemble(p,gfs,cg,verbose);
153 template<
typename Gr
id,
unsigned int degree, Dune::GeometryType::BasicType gt,
typename BCType,
typename GV =
typename Gr
id::LeafGr
idView>
154 class CGCONBaseExterior
157 typedef ConformingDirichletConstraints CON;
159 CGCONBaseExterior (Grid& grid,
const BCType& bctype,
const GV& gv)
161 conp = std::shared_ptr<CON>(
new CON());
164 CGCONBaseExterior (Grid& grid,
const BCType& bctype)
166 conp = std::shared_ptr<CON>(
new CON());
169 template<
typename GFS>
170 void postGFSHook (
const GFS& gfs) {}
171 CON& getCON() {
return *conp;}
172 const CON& getCON()
const {
return *conp;}
173 template<
typename GFS,
typename DOF>
174 void make_consistent (
const GFS& gfs, DOF& x)
const
177 istl::ParallelHelper<GFS> helper(gfs);
178 helper.maskForeignDOFs(Backend::native(x));
179 Dune::PDELab::AddDataHandle<GFS,DOF> adddh(gfs,x);
180 if (gfs.gridView().comm().size()>1)
181 gfs.gridView().communicate(adddh,Dune::InteriorBorder_All_Interface,Dune::ForwardCommunication);
184 std::shared_ptr<CON> conp;