MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / ConvertL2Operator

Method ConvertL2Operator

comp/fespace.cpp:2352–2484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2350
2351
2352 shared_ptr<BaseMatrix> FESpace :: ConvertL2Operator (shared_ptr<FESpace> l2space) const
2353 {
2354 LocalHeap lh(100000000);
2355
2356 Array<int> classnr(ma->GetNE());
2357
2358 FlatArray<int> vertex_map;
2359 if (const PeriodicFESpace * periodic = dynamic_cast<const PeriodicFESpace*> (this))
2360 vertex_map.Assign (periodic->GetVertexMap());
2361
2362 ma->IterateElements
2363 (VOL, lh, [&] (auto el, LocalHeap & llh)
2364 {
2365 if (!DefinedOn (el) || !l2space->DefinedOn (el)) { classnr[el.Nr()] = -1; return; }
2366 classnr[el.Nr()] =
2367 SwitchET<ET_TRIG,ET_QUAD,ET_TET,ET_HEX>
2368 (el.GetType(),
2369 [el, vertex_map] (auto et) {
2370 if (vertex_map.Size())
2371 return ET_trait<et.ElementType()>::GetClassNr(vertex_map[el.Vertices()]);
2372 else
2373 return ET_trait<et.ElementType()>::GetClassNr(el.Vertices());
2374 });
2375 });
2376
2377 TableCreator<size_t> creator;
2378 for ( ; !creator.Done(); creator++)
2379 for (auto i : Range(classnr))
2380 if(classnr[i] >= 0)
2381 creator.Add (classnr[i], i);
2382 Table<size_t> table = creator.MoveTable();
2383
2384 shared_ptr<BaseMatrix> sum;
2385
2386 // size_t ne = ma->GetNE();
2387
2388 // scaling for multiple dofs (if actually not an L2 space)
2389 Array<int> cnt(l2space->GetNDof());
2390 cnt = 0;
2391
2392 for (auto elclass_inds : table)
2393 {
2394 HeapReset hr(lh);
2395 if (elclass_inds.Size() == 0) continue;
2396
2397 ElementId ei(VOL,elclass_inds[0]);
2398 auto & fel = GetFE (ei, lh);
2399 auto & fel_l2 = l2space->GetFE (ei, lh);
2400
2401 auto & trafo = GetFEElementTransformation(fel.ElementType());
2402 MixedFiniteElement fel_mixed(fel, fel_l2);
2403 auto evaluator = GetEvaluator(VOL);
2404 auto l2evaluator = l2space->GetEvaluator(VOL);
2405
2406 auto trial = make_shared<ProxyFunction>(dynamic_pointer_cast<FESpace>(const_cast<FESpace*>(this)->shared_from_this()),
2407 false, false, evaluator,
2408 nullptr, nullptr, nullptr, nullptr, nullptr);
2409 auto trial_l2 = make_shared<ProxyFunction>(l2space,

Callers

nothing calls this directly

Calls 15

VerticesMethod · 0.80
AddMethod · 0.80
GetParallelDofsMethod · 0.80
DefinedOnFunction · 0.70
GetEvaluatorFunction · 0.70
GetDofNrsFunction · 0.70
GetParallelDofsFunction · 0.70
RangeFunction · 0.50
InnerProductFunction · 0.50
CalcInverseFunction · 0.50
AssignMethod · 0.45
DefinedOnMethod · 0.45

Tested by

no test coverage detected