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

Method AddIndirect

linalg/basevector.cpp:580–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578 */
579
580 void BaseVector :: AddIndirect (FlatArray<int> ind,
581 FlatVector<double> v, bool use_atomic)
582 {
583 if (EntrySize() == 1)
584 {
585 FlatVector<double> lsv(Size(), FVDouble().Addr(0));
586
587 if (!use_atomic)
588 {
589 for (size_t i = 0; i < ind.Size(); i++)
590 if (IsRegularIndex(ind[i]))
591 lsv(ind[i]) += v(i);
592 }
593 else
594 {
595 for (size_t i = 0; i < ind.Size(); i++)
596 if (IsRegularIndex(ind[i]))
597 AtomicAdd (lsv(ind[i]), v(i));
598 // lsv(ind[i]) += v(i);
599 }
600 }
601 else
602 {
603 FlatSysVector<double> lsv(Size(), EntrySize(), FVDouble().Addr(0));
604 FlatSysVector<double> sv(ind.Size(), EntrySize(), v.Addr(0));
605
606 for (size_t i = 0; i < ind.Size(); i++)
607 if (IsRegularIndex(ind[i]))
608 lsv(ind[i]) += sv(i);
609 }
610 }
611
612 void BaseVector :: AddIndirect (FlatArray<int> ind,
613 FlatVector<Complex> v, bool use_atomic)

Callers

nothing calls this directly

Calls 8

EntrySizeFunction · 0.85
FVDoubleFunction · 0.85
FVComplexFunction · 0.85
AddrMethod · 0.80
SizeFunction · 0.70
IsRegularIndexFunction · 0.70
AtomicAddFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected