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

Method T_Integrate

comp/postproc.cpp:1531–1828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1529
1530 template <typename TSCAL>
1531 TSCAL Integral :: T_Integrate (const ngcomp::MeshAccess & ma,
1532 FlatVector<TSCAL> element_wise)
1533 {
1534 LocalHeap glh(10000000, "integrate-lh");
1535 bool use_simd = true;
1536 TSCAL sum = 0.0;
1537
1538 BitArray defon;
1539
1540 if (dx.definedon)
1541 {
1542 if (auto definedon_bitarray = get_if<BitArray> (&*dx.definedon))
1543 defon = *definedon_bitarray;
1544 if (auto definedon_string = get_if<string> (&*dx.definedon))
1545 {
1546 shared_ptr<MeshAccess> spma(const_cast<MeshAccess*>(&ma), NOOP_Deleter);
1547 Region reg(spma, dx.vb, *definedon_string);
1548 defon = reg.Mask();
1549 }
1550 }
1551
1552 constexpr int max_element_type = std::max(element_types);
1553 std::array<IntegrationRule*, max_element_type+1> user_ir;
1554 for (auto & ir_ptr : user_ir)
1555 ir_ptr = nullptr;
1556 std::array<unique_ptr<SIMD_IntegrationRule>, max_element_type+1> user_simd_ir;
1557
1558 for (auto [type, val] : dx.userdefined_intrules)
1559 {
1560 user_ir[type] = val.get();
1561 user_simd_ir[type] = make_unique<SIMD_IntegrationRule>(*user_ir[type]);
1562 }
1563
1564 if (dx.element_vb == VOL)
1565 {
1566 ma.IterateElements
1567 (this->dx.vb, glh, [&] (Ngs_Element el, LocalHeap & lh)
1568 {
1569 if (this->dx.definedonelements && !this->dx.definedonelements->Test(el.Nr())) return;
1570 // if(!mask.Test(el.GetIndex())) return;
1571 auto & trafo1 = ma.GetTrafo (el, lh);
1572 auto & trafo = trafo1.AddDeformation(this->dx.deformation.get(), lh);
1573
1574 if (defon.Size() && !defon.Test(el.GetIndex()))
1575 return;
1576
1577 TSCAL hsum = 0.0;
1578
1579 bool this_simd = use_simd;
1580 int order = 5+this->dx.bonus_intorder;
1581
1582 if (this_simd)
1583 {
1584 try
1585 {
1586 SIMD_IntegrationRule ir(trafo.GetElementType(), order);
1587 auto myir = user_simd_ir[trafo.GetElementType()] ? user_simd_ir[trafo.GetElementType()].get() : &ir;
1588 auto & mir = trafo(*myir, lh);

Callers

nothing calls this directly

Calls 15

FacetTypeMethod · 0.80
VerticesMethod · 0.80
FacetsMethod · 0.80
HSumFunction · 0.50
AtomicAddFunction · 0.50
getMethod · 0.45
NrMethod · 0.45
SizeMethod · 0.45
EvaluateMethod · 0.45
WidthMethod · 0.45
GetWeightMethod · 0.45

Tested by

no test coverage detected