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

Function PrecomputeCacheCF

fem/coefficient.cpp:7821–7852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7819
7820
7821void PrecomputeCacheCF (const Array<CoefficientFunction*> & cachecfs, BaseMappedIntegrationRule & mir,
7822 LocalHeap & lh)
7823{
7824 // static Timer t("Precompute CacheCF");
7825 // RegionTracer reg(TaskManager::GetThreadId(), t);
7826
7827 auto & trafo = mir.GetTransformation();
7828 ProxyUserData * ud = static_cast<ProxyUserData*> (trafo.userdata);
7829 if (!ud) throw Exception ("don't have a userdata");
7830
7831 new (&ud->caches) FlatArray<pair<const CoefficientFunction*, void*>> (cachecfs.Size(), lh);
7832
7833 for (int i = 0; i < cachecfs.Size(); i++)
7834 {
7835 ud->caches[i].first = cachecfs[i];
7836 // or complex ...
7837 if (cachecfs[i]->IsComplex())
7838 {
7839 auto * mat = new (lh) FlatMatrix<Complex>(mir.Size(), cachecfs[i]->Dimension(), lh);
7840 static_cast<CacheCoefficientFunction*>(cachecfs[i])->Func() -> Evaluate (mir, *mat);
7841 ud->caches[i].second = mat;
7842 }
7843 else
7844 {
7845 auto * mat = new (lh) FlatMatrix<double>(mir.Size(), cachecfs[i]->Dimension(), lh);
7846 static_cast<CacheCoefficientFunction*>(cachecfs[i])->Func() -> Evaluate (mir, *mat);
7847 ud->caches[i].second = mat;
7848 }
7849
7850 }
7851
7852}
7853
7854
7855

Calls 9

GetTransformationMethod · 0.80
FuncMethod · 0.80
ContainsMethod · 0.80
SizeMethod · 0.45
IsComplexMethod · 0.45
DimensionMethod · 0.45
EvaluateMethod · 0.45
TraverseTreeMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected