LCOV - code coverage report
Current view: top level - ext/amrex/3d-coverage-g++-24.08/include - AMReX_MultiFab.H (source / functions) Hit Total Coverage
Test: coverage_merged.info Lines: 1 1 100.0 %
Date: 2024-11-18 05:28:54 Functions: 1 1 100.0 %

          Line data    Source code
       1             : 
       2             : #ifndef BL_MULTIFAB_H
       3             : #define BL_MULTIFAB_H
       4             : #include <AMReX_Config.H>
       5             : 
       6             : #include <AMReX_BLassert.H>
       7             : #include <AMReX_BaseFab.H>
       8             : #include <AMReX_FArrayBox.H>
       9             : #include <AMReX_FabArray.H>
      10             : #include <AMReX_FabArrayUtility.H>
      11             : #include <AMReX_Periodicity.H>
      12             : #include <AMReX_NonLocalBC.H>
      13             : 
      14             : #include <cstdint>
      15             : 
      16             : namespace amrex
      17             : {
      18             : 
      19             : using fMultiFab = FabArray<BaseFab<float> >;
      20             : 
      21             : class iMultiFab;
      22             : 
      23             : /**
      24             :  * \brief A collection (stored as an array) of FArrayBox objects.
      25             :  *
      26             :  * This class is useful for storing floating point data on a domain defined by
      27             :  * a union of rectangular regions embedded in a uniform index space.
      28             :  * MultiFab class extends the function of the underlying FabArray class just
      29             :  * as the FArrayBox class extends the function of BaseFab<Real>.
      30             :  * Additional member functions are defined for I/O and simple arithmetic
      31             :  * operations on these aggregate objects.
      32             :  *
      33             :  * This class does NOT provide a copy constructor or assignment operator.
      34             :  */
      35       11120 : class MultiFab
      36             :     :
      37             :     public FabArray<FArrayBox>
      38             : {
      39             : public:
      40             : 
      41             :     /**
      42             :     * \brief Constructs an empty MultiFab.
      43             :     *
      44             :     * Data can be defined at a later time using the define member functions
      45             :     * inherited from FabArray.
      46             :     */
      47             :     MultiFab () noexcept;
      48             : 
      49             :     /**
      50             :     * \brief Constructs an empty MultiFab.
      51             :     *
      52             :     * Data can be defined at a later time using the define member functions.
      53             :     * If `define` is called later with a nullptr as MFInfo's arena, the
      54             :     * default Arena `a` will be used.  If the arena in MFInfo is not a
      55             :     * nullptr, the MFInfo's arena will be used.
      56             :     */
      57             :     explicit MultiFab (Arena* a) noexcept;
      58             : 
      59             :     /**
      60             :     * \brief Constructs a MultiFab
      61             :     *
      62             :     * The size of the FArrayBox is given by the Box grown by \p ngrow, and
      63             :     * the number of components is given by \p ncomp. If \p info is set to
      64             :     * not allocating memory, then no FArrayBoxes are allocated at
      65             :     * this time but can be defined later.
      66             :     *
      67             :     * \param bxs a valid region
      68             :     * \param dm a DistribuionMapping
      69             :     * \param ncomp number of components
      70             :     * \param ngrow number of cells the region grows
      71             :     * \param info MFInfo
      72             :     */
      73             :     MultiFab (const BoxArray&            bxs,
      74             :               const DistributionMapping& dm,
      75             :               int                        ncomp,
      76             :               int                        ngrow,
      77             : #ifdef AMREX_STRICT_MODE
      78             :               const MFInfo&              info,
      79             :               const FabFactory<FArrayBox>& factory);
      80             : #else
      81             :               const MFInfo&              info = MFInfo(),
      82             :               const FabFactory<FArrayBox>& factory = FArrayBoxFactory());
      83             : #endif
      84             : 
      85             :     MultiFab (const BoxArray&            bxs,
      86             :               const DistributionMapping& dm,
      87             :               int                        ncomp,
      88             :               const IntVect&             ngrow,
      89             : #ifdef AMREX_STRICT_MODE
      90             :               const MFInfo&              info,
      91             :               const FabFactory<FArrayBox>& factory);
      92             : #else
      93             :               const MFInfo&              info = MFInfo(),
      94             :               const FabFactory<FArrayBox>& factory = FArrayBoxFactory());
      95             : #endif
      96             : 
      97             :     /**
      98             :      * \brief Make an alias MultiFab.
      99             :      *
     100             :      * Note that \p maketype must be `amrex::make_alias`,
     101             :      * \p scomp is the starting component of the alias, and
     102             :      * \p ncomp is the number of components in the new aliasing MultiFab.
     103             :      */
     104             :     MultiFab (const MultiFab& rhs, MakeType maketype, int scomp, int ncomp);
     105             : 
     106             :     ~MultiFab ();
     107             : 
     108             :     MultiFab (MultiFab&& rhs) noexcept;
     109             :     MultiFab& operator= (MultiFab&& rhs) noexcept = default;
     110             : 
     111             :     MultiFab (const MultiFab& rhs) = delete;
     112             :     MultiFab& operator= (const MultiFab& rhs) = delete;
     113             : 
     114             :     void define (const BoxArray&            bxs,
     115             :                  const DistributionMapping& dm,
     116             :                  int                        nvar,
     117             :                  int                        ngrow,
     118             : #ifdef AMREX_STRICT_MODE
     119             :                  const MFInfo&              info,
     120             :                  const FabFactory<FArrayBox>& factory);
     121             : #else
     122             :                  const MFInfo&              info = MFInfo(),
     123             :                  const FabFactory<FArrayBox>& factory = FArrayBoxFactory());
     124             : #endif
     125             : 
     126             :     void define (const BoxArray&            bxs,
     127             :                  const DistributionMapping& dm,
     128             :                  int                        nvar,
     129             :                  const IntVect&             ngrow,
     130             : #ifdef AMREX_STRICT_MODE
     131             :                  const MFInfo&              info,
     132             :                  const FabFactory<FArrayBox>& factory);
     133             : #else
     134             :                  const MFInfo&              info = MFInfo(),
     135             :                  const FabFactory<FArrayBox>& factory = FArrayBoxFactory());
     136             : #endif
     137             : 
     138             :     MultiFab& operator= (Real r);
     139             : 
     140             :     /**
     141             :     * \brief Returns the minimum value contained in component \p comp of the
     142             :     * MultiFab.
     143             :     *
     144             :     * The parameter \p nghost determines the number of
     145             :     * boundary cells to search for the minimum. The default is to
     146             :     * search only the valid regions of the FArrayBoxes.
     147             :     */
     148             :     [[nodiscard]] Real min (int comp,
     149             :               int nghost = 0,
     150             :               bool local = false) const;
     151             :     /**
     152             :     * \brief Identical to min() function, but confines its
     153             :     * search to intersection of Box b and the MultiFab.
     154             :     */
     155             :     [[nodiscard]] Real min (const Box& region,
     156             :               int        comp,
     157             :               int        nghost = 0,
     158             :               bool       local = false) const;
     159             :     /**
     160             :     * \brief Returns the maximum value contained in component \p comp of the
     161             :     * MultiFab.
     162             :     *
     163             :     * The parameter \p nghost determines the number of
     164             :     * boundary cells to search for the maximum. The default is to
     165             :     * search only the valid regions of the FArrayBoxes.
     166             :     */
     167             :     [[nodiscard]] Real max (int comp,
     168             :               int nghost = 0,
     169             :               bool local = false) const;
     170             :     /**
     171             :     * \brief Identical to the previous `max()` function, but confines its
     172             :     * search to intersection of Box b and the MultiFab.
     173             :     */
     174             :     [[nodiscard]] Real max (const Box& region,
     175             :               int        comp,
     176             :               int        nghost = 0,
     177             :               bool       local = false) const;
     178             :     /**
     179             :     * \brief Returns the maximum *absolute* value contained in
     180             :     * component comp of the MultiFab.
     181             :     */
     182             :     [[nodiscard]] Real norm0 (int comp = 0, int nghost = 0, bool local = false, bool ignore_covered = false ) const;
     183             :     [[nodiscard]] Real norminf (int comp = 0, int nghost = 0, bool local = false, bool ignore_covered = false ) const {
     184             :         return norm0(comp,nghost,local,ignore_covered);
     185             :     }
     186             : 
     187             :     [[nodiscard]] Real norm0 (const iMultiFab& mask, int comp = 0, int nghost = 0, bool local = false) const;
     188             :     [[nodiscard]] Real norminf (const iMultiFab& mask, int comp = 0, int nghost = 0, bool local = false) const {
     189             :         return norm0(mask,comp,nghost,local);
     190             :     }
     191             : 
     192             :     [[nodiscard]] Real norm0 (int comp, int ncomp, IntVect const& nghost, bool local = false,
     193             :                 bool ignore_covered = false) const;
     194             : 
     195             :     using FabArray<FArrayBox>::norminf;
     196             : 
     197             :     /**
     198             :     * \brief Returns the maximum *absolute* values contained in
     199             :     * each component of \p comps of the MultiFab. \p nghost ghost cells are used.
     200             :     */
     201             :     [[nodiscard]] Vector<Real> norm0 (const Vector<int>& comps, int nghost = 0, bool local = false, bool ignore_covered = false ) const;
     202             :     [[nodiscard]] Vector<Real> norminf (const Vector<int>& comps, int nghost = 0, bool local = false, bool ignore_covered = false) const {
     203             :         return norm0(comps,nghost,local,ignore_covered);
     204             :     }
     205             : 
     206             :     /**
     207             :     * \brief Returns the L1 norm of component \p comp over the MultiFab.
     208             :     *
     209             :     * No ghost cells are used.  This version has no double counting for nodal data.
     210             :     */
     211             :     [[nodiscard]] Real norm1 (int comp, const Periodicity& period, bool ignore_covered = false) const;
     212             :     /**
     213             :     * \brief Returns the L1 norm of component \p comp over the MultiFab.
     214             :     * \p ngrow ghost cells are used.
     215             :     */
     216             :     [[nodiscard]] Real norm1 (int comp = 0, int ngrow = 0, bool local = false) const;
     217             :     /**
     218             :     * \brief Returns the L1 norm of each component of "comps" over the MultiFab.
     219             :     * ngrow ghost cells are used.
     220             :     */
     221             :     [[nodiscard]] Vector<Real> norm1 (const Vector<int>& comps, int ngrow = 0, bool local = false) const;
     222             :     /**
     223             :     * \brief Returns the L2 norm of component \p comp over the MultiFab.
     224             :     * No ghost cells are used.
     225             :     */
     226             :     [[nodiscard]] Real norm2 (int comp = 0) const;
     227             :     /**
     228             :     * \brief Returns the L2 norm of component \p comp over the MultiFab.
     229             :     * No ghost cells are used. This version has no double counting for nodal data.
     230             :     */
     231             :     [[nodiscard]] Real norm2 (int comp, const Periodicity& period) const;
     232             :     /**
     233             :     * \brief Returns the L2 norm of each component of "comps" over the MultiFab.
     234             :     * No ghost cells are used.
     235             :     */
     236             :     [[nodiscard]] Vector<Real> norm2 (const Vector<int>& comps) const;
     237             :     /**
     238             :     * \brief Returns the sum of component "comp" over the MultiFab -- no ghost cells are included.
     239             :     */
     240             :     [[nodiscard]] Real sum (int comp = 0, bool local = false) const;
     241             :     /**
     242             :     * \brief Returns the sum of component "comp" in the given "region". -- no ghost cells are included.
     243             :     */
     244             :     [[nodiscard]] Real sum (Box const& region, int comp = 0, bool local = false) const;
     245             : 
     246             :     using FabArray<FArrayBox>::sum;
     247             : 
     248             :     /**
     249             :     * \brief Same as sum with \p local =false, but for non-cell-centered data, this
     250             :     * only adds non-unique points that are owned by multiple boxes once.
     251             :     */
     252             :     [[nodiscard]] Real sum_unique (int comp = 0,
     253             :                      bool local = false,
     254             :                      const Periodicity& period = Periodicity::NonPeriodic()) const;
     255             :     /**
     256             :     * \brief Returns the unique sum of component "comp" in the given
     257             :     * region. Non-unique points owned by multiple boxes in the MultiFab are
     258             :     * only added once. No ghost cells are included. This function does not take
     259             :     * periodicity into account in the determination of uniqueness of points.
     260             :     */
     261             :     [[nodiscard]] Real sum_unique (Box const& region, int comp = 0, bool local = false) const;
     262             :     /**
     263             :     * \brief Adds the scalar value \p val to the value of each cell in the
     264             :     * specified subregion of the MultiFab.
     265             :     *
     266             :     * The subregion consists of the \p num_comp components starting at component \p comp.
     267             :     * The value of nghost specifies the number of cells in the
     268             :     * boundary region of each FArrayBox in the subregion that should
     269             :     * be modified.
     270             :     */
     271             :     void plus (Real val,
     272             :                int  comp,
     273             :                int  num_comp,
     274             :                int  nghost = 0);
     275             :     /**
     276             :     * \brief Identical to the previous version of plus(), with the
     277             :     * restriction that the subregion is further constrained to
     278             :     * the intersection with Box region.
     279             :     */
     280             :     void plus (Real       val,
     281             :                const Box& region,
     282             :                int        comp,
     283             :                int        num_comp,
     284             :                int        nghost = 0);
     285             :     /**
     286             :     * \brief Adds the scalar value val to the value of each cell in the
     287             :     * valid region of each component of the MultiFab.  The value
     288             :     * of nghost specifies the number of cells in the boundary
     289             :     * region that should be modified.
     290             :     */
     291             :     void plus (Real val,
     292             :                int  nghost);
     293             :     /**
     294             :     * \brief Adds the scalar value val to the value of each cell in the
     295             :     * valid region of each component of the MultiFab, that also
     296             :     * intersects the Box region.  The value of nghost specifies the
     297             :     * number of cells in the boundary region of each FArrayBox in
     298             :     * the subregion that should be modified.
     299             :     */
     300             :     void plus (Real       val,
     301             :                const Box& region,
     302             :                int        nghost);
     303             :     /**
     304             :     * \brief Scales the value of each cell in the specified subregion of the
     305             :     * MultiFab by the scalar val (a[i] <- a[i]*val). The subregion
     306             :     * consists of the num_comp components starting at component comp.
     307             :     * The value of nghost specifies the number of cells in the
     308             :     * boundary region of each FArrayBox in the subregion that should
     309             :     * be modified.
     310             :     */
     311             :     void mult (Real val,
     312             :                int  comp,
     313             :                int  num_comp,
     314             :                int  nghost = 0);
     315             :     /**
     316             :     * \brief Identical to the previous version of mult(), with the
     317             :     * restriction that the subregion is further constrained to the
     318             :     * intersection with Box region.  The value of nghost specifies the
     319             :     * number of cells in the boundary region of each FArrayBox in
     320             :     * the subregion that should be modified.
     321             :     */
     322             :     void mult (Real       val,
     323             :                const Box& region,
     324             :                int        comp,
     325             :                int        num_comp,
     326             :                int        nghost = 0);
     327             :     /**
     328             :     * \brief Scales the value of each cell in the valid region of each
     329             :     * component of the MultiFab by the scalar val (a[i] <- a[i]*val).
     330             :     * The value of nghost specifies the number of cells in the
     331             :     * boundary region that should be modified.
     332             :     */
     333             :     void mult (Real val,
     334             :                int  nghost = 0);
     335             :     /**
     336             :     * \brief Scales the value of each cell in the valid region of each
     337             :     * component of the MultiFab by the scalar val (a[i] <- a[i]*val),
     338             :     * that also intersects the Box region.  The value of nghost
     339             :     * specifies the number of cells in the boundary region of each
     340             :     * FArrayBox in the subregion that should be modified.
     341             :     */
     342             :     void mult (Real       val,
     343             :                const Box& region,
     344             :                int        nghost = 0);
     345             :     /**
     346             :     * \brief Replaces the value of each cell in the specified subregion of
     347             :     * the MultiFab with its reciprocal multiplied by the value of
     348             :     * numerator. The subregion consists of the num_comp components
     349             :     * starting at component comp.  The value of nghost specifies the
     350             :     * number of cells in the boundary region of each FArrayBox in the
     351             :     * subregion that should be modified.
     352             :     */
     353             :     void invert (Real numerator,
     354             :                  int  comp,
     355             :                  int  num_comp,
     356             :                  int  nghost = 0);
     357             :     /**
     358             :     * \brief Identical to the previous version of invert(), with the
     359             :     * restriction that the subregion is further constrained to the
     360             :     * intersection with Box region.  The value of nghost specifies the
     361             :     * number of cells in the boundary region of each FArrayBox in the
     362             :     * subregion that should be modified.
     363             :     */
     364             :     void invert (Real       numerator,
     365             :                  const Box& region,
     366             :                  int        comp,
     367             :                  int        num_comp,
     368             :                  int        nghost = 0);
     369             :     /**
     370             :     * \brief Replaces the value of each cell in the specified subregion of
     371             :     * the MultiFab with its reciprocal multiplied by the value of
     372             :     * numerator.  The value of nghost specifies the number of cells
     373             :     * in the boundary region that should be modified.
     374             :     */
     375             :     void invert (Real numerator,
     376             :                  int  nghost);
     377             :     /**
     378             :     * \brief Replaces the value of each cell in the specified subregion of
     379             :     * the MultiFab, that also intersects the Box region, with its
     380             :     * reciprocal multiplied by the value of numerator.  The value
     381             :     * of nghost specifies the number of cells in the boundary region
     382             :     * of each FArrayBox in the subregion that should be modified.
     383             :     */
     384             :     void invert (Real       numerator,
     385             :                  const Box& region,
     386             :                  int        nghost);
     387             :     /**
     388             :     * \brief Negates the value of each cell in the specified subregion of
     389             :     * the MultiFab.  The subregion consists of the num_comp
     390             :     * components starting at component comp.  The value of nghost
     391             :     * specifies the number of cells in the boundary region of each
     392             :     * FArrayBox in the subregion that should be modified.
     393             :     */
     394             :     void negate (int comp,
     395             :                  int num_comp,
     396             :                  int nghost = 0);
     397             :     /**
     398             :     * \brief Identical to the previous version of negate(), with the
     399             :     * restriction that the subregion is further constrained to
     400             :     * the intersection with Box region.
     401             :     */
     402             :     void negate (const Box& region,
     403             :                  int        comp,
     404             :                  int        num_comp,
     405             :                  int        nghost = 0);
     406             :     /**
     407             :     * \brief Negates the value of each cell in the valid region of
     408             :     * the MultiFab.  The value of nghost specifies the number of
     409             :     * cells in the boundary region that should be modified.
     410             :     */
     411             :     void negate (int nghost = 0);
     412             :     /**
     413             :     * \brief Negates the value of each cell in the valid region of
     414             :     * the MultiFab that also intersects the Box region.  The value
     415             :     * of nghost specifies the number of cells in the boundary region
     416             :     * that should be modified.
     417             :     */
     418             :     void negate (const Box& region,
     419             :                  int        nghost = 0);
     420             : 
     421             :     [[nodiscard]] IntVect minIndex (int comp,
     422             :                       int nghost = 0) const;
     423             : 
     424             :     [[nodiscard]] IntVect maxIndex (int comp,
     425             :                       int nghost = 0) const;
     426             :     /**
     427             :     * \brief This function adds the values of the cells in mf to the corresponding
     428             :     * cells of this MultiFab.  mf is required to have the same BoxArray or
     429             :     * "valid region" as this MultiFab.  The addition is done only to num_comp
     430             :     * components, starting with component number strt_comp.  The parameter
     431             :     * nghost specifies the number of boundary cells that will be modified.
     432             :     * If nghost == 0, only the valid region of each FArrayBox will be
     433             :     * modified.
     434             :     */
     435             :     void plus (const MultiFab& mf,
     436             :                int             strt_comp,
     437             :                int             num_comp,
     438             :                int             nghost);
     439             :     /**
     440             :     * \brief This function subtracts the values of the cells in mf from the
     441             :     * corresponding cells of this MultiFab.  mf is required to have the
     442             :     * same BoxArray or "valid region" as this MultiFab.  The subtraction is
     443             :     * done only to num_comp components, starting with component number
     444             :     * strt_comp.  The parameter nghost specifies the number of boundary
     445             :     * cells that will be modified.  If nghost == 0, only the valid region of
     446             :     * each FArrayBox will be modified.
     447             :     */
     448             :     void minus (const MultiFab& mf,
     449             :                 int             strt_comp,
     450             :                 int             num_comp,
     451             :                 int             nghost);
     452             :     /**
     453             :     * \brief This function divides the values of the cells in mf from the
     454             :     * corresponding cells of this MultiFab.  mf is required to have the
     455             :     * same BoxArray or "valid region" as this MultiFab.  The division is
     456             :     * done only to num_comp components, starting with component number
     457             :     * strt_comp.  The parameter nghost specifies the number of boundary
     458             :     * cells that will be modified.  If nghost == 0, only the valid region of
     459             :     * each FArrayBox will be modified.  Note, nothing is done to protect
     460             :     * against divide by zero.
     461             :     */
     462             :     void divide (const MultiFab& mf,
     463             :                  int             strt_comp,
     464             :                  int             num_comp,
     465             :                  int             nghost);
     466             :     /**
     467             :     * \brief Returns the dot product of two MultiFabs.
     468             :     */
     469             :     static Real Dot (const MultiFab& x, int xcomp,
     470             :                      const MultiFab& y, int ycomp,
     471             :                      int numcomp, int nghost, bool local = false);
     472             : 
     473             :     /**
     474             :     * \brief Returns the dot product of a MultiFab with itself.
     475             :     */
     476             :     static Real Dot (const MultiFab& x, int xcomp,
     477             :                      int numcomp, int nghost, bool local = false);
     478             : 
     479             :     static Real Dot (const iMultiFab& mask,
     480             :                      const MultiFab& x, int xcomp,
     481             :                      const MultiFab& y, int ycomp,
     482             :                      int numcomp, int nghost, bool local = false);
     483             :     /**
     484             :     * \brief Add src to dst including nghost ghost cells.
     485             :     * The two MultiFabs MUST have the same underlying BoxArray.
     486             :     */
     487             :     static void Add (MultiFab&       dst,
     488             :                      const MultiFab& src,
     489             :                      int             srccomp,
     490             :                      int             dstcomp,
     491             :                      int             numcomp,
     492             :                      int             nghost);
     493             : 
     494             :     static void Add (MultiFab&       dst,
     495             :                      const MultiFab& src,
     496             :                      int             srccomp,
     497             :                      int             dstcomp,
     498             :                      int             numcomp,
     499             :                      const IntVect&  nghost);
     500             : 
     501             :     /** Create a deep copy of this MultiFab and its data.
     502             :      *
     503             :      * This uses the same arena and factory in the copy and copies
     504             :      * all data.
     505             :      */
     506             :     [[nodiscard]] MultiFab deepCopy () const;
     507             : 
     508             :     /**
     509             :     * \brief Copy from src to dst including nghost ghost cells.
     510             :     * The two MultiFabs MUST have the same underlying BoxArray.
     511             :     * The copy is local.  The parallel copy function is in FabArray.H
     512             :     */
     513             :     static void Copy (MultiFab&       dst,
     514             :                       const MultiFab& src,
     515             :                       int             srccomp,
     516             :                       int             dstcomp,
     517             :                       int             numcomp,
     518             :                       int             nghost);
     519             : 
     520             :     static void Copy (MultiFab&       dst,
     521             :                       const MultiFab& src,
     522             :                       int             srccomp,
     523             :                       int             dstcomp,
     524             :                       int             numcomp,
     525             :                       const IntVect&  nghost);
     526             : 
     527             :     /**
     528             :     * \brief Swap from src to dst including nghost ghost cells.
     529             :     * The two MultiFabs MUST have the same underlying BoxArray.
     530             :     * The swap is local.
     531             :     */
     532             :     static void Swap (MultiFab&       dst,
     533             :                       MultiFab&       src,
     534             :                       int             srccomp,
     535             :                       int             dstcomp,
     536             :                       int             numcomp,
     537             :                       int             nghost);
     538             : 
     539             :     static void Swap (MultiFab&       dst,
     540             :                       MultiFab&       src,
     541             :                       int             srccomp,
     542             :                       int             dstcomp,
     543             :                       int             numcomp,
     544             :                       const IntVect&  nghost);
     545             : 
     546             :     /**
     547             :     * \brief Subtract src from dst including nghost ghost cells.
     548             :     * The two MultiFabs MUST have the same underlying BoxArray.
     549             :     */
     550             :     static void Subtract (MultiFab&       dst,
     551             :                           const MultiFab& src,
     552             :                           int             srccomp,
     553             :                           int             dstcomp,
     554             :                           int             numcomp,
     555             :                           int             nghost);
     556             : 
     557             :     static void Subtract (MultiFab&       dst,
     558             :                           const MultiFab& src,
     559             :                           int             srccomp,
     560             :                           int             dstcomp,
     561             :                           int             numcomp,
     562             :                           const IntVect&  nghost);
     563             :     /**
     564             :     * \brief Multiply dst by src including nghost ghost cells.
     565             :     * The two MultiFabs MUST have the same underlying BoxArray.
     566             :     */
     567             :     static void Multiply (MultiFab&       dst,
     568             :                           const MultiFab& src,
     569             :                           int             srccomp,
     570             :                           int             dstcomp,
     571             :                           int             numcomp,
     572             :                           int             nghost);
     573             : 
     574             :     static void Multiply (MultiFab&       dst,
     575             :                           const MultiFab& src,
     576             :                           int             srccomp,
     577             :                           int             dstcomp,
     578             :                           int             numcomp,
     579             :                           const IntVect&  nghost);
     580             :     /**
     581             :     * \brief Divide dst by src including nghost ghost cells.
     582             :     * The two MultiFabs MUST have the same underlying BoxArray.
     583             :     */
     584             :     static void Divide (MultiFab&       dst,
     585             :                         const MultiFab& src,
     586             :                         int             srccomp,
     587             :                         int             dstcomp,
     588             :                         int             numcomp,
     589             :                         int             nghost);
     590             : 
     591             :     static void Divide (MultiFab&       dst,
     592             :                         const MultiFab& src,
     593             :                         int             srccomp,
     594             :                         int             dstcomp,
     595             :                         int             numcomp,
     596             :                         const IntVect&  nghost);
     597             :     /**
     598             :     * \brief dst += a*src
     599             :     */
     600             :     static void Saxpy (MultiFab&       dst,
     601             :                        Real            a,
     602             :                        const MultiFab& src,
     603             :                        int             srccomp,
     604             :                        int             dstcomp,
     605             :                        int             numcomp,
     606             :                        int             nghost);
     607             : 
     608             :     using FabArray<FArrayBox>::Saxpy;
     609             : 
     610             :     /**
     611             :     * \brief dst = src + a*dst
     612             :     */
     613             :     static void Xpay (MultiFab&       dst,
     614             :                       Real            a,
     615             :                       const MultiFab& src,
     616             :                       int             srccomp,
     617             :                       int             dstcomp,
     618             :                       int             numcomp,
     619             :                       int             nghost);
     620             : 
     621             :     using FabArray<FArrayBox>::Xpay;
     622             : 
     623             :     /**
     624             :     * \brief dst = a*x + b*y
     625             :     */
     626             :     static void LinComb (MultiFab&       dst,
     627             :                          Real            a,
     628             :                          const MultiFab& x,
     629             :                          int             xcomp,
     630             :                          Real            b,
     631             :                          const MultiFab& y,
     632             :                          int             ycomp,
     633             :                          int             dstcomp,
     634             :                          int             numcomp,
     635             :                          int             nghost);
     636             : 
     637             :     using FabArray<FArrayBox>::LinComb;
     638             : 
     639             :     /**
     640             :     * \brief dst += src1*src2
     641             :     */
     642             :     static void AddProduct (MultiFab&       dst,
     643             :                             const MultiFab& src1,
     644             :                             int             comp1,
     645             :                             const MultiFab& src2,
     646             :                             int             comp2,
     647             :                             int             dstcomp,
     648             :                             int             numcomp,
     649             :                             int             nghost);
     650             : 
     651             :     static void AddProduct (MultiFab&       dst,
     652             :                             const MultiFab& src1,
     653             :                             int             comp1,
     654             :                             const MultiFab& src2,
     655             :                             int             comp2,
     656             :                             int             dstcomp,
     657             :                             int             numcomp,
     658             :                             const IntVect&  nghost);
     659             : 
     660             :     /**
     661             :     * \brief Are the numbers in the MF finite (i.e., neither nan nor inf)?
     662             :     * This may return true, even if the MF contains NaNs or Infs, if the
     663             :     * machine doesn't support the appropriate NaN and Inf testing functions.
     664             :     *
     665             :     * This version checks all components and grow cells.
     666             :     */
     667             :     [[nodiscard]] bool is_finite (bool local=false) const;
     668             :     [[nodiscard]] bool is_finite (int scomp, int ncomp, int ngrow = 0, bool local=false) const;
     669             :     [[nodiscard]] bool is_finite (int scomp, int ncomp, const IntVect& ngrow, bool local=false) const;
     670             : 
     671             :     /**
     672             :     * \brief Are there any NaNs in the MF?
     673             :     * This may return false, even if the MF contains NaNs, if the machine
     674             :     * doesn't support the appropriate NaN testing functions.
     675             :     *
     676             :     * This version checks all components and grow cells.
     677             :     */
     678             :     [[nodiscard]] bool contains_nan (bool local=false) const;
     679             :     [[nodiscard]] bool contains_nan (int scomp, int ncomp, int ngrow = 0, bool local=false) const;
     680             :     [[nodiscard]] bool contains_nan (int scomp, int ncomp, const IntVect& ngrow, bool local=false) const;
     681             :     /**
     682             :     * \brief Are there any Infs in the MF?
     683             :     * This may return false, even if the MF contains Infs, if the machine
     684             :     * doesn't support the appropriate Inf testing functions.
     685             :     * This version checks all components and grow cells.
     686             :     */
     687             :     [[nodiscard]] bool contains_inf (bool local=false) const;
     688             :     [[nodiscard]] bool contains_inf (int scomp, int ncomp, int ngrow = 0, bool local=false) const;
     689             :     [[nodiscard]] bool contains_inf (int scomp, int ncomp, const IntVect& ngrow, bool local=false) const;
     690             : 
     691             :     /**
     692             :      * \brief Return a mask indicating how many duplicates are in each point.
     693             :      */
     694             :     [[nodiscard]] std::unique_ptr<MultiFab> OverlapMask (const Periodicity& period = Periodicity::NonPeriodic()) const;
     695             :     //! Owner is the grid with the lowest grid number containing the data.
     696             :     [[nodiscard]] std::unique_ptr<iMultiFab> OwnerMask (const Periodicity& period = Periodicity::NonPeriodic()) const;
     697             : 
     698             :     //! Sync up nodal data via averaging
     699             :     void AverageSync (const Periodicity& period = Periodicity::NonPeriodic());
     700             :     //! Sync up nodal data with weights
     701             :     void WeightedSync (const MultiFab& wgt, const Periodicity& period = Periodicity::NonPeriodic());
     702             :     //! Sync up nodal data with owners overriding non-owners
     703             :     void OverrideSync (const iMultiFab& msk, const Periodicity& period = Periodicity::NonPeriodic());
     704             : 
     705             :     using FabArray<FArrayBox>::OverrideSync;
     706             : 
     707             :     static void Initialize ();
     708             :     static void Finalize ();
     709             : 
     710             : private:
     711             :     //
     712             :     //! Some useful typedefs.
     713             :     using CopyComTagsContainer = FabArrayBase::CopyComTagsContainer;
     714             :     using MapOfCopyComTagContainers = FabArrayBase::MapOfCopyComTagContainers;
     715             : 
     716             :     void initVal ();
     717             : };
     718             : 
     719             : #ifndef _MSC_VER
     720             : inline void GccPlacaterMF ()
     721             : {
     722             :     std::allocator<MultiFab*> a1;
     723             :     std::allocator<MultiFab const*> a2;
     724             :     std::allocator<FabArray<FArrayBox>*> a3;
     725             :     std::allocator<FabArray<FArrayBox> const*> a4;
     726             : 
     727             :     amrex::ignore_unused(a1);
     728             :     amrex::ignore_unused(a2);
     729             :     amrex::ignore_unused(a3);
     730             :     amrex::ignore_unused(a4);
     731             : }
     732             : #endif
     733             : 
     734             : }
     735             : 
     736             : #endif /*BL_MULTIFAB_H*/

Generated by: LCOV version 1.14