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    / /__/ _ \/ _ \/  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 _REALVECT_H_
00053 #define _REALVECT_H_
00054 
00055 //
00056 // $Id: RealVect.H,v 1.26 2004/11/06 00:06:06 ligocki Exp $
00057 //
00058 
00059 #include <cstddef>
00060 #include <cstdlib>
00061 #include <cstring>
00062 #include <iostream>
00063 
00064 #include "SPACE.H"
00065 #include "Misc.H"
00066 #include "REAL.H"
00067 #include <cassert>
00068 #include "IntVect.H"
00069 
00071 
00079 class RealVect
00080 {
00081 public:
00082 
00087 
00089 
00092   RealVect ();
00093 
00095 
00100   RealVect (D_DECL(Real i, Real j, Real k));
00101 
00103 
00106   RealVect (const RealVect& rhs);
00107 
00109 
00113   RealVect (const IntVect & iv){
00114     for(int d=0 ; d<SpaceDim ; ++d ){ vect[d] = (Real)iv[d] ; }
00115   }
00117 
00120   RealVect& operator= (const RealVect& rhs);
00121 
00123 
00127   Real& operator[] (int i);
00128 
00130 
00133   const Real& operator[] (int i) const;
00134 
00141 
00143 
00147   bool operator== (const RealVect& p) const;
00148 
00150 
00154   bool operator!= (const RealVect& p) const;
00155 
00162 
00164 
00167   RealVect& operator+= (Real s);
00168 
00170 
00173   RealVect& operator+= (const RealVect& p);
00174 
00176 
00180   RealVect& operator-= (Real s);
00181 
00183 
00186   RealVect& operator-= (const RealVect& p);
00187 
00189 
00193   RealVect operator- (Real s) const;
00194 
00196 
00199   RealVect& operator*= (Real s);
00200 
00202 
00205   RealVect& operator*= (const RealVect& p);
00206 
00208 
00211   RealVect operator* (const RealVect& p) const;
00212 
00214 
00218   RealVect operator* (Real s) const;
00219 
00221 
00224   RealVect& operator/= (Real s);
00225 
00227 
00230   RealVect& operator/= (const RealVect& p);
00231 
00232 //XXX  ///
00233 //XXX  /**
00234 //XXX     Returns component-wise quotient of this RealVect by argument.
00235 //XXX  */
00236 //XXX  RealVect operator/ (const RealVect& p) const;
00237 
00239 
00243   RealVect operator/ (Real s) const;
00244 
00251 
00253 
00256   const Real* dataPtr() const;
00257 
00259 
00262   Real* dataPtr() ;
00263 
00270 
00272 
00283   friend RealVect BASISREALV(int dir);
00284 
00286 
00289   static const RealVect Zero;
00290 
00292 
00295   static const RealVect Unit;
00296 
00303 
00305 
00309   friend RealVect operator+ (Real            s,
00310                              const RealVect& p);
00311 
00313 
00316   friend RealVect operator- (Real            s,
00317                              const RealVect& p);
00318 
00320 
00324   friend RealVect operator* (Real            s,
00325                              const RealVect& p);
00327 
00331   friend RealVect operator/ (Real            s,
00332                              const RealVect& p);
00333 
00335 
00338   friend RealVect operator+ (const RealVect& s,
00339                              const RealVect& p);
00340 
00342 
00345   friend RealVect operator- (const RealVect& s,
00346                              const RealVect& p);
00347 
00349 
00352   friend RealVect operator* (const RealVect& s,
00353                              const RealVect& p);
00355 
00358   friend RealVect operator/ (const RealVect& s,
00359                              const RealVect& p);
00360 
00363 
00364 
00367   friend std::ostream& operator<< (std::ostream& ostr,
00368                                    const RealVect& p);
00369 
00370   friend class HDF5Handle;
00371 
00372   static size_t io_offset;
00373 private:
00374 
00378   Real vect[SpaceDim];
00379 
00380 };
00381 
00382 extern RealVect BASISREALV(int idir);
00383 /*
00384 #include "CH_HDF5.H"
00385 #include "SPMD.H"
00386 
00387 template < >
00388 int linearSize(const RealVect& vindex);
00389 
00390 //VolIndex specialization of linearIn
00391 template < >
00392 void linearIn(RealVect& a_outputT, const void* const inBuf);
00393 
00394 //VolIndex specialization of linearOut
00395 template < >
00396 void linearOut(void* const a_outBuf, const RealVect& a_inputT);
00397 
00398 */
00399 
00400 #endif

Generated on Wed Jan 19 17:51:27 2005 for Chombo&INSwithParticles by doxygen1.2.16