|
Nektar++
|
A gather-scatter over universal ids, mirroring Gs::Init(), Gs::Gather() and Gs::Unique() behind an implementation-agnostic interface. More...
#include <GatherScatter.h>
Public Member Functions | |
| virtual | ~GatherScatter ()=default |
| GatherScatter (const GatherScatter &)=delete | |
| GatherScatter & | operator= (const GatherScatter &)=delete |
| virtual void | Gather (Array< OneD, NekDouble > u, GatherScatterOp op)=0 |
The Gs::Gather() equivalent: fold the entries of u, in place, across every slot on every rank with the same id. | |
| virtual void | Unique (Array< OneD, long > &ids)=0 |
The Gs::Unique() equivalent: negate all but one occurrence of each id across all ranks, in place. ids must hold the ids this handle was built from. Which occurrence survives differs between implementations; that exactly one does is what callers rely on. | |
Static Public Member Functions | |
| static std::shared_ptr< GatherScatter > | Create (const Array< OneD, long > &ids, const CommSharedPtr &comm, const GatherScatterConfig &config, bool verbose=false) |
Set up a gather-scatter over ids: the Gs::Init() equivalent. | |
| static std::shared_ptr< GatherScatter > | CreateNoOp () |
| A handle whose Gather() and Unique() do nothing. | |
Protected Member Functions | |
| GatherScatter ()=default | |
A gather-scatter over universal ids, mirroring Gs::Init(), Gs::Gather() and Gs::Unique() behind an implementation-agnostic interface.
Create() picks the implementation from a #GatherScatterConfig: gslib's gs_data, or a #SharedIdPlan over one of its exchange backends. The subclasses live entirely in the implementation file, so a caller needs neither gslib's headers nor the shared-id module's to use one. This is what lets a solver be benchmarked with and without gslib just by adding, say, --gather-scatter pairwise to its command line.
On a serial communicator Create() returns the same do-nothing handle CreateNoOp() gives, as gslib is a no-op there too. Create() and Gather() are collective over the communicator, as is Unique() for gslib.
Definition at line 123 of file GatherScatter.h.
|
virtualdefault |
|
delete |
|
protecteddefault |
|
static |
Set up a gather-scatter over ids: the Gs::Init() equivalent.
| ids | One universal id per slot; 0 for slots to skip. The SharedIdPlan methods also skip negative ids, which gslib treats as "flagged" (see the implementation). |
| comm | Communicator to gather over. |
| config | Implementation to use. |
| verbose | Print a setup summary on rank 0. |
Definition at line 343 of file GatherScatter.cpp.
References CreateNoOp(), Nektar::LibUtilities::eGslib, and Nektar::LibUtilities::GatherScatterConfig::method.
Referenced by Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::CoupledAssemblyMap::CoupledAssemblyMap(), Nektar::MultiRegions::AssemblyMapCG::CreateGraph(), Nektar::MultiRegions::AssemblyMapCG::SetUpUniversalC0ContMap(), Nektar::MultiRegions::AssemblyMapDG::SetUpUniversalDGMap(), and Nektar::MultiRegions::AssemblyMapCG::v_LinearSpaceMap().
|
static |
A handle whose Gather() and Unique() do nothing.
For slots that never had a gather-scatter set up over them, which callers previously expressed as a null Gs::gs_data * and relied on Gs::Gather() ignoring.
Definition at line 363 of file GatherScatter.cpp.
Referenced by Create().
|
pure virtual |
The Gs::Gather() equivalent: fold the entries of u, in place, across every slot on every rank with the same id.
As with gslib, a slot whose id is neither shared nor repeated locally is never accessed, so u may be shorter than the id array this handle was built from provided it covers every other slot. AssemblyMap's multi-level static condensation relies on this.
|
delete |
The Gs::Unique() equivalent: negate all but one occurrence of each id across all ranks, in place. ids must hold the ids this handle was built from. Which occurrence survives differs between implementations; that exactly one does is what callers rely on.