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

Function IterateElements

comp/fespace.cpp:2123–2198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2121 }
2122
2123 void IterateElements (const FESpace & fes,
2124 VorB vb,
2125 LocalHeap & clh,
2126 const function<void(FESpace::Element,LocalHeap&)> & func)
2127 {
2128 static mutex copyex_mutex;
2129 const Table<int> & element_coloring = fes.ElementColoring(vb);
2130
2131 if (auto *task_manager = GetTaskManager(); task_manager)
2132 {
2133 for (FlatArray<int> els_of_col : element_coloring)
2134 {
2135 SharedLoop2 sl(els_of_col.Range());
2136
2137 task_manager -> CreateJob
2138 ( [&] (const TaskInfo & ti)
2139 {
2140 LocalHeap lh = clh.Split(ti.thread_nr, ti.nthreads);
2141 ArrayMem<int,100> temp_dnums;
2142
2143 for (int mynr : sl)
2144 {
2145 HeapReset hr(lh);
2146 FESpace::Element el(fes,
2147 ElementId (vb, els_of_col[mynr]),
2148 temp_dnums, lh);
2149
2150 func (std::move(el), lh);
2151 }
2152
2153 ProgressOutput::SumUpLocal();
2154 } );
2155 }
2156 return;
2157 }
2158
2159
2160 Exception * ex = nullptr;
2161
2162 for (FlatArray<int> els_of_col : element_coloring)
2163 ParallelForRange( IntRange(els_of_col.Size()), [&] ( IntRange r )
2164 {
2165 LocalHeap lh = clh.Split();
2166 Array<int> temp_dnums;
2167
2168 // lh.ClearValues();
2169
2170 for (int i : r)
2171 {
2172 try
2173 {
2174 HeapReset hr(lh);
2175 FESpace::Element el(fes, ElementId (vb, els_of_col[i]), temp_dnums, lh);
2176
2177 func (std::move(el), lh);
2178 }
2179
2180 catch (const Exception & e)

Callers 15

InterpolateMethod · 0.70
InterpolateMethod · 0.70
ApplyMassL2ConstMethod · 0.70
bilinearform.cppFile · 0.70
DoAssembleMethod · 0.70
ComputeInternalMethod · 0.70
AddMatrixTransMethod · 0.70
AddMatrix1Method · 0.70
EnergyMethod · 0.70
CalcFluxProjectFunction · 0.70

Calls 4

ElementIdClass · 0.85
RangeMethod · 0.45
SplitMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected