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
116 [[nodiscard]] int min (int comp,
117 int nghost = 0,
118 bool local = false) const;
119
131 [[nodiscard]] int min (const Box& region,
132 int comp,
133 int nghost = 0,
134 bool local = false) const;
135
148 [[nodiscard]] int max (int comp,
149 int nghost = 0,
150 bool local = false) const;
151
163 [[nodiscard]] int max (const Box& region,
164 int comp,
165 int nghost = 0,
166 bool local = false) const;
167
177 [[nodiscard]] Long sum (int comp, int nghost = 0, bool local = false) const;
178
184 [[nodiscard]] Long sum (Box const& region, int comp = 0, bool local = false) const;
185
199 void plus (int val,
200 int comp,
201 int num_comp,
202 int nghost = 0);
203
215 void plus (int val,
216 const Box& region,
217 int comp,
218 int num_comp,
219 int nghost = 0);
220
230 void plus (int val,
231 int nghost);
232
244 void plus (int val,
245 const Box& region,
246 int nghost);
247
261 void mult (int val,
262 int comp,
263 int num_comp,
264 int nghost = 0);
265
279 void mult (int val,
280 const Box& region,
281 int comp,
282 int num_comp,
283 int nghost = 0);
284
294 void mult (int val,
295 int nghost = 0);
296
308 void mult (int val,
309 const Box& region,
310 int nghost = 0);
311
323 void negate (int comp,
324 int num_comp,
325 int nghost = 0);
326
337 void negate (const Box& region,
338 int comp,
339 int num_comp,
340 int nghost = 0);
341
349 void negate (int nghost = 0);
350
360 void negate (const Box& region,
361 int nghost = 0);
362
367 [[nodiscard]] IntVect minIndex (int comp,
368 int nghost = 0) const;
369
374 [[nodiscard]] IntVect maxIndex (int comp,
375 int nghost = 0) const;
376
391 void plus (const iMultiFab& mf,
392 int strt_comp,
393 int num_comp,
394 int nghost);
395
410 void minus (const iMultiFab& mf,
411 int strt_comp,
412 int num_comp,
413 int nghost);
414
430 void divide (const iMultiFab& mf,
431 int strt_comp,
432 int num_comp,
433 int nghost);
434
446 static void Add (iMultiFab& dst,
447 const iMultiFab& src,
448 int srccomp,
449 int dstcomp,
450 int numcomp,
451 int nghost);
452
453 static void Add (iMultiFab& dst,
454 const iMultiFab& src,
455 int srccomp,
456 int dstcomp,
457 int numcomp,
458 const IntVect& nghost);
459
471 static void Copy (iMultiFab& dst,
472 const iMultiFab& src,
473 int srccomp,
474 int dstcomp,
475 int numcomp,
476 int nghost);
477
478 static void Copy (iMultiFab& dst,
479 const iMultiFab& src,
480 int srccomp,
481 int dstcomp,
482 int numcomp,
483 const IntVect& nghost);
484
490 static void Swap (iMultiFab& dst,
491 iMultiFab& src,
492 int srccomp,
493 int dstcomp,
494 int numcomp,
495 int nghost);
496
497 static void Swap (iMultiFab& dst,
498 iMultiFab& src,
499 int srccomp,
500 int dstcomp,
501 int numcomp,
502 const IntVect& nghost);
503
515 static void Subtract (iMultiFab& dst,
516 const iMultiFab& src,
517 int srccomp,
518 int dstcomp,
519 int numcomp,
520 int nghost);
521
522 static void Subtract (iMultiFab& dst,
523 const iMultiFab& src,
524 int srccomp,
525 int dstcomp,
526 int numcomp,
527 const IntVect& nghost);
528
540 static void Multiply (iMultiFab& dst,
541 const iMultiFab& src,
542 int srccomp,
543 int dstcomp,
544 int numcomp,
545 int nghost);
546
547 static void Multiply (iMultiFab& dst,
548 const iMultiFab& src,
549 int srccomp,
550 int dstcomp,
551 int numcomp,
552 const IntVect& nghost);
553
565 static void Divide (iMultiFab& dst,
566 const iMultiFab& src,
567 int srccomp,
568 int dstcomp,
569 int numcomp,
570 int nghost);
571
572 static void Divide (iMultiFab& dst,
573 const iMultiFab& src,
574 int srccomp,
575 int dstcomp,
576 int numcomp,
577 const IntVect& nghost);
578
579 void define (const BoxArray& bxs,
580 const DistributionMapping& dm,
581 int nvar,
582 const IntVect& ngrow,
583#ifdef AMREX_STRICT_MODE
584 const MFInfo& info,
585 const FabFactory<IArrayBox>& factory);
586#else
587 const MFInfo& info = MFInfo(),
589#endif
590
591 void define (const BoxArray& bxs,
592 const DistributionMapping& dm,
593 int nvar,
594 int ngrow,
595#ifdef AMREX_STRICT_MODE
596 const MFInfo& info,
597 const FabFactory<IArrayBox>& factory);
598#else
599 const MFInfo& info = MFInfo(),
601#endif
602
603 static void Initialize ();
604 static void Finalize ();
605};
606
607// ngrow != IntVect{0} is a special case that should not be used in normal cases,
608// because it may mark valid cells as non-owner and ghost cells as owners.
609std::unique_ptr<iMultiFab>
610OwnerMask (FabArrayBase const& mf, const Periodicity& period, const IntVect& ngrow=IntVect{0});
611
612}
613
614#endif /*BL_IMULTIFAB_H*/
Assertion macros used across AMReX for runtime consistency checks.
Reduction helpers and utility algorithms for FabArray objects.
Distributed container of FAB objects plus copy and fill utilities.
Abstract base class for memory arenas.
Definition AMReX_Arena.H:153
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:676
Default FabFactory that calls new / delete on the FAB type directly.
Definition AMReX_FabFactory.H:124
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:51
Base class for FabArray.
Definition AMReX_FabArrayBase.H:47
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:356
Abstract factory interface for creating, aliasing, and destroying FAB objects.
Definition AMReX_FabFactory.H:73
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:50
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:73