Chombo + EB  3.2
IntVectSet.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 _INTVECTSET_H_
12 #define _INTVECTSET_H_
13 
14 #include "SPACE.H"
15 
16 #ifndef WRAPPER
17 #include <iostream>
18 #include "Box.H"
19 #include "IntVect.H"
20 #include "TreeIntVectSet.H"
21 #include "DenseIntVectSet.H"
22 #include "parstream.H"
23 #include "NamespaceHeader.H"
24 
25 #endif
26 
27 /// An irregular domain on an integer lattice
28 /**
29  \nosubgrouping
30  IntVectSet represents an irregular region in an integer lattice
31  SpaceDim-dimensional index space as an arbitrary collection of
32  IntVects. A full set calculus is defined. Any IntVect or
33  cell-centered Box can be fully represented as an IntVectSet. There
34  is an iterator that provides access to the contents of an
35  IntVectSet. IntVectSets are implicitly cell-centered.
36  Intersection, union, and complement operations are defined for
37  pairs of IntVectSets (and, by extension, an IntVectSet and an
38  IntVect or an IntVectSet and a Box). The minimum Box of an
39  IntVectSet is defined as the smallest Box that contains every
40  IntVect in the IntVectSet.
41 
42  The IntVects in an IntVectSet do not have a canonical ordering.
43 */
45 {
46 public:
47  friend
48  class IVSIterator;
49 
50  /**
51  \name Constructors, Destructor, and defines
52  */
53 
54  /*@{*/
55 
56  ~IntVectSet();
57 
58  /// default constructor: defines an empty IntVectSet.
59  IntVectSet();
60  /// default define: modifies this IntVectSet to be empty.
61  void
62  define();
63 
64  /// copy constructor
65  IntVectSet(const IntVectSet& ivs);
66  /// copy define: modifies this IntVectSet into a copy of \a ivs
67  void
68  define(const IntVectSet& ivs);
69  /// copy define: same as \c define(IntVectSet)
70  void
71  define_intvectset(const IntVectSet& ivs)
72  {
73  define(ivs);
74  }
75  /// return a copy of this IntVectSet
77  copy() const
78  {
79  return *this;
80  }
81 
82  /// conversion constructor
83  explicit
84  IntVectSet(const DenseIntVectSet& a_dense);
85  /// conversion define
86  void
87  define (const DenseIntVectSet& a_dense);
88  /// conversion constructor
89  explicit
90  IntVectSet(const TreeIntVectSet& a_tree);
91  /// conversion define
92  void
93  define (const TreeIntVectSet& a_tree);
94 
95  /// IntVect constructor
96  /** construct this to be an IntVectSet with just one IntVect. */
97  explicit
98  IntVectSet(const IntVect& iv);
99  /// IntVect define: modifies this IntVectSet to have just one IntVect
100  void
101  define(const IntVect& iv);
102  /// IntVect define: same as \c define(IntVect)
103  void
104  define_intvect(const IntVect& iv)
105  {
106  define(iv);
107  }
108 
109  /// Box constructor
110  /** construct this to be an IntVectSet with all the IntVects in the Box \b. */
111  explicit
112  IntVectSet(const Box& b);
113  /// Box define
114  /** modifies this IntVect to have all the IntVects in the Box \b. */
115  void
116  define(const Box& b);
117  /// Box define: same as \c define(Box)
118  void
119  define_box(const Box& b)
120  {
121  define(b);
122  }
123  /// Define this IntVectSet to have all the corners of the input box.
124  void
125  define_boxCorners(const Box& b);
126 
127  /*@}*/
128 
129  /**
130  \name Union operators
131  */
132  /*@{*/
133 
134  /// unions another IntVectSet \a ivs into this IntVectSet
135  IntVectSet&
136  operator|=(const IntVectSet& ivs);
137 
138  /// same as operator|= except it doesn't return *this
139  void
140  or_intvectset(const IntVectSet& ivs)
141  {
142  *this |= ivs;
143  }
144 
145  /// unions a single IntVect \a iv into this IntVectSet
146  IntVectSet&
147  operator|=(const IntVect& iv);
148  /// same as operator|= except it doesn't return *this
149  void
150  or_intvect(const IntVect& ivs)
151  {
152  *this |= ivs;
153  }
154 
155  /// unions the IntVects in the Box \b into this IntVectSet
156  IntVectSet&
157  operator|=(const Box& b);
158  /// same as operator|= except it doesn't return *this
159  void
160  or_box(const Box& b)
161  {
162  *this |= b;
163  }
164 
165  /// Returns a new IntVectSet that is the union of two IntVectSets
166  friend
167  IntVectSet
168  operator|(const IntVectSet& ivs1, const IntVectSet& ivs2);
169 
170  /// Returns a new IntVectSet that is the union of an IntVectSet and an IntVect
171  friend
172  IntVectSet
173  operator|(const IntVectSet& ivs, const IntVect& iv);
174 
175  /// Returns a new IntVectSet that is the union of an IntVectSet and an IntVect
176  friend
177  IntVectSet
178  operator|(const IntVect& iv, const IntVectSet& ivs);
179 
180  /// Returns a new IntVectSet that is the union of an IntVectSet and a Box
181  friend
182  IntVectSet
183  operator|(const IntVectSet& ivs, const Box& b);
184 
185  /// Returns a new IntVectSet that is the union of an IntVectSet and a Box
186  friend
187  IntVectSet
188  operator|(const Box& b, const IntVectSet& ivs);
189 
190  /*@}*/
191 
192  /**
193  \name Complement operators
194  */
195  /*@{*/
196 
197  /// Returns the complement of the IntVectSet \a ivs within this IntVectSet
198  IntVectSet
199  operator-(const IntVectSet& ivs) const;
200 
201  /// Returns the complement of the Box \a b within this IntVectSet
202  IntVectSet
203  operator-(const Box& b) const;
204 
205  /// Returns the complement of the IntVect \a iv within this IntVectSet
206  IntVectSet
207  operator-(const IntVect& iv) const;
208 
209  /// Remove the IntVects in the IntVectSet \a ivs from this IntVectSet
210  /**
211  * Modifies this IntVectSet to be the complement of the IntVectSet \a ivs
212  * within this IntVectSet.
213  */
214  IntVectSet&
215  operator-=(const IntVectSet& ivs);
216  /// same as operator-= except it doesn't return *this
217  void
218  minus(const IntVectSet& ivs)
219  {
220  *this -= ivs;
221  }
222 
223  /// Remove the IntVects in the Box \a b from this IntVectSet
224  /**
225  * Modifies this IntVectSet to be the complement of the argument
226  * Box within this IntVectSet.
227  */
228  IntVectSet&
229  operator-=(const Box& b);
230  /// same as operator-= except it doesn't return *this
231  void
232  minus_box(const Box& b)
233  {
234  *this -=b;
235  }
236 
237  /// Remove the IntVect \a iv from this IntVectSet
238  /**
239  Modifies this IntVectSet to be the complement of the argument
240  IntVect within this IntVectSet.
241  */
242  IntVectSet&
243  operator-=(const IntVect& iv);
244  /// same as operator-= except it doesn't return *this
245  void
246  minus_intvect(const IntVect& iv)
247  {
248  *this -=iv;
249  }
250 
251  /*@}*/
252 
253  /**
254  \name Intersection operators */
255  /*@{*/
256 
257  /// Returns a new IntVectSet that is the intersection of two IntVectSets
258  /**
259  * The result may be empty.
260  */
261  friend
262  IntVectSet
263  operator&(const IntVectSet& ivs1, const IntVectSet& ivs2);
264 
265  /// Returns a new IntVectSet that is the intersection of an IntVectSet and a Box
266  /**
267  * The result may be empty.
268  */
269  friend
270  IntVectSet
271  operator&(const IntVectSet& ivs, const Box& b);
272 
273  /// Returns a new IntVectSet that is the intersection of an IntVectSet and a Box
274  /**
275  * The result may be empty.
276  */
277  friend
278  IntVectSet
279  operator&(const Box& b, const IntVectSet& ivs);
280 
281  /// Modifies this IntVectSet to its intersection with another IntVectSet
282  IntVectSet&
283  operator&=(const IntVectSet& ivs);
284  /// same as operator&= except it doesn't return *this
285  void
286  and_intvectset(const IntVectSet& ivs)
287  {
288  *this &= ivs;
289  }
290 
291  /// Modifies this IntVectSet to be its intersection with a Box
292  IntVectSet&
293  operator&=(const Box& b);
294  /// same as operator&= except it doesn't return *this
295  void
296  and_box(const Box& b)
297  {
298  *this &= b;
299  }
300 
301  /// Modifies this IntVectSet to be its intersection with the Box in a ProblemDomain
302  IntVectSet&
303  operator&=(const ProblemDomain& domain);
304  /// same as operator&= except it doesn't return *this
305  void
306  and_domain(const ProblemDomain& d)
307  {
308  *this &= d;
309  }
310 
311  /*@}*/
312 
313  /**
314  \name Modification functions */
315  /*@{*/
316 
317  /// Add IntVects to this IntVectSet in all directions
318  /**
319  Modifies this IntVectSet by growing it by the specified number
320  of IntVects in all directions, including diagonal. It is an error
321  if \a igrow < 0.
322  */
323  void
324  grow(int igrow);
325 
326  /// Add IntVects to an IntVectSet in all directions
327  /**
328  Creates a new IntVectSet that is a copy of the argument IntVectSet \a ivs
329  grown by the specified number of IntVects in all directions \a igrow, including
330  diagonal. It is an error if \a igrow < 0.
331  */
332  friend
333  IntVectSet
334  grow(const IntVectSet& ivs, int igrow);
335 
336  /// Add IntVects to this IntVectSet in one direction
337  /**
338  Modifies this IntVectSet by growing it by the specified number of
339  IntVects \a igrow in the specified coordinate direction \a idir.
340  Directions are zero-based.
341  */
342  IntVectSet&
343  grow(int idir, int igrow);
344  /// same as \c grow(idir,igrow) except doesn't return *this
345  void
346  grow_dir(int idir, int igrow)
347  {
348  grow(idir, igrow);
349  }
350 
351  /// Analogous to surroundingNodes() for a Box.
352  /**
353  Modifies this IntVectSet by adding IntVects to the high-side of each
354  direction.
355  */
356  void
357  growHi();
358 
359  /// Analogous to surroundingNodes(dir) for a Box.
360  /**
361  Modifies this IntVectSet by adding IntVects to the high-side of a specified
362  direction.
363  */
364  void
365  growHi(const int a_dir);
366 
367  /// Refine all the IntVects in this IntVecSet
368  /**
369  Modifies this IntVectSet by refining it by the factor \a iref. It is
370  an error if \a iref <= 0. Definition of refinement: for each IntVect \p iv
371  in the original IntVectSet, the refined IntVectSet will contain the Box
372  defined by <b>refine( Box(iv,iv), iref )</b>.
373  */
374  IntVectSet&
375  refine(int iref = 2);
376 
377  /// Refine all the IntVects in an IntVectSet
378  /**
379  Creates a new IntVectSet that is a copy of the argument IntVectSet \a ivs
380  refined by the factor \a iref. It is an error if \a iref <= 0.
381  Definition of refinement: for each IntVect \p iv in the original
382  IntVectSet \a ivs, the refined IntVectSet will contain the Box defined by
383  <b>refine( Box(iv,iv), iref )<b>.
384  */
385  friend
386  IntVectSet
387  refine(const IntVectSet& ivs, int iref);
388 
389  /// Coarsen all the IntVects in this IntVectSet
390  /**
391  Modifies this IntVectSet by coarsening it by the factor \a iref. It is
392  an error if \a iref <= 0. Definition of coarsening: for each IntVect
393  \p iv in the original IntVectSet, the refined IntVectSet will contain the
394  IntVect defined by <b>coarsen( iv, iref )</b>.
395  */
396  IntVectSet&
397  coarsen(int iref = 2);
398 
399  /// Coarsen all the IntVects in an IntVectSet
400  /**
401  Creates a new IntVectSet that is a copy of the argument IntVectSet \a ivs coarsened
402  by the factor \a iref. It is an error if \a iref <= 0.
403  Definition of coarsening: for each IntVect \p iv in the original
404  IntVectSet, the refined IntVectSet will contain the IntVect defined by
405  <b>coarsen( iv, iref )</b>.
406  */
407  friend
408  IntVectSet
409  coarsen(const IntVectSet& ivs, int iref);
410 
411  /// Increment all the IntVects in this IntVectSet by the IntVect \a iv
412  void
413  shift(const IntVect& iv);
414 
415  /// Make this IntVectSet be properly nested
416  /**
417  Modifies this IntVectSet to remove all IntVects that are not at least
418  \a radius from the the edge of the IntVectSet in any direction. \a
419  radius must be positive. IntVects that border the Box \a domain are
420  spared from this trimming.
421  */
422  void
423  nestingRegion(int radius, const Box& domain, int granularity = 1);
424 
425  /// Make this IntVectSet be properly nested
426  /**
427  Modifies this IntVectSet to remove all IntVects that are not at least
428  \a radius from the the edge of the IntVectSet in any direction. \a
429  radius must be positive. IntVects that border non-periodic boundaries
430  are spared from this trimming. Radius extends across periodic images.
431  */
432  void
433  nestingRegion(int radius, const ProblemDomain& probdomain, int granularity = 1);
434  /// same as \c nestingRegion() except it doesn't return *this
435  void
436  nestingRegion_prob(int radius, const ProblemDomain& probdomain)
437  {
438  nestingRegion(radius, probdomain);
439  }
440 
441  /// Modifies this IntVectSet to be empty
442  void
443  makeEmpty();
444 
445  /// Modifies this IntVectSet to empty but leaves dense domain box unchanged.
446  /**
447  This leaves unchanged the domain box for a dense IntVectSet - it only sets
448  all bits to zero. So you can still do unions later (in the domain box) and
449  not be converted to a tree representation. There is no difference from
450  makeEmpty() for a tree IntVectSet
451  */
452  void
453  makeEmptyBits();
454 
455  /// Chop the IntVectSet at the \a chop_pnt index in the \a dir direction.
456  /**
457  Returns one IntVectSet and modifies this IntVectSet. The union of the
458  two is the original IntVectSet. This IntVectSet gets the IntVects with
459  \a dir index >= \a chop_pnt, and the returned IntVectSet gets the
460  IntVects with \a dir index < \a chop_pnt. It is an error if \a dir is
461  invalid.
462  */
463  IntVectSet chop(int dir, int chop_pnt);
464 
465  void chop(int dir, int chop_pnt, IntVectSet& a_hi);
466  ///
467  /**
468  Set the max box size for IntVectSet::define(Box) which will
469  make the IntVectSet dense. Default is 6.4^6.
470  */
471  static void setMaxDense(const int& a_maxDense);
472 
473  /*@}*/
474 
475  /**
476  \name Accessor and Inquiry functions */
477  /*@{*/
478 
479  /// Returns the number of IntVects in this IntVectSet
480  int
481  numPts() const;
482 
483  /// Returns the minimum enclosing box of this IntVectSet
484  const Box&
485  minBox() const;
486 
487  /// Forces recalculation of the minimum enclosing box of this IntVectSet
488  void
489  recalcMinBox() const;
490 
491  /// Returns true if no IntVects are in this IntVectSet
492  bool
493  isEmpty() const;
494 
495  /// Returns true if this IntVectSet is currently being represented in a dense fashion
496  bool
497  isDense() const;
498 
499  /// Returns true if this IntVectSet contains \a iv
500  bool
501  contains(const IntVect& iv) const;
502 
503  /// Returns true if this IntVectSet contains all the IntVects in \a ivs
504  bool
505  contains(const IntVectSet& ivs) const;
506  /// same as \c contains(ivs)
507  bool
508  contains_intvectset(const IntVectSet& ivs) const
509  {
510  return contains(ivs);
511  }
512 
513  /// Returns true if this IntVectSet contains all the IntVects in \a box
514  /**
515  * Note: this is done using an algorithm that is much faster than looping
516  * through all the IntVects.
517  */
518  bool
519  contains(const Box& box) const;
520  /// same as \c contains(b)
521  bool
522  contains_box(const Box& b) const
523  {
524  return contains(b);
525  }
526 
527  /// Returns a Vector<Box> representation of this IntVectSet.
528  /**
529  * The returned Boxes contain only the IntVects in this IntVectSet, so
530  * the union of the Boxes in the Vector == this IntVectSet.
531  */
533  boxes() const;
534 
535  /// Optimize memory usage of this IntVectSet
536  /**
537  Attempts to optimize storage for IntVectSet. This will also
538  optimize iteration through the IntVectSet later. Best to call
539  it when you are no longer modifying the IntVectSet
540  */
541  void
542  compact() const;
543 
544  /*@}*/
545 
546  /**
547  \name Linearization functions */
548  /*@{*/
549 
550  /// Returns the number of bytes in a linear representation of *this
551  int
552  linearSize() const;
553 
554  /// Modify *this using the data in the linear representation in \a a_inBuf
555  void
556  linearIn(const void* const a_inBuf);
557 
558  /// Write a linear representation of *this to \a a_outBuf
559  /**
560  Assumes a_outBuf is at least linearSize() bytes long.
561  */
562  void
563  linearOut(void* const a_outBuf) const;
564 
565  /*@}*/
566 
567  /// Returns true if this IntVectSet has the same IntVects as \a a_ivs
568  bool
569  operator==(const IntVectSet& a_ivs) const;
570 
571  /** Primary sorting criterion: being dense; if *this is dense and \a a_ivs is
572  not, then *this is smaller, and vice versa.
573  Secondary sorting criterion: operator< as defined on DenseIntVectSet or
574  TreeIntVectSet.
575  In a total tie, returns false.
576 
577  These criteria might not seem natural, but that doesn't matter as the only
578  reason for this operator is to support using IntVectSet as the key to an
579  std::map.
580  */
581  bool
582  operator<(const IntVectSet& a_ivs) const;
583 
584  /// Writes a Vector<Box> representation to an output stream.
585  void
586  printBoxes(std::ostream& a_ostream) const;
587 
588  /// Writes a Vector<Box> representation to the parallel stdout.
589  void
590  p() const
591  {
592  printBoxes(pout());
593  }
594 
595  /// Writes a text representation of an IntVectSet to an output stream
596  friend
597  std::ostream&
598  operator<<(std::ostream& os, const IntVectSet& ivs);
599 
600  void convert() const; // turn dense rep into Tree rep. very costly.
601  // it is 'logically' const, but does modify data structures;
602 
603  // not for public consumption. used in memory tracking.
604  static long int count;
605  static long int peakcount;
606 
607  //set to 6400000 as default. resettable.
608  static int s_maxDense;
609 
610 private:
612  bool m_isdense;
615  // not a user function. called by memory tracking system on
616  // exit to clean up static allocation pools used for the optimization
617  // of these routines.
618  friend void dumpmemoryatexit();
619  static void clearStaticMemory(); // after this functon is called, you cannot
620  // do any other operations with IntVectSet.
621 };
622 
623 /// Iterator for an IntVectSet
624 /**
625  IVSIterator iterates over every point (IntVect)
626  in an IntVectSet. It has exactly the same
627  syntax and sematic as BoxIterator. Typical usage:
628 
629 \code
630  IntVectSet ivs;
631  ...
632  IVSIterator ivsit (ivs);
633  for (ivsit.begin(); ivsit.ok(); ++ivsit)
634  {
635  IntVect iv = ivsit();
636  (do operations involving iv)
637  }
638 \endcode
639 */
641 {
642 public:
643 
644  /**
645  * A default constructed iterator iterates over an empty IntVectSet.
646  * It starts in the \c begin() state, and is never \c ok().
647  */
649  {}
650 
651  /**
652  * Iterates over IntVectSet \a ivs. There is no canonical ordering.
653  * Starts in the \c begin() state.
654  */
655  IVSIterator(const IntVectSet& ivs);
656 
658  {}
659 
660  /**
661  * Modifies this IVSIterator to iterate over the IntVectSet \a ivs.
662  * There is no canonical ordering. Starts in the \c begin() state.
663  */
664  void define(const IntVectSet& ivs);
665 
666  /// returns the IntVect that this iterator is at
667  const IntVect& operator()() const ;
668 
669  /// same as operator()
670  const IntVect& iv() const
671  {
672  return this->operator()();
673  }
674 
675  /// returns true if this iterator is still in its IntVectSet
676  bool ok() const;
677 
678  /// move iterator to the next IntVect in its IntVectSet
679  void operator++();
680 
681  /// same as operator++
682  void incr()
683  {
684  ++(*this);
685  }
686 
687  /// initialize this iterator to the first IntVect in its IntVectSet
688  void begin();
689 
690  /// same as begin()
691  void reset();
692 
693  /// move this iterator to after the last IntVect in the set
694  /** The iterator will be !ok() afterwards. */
695  void end();
696 
697 private:
698  bool m_isdense;
701 };
702 
703 #ifndef WRAPPER
704 
705 inline const IntVect& IVSIterator::operator()() const
706 {
707  if (m_isdense) return m_dense();
708  return m_tree();
709 }
710 
711 inline bool IVSIterator::ok() const
712 {
713  if (m_isdense) return m_dense.ok();
714  return m_tree.ok();
715 }
716 
718 {
719  if (m_isdense) ++m_dense;
720  else ++m_tree;
721 }
722 inline void IVSIterator::reset()
723 {
724  begin();
725 }
726 
727 inline void IVSIterator::begin()
728 {
729  if (m_isdense) m_dense.begin();
730  else m_tree.begin();
731 }
732 
733 inline void IVSIterator::end()
734 {
735  if (m_isdense) m_dense.end();
736  else m_tree.end();
737 }
738 
740 {
741  count++;
742  if (count > peakcount) peakcount = count;
743 }
744 
745 inline void IntVectSet::define(const IntVectSet& ige_in)
746 {
747  *this = ige_in;
748 }
749 
750 inline IntVectSet::IntVectSet(const IntVectSet& ige_in)
751 {
752  count++;
753  if (count > peakcount) peakcount = count;
754 
755  *this = ige_in;
756 }
757 
758 inline bool
760 {
761  return m_isdense;
762 }
763 
764 /// Refine all the IntVects in an IntVectSet
765 /**
766  Creates a new IntVectSet that is a copy of the argument IntVectSet \a ivs
767  refined by the factor \a iref. It is an error if \a iref <= 0.
768  Definition of refinement: for each IntVect \p iv in the original
769  IntVectSet \a ivs, the refined IntVectSet will contain the Box defined by
770  <b>refine( Box(iv,iv), iref )<b>.
771  */
773 refine(const IntVectSet& ivs, int iref = 2);
774 
775 /// Coarsen all the IntVects in an IntVectSet
776 /**
777  Creates a new IntVectSet that is a copy of the argument IntVectSet \a ivs coarsened
778  by the factor \a iref. It is an error if \a iref <= 0.
779  Definition of coarsening: for each IntVect \p iv in the original
780  IntVectSet, the refined IntVectSet will contain the IntVect defined by
781  <b>coarsen( iv, iref )</b>.
782  */
784 coarsen(const IntVectSet& ivs, int iref = 2);
785 
786 #endif /* WRAPPER */
787 
788 #include "NamespaceFooter.H"
789 #endif
std::ostream & pout()
Use this in place of std::cout for program output.
bool operator==(const IntVectSet &a_ivs) const
Returns true if this IntVectSet has the same IntVects as a_ivs.
IntVectSet & coarsen(int iref=2)
Coarsen all the IntVects in this IntVectSet.
const IntVect & iv() const
same as operator()
Definition: IntVectSet.H:670
void and_intvectset(const IntVectSet &ivs)
same as operator&= except it doesn&#39;t return *this
Definition: IntVectSet.H:285
IntVectSet & operator &=(const IntVectSet &ivs)
Modifies this IntVectSet to its intersection with another IntVectSet.
IntVectSet & refine(int iref=2)
Refine all the IntVects in this IntVecSet.
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
friend void dumpmemoryatexit()
IntVectSet()
default constructor: defines an empty IntVectSet.
Definition: IntVectSet.H:739
void growHi()
Analogous to surroundingNodes() for a Box.
void define_boxCorners(const Box &b)
Define this IntVectSet to have all the corners of the input box.
~IVSIterator()
Definition: IntVectSet.H:657
friend IntVectSet operator|(const IntVectSet &ivs1, const IntVectSet &ivs2)
Returns a new IntVectSet that is the union of two IntVectSets.
Dense representation implementation of IntVectSet class.
Definition: DenseIntVectSet.H:37
void recalcMinBox() const
Forces recalculation of the minimum enclosing box of this IntVectSet.
IntVectSet chop(int dir, int chop_pnt)
Chop the IntVectSet at the chop_pnt index in the dir direction.
IntVectSet & operator|=(const IntVectSet &ivs)
unions another IntVectSet ivs into this IntVectSet
void minus(const IntVectSet &ivs)
same as operator-= except it doesn&#39;t return *this
Definition: IntVectSet.H:217
void makeEmpty()
Modifies this IntVectSet to be empty.
void grow(int igrow)
Add IntVects to this IntVectSet in all directions.
IntVectSet & operator-=(const IntVectSet &ivs)
Remove the IntVects in the IntVectSet ivs from this IntVectSet.
int linearSize() const
Returns the number of bytes in a linear representation of *this.
void minus_box(const Box &b)
same as operator-= except it doesn&#39;t return *this
Definition: IntVectSet.H:231
int numPts() const
Returns the number of IntVects in this IntVectSet.
IntVectSet implementation based on tree representation.
Definition: TreeIntVectSet.H:93
void define_intvect(const IntVect &iv)
IntVect define: same as define(IntVect)
Definition: IntVectSet.H:103
void reset()
same as begin()
Definition: IntVectSet.H:722
bool ok() const
returns true if this iterator is still in its IntVectSet
Definition: IntVectSet.H:711
bool m_isdense
Definition: IntVectSet.H:611
bool contains_box(const Box &b) const
same as contains(b)
Definition: IntVectSet.H:521
void printBoxes(std::ostream &a_ostream) const
Writes a Vector<Box> representation to an output stream.
Definition: EBInterface.H:45
void define()
default define: modifies this IntVectSet to be empty.
void linearIn(const void *const a_inBuf)
Modify *this using the data in the linear representation in a_inBuf.
DenseIntVectSet m_dense
Definition: IntVectSet.H:613
static long int count
Definition: IntVectSet.H:603
void incr()
same as operator++
Definition: IntVectSet.H:682
void and_box(const Box &b)
same as operator&= except it doesn&#39;t return *this
Definition: IntVectSet.H:295
void operator++()
move iterator to the next IntVect in its IntVectSet
Definition: IntVectSet.H:717
Vector< Box > boxes() const
Returns a Vector<Box> representation of this IntVectSet.
const IntVect & operator()() const
returns the IntVect that this iterator is at
Definition: IntVectSet.H:705
bool isDense() const
Returns true if this IntVectSet is currently being represented in a dense fashion.
Definition: IntVectSet.H:759
static void clearStaticMemory()
Iterate over all the &#39;true&#39; members of a DenseIntVectSet set.
Definition: DenseIntVectSet.H:272
void define_intvectset(const IntVectSet &ivs)
copy define: same as define(IntVectSet)
Definition: IntVectSet.H:70
Definition: TreeIntVectSet.H:335
void compact() const
Optimize memory usage of this IntVectSet.
friend std::ostream & operator<<(std::ostream &os, const IntVectSet &ivs)
Writes a text representation of an IntVectSet to an output stream.
static int s_maxDense
Definition: IntVectSet.H:607
bool operator<(const IntVectSet &a_ivs) const
void minus_intvect(const IntVect &iv)
same as operator-= except it doesn&#39;t return *this
Definition: IntVectSet.H:245
void and_domain(const ProblemDomain &d)
same as operator&= except it doesn&#39;t return *this
Definition: IntVectSet.H:305
void or_intvect(const IntVect &ivs)
same as operator|= except it doesn&#39;t return *this
Definition: IntVectSet.H:149
void convert() const
void or_intvectset(const IntVectSet &ivs)
same as operator|= except it doesn&#39;t return *this
Definition: IntVectSet.H:139
void p() const
Writes a Vector<Box> representation to the parallel stdout.
Definition: IntVectSet.H:589
static void setMaxDense(const int &a_maxDense)
IntVectSet copy() const
return a copy of this IntVectSet
Definition: IntVectSet.H:76
static long int peakcount
Definition: IntVectSet.H:604
void begin()
initialize this iterator to the first IntVect in its IntVectSet
Definition: IntVectSet.H:727
void nestingRegion(int radius, const Box &domain, int granularity=1)
Make this IntVectSet be properly nested.
friend class IVSIterator
Definition: IntVectSet.H:47
IntVectSet operator-(const IntVectSet &ivs) const
Returns the complement of the IntVectSet ivs within this IntVectSet.
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
bool contains_intvectset(const IntVectSet &ivs) const
same as contains(ivs)
Definition: IntVectSet.H:507
void grow_dir(int idir, int igrow)
same as grow(idir,igrow) except doesn&#39;t return *this
Definition: IntVectSet.H:345
void or_box(const Box &b)
same as operator|= except it doesn&#39;t return *this
Definition: IntVectSet.H:159
friend IntVectSet operator &(const IntVectSet &ivs1, const IntVectSet &ivs2)
Returns a new IntVectSet that is the intersection of two IntVectSets.
TreeIntVectSetIterator m_tree
Definition: IntVectSet.H:700
void makeEmptyBits()
Modifies this IntVectSet to empty but leaves dense domain box unchanged.
void define_box(const Box &b)
Box define: same as define(Box)
Definition: IntVectSet.H:118
void linearOut(void *const a_outBuf) const
Write a linear representation of *this to a_outBuf.
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
bool m_isdense
Definition: IntVectSet.H:698
void nestingRegion_prob(int radius, const ProblemDomain &probdomain)
same as nestingRegion() except it doesn&#39;t return *this
Definition: IntVectSet.H:435
void end()
move this iterator to after the last IntVect in the set
Definition: IntVectSet.H:733
Iterator for an IntVectSet.
Definition: IntVectSet.H:640
const Box & minBox() const
Returns the minimum enclosing box of this IntVectSet.
bool contains(const IntVect &iv) const
Returns true if this IntVectSet contains iv.
IVSIterator()
Definition: IntVectSet.H:648
bool isEmpty() const
Returns true if no IntVects are in this IntVectSet.
void shift(const IntVect &iv)
Increment all the IntVects in this IntVectSet by the IntVect iv.
DenseIntVectSetIterator m_dense
Definition: IntVectSet.H:699
TreeIntVectSet m_ivs
Definition: IntVectSet.H:612