Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

IntVect.H

Go to the documentation of this file.
00001 /*   _______              __
00002     / ___/ /  ___  __ _  / /  ___
00003    / /__/ _ \/ _ \/  V \/ _ \/ _ \
00004    \___/_//_/\___/_/_/_/_.__/\___/
00005 */
00006 // CHOMBO Copyright (c) 2000-2004, The Regents of the University of
00007 // California, through Lawrence Berkeley National Laboratory (subject to
00008 // receipt of any required approvals from U.S. Dept. of Energy).  All
00009 // rights reserved.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are met:
00013 //
00014 // (1) Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 // (2) Redistributions in binary form must reproduce the above copyright
00017 // notice, this list of conditions and the following disclaimer in the
00018 // documentation and/or other materials provided with the distribution.
00019 // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S.
00020 // Dept. of Energy nor the names of its contributors may be used to endorse
00021 // or promote products derived from this software without specific prior
00022 // written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035 //
00036 // You are under no obligation whatsoever to provide any bug fixes,
00037 // patches, or upgrades to the features, functionality or performance of
00038 // the source code ("Enhancements") to anyone; however, if you choose to
00039 // make your Enhancements available either publicly, or directly to
00040 // Lawrence Berkeley National Laboratory, without imposing a separate
00041 // written license agreement for such Enhancements, then you hereby grant
00042 // the following license: a non-exclusive, royalty-free perpetual license
00043 // to install, use, modify, prepare derivative works, incorporate into
00044 // other computer software, distribute, and sublicense such Enhancements or
00045 // derivative works thereof, in binary and source code form.
00046 //
00047 // TRADEMARKS. Product and company names mentioned herein may be the
00048 // trademarks of their respective owners.  Any rights not expressly granted
00049 // herein are reserved.
00050 //
00051 
00052 #ifndef _INTVECT_H_
00053 #define _INTVECT_H_
00054 
00055 #ifndef WRAPPER
00056 #include <cstddef>
00057 #include <cstdlib>
00058 #include <cstring>
00059 #include <iostream>
00060 #include "SPACE.H"
00061 
00062 class HDF5Handle;
00063 
00064 #include "Misc.H"
00065 #endif
00066 
00067 #include "SPACE.H"
00068 
00070 
00078 class IntVect
00079 {
00080 public:
00081 
00086 
00088 
00091   IntVect()
00092   {}
00093 
00095 
00098   ~IntVect()
00099   {}
00100 
00102 
00107   IntVect (D_DECL(int i, int j, int k));
00108 
00110 
00114   explicit IntVect (const int* a);
00115 
00117 
00120   IntVect (const IntVect& rhs);
00121 
00122   IntVect copy() const {return *this;}
00124 
00127   IntVect& operator= (const IntVect& rhs);
00128 
00130 
00134   inline
00135   int& operator[] (int i);
00136 
00138 
00141   inline
00142   int operator[] (int i) const;
00143 
00145 
00148   void setVal (int i,
00149                int val);
00150 
00157 
00159 
00163   const int* getVect () const;
00164 
00166 
00169   const int*  dataPtr() const;
00170 
00172 
00175   int*  dataPtr();
00176 
00183 
00185 
00189   bool operator== (const IntVect& p) const;
00190 
00192 
00196   bool operator!= (const IntVect& p) const;
00197 
00199 
00206   bool operator< (const IntVect& p) const;
00207 
00209 
00216   bool operator<= (const IntVect& p) const;
00217 
00219 
00226   bool operator> (const IntVect& p) const;
00227 
00229 
00237   bool operator>= (const IntVect& p) const;
00238 
00240 
00253   bool lexLT (const IntVect& s) const;
00254 
00256 
00269   bool lexGT (const IntVect& s) const;
00270 
00277 
00279 
00282   IntVect operator+ () const;
00283 
00285 
00288   IntVect operator- () const;
00289 
00291 
00294   int sum () const;
00295 
00297 
00300   int product () const;
00301 
00308 
00310 
00313   IntVect& operator+= (int s);
00314 
00316 
00319   IntVect& operator+= (const IntVect& p);
00320 
00322 
00325   IntVect operator+ (const IntVect& p) const;
00326 
00328 
00332   IntVect operator+ (int s) const;
00333 
00335 
00339   friend inline IntVect operator+ (int            s,
00340                                    const IntVect& p);
00341 
00348 
00350 
00354   IntVect& operator-= (int s);
00355 
00357 
00360   IntVect& operator-= (const IntVect& p);
00361 
00363 
00367   IntVect operator- (const IntVect& p) const;
00368 
00370 
00374   IntVect operator- (int s) const;
00375 
00377 
00380   friend inline IntVect operator- (int            s,
00381                                    const IntVect& p);
00382 
00389 
00391 
00395   IntVect& operator*= (int s);
00396 
00398 
00401   IntVect& operator*= (const IntVect& p);
00402 
00404 
00407   IntVect operator* (const IntVect& p) const;
00408 
00410 
00414   IntVect operator* (int s) const;
00415 
00417 
00421   friend inline IntVect operator* (int            s,
00422                                    const IntVect& p);
00423 
00430 
00432 
00435   IntVect& operator/= (int s);
00436 
00438 
00442   IntVect& operator/= (const IntVect& p);
00443 
00445 
00448   IntVect operator/ (const IntVect& p) const;
00449 
00451 
00455   IntVect operator/ (int s) const;
00456 
00463 
00465 
00469   IntVect& min (const IntVect& p);
00470 
00472 
00476   friend inline IntVect min (const IntVect& p1,
00477                              const IntVect& p2);
00478 
00480 
00484   IntVect& max (const IntVect& p);
00485 
00487 
00491   friend inline IntVect max (const IntVect& p1,
00492                              const IntVect& p2);
00493 
00495 
00498   IntVect& scale (int s);
00499 
00501 
00505   friend inline IntVect scale (const IntVect& p,
00506                                int            s);
00507 
00509 
00514   IntVect& reflect (int ref_ix,
00515                     int idir);
00516 
00518 
00523   friend inline IntVect reflect(const IntVect& a,
00524                                 int            ref_ix,
00525                                 int            idir);
00526 
00528 
00532   IntVect& shift (int coord,
00533                   int s);
00534 
00536 
00540   IntVect& shift (const IntVect& iv);
00541 
00543 
00547   IntVect& diagShift (int s);
00548 
00550 
00554   friend inline IntVect diagShift (const IntVect& p,
00555                                    int            s);
00556 
00558 
00561   IntVect& coarsen (const IntVect& p);
00562 
00564 
00567   IntVect& coarsen (int p);
00568 
00570 
00574   friend inline IntVect coarsen (const IntVect& p,
00575                                  int            s);
00576 
00578 
00582   friend inline IntVect coarsen (const IntVect& p1,
00583                                  const IntVect& p2);
00584 
00591 
00593 
00596   void printOn (std::ostream& os) const;
00597 
00599 
00602   void p() const;
00603 
00605 
00608   void dumpOn (std::ostream& os) const;
00609 
00611 
00614   friend std::ostream& operator<< (std::ostream&       os,
00615                                    const IntVect& iv);
00616 
00618 
00621   friend std::istream& operator>> (std::istream& os,
00622                                    IntVect& iv);
00623 
00630 
00632 
00640   friend inline IntVect BASISV (int dir);
00641 
00645   static const IntVect Zero;
00646 
00650   static const IntVect Unit;
00651 
00655   static int InitStatics();
00656 
00659 protected:
00660   //
00661   // Box is a friend of ours.
00662   //
00663   friend class Box;
00664 
00665   friend class HDF5Handle;
00666   friend class VolIndex;
00667   friend class FaceIndex;
00668 
00672   int vect[SpaceDim];
00673 
00677   static const size_t IntVectSize;
00678 };
00679 
00680 //
00681 // Static initialization.  Gotta make sure there are no static object
00682 // definitions above here (except possibly stuff in headers).  Otherwise,
00683 // the danger is that some static object's constructor calls IntVect::Zero or
00684 // IntVect::Unit -- the very things the following definition is supposed to
00685 // initialize.
00686 //
00687 static int s_dummyForIntVectH( IntVect::InitStatics() );
00688 
00689 
00690 #ifndef WRAPPER
00691 //
00692 // Inlines.
00693 //
00694 
00695 // try uninitialized IntVect null construction for now.....
00696 
00697 // inline
00698 // IntVect::IntVect ()
00699 // {
00700 //     D_EXPR(vect[0] = 0, vect[1] = 0, vect[2] = 0);
00701 // }
00702 
00703 inline
00704 IntVect::IntVect (D_DECL(int i, int j, int k))
00705 {
00706   D_EXPR(vect[0] = i, vect[1] = j, vect[2] = k);
00707 }
00708 
00709 inline
00710 IntVect::IntVect (const int *a)
00711 {
00712   D_EXPR(vect[0] = a[0], vect[1] = a[1], vect[2] = a[2]);
00713 }
00714 
00715 inline
00716 IntVect::IntVect (const IntVect &iv)
00717 {
00718   //D_EXPR(vect[0]=iv.vect[0], vect[1]=iv.vect[1], vect[2]=iv.vect[2]);
00719   memcpy(vect, iv.vect, IntVectSize);
00720 }
00721 
00722 inline
00723 IntVect&
00724 IntVect::operator= (const IntVect &iv)
00725 {
00726   D_EXPR(vect[0]=iv.vect[0], vect[1]=iv.vect[1], vect[2]=iv.vect[2]);
00727   return *this;
00728 }
00729 
00730 inline
00731 int&
00732 IntVect::operator[] (int i)
00733 {
00734  CH_assert(i>=0 && i < SpaceDim);
00735   return vect[i];
00736 }
00737 
00738 inline
00739 int
00740 IntVect::operator[] (int i) const
00741 {
00742  CH_assert(i>=0 && i < SpaceDim);
00743   return vect[i];
00744 }
00745 
00746 inline
00747 void
00748 IntVect::setVal (int i,
00749                  int val)
00750 {
00751  CH_assert(i >=0 && i < SpaceDim);
00752   vect[i] = val;
00753   //  return *this;
00754 }
00755 
00756 inline
00757 const int*
00758 IntVect::dataPtr() const
00759 {
00760   return vect;
00761 }
00762 
00763 inline
00764 int*
00765 IntVect::dataPtr()
00766 {
00767   return vect;
00768 }
00769 
00770 inline
00771 const int*
00772 IntVect::getVect () const
00773 {
00774   return vect;
00775 }
00776 
00777 inline
00778 bool
00779 IntVect::operator== (const IntVect& p) const
00780 {
00781   return D_TERM(vect[0] == p[0], && vect[1] == p[1], && vect[2] == p[2]);
00782 }
00783 
00784 inline
00785 bool
00786 IntVect::operator!= (const IntVect& p) const
00787 {
00788   return D_TERM(vect[0] != p[0], || vect[1] != p[1], || vect[2] != p[2]);
00789 }
00790 
00791 inline
00792 bool
00793 IntVect::operator< (const IntVect& p) const
00794 {
00795   return D_TERM(vect[0] < p[0], && vect[1] < p[1], && vect[2] < p[2]);
00796 }
00797 
00798 inline
00799 bool
00800 IntVect::operator<= (const IntVect& p) const
00801 {
00802   return D_TERM(vect[0] <= p[0], && vect[1] <= p[1], && vect[2] <= p[2]);
00803 }
00804 
00805 
00806 inline
00807 bool
00808 IntVect::operator> (const IntVect& p) const
00809 {
00810   return D_TERM(vect[0] > p[0], && vect[1] > p[1], && vect[2] > p[2]);
00811 }
00812 
00813 inline
00814 bool
00815 IntVect::operator>= (const IntVect& p) const
00816 {
00817   return D_TERM(vect[0] >= p[0], && vect[1] >= p[1], && vect[2] >= p[2]);
00818 }
00819 
00820 inline
00821 bool
00822 IntVect::lexLT (const IntVect &s) const
00823 {
00824 #define LLT0 (vect[0] < s[0])
00825 #define LLT1 ((vect[0] == s[0]) && (vect[1] < s[1]))
00826 #define LLT2 ((vect[1] == s[1]) && (vect[2] < s[2]))
00827 #if   CH_SPACEDIM == 1
00828   return LLT0;
00829 #elif CH_SPACEDIM == 2
00830   return LLT0 || LLT1;
00831 #elif CH_SPACEDIM == 3
00832   return LLT0 || (vect[0]==s[0] && ((vect[1] < s[1] || LLT2)));
00833 #endif
00834 #undef LLT0
00835 #undef LLT1
00836 #undef LLT2
00837 }
00838 
00839 inline
00840 bool
00841 IntVect::lexGT (const IntVect& s) const
00842 {
00843 #define LGT0 (vect[0] > s[0])
00844 #define LGT1 ((vect[0] == s[0]) && (vect[1] > s[1]))
00845 #define LGT2 ((vect[1] == s[1]) && (vect[2] > s[2]))
00846 #if   CH_SPACEDIM == 1
00847   return LGT0;
00848 #elif CH_SPACEDIM == 2
00849   return LGT0 || LGT1;
00850 #elif CH_SPACEDIM == 3
00851   return LGT0 || (vect[0] == s[0] && ((vect[1] > s[1] || LGT2)));
00852 #endif
00853 #undef LGT0
00854 #undef LGT1
00855 #undef LGT2
00856 }
00857 
00858 inline
00859 IntVect
00860 IntVect::operator+ () const
00861 {
00862   return IntVect(*this);
00863 }
00864 
00865 inline
00866 IntVect
00867 IntVect::operator- () const
00868 {
00869   return IntVect(D_DECL(-vect[0], -vect[1], -vect[2] ));
00870 }
00871 
00872 inline
00873 int
00874 IntVect::sum () const
00875 {
00876   return D_TERM(vect[0], + vect[1], + vect[2]);
00877 }
00878 
00879 inline
00880 int
00881 IntVect::product () const
00882 {
00883   return D_TERM(vect[0], * vect[1], * vect[2]);
00884 }
00885 
00886 inline
00887 IntVect&
00888 IntVect::operator+= (int s)
00889 {
00890   D_EXPR(vect[0] += s, vect[1] += s, vect[2] += s);
00891   return *this;
00892 }
00893 
00894 inline
00895 IntVect&
00896 IntVect::operator+= (const IntVect& p)
00897 {
00898   D_EXPR(vect[0] += p[0], vect[1] += p[1], vect[2] += p[2]);
00899   return *this;
00900 }
00901 
00902 inline
00903 IntVect&
00904 IntVect::operator*= (int s)
00905 {
00906   D_EXPR(vect[0] *= s, vect[1] *= s, vect[2] *= s);
00907   return *this;
00908 }
00909 
00910 inline
00911 IntVect&
00912 IntVect::operator*= (const IntVect &p)
00913 {
00914   D_EXPR(vect[0] *= p[0], vect[1] *= p[1], vect[2] *= p[2]);
00915   return *this;
00916 }
00917 
00918 inline
00919 IntVect&
00920 IntVect::operator/= (int s)
00921 {
00922   D_EXPR(vect[0] /= s, vect[1] /= s, vect[2] /= s);
00923   return *this;
00924 }
00925 
00926 inline
00927 IntVect&
00928 IntVect::operator/= (const IntVect& p)
00929 {
00930   D_EXPR(vect[0] /= p[0], vect[1] /= p[1], vect[2] /= p[2]);
00931   return *this;
00932 }
00933 
00934 inline
00935 IntVect&
00936 IntVect::operator-= (int s)
00937 {
00938   D_EXPR(vect[0] -= s, vect[1] -= s, vect[2] -= s);
00939   return *this;
00940 }
00941 
00942 inline
00943 IntVect&
00944 IntVect::operator-= (const IntVect& p)
00945 {
00946   D_EXPR(vect[0] -= p[0], vect[1] -= p[1], vect[2] -= p[2]);
00947   return *this;
00948 }
00949 
00950 inline
00951 IntVect
00952 IntVect::operator+ (const IntVect& p) const
00953 {
00954   return IntVect(D_DECL(vect[0] + p[0], vect[1] + p[1], vect[2] + p[2]));
00955 }
00956 
00957 inline
00958 IntVect
00959 IntVect::operator+ (int s) const
00960 {
00961   return IntVect(D_DECL(vect[0] + s, vect[1] + s, vect[2] + s));
00962 }
00963 
00964 inline
00965 IntVect
00966 IntVect::operator- (const IntVect& p) const
00967 {
00968   return IntVect(D_DECL(vect[0] - p[0], vect[1] - p[1], vect[2] - p[2]));
00969 }
00970 
00971 inline
00972 IntVect
00973 IntVect::operator- (int s) const
00974 {
00975   return IntVect(D_DECL(vect[0] - s, vect[1] - s, vect[2] - s));
00976 }
00977 
00978 inline
00979 IntVect
00980 IntVect::operator* (const IntVect& p) const
00981 {
00982   return IntVect(D_DECL(vect[0] * p[0], vect[1] * p[1], vect[2] * p[2]));
00983 }
00984 
00985 inline
00986 IntVect
00987 IntVect::operator* (int s) const
00988 {
00989   return IntVect(D_DECL(vect[0] * s, vect[1] * s, vect[2] * s));
00990 }
00991 
00992 inline
00993 IntVect
00994 IntVect::operator/ (const IntVect& p) const
00995 {
00996   return IntVect(D_DECL(vect[0] / p[0], vect[1] / p[1], vect[2] / p[2]));
00997 }
00998 
00999 inline
01000 IntVect
01001 IntVect::operator/ (int s) const
01002 {
01003   return IntVect(D_DECL(vect[0] / s, vect[1] / s, vect[2] / s));
01004 }
01005 
01006 inline
01007 IntVect&
01008 IntVect::min (const IntVect& p)
01009 {
01010   D_EXPR(vect[0] = Min(vect[0], p.vect[0]),
01011          vect[1] = Min(vect[1], p.vect[1]),
01012          vect[2] = Min(vect[2], p.vect[2]));
01013   return *this;
01014 }
01015 
01016 inline
01017 IntVect&
01018 IntVect::max (const IntVect& p)
01019 {
01020   D_EXPR(vect[0] = Max(vect[0], p.vect[0]),
01021          vect[1] = Max(vect[1], p.vect[1]),
01022          vect[2] = Max(vect[2], p.vect[2]));
01023   return *this;
01024 }
01025 
01026 inline
01027 IntVect&
01028 IntVect::scale (int s)
01029 {
01030   D_EXPR(vect[0] *= s, vect[1] *= s, vect[2] *= s);
01031   return *this;
01032 }
01033 
01034 inline
01035 IntVect&
01036 IntVect::reflect (int ref_ix,
01037                   int idir)
01038 {
01039  CH_assert(idir >= 0 && idir < SpaceDim);
01040   vect[idir] = -vect[idir] + 2*ref_ix;
01041   return *this;
01042 }
01043 
01044 inline
01045 IntVect&
01046 IntVect::shift (int coord,
01047                 int s)
01048 {
01049  CH_assert(coord >= 0 && coord < SpaceDim);
01050   vect[coord] += s;
01051   return *this;
01052 }
01053 
01054 inline
01055 IntVect&
01056 IntVect::shift (const IntVect& iv)
01057 {
01058   *this += iv;
01059   return *this;
01060 }
01061 
01062 inline
01063 IntVect&
01064 IntVect::diagShift (int s)
01065 {
01066   D_EXPR(vect[0] += s, vect[1] += s, vect[2] += s);
01067   return *this;
01068 }
01069 
01070 inline
01071 IntVect
01072 operator+ (int            s,
01073            const IntVect& p)
01074 {
01075   return IntVect(D_DECL(p[0] + s, p[1] + s, p[2] + s));
01076 }
01077 
01078 inline
01079 IntVect
01080 operator- (int            s,
01081            const IntVect& p)
01082 {
01083   return IntVect(D_DECL(s - p[0], s - p[1], s - p[2]));
01084 }
01085 
01086 inline
01087 IntVect
01088 operator* (int            s,
01089            const IntVect& p)
01090 {
01091   return IntVect(D_DECL(s * p[0], s * p[1], s * p[2]));
01092 }
01093 
01094 inline
01095 IntVect
01096 scale (const IntVect& p,
01097        int            s)
01098 {
01099   return IntVect(D_DECL(s * p[0], s * p[1], s * p[2]));
01100 }
01101 
01102 inline
01103 IntVect
01104 diagShift (const IntVect &p, int s)
01105 {
01106   return IntVect(D_DECL(p[0] + s, p[1] + s, p[2] + s));
01107 }
01108 
01109 inline
01110 IntVect
01111 min (const IntVect& p1,
01112      const IntVect& p2)
01113 {
01114   IntVect p(p1);
01115   return p.min(p2);
01116 }
01117 
01118 inline
01119 IntVect
01120 max (const IntVect& p1,
01121      const IntVect& p2)
01122 {
01123   IntVect p(p1);
01124   return p.max(p2);
01125 }
01126 
01127 inline
01128 IntVect
01129 BASISV (int dir)
01130 {
01131  CH_assert(dir >= 0 && dir < SpaceDim);
01132   IntVect tmp = IntVect::Zero ;
01133   tmp.vect[dir] = 1;
01134   return tmp;
01135 }
01136 
01137 inline
01138 IntVect
01139 reflect (const IntVect& a,
01140          int            ref_ix,
01141          int            idir)
01142 {
01143  CH_assert(idir >= 0 && idir < SpaceDim);
01144   IntVect b(a);
01145   b.vect[idir] = -b.vect[idir] + 2*ref_ix;
01146   return b;
01147 }
01148 
01149 inline
01150 IntVect
01151 coarsen (const IntVect& p,
01152          int            s)
01153 {
01154  CH_assert(s > 0);
01155   return IntVect(
01156                  D_DECL((p.vect[0]<0) ? -abs(p.vect[0]+1)/s-1 : p.vect[0]/s ,
01157                         (p.vect[1]<0) ? -abs(p.vect[1]+1)/s-1 : p.vect[1]/s ,
01158                         (p.vect[2]<0) ? -abs(p.vect[2]+1)/s-1 : p.vect[2]/s ));
01159 }
01160 
01161 inline
01162 IntVect
01163 coarsen (const IntVect& p1,
01164          const IntVect& p2)
01165 {
01166  CH_assert(p2 > IntVect::Zero);
01167   return IntVect(
01168                  D_DECL(
01169                         (p1.vect[0]<0)?-abs(p1.vect[0]+1)/p2.vect[0]-1:p1.vect[0]/p2.vect[0],
01170                         (p1.vect[1]<0)?-abs(p1.vect[1]+1)/p2.vect[1]-1:p1.vect[1]/p2.vect[1],
01171                         (p1.vect[2]<0)?-abs(p1.vect[2]+1)/p2.vect[2]-1:p1.vect[2]/p2.vect[2])
01172                  );
01173 }
01174 
01175 inline
01176 IntVect&
01177 IntVect::coarsen (int s)
01178 {
01179  CH_assert(s > 0);
01180   for (int i = 0; i < SpaceDim; ++i)
01181     vect[i] = ((vect[i]<0) ? -abs(vect[i]+1)/s-1 : vect[i]/s);
01182   return *this;
01183 }
01184 
01185 inline
01186 IntVect&
01187 IntVect::coarsen (const IntVect& p)
01188 {
01189  CH_assert(p > IntVect::Zero);
01190   for (int i = 0; i <SpaceDim; ++i)
01191     {
01192       const int s = p.vect[i];
01193       vect[i] = ((vect[i]<0) ? -abs(vect[i]+1)/s-1 : vect[i]/s);
01194     }
01195   return *this;
01196 }
01197 
01198 #endif /* WRAPPER */
01199 
01200 #endif

Generated on Wed Oct 5 13:52:08 2005 for Chombo&AMRSelfGravity by  doxygen 1.4.1