Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_TagBox.H
Go to the documentation of this file.
1
2#ifndef AMREX_TagBox_H_
3#define AMREX_TagBox_H_
4#include <AMReX_Config.H>
5
6#include <AMReX_IntVect.H>
7#include <AMReX_Box.H>
8#include <AMReX_Array.H>
9#include <AMReX_Vector.H>
10#include <AMReX_BaseFab.H>
11#include <AMReX_FabArray.H>
12#include <AMReX_BoxArray.H>
13#include <AMReX_Geometry.H>
14
20namespace amrex {
21
22
28class TagBox final
29 :
30 public BaseFab<char>
31{
32public:
33
35 using TagType = char;
36
38 enum TagVal { CLEAR=0, BUF, SET };
39
40 TagBox () noexcept = default;
41
42 explicit TagBox (Arena* ar) noexcept;
43
44 TagBox (const Box& bx, int n, Arena* ar);
45
46 explicit TagBox (const Box& bx, int n = 1, bool alloc = true,
47 bool shared = false, Arena* ar = nullptr);
48
49 TagBox (const TagBox& rhs, MakeType make_type, int scomp, int ncomp);
50
51 ~TagBox () noexcept override = default;
52
53 TagBox (TagBox&& rhs) noexcept = default;
54
55 TagBox (const TagBox& rhs) = delete;
56 TagBox& operator= (const TagBox& rhs) = delete;
57 TagBox& operator= (TagBox&& rhs) = delete;
58
59
66 void coarsen (const IntVect& ratio, const Box& cbox) noexcept;
67
74 void buffer (const IntVect& a_nbuff, const IntVect& nwid) noexcept;
75
81//#if (__cplusplus >= 201402L)
82// [[deprecated("No need to use this unless calling Fortran < 2003")]]
83//#endif
84 [[nodiscard]] Vector<int> tags () const noexcept;
85
94//#if (__cplusplus >= 201402L)
95// [[deprecated("No need to use this unless calling Fortran < 2003")]]
96//#endif
97 void get_itags(Vector<int>& ar, const Box& tilebx) const noexcept;
98
104//#if (__cplusplus >= 201402L)
105// [[deprecated("No need to use this unless calling Fortran < 2003")]]
106//#endif
107 void tags (const Vector<int>& ar) noexcept;
108
114//#if (__cplusplus >= 201402L)
115// [[deprecated("No need to use this unless calling Fortran < 2003")]]
116//#endif
117 void tags_and_untags (const Vector<int>& ar) noexcept;
118
125//#if (__cplusplus >= 201402L)
126// [[deprecated("No need to use this unless calling Fortran < 2003")]]
127//#endif
128 void tags (const Vector<int>& ar, const Box& tilebx) noexcept;
129
136//#if (__cplusplus >= 201402L)
137// [[deprecated("No need to use this unless calling Fortran < 2003")]]
138//#endif
139 void tags_and_untags (const Vector<int>& ar, const Box& tilebx) noexcept;
140};
141
142
149 :
150 public FabArray<TagBox>
151{
152public:
153
156
160 TagBoxArray (const BoxArray& ba, const DistributionMapping& dm, int _ngrow=0);
161 TagBoxArray (const BoxArray& ba, const DistributionMapping& dm, const IntVect& _ngrow);
162
163 ~TagBoxArray () = default;
164
165 TagBoxArray (TagBoxArray&& rhs) noexcept = default;
166 TagBoxArray& operator= (TagBoxArray&& rhs) noexcept = default;
167
168 TagBoxArray (const TagBoxArray& rhs) = delete;
169 TagBoxArray& operator= (const TagBoxArray& rhs) = delete;
170
174 void buffer (const IntVect& nbuf);
175
179 void mapPeriodicRemoveDuplicates (const Geometry& geom);
180
184 void setVal (const BoxArray& ba, TagBox::TagVal val);
186
192 void coarsen (const IntVect& ratio);
193
199 void collate (Gpu::PinnedVector<IntVect>& TheGlobalCollateSpace) const;
200
202 bool hasTags (Box const& bx) const;
203
204 void local_collate_cpu (Gpu::PinnedVector<IntVect>& v) const;
205#ifdef AMREX_USE_GPU
206 void local_collate_gpu (Gpu::PinnedVector<IntVect>& v) const;
207#endif
208};
209
210}
211
212#endif /*_TagBox_H_*/
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:127
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:190
void setVal(char const &x, const Box &bx, int dcomp, int ncomp) noexcept
The setVal functions set sub-regions in the BaseFab to a constant value. This most general form speci...
Definition AMReX_BaseFab.H:1400
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:568
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:43
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:349
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:74
Dynamically allocated vector for trivially copyable data.
Definition AMReX_PODVector.H:308
An array of TagBoxes.
Definition AMReX_TagBox.H:151
TagBoxArray(const TagBoxArray &rhs)=delete
~TagBoxArray()=default
TagBoxArray(TagBoxArray &&rhs) noexcept=default
TagBox::TagType TagType
The type of each tag.
Definition AMReX_TagBox.H:155
Tagged cells in a Box.
Definition AMReX_TagBox.H:31
void get_itags(Vector< int > &ar, const Box &tilebx) const noexcept
Since a TagBox is a BaseFab<char>, we can use this utility function to allocate an integer array to h...
Definition AMReX_TagBox.cpp:180
void coarsen(const IntVect &ratio, const Box &cbox) noexcept
Coarsen the TagBox in-place and mark coarse cells as tagged if any fine cell was tagged.
Definition AMReX_TagBox.cpp:33
TagBox() noexcept=default
TagBox & operator=(const TagBox &rhs)=delete
char TagType
The type of each tag.
Definition AMReX_TagBox.H:35
Vector< int > tags() const noexcept
Returns Vector<int> of size domain.numPts() suitable for calling Fortran, with positions set to same ...
Definition AMReX_TagBox.cpp:124
TagVal
Possible values for each cell.
Definition AMReX_TagBox.H:38
@ SET
Definition AMReX_TagBox.H:38
@ CLEAR
Definition AMReX_TagBox.H:38
@ BUF
Definition AMReX_TagBox.H:38
void tags_and_untags(const Vector< int > &ar) noexcept
Set values as specified by ar, allowing both tagging and untagging.
Definition AMReX_TagBox.cpp:161
void buffer(const IntVect &a_nbuff, const IntVect &nwid) noexcept
Grow tags by a_nbuff cells, ignoring seed tags within nwid of the boundary.
Definition AMReX_TagBox.cpp:76
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
Definition AMReX_Amr.cpp:49
MakeType
Definition AMReX_MakeType.H:7
void * alloc(std::size_t sz) const noexcept
Definition AMReX_DataAllocator.H:16