| 258 | |
| 259 | template<int DIM> |
| 260 | void T_GapFunction<DIM> :: Update(shared_ptr<GridFunction> displacement_, int intorder2, double h_, bool both_sides) |
| 261 | { |
| 262 | h = h_; |
| 263 | this->both_sides = both_sides; |
| 264 | |
| 265 | displacement = displacement_; |
| 266 | |
| 267 | LocalHeap lh(1000000, "T_GapFunction::Update"); |
| 268 | netgen::Box<DIM> bbox{netgen::Box<DIM>::EMPTY_BOX}; |
| 269 | double maxh = 0; |
| 270 | for (Ngs_Element el2 : ma->Elements(BND)) |
| 271 | { |
| 272 | HeapReset hr(lh); |
| 273 | auto & mask = other.Mask(); |
| 274 | if (!mask.Test(el2.GetIndex())) continue; |
| 275 | |
| 276 | auto & trafo2 = ma->GetTrafo (el2, lh); |
| 277 | auto & trafo2_def = trafo2.AddDeformation(displacement.get(), lh); |
| 278 | |
| 279 | IntegrationRule ir2_(trafo2.GetElementType(), intorder2); |
| 280 | for(auto ir2 : ir2_.Split()) |
| 281 | { |
| 282 | HeapReset hr(lh); |
| 283 | MappedIntegrationRule<DIM-1, DIM> mir2(ir2, trafo2, lh); |
| 284 | MappedIntegrationRule<DIM-1, DIM> mir2_def(ir2, trafo2_def, lh); |
| 285 | |
| 286 | netgen::Box<DIM> el_box{netgen::Box<DIM>::EMPTY_BOX}; |
| 287 | for (auto & mip : mir2_def) |
| 288 | { |
| 289 | netgen::Point<DIM> p; |
| 290 | for (int j = 0; j < DIM; j++) |
| 291 | p(j) = mip.GetPoint()(j); |
| 292 | bbox.Add(p); |
| 293 | if(h==0.0) |
| 294 | el_box.Add(p); |
| 295 | } |
| 296 | maxh = max(maxh, el_box.Diam()); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | // Default-value for h is 2 * maximum_element_diameter |
| 301 | if(h==0.0) |
| 302 | h = 2*maxh; |
| 303 | |
| 304 | bbox.Scale(2); // make sure we don't add boxes outside of tree bounding box |
| 305 | searchtree = make_unique<netgen::BoxTree<DIM, int>>(bbox); |
| 306 | for (Ngs_Element el2 : ma->Elements(BND)) |
| 307 | { |
| 308 | HeapReset hr(lh); |
| 309 | auto & mask = other.Mask(); |
| 310 | if (!mask.Test(el2.GetIndex())) continue; |
| 311 | |
| 312 | auto & trafo2 = ma->GetTrafo (el2, lh); |
| 313 | auto & trafo2_def = trafo2.AddDeformation(displacement.get(), lh); |
| 314 | |
| 315 | IntegrationRule ir2_(trafo2.GetElementType(), intorder2); |
| 316 | netgen::Box<DIM> elbox{netgen::Box<DIM>::EMPTY_BOX}; |
| 317 | for(auto ir2 : ir2_.Split()) |
nothing calls this directly
no test coverage detected