Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_Cluster.H
Go to the documentation of this file.
1
2#ifndef AMREX_Cluster_H_
3#define AMREX_Cluster_H_
4#include <AMReX_Config.H>
5
6#include <AMReX_BoxList.H>
7#include <AMReX_REAL.H>
8
9#include <list>
10
16namespace amrex {
17
18class BoxDomain;
19class BoxArray;
20class ClusterList;
21
22
29{
30public:
31
35 Cluster () noexcept = default;
36
45 Cluster (IntVect* a, Long len) noexcept;
46
54 Cluster (Cluster& c, const Box& b);
55
56 ~Cluster () = default;
57 Cluster (const Cluster&) = delete;
58 Cluster (Cluster&&) = delete;
59 Cluster& operator= (const Cluster&) = delete;
60 Cluster& operator= (Cluster&&) = delete;
61
65 [[nodiscard]] const Box& box () const noexcept { return m_bx; }
66
70 [[nodiscard]] bool ok () const noexcept { return m_bx.d_numPts() > 0. && m_ar != nullptr && m_len > 0; }
71
75 [[nodiscard]] Long numTag () const noexcept { return m_len; }
76
82 [[nodiscard]] Long numTag (const Box& b) const noexcept;
83
91 Cluster* chop ();
92
93
100 Cluster* new_chop ();
101
115 void distribute (ClusterList& clst,
116 const BoxDomain& bd);
117
121 [[nodiscard]] Real eff () const noexcept {
122 BL_ASSERT(ok());
123 return static_cast<Real>(double(numTag()) / m_bx.d_numPts());
124 }
125
126private:
127
131 void minBox () noexcept;
132
134 Box m_bx;
135 IntVect* m_ar = nullptr;
136 Long m_len = 0;
137};
138
139
146{
147public:
148
152 ClusterList () = default;
153
160 ClusterList (IntVect* pts, Long len);
161
165 ~ClusterList ();
166
167 ClusterList (const ClusterList&) = delete;
171
175 [[nodiscard]] int length () const { return static_cast<int>(lst.size()); }
176
182 void append (Cluster* c) { lst.push_back(c); }
183
187 [[nodiscard]] BoxArray boxArray () const;
188
194 void boxArray (BoxArray& ba) const;
195
199 [[nodiscard]] BoxList boxList() const;
200
206 void boxList (BoxList& blst) const;
207
213 void chop (Real eff);
214
221 void new_chop (Real eff);
222
230 void intersect (BoxArray& ba);
231
232private:
233
235 std::list<Cluster*> lst;
236};
237
238}
239
240#endif /*_Cluster_H_*/
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:568
A List of Disjoint Boxes.
Definition AMReX_BoxDomain.H:67
A class for managing a List of Boxes that share a common IndexType. This class implements operations ...
Definition AMReX_BoxList.H:52
__host__ __device__ double d_numPts() const noexcept
Return the number of points contained in the BoxND. This is intended for use only in diagnostic messa...
Definition AMReX_Box.H:376
A list of Cluster objects.
Definition AMReX_Cluster.H:146
ClusterList(ClusterList &&)=delete
ClusterList(const ClusterList &)=delete
void append(Cluster *c)
Add cluster to end of list.
Definition AMReX_Cluster.H:182
ClusterList()=default
The default constructor.
int length() const
Return number of clusters in list.
Definition AMReX_Cluster.H:175
A cluster of tagged cells.
Definition AMReX_Cluster.H:29
Cluster * new_chop()
This version of chop has slightly different logic - in this case if a cut results in two boxes with t...
Definition AMReX_Cluster.cpp:334
const Box & box() const noexcept
Return minimal box containing all tagged points.
Definition AMReX_Cluster.H:65
Long numTag() const noexcept
Returns number of tagged points in cluster.
Definition AMReX_Cluster.H:75
Real eff() const noexcept
Compute ratio of tagged to total number of points in cluster.
Definition AMReX_Cluster.H:121
Cluster() noexcept=default
The default constructor – builds invalid Cluster.
void distribute(ClusterList &clst, const BoxDomain &bd)
Constructs a list of cluster objects obtained by intersecting this cluster with each box in bl....
Definition AMReX_Cluster.cpp:98
bool ok() const noexcept
Does cluster contain any points?
Definition AMReX_Cluster.H:70
Cluster * chop()
This operation splits a cluster into two pieces by selecting a cutting plane with certain optimal cha...
Definition AMReX_Cluster.cpp:261
Cluster & operator=(const Cluster &)=delete
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
amrex_long Long
Definition AMReX_INT.H:30
Definition AMReX_Amr.cpp:49
BoxArray intersect(const BoxArray &ba, const Box &b, int ng)
Make a BoxArray from the intersection of Box b and BoxArray(+ghostcells).
Definition AMReX_BoxArray.cpp:1721
BoxArray const & boxArray(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2861