Skip to content

Commit d0e2504

Browse files
authored
PC::make_alike<Allocator> Change Default (#4771)
## Summary Change the template default of `make_alike<>()` to use the same allocator as the creating allocator. This is a breaking change. In practice, this was so far used to create a pinned allocator, e.g., for I/O operations. It is more sensible to create the same allocator if unspecified as the creating PC and it also makes "modern"/future AMReX, which uses PCs with `PolymorphicArena` allocators, shorter/cleaner in user code. ## Additional background Introduced a few years ago for BLAST codes. Not sure how widely this is used yet, will ask on Slack, too. I doubt in practice this is used a lot without explicit template arguments. In pyAMReX, we already implement this only for the same allocator as the creating one (no break). See the [particle roadmap](AMReX-Codes/pyamrex#460). ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [ ] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [x] are likely to significantly affect the results of downstream AMReX users - [x] include documentation in the code and/or rst files, if appropriate
1 parent 010ee1f commit d0e2504

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Src/Particle/AMReX_ParticleContainer.H

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,14 +1370,14 @@ public:
13701370
/** Create an empty particle container
13711371
*
13721372
* This creates a new AMReX particle container type with same compile-time
1373-
* and run-time attributes. But, it can change its allocator. This is
1374-
* helpful when creating temporary particle buffers for filter operations
1373+
* and run-time attributes. But, it can change its allocator (default: same allocator).
1374+
* This is helpful when creating temporary particle buffers for filter operations
13751375
* and device-to-host copies.
13761376
*
1377-
* @tparam Allocator AMReX allocator, e.g., amrex::PinnedArenaAllocator
1377+
* @tparam Allocator AMReX allocator, e.g., amrex::PinnedArenaAllocator, default: same allocator as the creating PC
13781378
* @return an empty particle container
13791379
* */
1380-
template <template<class> class NewAllocator=amrex::DefaultAllocator>
1380+
template <template<class> class NewAllocator=Allocator>
13811381
ContainerLike<NewAllocator>
13821382
make_alike () const
13831383
{

0 commit comments

Comments
 (0)