DUNE PDELab (git)

localoperator_ovlp_region.hh
1#ifndef DUNE_PDELAB_BACKEND_ISTL_GENEO_LOCALOPERATOR_OVLP_REGION_HH
2#define DUNE_PDELAB_BACKEND_ISTL_GENEO_LOCALOPERATOR_OVLP_REGION_HH
3
4#include <dune/pdelab/backend/interface.hh>
5#include <dune/pdelab/gridfunctionspace/lfsindexcache.hh>
6
7namespace Dune {
8 namespace PDELab {
9
17 template<typename LocalOperatorBase, typename GFS>
19
20 typedef Dune::PDELab::Backend::Vector<GFS,int> V;
21
22 public:
23 LocalOperatorOvlpRegion (LocalOperatorBase& base_, const GFS& gfs)
24 : baseop(base_), subdomain_sum(gfs, 1) {
25 // Add ones; any value > 1 then indicates multiple subdomains covering this DOF
26 Dune::PDELab::AddDataHandle<GFS,V> addh(gfs,subdomain_sum);
27 gfs.gridView().communicate(addh,Dune::All_All_Interface,Dune::ForwardCommunication);
28 }
29
30 // selective assembly flags
31 enum { doSkipEntity = LocalOperatorBase::doSkipEntity };
32 enum { doSkipIntersection = LocalOperatorBase::doSkipIntersection };
33
34 // pattern assembly flags
35 enum { doPatternVolume = LocalOperatorBase::doPatternVolume };
36 enum { doPatternSkeleton = LocalOperatorBase::doPatternSkeleton };
37 enum { doPatternVolumePostSkeleton = LocalOperatorBase::doPatternVolumePostSkeleton };
38 enum { doPatternBoundary = LocalOperatorBase::doPatternBoundary };
39
40 // residual assembly flags
41 enum { doAlphaVolume = true };
42 enum { doAlphaVolumePostSkeleton = LocalOperatorBase::doAlphaVolumePostSkeleton };
43 //enum { doAlphaPostSkeletonVolume = LocalOperatorBase::doAlphaPostSkeletonVolume };
44 enum { doAlphaBoundary = true };
45
46 enum { doAlphaSkeleton = LocalOperatorBase::doAlphaSkeleton };
47 enum { doLambdaVolume = LocalOperatorBase::doLambdaVolume };
48 enum { doLambdaBoundary = LocalOperatorBase::doLambdaBoundary };
49 enum { doLambdaSkeleton = LocalOperatorBase::doLambdaSkeleton };
50
51 enum { doSkeletonTwoSided = LocalOperatorBase::doSkeletonTwoSided };
52 enum { isLinear = LocalOperatorBase::isLinear };
53
54 template<typename EG>
55 bool skip_entity (const EG& eg) const
56 {
57 return baseop.skip_entity(eg);
58 }
59
60 template<typename IG>
61 bool skip_intersection (const IG& ig) const
62 {
63 return baseop.skip_intersection(ig);
64 }
65
66 template<typename LFSU, typename LFSV, typename LocalPattern>
67 void pattern_volume (const LFSU& lfsu, const LFSV& lfsv, LocalPattern& pattern) const
68 {
69 if (entity_is_interior(lfsu))
70 return;
71 baseop.pattern_volume(lfsu, lfsv, pattern);
72 }
73
74 template<typename LFSU, typename LFSV, typename LocalPattern>
75 void pattern_skeleton (const LFSU& lfsu_s, const LFSV& lfsv_s, const LFSU& lfsu_n, const LFSV& lfsv_n, LocalPattern& pattern_sn, LocalPattern& pattern_ns) const
76 {
77 if (entity_is_interior(lfsu_s))
78 return;
79 baseop.pattern_skeleton(lfsu_s, lfsv_s, lfsu_n, lfsv_n, pattern_sn, pattern_ns);
80 }
81
82 template<typename LFSU, typename LFSV, typename LocalPattern>
83 void pattern_volume_post_skeleton (const LFSU& lfsu, const LFSV& lfsv, LocalPattern& pattern) const
84 {
85 if (entity_is_interior(lfsu))
86 return;
87 baseop.pattern_volume(lfsu, lfsv, pattern);
88 }
89
90 template<typename LFSU, typename LFSV, typename LocalPattern>
91 void pattern_boundary (const LFSU& lfsu_s, const LFSV& lfsv_s, LocalPattern& pattern_ss) const
92 {
93 if (entity_is_interior(lfsu_s))
94 return;
95 baseop.pattern_boundary (lfsu_s, lfsv_s, pattern_ss);
96 }
97
98 template<typename EG, typename LFSU, typename X, typename LFSV, typename R>
99 void alpha_volume (const EG& eg, const LFSU& lfsu, const X& x, const LFSV& lfsv, R& r) const
100 {
101 if (entity_is_interior(lfsu))
102 return;
103 baseop.alpha_volume(eg, lfsu, x, lfsv, r);
104 }
105
106 // jacobian of volume term
107 template<typename EG, typename LFSU, typename X, typename LFSV, typename M>
108 void jacobian_volume (const EG& eg, const LFSU& lfsu, const X& x, const LFSV& lfsv, M& mat) const
109 {
110 if (entity_is_interior(lfsu))
111 return;
112 baseop.jacobian_volume (eg, lfsu, x, lfsv, mat);
113 }
114
115 // volume integral depending only on test functions
116 template<typename EG, typename LFSV, typename R>
117 void lambda_volume (const EG& eg, const LFSV& lfsv, R& r) const
118 {
119 if (entity_is_interior(lfsv))
120 return;
121 baseop.lambda_volume (eg, lfsv, r);
122 }
123
124 // post skeleton: compute time step allowable for cell; to be done later
125 template<typename EG, typename LFSU, typename X, typename LFSV, typename R>
126 void alpha_volume_post_skeleton(const EG& eg, const LFSU& lfsu, const X& x,
127 const LFSV& lfsv, R& r) const
128 {
129 if (entity_is_interior(lfsu))
130 return;
131 baseop.alpha_volume_post_skeleton (eg, lfsu, x, lfsv, r);
132 }
133
134 // boundary integral
135 template<typename IG, typename LFSU, typename X, typename LFSV, typename R>
136 void alpha_boundary (const IG& ig,
137 const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
138 R& r_s) const
139 {
140 if (entity_is_interior(lfsu_s))
141 return;
142 baseop.alpha_boundary (ig, lfsu_s, x_s, lfsv_s, r_s);
143 }
144
145 // jacobian contribution from boundary
146 template<typename IG, typename LFSU, typename X, typename LFSV, typename M>
147 void jacobian_boundary (const IG& ig,
148 const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
149 M& mat_s) const
150 {
151 if (entity_is_interior(lfsu_s))
152 return;
153 baseop.jacobian_boundary (ig, lfsu_s, x_s, lfsv_s, mat_s);
154 }
155
156 template<typename IG, typename LFSU, typename X, typename LFSV, typename R>
157 void alpha_skeleton (const IG& ig,
158 const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
159 const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
160 R& r_s, R& r_n) const
161 {
162 if (entity_is_interior(lfsu_s))
163 return;
164 baseop.alpha_skeleton (ig, lfsu_s, x_s, lfsv_s, lfsu_n, x_n, lfsv_n, r_s, r_n);
165 }
166
167 template<typename IG, typename LFSU, typename X, typename LFSV, typename M>
168 void jacobian_skeleton (const IG& ig,
169 const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
170 const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
171 M& mat_ss, M& mat_sn,
172 M& mat_ns, M& mat_nn) const
173 {
174 if (entity_is_interior(lfsu_s))
175 return;
176 baseop.jacobian_skeleton (ig, lfsu_s, x_s, lfsv_s, lfsu_n, x_n, lfsv_n, mat_ss, mat_sn, mat_ns, mat_nn);
177 }
178
179
180 void setTime (double t)
181 {
182 baseop.setTime(t);
183 }
184
185 private:
186
187 template <typename LFS>
188 bool entity_is_interior (const LFS& lfs) const {
189 LFSIndexCache<LFS> cache(lfs);
190 cache.update();
191 for (std::size_t i = 0; i < cache.size(); i++)
192 {
193 if (subdomain_sum[cache.containerIndex(i)] < 2)
194 return true;
195 }
196 return false;
197 }
198
199 LocalOperatorBase& baseop;
200 V subdomain_sum;
201 };
202
203 }
204}
205
206#endif //DUNE_PDELAB_BACKEND_ISTL_GENEO_LOCALOPERATOR_OVLP_REGION_HH
Wrapper for LocalOperators restricting their action to areas overlapping with other subdomains Any en...
Definition: localoperator_ovlp_region.hh:18
@ ForwardCommunication
communicate as given in InterfaceType
Definition: gridenums.hh:171
@ All_All_Interface
send all and receive all entities
Definition: gridenums.hh:91
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)