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

Method AddMatrixTrans

comp/bilinearform.cpp:5045–5137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5043
5044 template <class SCAL>
5045 void S_BilinearForm<SCAL> :: AddMatrixTrans (double val,
5046 const BaseVector & x,
5047 BaseVector & y, LocalHeap & clh) const
5048 {
5049 if (geom_free_parts.Size())
5050 AddMatrixGF(val, x, y, true, clh);
5051 if (geom_free_parts.Size() == parts.Size()) return;
5052
5053 if (!MixedSpaces())
5054 {
5055 for (auto vb : { VOL, BND, BBND, BBBND } )
5056 if (VB_parts[vb].Size())
5057 {
5058 IterateElements
5059 (*fespace, vb, clh,
5060 [&] (FESpace::Element el, LocalHeap & lh)
5061 {
5062 // RegionTimer reg (timer_loop);
5063 auto & fel = el.GetFE();
5064 auto & trafo = el.GetTrafo();
5065 auto dnums = el.GetDofs();
5066
5067 FlatVector<SCAL> elvecx (dnums.Size() * fespace->GetDimension(), lh);
5068 FlatVector<SCAL> elvecy (dnums.Size() * fespace->GetDimension(), lh);
5069
5070 x.GetIndirect (dnums, elvecx);
5071 this->fespace->TransformVec (el, elvecx, TRANSFORM_SOL);
5072
5073 for (auto & bfi : VB_parts[vb])
5074 {
5075 if (!bfi->DefinedOn (el.GetIndex())) continue;
5076 if (!bfi->DefinedOnElement (el.Nr())) continue;
5077
5078 auto & mapped_trafo = trafo.AddDeformation(bfi->GetDeformation().get(), lh);
5079
5080 bfi->ApplyElementMatrixTrans (fel, mapped_trafo, elvecx, elvecy, 0, lh);
5081
5082 this->fespace->TransformVec (el, elvecy, TRANSFORM_RHS);
5083
5084 elvecy *= val;
5085 y.AddIndirect (dnums, elvecy, fespace->HasAtomicDofs()); // coloring
5086 }
5087 });
5088 }
5089 }
5090 else // MixedSpaces
5091 {
5092 static Timer timer ("Apply Matrix Trans - mixed"); RegionTimer reg(timer);
5093
5094 for (auto vb : { VOL, BND, BBND } )
5095 if (VB_parts[vb].Size())
5096 {
5097 IterateElements
5098 (*fespace, vb, clh,
5099 [&] (ElementId ei, LocalHeap & lh)
5100
5101 {
5102 if (!fespace->DefinedOn (ei)) return;

Callers

nothing calls this directly

Calls 11

MixedSpacesFunction · 0.85
GetIndirectMethod · 0.80
TransformVecMethod · 0.80
IterateElementsFunction · 0.70
SizeMethod · 0.45
GetDimensionMethod · 0.45
DefinedOnMethod · 0.45
NrMethod · 0.45
getMethod · 0.45
GetNDofMethod · 0.45
GetDofNrsMethod · 0.45

Tested by

no test coverage detected