2#ifndef BL_FABFACTORY_H_
3#define BL_FABFACTORY_H_
4#include <AMReX_Config.H>
93 virtual FAB*
create (const
Box& box,
int ncomps, const
FabInfo& info,
int box_index) const = 0;
100 virtual FAB*
create_alias (FAB const& ,
int ,
int )
const {
return nullptr; }
106 [[nodiscard]]
virtual Long nBytes (
const Box& box,
int ncomps,
int )
const {
107 if constexpr (IsBaseFab_v<FAB>) {
108 return box.
numPts() * ncomps *
Long(
sizeof(
typename FAB::value_type));
133 FAB*
create_alias (FAB
const& rhs,
int scomp,
int ncomp)
const override
Memory arena base class and global arena accessors.
Integer-lattice boxes and helpers for defining index-space regions.
Abstract base class for memory arenas.
Definition AMReX_Arena.H:153
__host__ __device__ Long numPts() const noexcept
Return the number of points contained in the BoxND.
Definition AMReX_Box.H:385
Default FabFactory that calls new / delete on the FAB type directly.
Definition AMReX_FabFactory.H:124
FAB * create(const Box &box, int ncomps, const FabInfo &info, int) const override
Create a FAB covering box with ncomps components.
Definition AMReX_FabFactory.H:127
void destroy(FAB *fab) const override
Destroy a FAB previously created by this factory.
Definition AMReX_FabFactory.H:138
FAB * create_alias(FAB const &rhs, int scomp, int ncomp) const override
Create an alias FAB that views components [scomp, scomp+ncomp) of rhs.
Definition AMReX_FabFactory.H:133
DefaultFabFactory< FAB > * clone() const override
Return a heap-allocated copy of this factory.
Definition AMReX_FabFactory.H:144
Abstract factory interface for creating, aliasing, and destroying FAB objects.
Definition AMReX_FabFactory.H:73
virtual void destroy(FAB *fab) const =0
Destroy a FAB previously created by this factory.
virtual Long nBytes(const Box &box, int ncomps, int) const
Return the storage size for ncomps components in box, or -1 if unavailable.
Definition AMReX_FabFactory.H:106
virtual FabFactory< FAB > * clone() const =0
Return a heap-allocated copy of this factory.
FabFactory() noexcept=default
virtual FAB * create_alias(FAB const &, int, int) const
Create an alias FAB that views components [scomp, scomp+ncomp) of rhs.
Definition AMReX_FabFactory.H:100
virtual FAB * create(const Box &box, int ncomps, const FabInfo &info, int box_index) const =0
Create a FAB covering box with ncomps components.
amrex_long Long
Definition AMReX_INT.H:30
FabType
Aggregate classification of a FAB or subregion used by embedded-boundary data.
Definition AMReX_FabFactory.H:27
@ undefined
The classification has not been determined.
@ singlevalued
No multivalued cells; not entirely regular or covered.
@ covered
Every cell in the region is covered.
@ regular
Every cell in the region is regular.
@ multivalued
The region contains at least one multivalued cell.
Definition AMReX_Amr.cpp:50
@ make_alias
Definition AMReX_MakeType.H:7
Construction hints passed to FabFactory::create.
Definition AMReX_FabFactory.H:41
FabInfo & SetShared(bool s) noexcept
Set the shared flag; returns *this for chaining.
Definition AMReX_FabFactory.H:53
bool alloc
Whether the factory should allocate FAB storage.
Definition AMReX_FabFactory.H:42
bool shared
Whether storage is managed as team-shared memory.
Definition AMReX_FabFactory.H:43
FabInfo & SetAlloc(bool a) noexcept
Set the alloc flag; returns *this for chaining.
Definition AMReX_FabFactory.H:47
FabInfo & SetArena(Arena *ar) noexcept
Set the arena pointer; returns *this for chaining.
Definition AMReX_FabFactory.H:59
Arena * arena
Arena for storage allocation; null selects the default.
Definition AMReX_FabFactory.H:44