Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

RealVect.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 #ifndef CH_REALVECT_H
00029 #define CH_REALVECT_H
00030 
00031 //
00032 // $Id: RealVect.H,v 1.15 2003/02/19 02:52:43 dbs Exp $
00033 //
00034 
00035 #include <cstddef>
00036 #include <cstdlib>
00037 #include <cstring>
00038 #include <iostream>
00039 
00040 #include "SPACE.H"
00041 #include "Misc.H"
00042 #include "REAL.H"
00043 #include <cassert>
00044 #include "IntVect.H"
00045 
00046 //
00047 //@Man:
00048 //@Memo: An Real Vector in SpaceDim-Dimensional Space
00049 /*@Doc:
00050 
00051   The class RealVect is an implementation of an Real vector in a
00052   SpaceDim-dimensional space.  
00053   RealVect values are accessed using the operator[] function, as for a normal
00054   C++ array.  In addition, the basic arithmetic operators have been overloaded
00055   to implement scaling and translation operations.
00056 */
00057 
00058 class RealVect
00059 {
00060 public:
00061 
00063 
00065 
00069   RealVect ();
00070 
00072 
00078   RealVect (D_DECL(Real i, Real j, Real k));
00079 
00081 
00085   RealVect (const RealVect& rhs);
00086 
00088 
00092   RealVect (const IntVect & iv){
00093     for(int d=0 ; d<SpaceDim ; ++d ){ vect[d] = (Real)iv[d] ; }
00094   }
00096 
00100   RealVect& operator= (const RealVect& rhs);
00101 
00103 
00108   Real& operator[] (int i);
00109 
00111 
00115   const Real& operator[] (int i) const;
00116 
00117 
00119 
00121 
00126   bool operator== (const RealVect& p) const;
00127 
00129 
00134   bool operator!= (const RealVect& p) const;
00135 
00137 
00141   RealVect& operator+= (Real s);
00142 
00144 
00148   RealVect& operator+= (const RealVect& p);
00149 
00151 
00156   RealVect& operator-= (Real s);
00157 
00159 
00163   RealVect& operator-= (const RealVect& p);
00164 
00166 
00171   RealVect operator- (Real s) const;
00172  
00174 
00179   RealVect& operator*= (Real s);
00180 
00182 
00186   RealVect& operator*= (const RealVect& p);
00187 
00189 
00193   RealVect operator* (const RealVect& p) const;
00194 
00196 
00201   RealVect operator* (Real s) const;
00202 
00204 
00208   RealVect& operator/= (Real s);
00209 
00211 
00216   RealVect& operator/= (const RealVect& p);
00217 
00219 
00223   RealVect operator/ (const RealVect& p) const;
00224 
00226 
00230   RealVect operator/ (Real s) const;
00231 
00233 
00236   const Real* dataPtr() const;
00237 
00239 
00242   Real* dataPtr() ;
00243 
00245 
00251   friend RealVect BASISREALV(int dir);
00252 
00254 
00258   static const RealVect Zero;
00259 
00261 
00265   static const RealVect Unit;
00266 
00268 
00273   friend RealVect operator+ (Real            s,
00274                              const RealVect& p);
00275 
00277 
00281   friend RealVect operator- (Real            s,
00282                              const RealVect& p);
00283 
00285 
00290   friend RealVect operator* (Real            s,
00291                              const RealVect& p);
00293 
00298   friend RealVect operator/ (Real            s,
00299                              const RealVect& p);
00300 
00302 
00307   friend RealVect operator+ (const RealVect& s,
00308                              const RealVect& p);
00309 
00311 
00315   friend RealVect operator- (const RealVect& s,
00316                              const RealVect& p);
00317 
00319 
00324   friend RealVect operator* (const RealVect& s,
00325                              const RealVect& p);
00327 
00332   friend RealVect operator/ (const RealVect& s,
00333                              const RealVect& p);
00334 
00336 
00339   friend std::ostream& operator<< (std::ostream& ostr,
00340                                    const RealVect& p);
00341 
00342   friend class HDF5Handle;
00343 
00344   static size_t io_offset;
00345 private:
00346 
00347   Real vect[SpaceDim];
00348 
00349 };
00350 
00351 #include "HDF5.H"
00352 #include "SPMD.H"
00353 
00354 template < >
00355 int linearSize(const RealVect& vindex);
00356   
00357 //VolIndex specialization of linearIn
00358 template < >
00359 void linearIn(RealVect& a_outputT, const void* const inBuf);
00360   
00361 //VolIndex specialization of linearOut
00362 template < >
00363 void linearOut(void* const a_outBuf, const RealVect& a_inputT); 
00364 
00365 
00366 #endif /*CH_RealVect_H*/
00367 

Generated on Wed Apr 16 14:26:49 2003 for Chombo by doxygen1.2.16