Logo ROOT   6.13/01
Reference Guide
TFoamVect.h
Go to the documentation of this file.
1 // @(#)root/foam:$Id$
2 // Author: S. Jadach <mailto:Stanislaw.jadach@ifj.edu.pl>, P.Sawicki <mailto:Pawel.Sawicki@ifj.edu.pl>
3 
4 #ifndef ROOT_TFoamVect
5 #define ROOT_TFoamVect
6 
7 ////////////////////////////////////////////////////////////////////////////////
8 // //
9 // Auxiliary class TFoamVect of n-dimensional vector, with dynamic allocation //
10 // used for the cartesian geometry of the TFoam cells //
11 // //
12 ////////////////////////////////////////////////////////////////////////////////
13 
14 #include "TObject.h"
15 
16 
17 ///////////////////////////////////////////////////////////////////////////////
18 class TFoamVect : public TObject {
19  // constructor
20 private:
21  Int_t fDim; // Dimension
22  Double_t *fCoords; // [fDim] Coordinates
23 public:
24  TFoamVect(); // Constructor
25  TFoamVect(Int_t); // USER Constructor
26  TFoamVect(const TFoamVect &); // Copy constructor
27  virtual ~TFoamVect(); // Destructor
28 //////////////////////////////////////////////////////////////////////////////
29 // Overloading operators //
30 //////////////////////////////////////////////////////////////////////////////
31  TFoamVect& operator =(const TFoamVect&); // = operator; Substitution
32  Double_t &operator[](Int_t); // [] provides POINTER to coordinate
33  TFoamVect& operator =(Double_t []); // LOAD IN entire double vector
34  TFoamVect& operator =(Double_t); // LOAD IN double number
35 ////////////////////////// OTHER METHODS //////////////////////////////////
36  TFoamVect& operator+=(const TFoamVect&); // +=; add vector u+=v (FAST)
37  TFoamVect& operator-=(const TFoamVect&); // +=; add vector u+=v (FAST)
38  TFoamVect& operator*=(const Double_t&); // *=; mult. by scalar v*=x (FAST)
39  TFoamVect operator+( const TFoamVect&); // +; u=v+s, NEVER USE IT, SLOW!!!
40  TFoamVect operator-( const TFoamVect&); // -; u=v-s, NEVER USE IT, SLOW!!!
41  void Print(Option_t *option) const; // Prints vector
42  Int_t GetDim() const { return fDim; } // Returns dimension
43  Double_t GetCoord(Int_t i) const {return fCoords[i];}; // Returns coordinate
44 
45  ClassDef(TFoamVect,1) //n-dimensional vector with dynamical allocation
46 };
47 
48 #endif
49 
virtual ~TFoamVect()
Destructor.
Definition: TFoamVect.cxx:69
Int_t fDim
Definition: TFoamVect.h:21
Double_t & operator[](Int_t)
[] is for access to elements as in ordinary matrix like a[j]=bj Range protection is built in...
Definition: TFoamVect.cxx:107
TFoamVect operator-(const TFoamVect &)
subtraction operator -; difference of 2 vectors; c=a-b, a=a-b, NEVER USE IT, VERY SLOW!!! ...
Definition: TFoamVect.cxx:167
Int_t GetDim() const
Definition: TFoamVect.h:42
TFoamVect & operator=(const TFoamVect &)
substitution operator
Definition: TFoamVect.cxx:84
TFoamVect & operator-=(const TFoamVect &)
unary subtraction operator -=
Definition: TFoamVect.cxx:141
TFoamVect & operator+=(const TFoamVect &)
unary addition operator +=; adding vector c*=x,
Definition: TFoamVect.cxx:128
TFoamVect & operator*=(const Double_t &)
unary multiplication operator *=
Definition: TFoamVect.cxx:118
TFoamVect()
Default constructor for streamer.
Definition: TFoamVect.cxx:21
Double_t * fCoords
Definition: TFoamVect.h:22
void Print(Option_t *option) const
Printout of all vector components on "std::cout".
Definition: TFoamVect.cxx:204
Double_t GetCoord(Int_t i) const
Definition: TFoamVect.h:43
TFoamVect operator+(const TFoamVect &)
addition operator +; sum of 2 vectors: c=a+b, a=a+b, NEVER USE IT, VERY SLOW!!!
Definition: TFoamVect.cxx:155