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.11 2002/06/18 23:09:09 bvs Exp $
00033 //
00034 
00035 #include <cstddef>
00036 #include <cstdlib>
00037 #include <cstring>
00038 #include <iostream>
00039 
00040 
00041 
00042 
00043 #include "SPACE.H"
00044 #include "Misc.H"
00045 #include "REAL.H"
00046 #include <cassert>
00047 
00048 
00049 //
00050 //@Man:
00051 //@Memo: An Real Vector in SpaceDim-Dimensional Space
00052 /*@Doc:
00053 
00054   The class RealVect is an implementation of an Real vector in a
00055   SpaceDim-dimensional space.  
00056   RealVect values are accessed using the operator[] function, as for a normal
00057   C++ array.  In addition, the basic arithmetic operators have been overloaded
00058   to implement scaling and translation operations.
00059 */
00060 
00061 class RealVect
00062 {
00063 public:
00064 
00066 
00068 
00072   RealVect ();
00073 
00075 
00081   RealVect (D_DECL(Real i, Real j, Real k));
00082 
00084 
00088   RealVect (const RealVect& rhs);
00089 
00091 
00095   RealVect& operator= (const RealVect& rhs);
00096 
00098 
00103   Real& operator[] (int i);
00104 
00106 
00110   const Real& operator[] (int i) const;
00111 
00112 
00114 
00116 
00121   bool operator== (const RealVect& p) const;
00122 
00124 
00129   bool operator!= (const RealVect& p) const;
00130 
00132 
00136   RealVect& operator+= (Real s);
00137 
00139 
00143   RealVect& operator+= (const RealVect& p);
00144 
00146 
00151   RealVect& operator-= (Real s);
00152 
00154 
00158   RealVect& operator-= (const RealVect& p);
00159 
00161 
00164   RealVect operator- (const RealVect& p) const;
00165 
00167 
00172   RealVect operator- (Real s) const;
00173  
00175 
00180   RealVect& operator*= (Real s);
00181 
00183 
00187   RealVect& operator*= (const RealVect& p);
00188 
00190 
00194   RealVect operator* (const RealVect& p) const;
00195 
00197 
00202   RealVect operator* (Real s) const;
00203 
00205 
00209   RealVect& operator/= (Real s);
00210 
00212 
00217   RealVect& operator/= (const RealVect& p);
00218 
00220 
00224   RealVect operator/ (const RealVect& p) const;
00225 
00227 
00231   RealVect operator/ (Real s) const;
00232 
00234 
00237   const Real* dataPtr() const;
00238 
00240 
00246   friend RealVect BASISREALV(int dir);
00247 
00249 
00253   static const RealVect Zero;
00254 
00256 
00260   static const RealVect Unit;
00261 
00263 
00268   friend RealVect operator+ (Real            s,
00269                              const RealVect& p);
00270 
00272 
00276   friend RealVect operator- (Real            s,
00277                              const RealVect& p);
00278 
00280 
00285   friend RealVect operator* (Real            s,
00286                              const RealVect& p);
00288 
00293   friend RealVect operator/ (Real            s,
00294                              const RealVect& p);
00295 
00297 
00302   friend RealVect operator+ (const RealVect& s,
00303                              const RealVect& p);
00304 
00306 
00310   friend RealVect operator- (const RealVect& s,
00311                              const RealVect& p);
00312 
00314 
00319   friend RealVect operator* (const RealVect& s,
00320                              const RealVect& p);
00322 
00327   friend RealVect operator/ (const RealVect& s,
00328                              const RealVect& p);
00329 
00330   friend class HDF5Handle;
00331 
00332   static size_t io_offset;
00333 private:
00334 
00335   Real vect[SpaceDim];
00336 
00337 };
00338 
00339 #include "HDF5.H"
00340 
00341 template < >
00342 int linearSize(const RealVect& vindex);
00343   
00344 //VolIndex specialization of linearIn
00345 template < >
00346 void linearIn(RealVect& a_outputT, const void* const inBuf);
00347   
00348 //VolIndex specialization of linearOut
00349 template < >
00350 void linearOut(void* const a_outBuf, const RealVect& a_inputT); 
00351 
00352 
00353 #endif /*CH_RealVect_H*/
00354 

Generated on Tue Jul 2 10:42:20 2002 for Chombo by doxygen1.2.16