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

Method ProcessVectorizedBatchSS

bem/mptools.hpp:643–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641
642 template<int N, int vec_length>
643 static void ProcessVectorizedBatchSS(FlatArray<RecordingSS*> batch, double len, double theta) {
644
645 // *testout << "Processing vectorized S->S batch of size " << batch.Size() << ", with N = " << N << ", vec_length = " << vec_length << ", len = " << len << ", theta = " << theta << endl;
646 T_Kappa kappa = batch[0]->mp_source->Kappa();
647 int so = batch[0]->mp_source->Order();
648 int to = batch[0]->mp_target->Order();
649 SphericalExpansion<Singular, Vec<N,Complex>, T_Kappa> vec_source(so, kappa, batch[0]->mp_source->RTyp());
650 SphericalExpansion<Singular, Vec<N,Complex>, T_Kappa> vec_target(to, kappa, batch[0]->mp_target->RTyp());
651
652 // Copy multipoles into vectorized multipole
653 for (int i = 0; i < batch.Size(); i++)
654 {
655 auto source_i = VecVector2Matrix (batch[i]->mp_source->SH().Coefs());
656 auto source_mati = VecVector2Matrix (vec_source.SH().Coefs()).Cols(i*vec_length, (i+1)*vec_length);
657 batch[i]->mp_source->SH().RotateZFlip(batch[i]->phi, batch[i]->flipz,
658 [source_i, source_mati] (size_t ii, Complex factor)
659 {
660 source_mati.Row(ii) = factor * source_i.Row(ii);
661 });
662 }
663
664 vec_source.SH().RotateY(theta, vec_source.SH().Order() >= 100);
665 vec_source.ShiftZ(-len, vec_target);
666 vec_target.SH().RotateY(-theta, vec_target.SH().Order() >= 100);
667
668 // Copy vectorized multipole into individual multipoles
669 for (int i = 0; i < batch.Size(); i++)
670 {
671 auto source_mati = VecVector2Matrix (vec_target.SH().Coefs()).Cols(i*vec_length, (i+1)*vec_length);
672 auto target_mati = VecVector2Matrix (batch[i]->mp_target->SH().Coefs());
673 batch[i]->mp_target->SH().RotateZFlip(-batch[i]->phi, batch[i]->flipz,
674 [source_mati, target_mati] (size_t ii, Complex factor)
675 {
676 AtomicAdd (target_mati.Row(ii), factor * source_mati.Row(ii));
677 });
678 }
679 }
680
681 struct Node
682 {

Callers

nothing calls this directly

Calls 8

VecVector2MatrixFunction · 0.85
KappaMethod · 0.80
ShiftZMethod · 0.80
AtomicAddFunction · 0.50
OrderMethod · 0.45
SizeMethod · 0.45
ColsMethod · 0.45
RowMethod · 0.45

Tested by

no test coverage detected