Chombo + EB + MF  3.2
FArrayBox.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _FARRAYBOX_H_
12 #define _FARRAYBOX_H_
13 
14 #ifndef WRAPPER
15 #include <iostream>
16 
17 // #include <Pointers.H>
18 #include "Box.H"
19 #include "BaseFab.H"
20 #endif
21 
22 #include "REAL.H"
23 #include "SPACE.H"
24 #include "NamespaceHeader.H"
25 
26 
27 ///
28 /**
29  Fortran Array Boxes (generally called FABs) are objects constructed
30  to interface with arrays in Fortran. Useful operations can be performed
31  upon FABs in C++, and they provide a convenient interface to
32  Fortran when it is necessary to retreat into that language for
33  doing arithmetic operations when performance matters.
34 
35  FArrayBox is derived from BaseFab<Real>.
36  FArrayBox adds additional useful capabilities which make sense
37  for Real types, such as I/O and L**p norms.
38 
39  The C pre-processor macro `CH_SPACEDIM' must be defined to use
40  this class. The internal precision of FArrayBox objects is
41  set by defining either `CH_USE_FLOAT' or `CH_USE_DOUBLE'
42 
43  This class does NOT provide a copy constructor or assignment operator.
44 */
45 class FArrayBox: public BaseFab<Real>
46 {
47 public:
48 
49  ///
50  /**
51  Constructs an invalid FArrayBox with no memory.
52  */
53  FArrayBox ();
54 
55  ///
56  /**
57  Constructs an initial FArrayBox with the data space allocated but not
58  inititialized. a_ncomp is the number of components (variables) at each
59  data point in the Box.
60  */
61  FArrayBox(const Box& a_box,
62  int a_ncomp,
63  Real* a_alias);
64 
65  FArrayBox(const Box& a_box,
66  int a_ncomp);
67  ///
68  /**
69  Construct an aliaed FArrayBox. See BaseFab class for details.
70  */
71  FArrayBox(const Interval& a_comps,
72  FArrayBox& a_original)
73  :
74  BaseFab<Real>(a_comps, a_original)
75  {}
76 
77  ///
78  /**
79  Defines FArrayBox with the data space allocated but not
80  inititialized. a_ncomp is the number of components (variables) at each
81  data point in the Box.
82  */
83  virtual void define(const Box& a_box,
84  int a_ncomp,
85  Real* a_alias = NULL)
86  {
87  BaseFab<Real>::define(a_box, a_ncomp, a_alias);
88  }
89 
90  ///
91  /**
92  The (virtual) destructor.
93  */
94  virtual ~FArrayBox ();
95 
96  ///
97  /**
98  Constructs an 'aliased' BaseFab of the requested interval of the
99  argument BaseFab. This BaseFab does not allocate any memory, but
100  sets its data pointer into the memory pointed to by the argument
101  BaseFab. It is the users responsiblity to ensure this aliased
102  BaseFab is not used after the original BaseFab has deleted its data ptr
103  (resize, define(..) called, or destruction, etc.).
104 
105  This aliased BaseFab will also generate side effects (modifying the values
106  of data in one will modify the other's data).
107 
108  This aliased BaseFab will have a_comps.size() components, starting at zero.
109  */
110  virtual void define(const Interval& a_comps,
111  FArrayBox& a_original)
112  {
113  BaseFab<Real>::define(a_comps, a_original);
114  }
115 
116  ///
117  /**
118  * This is here only to make the Intel compiler stop warning about
119  * partial override.
120  */
121  virtual void define(const Interval& a_comps,
122  BaseFab<Real>& a_original)
123  {
124  BaseFab<Real>::define(a_comps, a_original);
125  }
126 
127  ///
128  /** override resize. I'm going to try and get rid of this function in the future (bvs)
129  */
130  virtual void resize(const Box& a_box,
131  int a_comps,
132  Real* a_alias = NULL)
133  {
134  BaseFab<Real>::resize(a_box, a_comps, a_alias);
135  }
136  ///
137  /**
138  Constructs FArrayBox by reading it from istream.
139  */
140  explicit FArrayBox(std::istream& a_is);
141 
142  ///
143  /**
144  Returns the Lp-norm of this FAB using components
145  (a_comp : a_comp+a_numcomp-1) and within the a_subbox.
146  a_p < 0 -> ERROR
147  a_p = 0 -> infinity norm (max norm)
148  a_p = 1 -> sum of ABS(FAB)
149  a_p > 1 -> Lp-norm
150  */
151  virtual Real norm(const Box& a_subbox,
152  int a_p = 2,
153  int a_comp = 0,
154  int a_numcomp = 1) const;
155 
156  ///
157  /**
158  Returns the Lp-norm of this FAB using components
159  (a_comp : a_comp+a_numcomp-1).
160  a_p < 0 -> ERROR
161  a_p = 0 -> infinity norm (max norm)
162  a_p = 1 -> sum of ABS(FAB)
163  a_p > 1 -> Lp-norm
164  */
165  virtual Real norm(int a_p = 2,
166  int a_comp = 0,
167  int a_numcomp = 1) const;
168 
169  ///
170  /**
171  Returns sum of pow(fab[i,c],p): i in a_subbox, a_comp <= c <
172  a_comp+a_numcomp, a_p >= 2 only
173  */
174  virtual Real sumPow(const Box& a_subbox,
175  int a_p = 2,
176  int a_comp = 0,
177  int a_numcomp = 1) const;
178 
179  /// Return the dot product of this FArrayBox with another
180  /**
181  Return the dot product of this FArrayBox and "a_fab2" over their common
182  box and all components.
183  */
184  Real dotProduct(const FArrayBox& a_fab2) const;
185 
186  /// Return the dot product of this FArrayBox with another
187  /**
188  Return the dot product of this FArrayBox and "a_fab2" over the
189  a_box box and all components.
190  */
191  Real dotProduct(const FArrayBox& a_fab2, const Box& a_box) const;
192 
193  ///
194  /**
195  Returns the minimum value of given component of this FArrayBox.
196  */
197  Real min(int a_comp = 0) const;
198 
199  ///
200  /**
201  Returns the minimum value of given component of this FArrayBox in
202  given a_subbox.
203 
204  */
205  Real min(const Box& a_subbox,
206  int a_comp = 0) const;
207 
208  ///
209  /**
210  Returns the maximum value of given component of this FArrayBox.
211  */
212  Real max(int a_comp = 0) const;
213 
214  ///
215  /**
216  Returns the maximum value of given component of this FArrayBox in
217  given a_subbox.
218 
219  */
220  Real max(const Box& a_subbox,
221  int a_comp = 0) const;
222 
223  ///
224  /**
225  Finds location of minimum value in given component of this FArrayBox.
226  */
227  IntVect minIndex(int a_comp = 0) const;
228 
229  ///
230  /**
231  Returns location of minimum value in given component of this FArrayBox
232  in given a_subbox.
233  */
234  IntVect minIndex(const Box& a_subbox,
235  int a_comp = 0) const;
236 
237  ///
238  /**
239  Returns location of maximum value in given component of this FArrayBox.
240  */
241  IntVect maxIndex(int a_comp = 0) const;
242 
243  ///
244  /**
245  Returns location of maximum value in given component of this FArrayBox
246  in given a_subbox.
247  */
248  IntVect maxIndex(const Box& a_subbox,
249  int a_comp = 0) const;
250 
251  ///
252  /**
253  Computes a_mask array with value of 1 in cells where this FArrayBox
254  has value less than a_val, 0 otherwise. a_mask is resized by this
255  function. The number of cells marked with 1 returned.
256  */
257  int maskLT(BaseFab<int>& a_mask,
258  Real a_val,
259  int a_comp = 0) const;
260 
261  ///
262  /**
263  Computes a_mask array with value of 1 in cells where this FArrayBox
264  has value less than or equal to a_val, 0 otherwise. a_mask is
265  resized by this function. The number of cells marked with 1
266  returned.
267  */
268  int maskLE(BaseFab<int>& a_mask,
269  Real a_val,
270  int a_comp = 0) const;
271  ///
272  /**
273  Computes a_mask array with value of 1 in cells where this FArrayBox
274  has value equal to a_val, 0 otherwise. a_mask is resized by this
275  function. The number of cells marked with 1 returned.
276 
277  */
278  int maskEQ(BaseFab<int>& a_mask,
279  Real a_val,
280  int a_comp = 0) const;
281  ///
282  /**
283  Computes a_mask array with value of 1 in cells where this FArrayBox
284  has value greater than a_val, 0 otherwise. a_mask is resized by this
285  function. The number of cells marked with 1 returned.
286  */
287  int maskGT(BaseFab<int>& a_mask,
288  Real a_val,
289  int a_comp = 0) const;
290 
291  ///
292  /**
293  Computes a_mask array with value of 1 in cells where this FArrayBox
294  has value greater than or equal to a_val, 0 otherwise. a_mask is
295  resized by this function. The number of cells marked with 1 returned.
296  */
297  int maskGE(BaseFab<int>& a_mask,
298  Real a_val,
299  int a_comp = 0) const;
300 
301 
302  ///
303  /**
304  Modifies this FArrayBox by replacing each value with its absolute value.
305  */
306  void abs();
307 
308  ///
309  /**
310  Modifies this FArrayBox by replacing each value with its absolute value,
311  for components (a_comp : a_comp+a_numcomp-1).
312  */
313  void abs(int a_comp,
314  int a_numcomp = 1);
315 
316  ///
317  /**
318  Modifies this FArrayBox by replacing eahc value with its absolute value,
319  for components (a_comp : a_comp+a_numcomp-1) and within the a_subbox.
320  */
321  void abs (const Box& a_subbox,
322  int a_comp = 0,
323  int a_numcomp = 1);
324 
325  ///
326  /**
327  Returns sum of given component of FArrayBox.
328  */
329  Real sum(int a_comp,
330  int a_numcomp = 1) const;
331 
332  ///
333  /**
334  Returns sum of component of this FArrayBox in given a_subbox.
335  */
336  Real sum(const Box& a_subbox,
337  int a_comp,
338  int a_numcomp = 1) const;
339 
340  ///
341  /**
342  Modifies this FArrayBox by replacing each value x with a_r/x.
343  */
344  FArrayBox& invert(Real a_r);
345 
346  ///
347  /**
348  Modifies this FArrayBox by replacing each value x with a_r/x. For
349  given range of components.
350  */
351  FArrayBox& invert(Real a_r,
352  int a_comp,
353  int a_numcomp = 1);
354 
355  ///
356  /**
357  Modifies this FArrayBox by replacing each value x with a_r/x. For
358  given range of components and within given a_subbox.
359  */
360  FArrayBox& invert(Real a_r,
361  const Box& a_subbox,
362  int a_comp = 0,
363  int a_numcomp = 1);
364 
365  ///
366  /**
367  Modifies this FArrayBox by replacing each value with its additive
368  inverse. For given range of components and within given a_subbox.
369  */
370  FArrayBox& negate(const Box& a_subbox,
371  int a_comp = 0,
372  int a_numcomp = 1);
373 
374  ///
375  /**
376  Modifies this FArrayBox by replacing each value with its additive
377  inverse. For given range of components.
378  */
379  FArrayBox& negate(int a_comp,
380  int a_numcomp = 1);
381 
382  ///
383  /**
384  Modifies this FArrayBox by replacing each value with its additive
385  inverse.
386  */
387  FArrayBox& negate();
388 
389  ///
390  /**
391  Modifies this FArrayBox by adding the scalar Real a_r to all values. For
392  given range of components and within given a_subbox.
393  */
394  FArrayBox& plus(Real a_r,
395  const Box& a_subbox,
396  int a_comp = 0,
397  int a_numcomp = 1);
398 
399  ///
400  /**
401  Modifies this FArrayBox by adding the scalar Real a_r to all values. For
402  given range of components.
403  */
404  FArrayBox& plus(Real a_r,
405  int a_comp,
406  int a_numcomp = 1);
407 
408  ///
409  /**
410  Modifies this FArrayBox by adding the scalar Real a_r to all values.
411  */
413 
414  ///
415  /**
416  Modifies this FArrayBox by pointwise addition of the values of the
417  argument FArrayBox. You might come to grief if the domains of the
418  FArrayBoxes don't match.
419  */
420  FArrayBox& operator += (const FArrayBox& a_x);
421 
422  ///
423  /**
424  Modifies this FArrayBox by adding the scalar Real a_r to all values.
425  */
426  FArrayBox& plus(Real a_r);
427 
429  {
430  return this->plus(a_r);
431  }
432 
433  ///
434  /**
435  Modifies this FArrayBox by pointwise addition of the values of the
436  argument FArrayBox. You might come to grief if the domains of the
437  FArrayBoxes don't match. The same as += operator.
438 
439  */
440  FArrayBox& plus(const FArrayBox& a_x);
441 
442  ///
443  /**
444  Modifies this FArrayBox by pointwise scaled addition of the
445  argument FArrayBox (a[i] <- a[i] + a_scale * a_src[i]). Uses domain
446  of the intersection of these two FArrayBoxes.
447  */
448  FArrayBox& plus(const FArrayBox& a_src,
449  const Real& a_scale);
450 
451  ///
452  /**
453  Modifies this FArrayBox by pointwise scaled addition of the
454  argument FArrayBox (a[i] <- a[i] + a_scale * a_src[i]). Uses domain
455  of the intersection of these two FArrayBoxes.
456  */
457  FArrayBox& plus(const FArrayBox& a_src,
458  const Real& a_scale,
459  int a_srccomp,
460  int a_destcomp,
461  int a_numcomp = 1);
462 
463  ///
464  /**
465  Modifies this FArrayBox by pointwise addition of values in the argument
466  FArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1)
467  to this FArrayBox's components (a_destcomp : a_destcomp+a_numcomp-1)
468  where the domains of the two FArrayBoxes intersect.
469  */
470  FArrayBox& plus(const FArrayBox& a_src,
471  int a_srccomp,
472  int a_destcomp,
473  int a_numcomp = 1);
474 
475  ///
476  /**
477  Modifies this FArrayBox by pointwise addition of values in the argument
478  FArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1)
479  to this FArrayBox's components (a_destcomp : a_destcomp+numcomp-1)
480  where the domain of this FArrayBox intersects the a_subbox. NOTE:
481  a_subbox must be contained in this FAB.
482  */
483  FArrayBox& plus(const FArrayBox& a_src,
484  const Box& a_subbox,
485  int a_srccomp,
486  int a_destcomp,
487  int a_numcomp = 1);
488 
489  ///
490  /**
491  Modifies this FArrayBox by pointwise addition of values in the argument
492  FArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1)
493  in the Box a_srcbox to this FArrayBox's components (a_destcomp :
494  a_destcomp+a_numcomp-1) in the Box a_destbox. Corresponding locations
495  within the two FArrayBoxes are indexed relative to a_srcbox and a_destbox,
496  and will in general not be the same. The a_srcbox and a_destbox must be
497  same size. The results are UNDEFINED if the a_src and dest FArrayBoxes
498  are the same and the a_srcbox and a_destbox overlap.
499 
500  */
501  FArrayBox& plus(const FArrayBox& a_src,
502  const Box& a_srcbox,
503  const Box& a_destbox,
504  int a_srccomp,
505  int a_destcomp,
506  int a_numcomp = 1);
507 
508  ///
509  FArrayBox& plus(const FArrayBox& a_src,
510  const Box& a_srcbox,
511  const Box& a_destbox,
512  const Real& a_scale,
513  int a_srccomp,
514  int a_destcomp,
515  int a_numcomp = 1);
516 
517  ///
518  /**
519  Modifies this FArrayBox by subtracting the scalar Real a_r to all values.
520  Note: use plus(-a_r) for more general operations.
521  */
523 
524  ///
525  /**
526  Modifies this FArrayBox by pointwise subtraction of the values of the
527  argument FArrayBox. You might come to grief if the domains of the
528  FArrayBoxes don't match.
529  */
530  FArrayBox& operator -= (const FArrayBox& a_x);
531 
532  ///
533  /**
534  Modifies this FArrayBox by pointwise subtraction of the values of the
535  argument FArrayBox. You might come to grief if the domains of the
536  FArrayBoxes don't match. The same as -= operator.
537  */
538  FArrayBox& minus(const FArrayBox& a_x);
539 
540  /**
541  Modifies this FArrayBox by pointwise subtraction of values in the
542  argument FArrayBox. Subtracts a_src's components (a_srccomp :
543  a_srccomp+a_numcomp-1) from this FArrayBox's components (a_destcomp :
544  a_destcomp+a_numcomp-1) where the domains of the two FArrayBoxes
545  intersect.
546  */
547  FArrayBox& minus(const FArrayBox& a_src,
548  int a_srccomp,
549  int a_destcomp,
550  int a_numcomp = 1);
551 
552  /**
553  Modifies this FArrayBox by pointwise subtraction of values in the
554  argument FArrayBox. Subtracts a_src's components (a_srccomp :
555  a_srccomp+a_numcomp-1) from this FArrayBox's components (a_destcomp :
556  a_destcomp+a_numcomp-1) where the domain of this FArrayBox intersects
557  the a_subbox. NOTE: a_subbox must be contained in this FAB.
558  */
559  FArrayBox& minus(const FArrayBox& a_src,
560  const Box& a_subbox,
561  int a_srccomp,
562  int a_destcomp,
563  int a_numcomp = 1);
564 
565  ///
566  /**
567  Modifies this FArrayBox by pointwise subtraction of values in the
568  argument FArrayBox. Subtracts a_src's components (a_srccomp :
569  a_srccomp+a_numcomp-1) in the Box a_srcbox from this FArrayBox's
570  components (a_destcomp : a_destcomp+a_numcomp-1) in the Box a_destbox.
571  Corresponding locations within the two FArrayBoxes are indexed relative
572  to a_srcbox and a_destbox, and will in general not be the same. The
573  a_srcbox and a_destbox must be same size. The results are UNDEFINED
574  if the a_src and dest FArrayBoxes are the same and the a_srcbox and
575  a_destbox overlap.
576  */
577  FArrayBox& minus(const FArrayBox& a_src,
578  const Box& a_srcbox,
579  const Box& a_destbox,
580  int a_srccomp,
581  int a_destcomp,
582  int a_numcomp = 1);
583 
584  ///
585  /**
586  Modifies this FArrayBox by multiplying all values by the scalar Real a_r.
587  */
589 
590  ///
591  /**
592  Modifies this FArrayBox by multiplying all values by the scalar Real a_r.
593  */
594  FArrayBox& mult(Real a_r);
595 
596  ///
597  /**
598  Modifies this FArrayBox by multiplying all values by the scalar
599  Real a_r. For given range of components.
600  */
601  FArrayBox& mult(Real a_r,
602  int a_comp,
603  int a_numcomp = 1);
604 
605  ///
606  /**
607  Modifies this FArrayBox by multiplying all values by the scalar
608  Real a_r. For given range of components and within given a_subbox.
609  */
610  FArrayBox& mult(Real a_r,
611  const Box& a_subbox,
612  int a_comp = 0,
613  int a_numcomp = 1);
614 
615  ///
616  /**
617  Modifies this FArrayBox by pointwise multiplication of the values by the
618  argument FArrayBox. You might come to grief if the domains of the
619  FArrayBoxes don't match.
620  */
621  FArrayBox& operator *= (const FArrayBox& a_x);
622 
623  ///
624  /**
625  Modifies this FArrayBox by pointwise multiplication by the values in the
626  argument FArrayBox. You might come to grief if the domains of the
627  FArrayBoxes don't match. The same as the *= operator.
628  */
629  FArrayBox& mult(const FArrayBox& a_x);
630 
631  ///
632  /**
633  Modifies this FArrayBox by pointwise multiplication by values in the
634  argument FArrayBox. Multiplies a_src's components (a_srccomp :
635  a_srccomp+a_numcomp-1) by this FArrayBox's components (a_destcomp :
636  a_destcomp+a_numcomp-1) where the domains of the two FArrayBoxes
637  intersect.
638  */
639  FArrayBox& mult(const FArrayBox& a_src,
640  int a_srccomp,
641  int a_destcomp,
642  int a_numcomp = 1);
643 
644  ///
645  /**
646  Modifies this FArrayBox by pointwise multiplication by values in the
647  argument FArrayBox. Multiplies a_src's components (a_srccomp :
648  a_srccomp+a_numcomp-1) by this FArrayBox's components (a_destcomp :
649  a_destcomp+a_numcomp-1) where the domain of this FArrayBox intersects
650  the a_subbox. NOTE: a_subbox must be contained in this FAB.
651  */
652  FArrayBox& mult(const FArrayBox& a_src,
653  const Box& a_subbox,
654  int a_srccomp,
655  int a_destcomp,
656  int a_numcomp = 1);
657 
658  ///
659  /**
660  Modifies this FArrayBox by pointwise multiplication by values in the
661  argument FArrayBox. Multiplies a_src's components (a_srccomp :
662  a_srccomp+a_numcomp-1) in the Box a_srcbox by this FArrayBox's
663  components (a_destcomp : a_destcomp+a_numcomp-1) in the Box a_destbox.
664  Corresponding locations within the two FArrayBoxes are indexed relative
665  to a_srcbox and a_destbox, and will in general not be the same. The
666  a_srcbox and a_destbox must be same size. The results are UNDEFINED if
667  the a_src and dest FArrayBoxes are the same and the a_srcbox and a_destbox
668  overlap.
669  */
670  FArrayBox& mult(const FArrayBox& a_src,
671  const Box& a_srcbox,
672  const Box& a_destbox,
673  int a_srccomp,
674  int a_destcomp,
675  int a_numcomp = 1);
676 
677  ///
678  /**
679  Modifies this FArrayBox by dividing all values by the scalar Real a_r.
680  */
682 
683  ///
684  /**
685  Modifies this FArrayBox by dividing all values by the scalar Real a_r.
686  */
687  FArrayBox& divide(Real a_r);
688 
689  ///
690  /**
691  Modifies this FArrayBox by dividing all values by the scalar Real a_r.
692  For given range of components.
693  */
694  FArrayBox& divide(Real a_r,
695  int a_comp,
696  int a_numcomp = 1);
697 
698  ///
699  /**
700  Modifies this FArrayBox by dividing all values by the scalar Real
701  a_r. For given range of components and within given a_subbox.
702  */
703  FArrayBox& divide(Real a_r,
704  const Box& a_subbox,
705  int a_comp = 0,
706  int a_numcomp = 1);
707 
708  ///
709  /**
710  Modifies this FArrayBox by pointwise division of the values by the
711  argument FArrayBox. You might come to grief if the domains of the
712  FArrayBoxes don't match.
713  */
714  FArrayBox& operator /= (const FArrayBox& a_x);
715 
716  ///
717  /**
718  Modifies this FArrayBox by pointwise division by the values in the
719  argument FArrayBox. You might come to grief if the domains of the
720  FArrayBoxes don't match. The same as the /= operator.
721  */
722  FArrayBox& divide(const FArrayBox& a_x);
723 
724  ///
725  /**
726  Modifies this FArrayBox by pointwise division by values in the argument
727  FArrayBox. Divides this FArrayBox's components (a_destcomp :
728  a_destcomp+a_numcomp-1) by a_src's components (a_srccomp :
729  a_srccomp+a_numcomp-1) where the domains of the two FArrayBoxes intersect.
730  */
731  FArrayBox& divide(const FArrayBox& a_src,
732  int a_srccomp,
733  int a_destcomp,
734  int a_numcomp = 1);
735 
736  ///
737  /**
738  Modifies this FArrayBox by pointwise division by values in the argument
739  FArrayBox. Divides this FArrayBox's components (a_destcomp :
740  a_destcomp+a_numcomp-1) by a_src's components (a_srccomp :
741  a_srccomp+a_numcomp-1) where the domain of this FArrayBox intersects
742  the a_subbox. NOTE: a_subbox must be contained in this FAB.
743  */
744  FArrayBox& divide(const FArrayBox& a_src,
745  const Box& a_subbox,
746  int a_srccomp,
747  int a_destcomp,
748  int a_numcomp = 1);
749 
750  ///
751  /**
752  Modifies this FArrayBox by pointwise division by values in the argument
753  FArrayBox. Divides this FArrayBox's components (a_destcomp :
754  a_destcomp+a_numcomp-1) in the Box a_destbox by a_src's components
755  (a_srccomp : a_srccomp+a_numcomp-1) in the Box a_srcbox. Corresponding
756  locations within the two FArrayBoxes are indexed relative to a_srcbox and
757  a_destbox, and will in general not be the same. The a_srcbox and
758  a_destbox must be same size. The results are UNDEFINED if the a_src and
759  dest FArrayBoxes are the same and the a_srcbox and a_destbox overlap.
760  */
761  FArrayBox& divide(const FArrayBox& a_src,
762  const Box& a_srcbox,
763  const Box& a_destbox,
764  int a_srccomp,
765  int a_destcomp,
766  int a_numcomp = 1);
767 
768  ///
769  Real get(const IntVect& a_iv,
770  int a_comp) const
771  {
772  return this->operator()(a_iv, a_comp);
773  }
774 
775  ///
776  void set(const IntVect& a_iv,
777  int a_comp,
778  Real a_val)
779  {
780  this->operator()(a_iv, a_comp) = a_val;
781  }
782 
783  //! Computes a_A * a_X + a_B * a_Y, placing the result in this FArrayBox.
784  FArrayBox& axby(const FArrayBox& a_X, const FArrayBox& a_Y,
785  Real a_A, Real a_B);
786 
787  //! Computes a_A * a_X + a_B * a_Y, placing the result in this FArrayBox.
788  //! This version performs this operation only for the given component
789  //! in each FArrayBox.
790  FArrayBox& axby(const FArrayBox& a_X, const FArrayBox& a_Y,
791  Real a_A, Real a_B,
792  int a_destComp, int a_xComp, int a_yComp);
793 
794 
795 
796  FArrayBox(FArrayBox&& a_in)=default;
797  FArrayBox& operator=(FArrayBox&& a_in)=default;
798 protected:
799  virtual void performCopy(const BaseFab<Real>& a_src,
800  const Box& a_srcbox,
801  int a_srccomp,
802  const Box& a_destbox,
803  int a_destcomp,
804  int a_numcomp);
805 
806 
807 private:
808  //
809  // These are disallowed.
810  //
811  //FArrayBox (const FArrayBox&);
812  //FArrayBox& operator = (const FArrayBox&);
813 };
814 
815 #include "NamespaceFooter.H"
816 #endif
FArrayBox & operator+=(Real a_r)
Real sum(int a_comp, int a_numcomp=1) const
int maskGT(BaseFab< int > &a_mask, Real a_val, int a_comp=0) const
Real dotProduct(const FArrayBox &a_fab2) const
Return the dot product of this FArrayBox with another.
FArrayBox & operator=(FArrayBox &&a_in)=default
FArrayBox & plus(Real a_r, const Box &a_subbox, int a_comp=0, int a_numcomp=1)
int maskEQ(BaseFab< int > &a_mask, Real a_val, int a_comp=0) const
FArrayBox & operator/=(Real a_r)
FArrayBox & invert(Real a_r)
void set(const IntVect &a_iv, int a_comp, Real a_val)
Definition: FArrayBox.H:776
FArrayBox & divide(Real a_r)
FArrayBox & axby(const FArrayBox &a_X, const FArrayBox &a_Y, Real a_A, Real a_B)
Computes a_A * a_X + a_B * a_Y, placing the result in this FArrayBox.
IntVect maxIndex(int a_comp=0) const
FArrayBox & negate()
Real min(int a_comp=0) const
virtual void resize(const Box &a_box, int a_comps, Real *a_alias=NULL)
Definition: FArrayBox.H:130
Structure for passing component ranges in code.
Definition: Interval.H:23
virtual void define(const Interval &a_comps, BaseFab< Real > &a_original)
Definition: FArrayBox.H:121
int maskGE(BaseFab< int > &a_mask, Real a_val, int a_comp=0) const
virtual Real sumPow(const Box &a_subbox, int a_p=2, int a_comp=0, int a_numcomp=1) const
double Real
Definition: REAL.H:33
void define()
Definition: BaseFabImplem.H:626
int maskLT(BaseFab< int > &a_mask, Real a_val, int a_comp=0) const
FArrayBox & operator-=(Real a_r)
virtual ~FArrayBox()
FArrayBox & minus(const FArrayBox &a_x)
FArrayBox & operator*=(Real a_r)
IntVect minIndex(int a_comp=0) const
virtual void define(const Box &a_box, int a_ncomp, Real *a_alias=NULL)
Definition: FArrayBox.H:83
Definition: BaseFab.H:80
Real max(int a_comp=0) const
void abs()
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Real & operator()(const IntVect &a_p, int a_N)
virtual void define(const Interval &a_comps, FArrayBox &a_original)
Definition: FArrayBox.H:110
virtual void performCopy(const BaseFab< Real > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
Definition: FArrayBox.H:45
FArrayBox & plus_real(Real a_r)
Definition: FArrayBox.H:428
void resize(const Box &a_b, int a_n=1, T *a_alias=NULL)
Definition: BaseFabImplem.H:158
FArrayBox(const Interval &a_comps, FArrayBox &a_original)
Definition: FArrayBox.H:71
virtual Real norm(const Box &a_subbox, int a_p=2, int a_comp=0, int a_numcomp=1) const
int maskLE(BaseFab< int > &a_mask, Real a_val, int a_comp=0) const
FArrayBox & mult(Real a_r)