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