Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
AMReX_iMultiFab.H
Go to the documentation of this file.
1
2#ifndef BL_IMULTIFAB_H
3#define BL_IMULTIFAB_H
4#include <AMReX_Config.H>
5
6#include <AMReX_BLassert.H>
7#include <AMReX_IArrayBox.H>
8#include <AMReX_FabArray.H>
10#include <AMReX_Geometry.H>
11#include <memory>
12
13namespace amrex {
14
32 :
33 public FabArray<IArrayBox>
34{
35public:
36
42 iMultiFab () noexcept = default;
43
51 explicit iMultiFab (Arena* a) noexcept;
52
57 iMultiFab (const BoxArray& bxs,
58 const DistributionMapping& dm,
59 int ncomp,
60 int ngrow,
61#ifdef AMREX_STRICT_MODE
62 const MFInfo& info,
63 const FabFactory<IArrayBox>& factory);
64#else
65 const MFInfo& info = MFInfo(),
67#endif
68
69 iMultiFab (const BoxArray& bxs,
70 const DistributionMapping& dm,
71 int ncomp,
72 const IntVect& ngrow,
73#ifdef AMREX_STRICT_MODE
74 const MFInfo& info,
75 const FabFactory<IArrayBox>& factory);
76#else
77 const MFInfo& info = MFInfo(),
79#endif
80
92 iMultiFab (const iMultiFab& rhs, MakeType maketype, int scomp, int ncomp);
93
94 ~iMultiFab () = default;
95
96 iMultiFab (iMultiFab&& rhs) noexcept = default;
97 iMultiFab& operator= (iMultiFab&& rhs) noexcept = default;
98
99 iMultiFab (const iMultiFab& rhs) = delete;
100 iMultiFab& operator= (const iMultiFab& rhs) = delete;
101
102 iMultiFab& operator= (int r);
103
114 [[nodiscard]] int min (int comp,
115 int nghost = 0,
116 bool local = false) const;
117
127 [[nodiscard]] int min (const Box& region,
128 int comp,
129 int nghost = 0,
130 bool local = false) const;
131
142 [[nodiscard]] int max (int comp,
143 int nghost = 0,
144 bool local = false) const;
145
155 [[nodiscard]] int max (const Box& region,
156 int comp,
157 int nghost = 0,
158 bool local = false) const;
159
167 [[nodiscard]] Long sum (int comp, int nghost = 0, bool local = false) const;
168
172 [[nodiscard]] Long sum (Box const& region, int comp = 0, bool local = false) const;
173
187 void plus (int val,
188 int comp,
189 int num_comp,
190 int nghost = 0);
191
203 void plus (int val,
204 const Box& region,
205 int comp,
206 int num_comp,
207 int nghost = 0);
208
218 void plus (int val,
219 int nghost);
220
232 void plus (int val,
233 const Box& region,
234 int nghost);
235
249 void mult (int val,
250 int comp,
251 int num_comp,
252 int nghost = 0);
253
267 void mult (int val,
268 const Box& region,
269 int comp,
270 int num_comp,
271 int nghost = 0);
272
282 void mult (int val,
283 int nghost = 0);
284
296 void mult (int val,
297 const Box& region,
298 int nghost = 0);
299
311 void negate (int comp,
312 int num_comp,
313 int nghost = 0);
314
325 void negate (const Box& region,
326 int comp,
327 int num_comp,
328 int nghost = 0);
329
337 void negate (int nghost = 0);
338
348 void negate (const Box& region,
349 int nghost = 0);
350
351 [[nodiscard]] IntVect minIndex (int comp,
352 int nghost = 0) const;
353
354 [[nodiscard]] IntVect maxIndex (int comp,
355 int nghost = 0) const;
356
371 void plus (const iMultiFab& mf,
372 int strt_comp,
373 int num_comp,
374 int nghost);
375
390 void minus (const iMultiFab& mf,
391 int strt_comp,
392 int num_comp,
393 int nghost);
394
410 void divide (const iMultiFab& mf,
411 int strt_comp,
412 int num_comp,
413 int nghost);
414
426 static void Add (iMultiFab& dst,
427 const iMultiFab& src,
428 int srccomp,
429 int dstcomp,
430 int numcomp,
431 int nghost);
432
433 static void Add (iMultiFab& dst,
434 const iMultiFab& src,
435 int srccomp,
436 int dstcomp,
437 int numcomp,
438 const IntVect& nghost);
439
451 static void Copy (iMultiFab& dst,
452 const iMultiFab& src,
453 int srccomp,
454 int dstcomp,
455 int numcomp,
456 int nghost);
457
458 static void Copy (iMultiFab& dst,
459 const iMultiFab& src,
460 int srccomp,
461 int dstcomp,
462 int numcomp,
463 const IntVect& nghost);
464
470 static void Swap (iMultiFab& dst,
471 iMultiFab& src,
472 int srccomp,
473 int dstcomp,
474 int numcomp,
475 int nghost);
476
477 static void Swap (iMultiFab& dst,
478 iMultiFab& src,
479 int srccomp,
480 int dstcomp,
481 int numcomp,
482 const IntVect& nghost);
483
495 static void Subtract (iMultiFab& dst,
496 const iMultiFab& src,
497 int srccomp,
498 int dstcomp,
499 int numcomp,
500 int nghost);
501
502 static void Subtract (iMultiFab& dst,
503 const iMultiFab& src,
504 int srccomp,
505 int dstcomp,
506 int numcomp,
507 const IntVect& nghost);
508
520 static void Multiply (iMultiFab& dst,
521 const iMultiFab& src,
522 int srccomp,
523 int dstcomp,
524 int numcomp,
525 int nghost);
526
527 static void Multiply (iMultiFab& dst,
528 const iMultiFab& src,
529 int srccomp,
530 int dstcomp,
531 int numcomp,
532 const IntVect& nghost);
533
545 static void Divide (iMultiFab& dst,
546 const iMultiFab& src,
547 int srccomp,
548 int dstcomp,
549 int numcomp,
550 int nghost);
551
552 static void Divide (iMultiFab& dst,
553 const iMultiFab& src,
554 int srccomp,
555 int dstcomp,
556 int numcomp,
557 const IntVect& nghost);
558
559 void define (const BoxArray& bxs,
560 const DistributionMapping& dm,
561 int nvar,
562 const IntVect& ngrow,
563#ifdef AMREX_STRICT_MODE
564 const MFInfo& info,
565 const FabFactory<IArrayBox>& factory);
566#else
567 const MFInfo& info = MFInfo(),
569#endif
570
571 void define (const BoxArray& bxs,
572 const DistributionMapping& dm,
573 int nvar,
574 int ngrow,
575#ifdef AMREX_STRICT_MODE
576 const MFInfo& info,
577 const FabFactory<IArrayBox>& factory);
578#else
579 const MFInfo& info = MFInfo(),
581#endif
582
583 static void Initialize ();
584 static void Finalize ();
585};
586
587// ngrow != IntVect{0} is a special case that should not be used in normal cases,
588// because it may mark valid cells as non-owner and ghost cells as owners.
589std::unique_ptr<iMultiFab>
590OwnerMask (FabArrayBase const& mf, const Periodicity& period, const IntVect& ngrow=IntVect{0});
591
592}
593
594#endif /*BL_IMULTIFAB_H*/
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:105
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:567
Definition AMReX_FabFactory.H:76
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:43
Base class for FabArray.
Definition AMReX_FabArrayBase.H:42
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:347
Definition AMReX_FabFactory.H:50
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition AMReX_Periodicity.H:17
A Collection of IArrayBoxes.
Definition AMReX_iMultiFab.H:34
static void Initialize()
Definition AMReX_iMultiFab.cpp:210
IntVect maxIndex(int comp, int nghost=0) const
Definition AMReX_iMultiFab.cpp:581
static void Swap(iMultiFab &dst, iMultiFab &src, int srccomp, int dstcomp, int numcomp, int nghost)
Swap from src to dst including nghost ghost cells. The two iMultiFabs MUST have the same underlying B...
Definition AMReX_iMultiFab.cpp:74
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, const IntVect &ngrow, const MFInfo &info=MFInfo(), const FabFactory< IArrayBox > &factory=DefaultFabFactory< IArrayBox >())
Definition AMReX_iMultiFab.cpp:264
int max(int comp, int nghost=0, bool local=false) const
Returns the maximum value contained in component comp of the iMultiFab. The parameter nghost determin...
Definition AMReX_iMultiFab.cpp:370
Long sum(int comp, int nghost=0, bool local=false) const
Returns the sum in component comp.
Definition AMReX_iMultiFab.cpp:454
static void Finalize()
Definition AMReX_iMultiFab.cpp:220
int min(int comp, int nghost=0, bool local=false) const
Returns the minimum value contained in component comp of the iMultiFab. The parameter nghost determin...
Definition AMReX_iMultiFab.cpp:286
iMultiFab() noexcept=default
Constructs an empty iMultiFab. Data can be defined at a later time using the define member functions ...
iMultiFab & operator=(iMultiFab &&rhs) noexcept=default
static void Subtract(iMultiFab &dst, const iMultiFab &src, int srccomp, int dstcomp, int numcomp, int nghost)
Subtract src from dst including nghost ghost cells. The two iMultiFabs MUST have the same underlying ...
Definition AMReX_iMultiFab.cpp:93
IntVect minIndex(int comp, int nghost=0) const
Definition AMReX_iMultiFab.cpp:573
iMultiFab(iMultiFab &&rhs) noexcept=default
void minus(const iMultiFab &mf, int strt_comp, int num_comp, int nghost)
This function subtracts the values of the cells in mf from the corresponding cells of this iMultiFab....
Definition AMReX_iMultiFab.cpp:589
static void Add(iMultiFab &dst, const iMultiFab &src, int srccomp, int dstcomp, int numcomp, int nghost)
Add src to dst including nghost ghost cells. The two iMultiFabs MUST have the same underlying BoxArra...
Definition AMReX_iMultiFab.cpp:24
static void Divide(iMultiFab &dst, const iMultiFab &src, int srccomp, int dstcomp, int numcomp, int nghost)
Divide dst by src including nghost ghost cells. The two iMultiFabs MUST have the same underlying BoxA...
Definition AMReX_iMultiFab.cpp:147
void plus(int val, int comp, int num_comp, int nghost=0)
Adds the scalar value val to the value of each cell in the specified subregion of the iMultiFab....
Definition AMReX_iMultiFab.cpp:607
~iMultiFab()=default
void divide(const iMultiFab &mf, int strt_comp, int num_comp, int nghost)
This function divides the values of the cells in mf from the corresponding cells of this iMultiFab....
Definition AMReX_iMultiFab.cpp:598
static void Multiply(iMultiFab &dst, const iMultiFab &src, int srccomp, int dstcomp, int numcomp, int nghost)
Multiply dst by src including nghost ghost cells. The two iMultiFabs MUST have the same underlying Bo...
Definition AMReX_iMultiFab.cpp:120
void negate(int comp, int num_comp, int nghost=0)
Negates the value of each cell in the specified subregion of the iMultiFab. The subregion consists of...
Definition AMReX_iMultiFab.cpp:676
void mult(int val, int comp, int num_comp, int nghost=0)
Scales the value of each cell in the specified subregion of the iMultiFab by the scalar val (a[i] <- ...
Definition AMReX_iMultiFab.cpp:649
iMultiFab(const iMultiFab &rhs)=delete
static void Copy(iMultiFab &dst, const iMultiFab &src, int srccomp, int dstcomp, int numcomp, int nghost)
Copy from src to dst including nghost ghost cells. The two iMultiFabs MUST have the same underlying B...
Definition AMReX_iMultiFab.cpp:51
amrex_long Long
Definition AMReX_INT.H:30
Definition AMReX_Amr.cpp:49
MakeType
Definition AMReX_MakeType.H:7
std::unique_ptr< iMultiFab > OwnerMask(FabArrayBase const &mf, const Periodicity &period, const IntVect &ngrow)
Definition AMReX_iMultiFab.cpp:699
FabArray memory allocation information.
Definition AMReX_FabArray.H:66