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

Method RegionCF

comp/meshaccess.cpp:2409–2436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2407 }
2408
2409 shared_ptr<CoefficientFunction> MeshAccess ::
2410 RegionCF(VorB vb, shared_ptr<CoefficientFunction> default_value, const Array<pair<variant<string, Region>, shared_ptr<CoefficientFunction>>>& region_values)
2411 {
2412 Array<shared_ptr<CoefficientFunction>> cfs(GetNRegions(vb));
2413 shared_ptr<MeshAccess> spm(this, NOOP_Deleter);
2414 for(const auto& val : region_values)
2415 {
2416 const auto& key = val.first;
2417 Region region;
2418 if(auto skey = get_if<string>(&key); skey)
2419 region = Region(spm, vb, *skey);
2420 else
2421 {
2422 region = *get_if<Region>(&key);
2423 if(region.VB() != vb)
2424 throw Exception("Region with false vb given to region wise CF!");
2425 }
2426 for(auto i : Range(region.Mask().Size()))
2427 {
2428 if(region.Mask()[i])
2429 cfs[i] = val.second;
2430 }
2431 }
2432 for(auto i : Range(cfs))
2433 if(cfs[i] == nullptr)
2434 cfs[i] = default_value;
2435 return MakeDomainWiseCoefficientFunction(std::move(cfs), vb);
2436 }
2437
2438 class BoundaryFromVolumeCoefficientFunction :
2439 public T_CoefficientFunction<BoundaryFromVolumeCoefficientFunction>

Callers

nothing calls this directly

Calls 6

GetNRegionsFunction · 0.85
RegionClass · 0.70
RangeFunction · 0.50
VBMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected