RE: TVector3 3D array

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 22 Apr 2005 13:27:42 -0500


Hi,

The easiest way would be to use

        vector<vector<vector<TVector3> > > CellGridV;

If you can't use this then you have to use TVector3 ***CellGridV and initiliaze it with something like:

   CellGridV = new TVector3**[left_dim]
   for(int i=0; i<left_dim; ++i) {

      CellGridV[i] = new TVector*[middle_dim];
      for(int j=0; j<left_dim; ++j) {
         CellGridV[i][j] = new TVector[rigthdim];
         for(int k=0; k<left_dim; ++k) {
           do something with CellGridV[i][j][k];
         }
      }

   }
or use TVector3 *CellGridV = new TVector3[left_dim*middle_dim*right_dim]; and access CellGridV using an arithmetic expression involve i,j,k,left_dim,middle_dim and right_dim.

Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of doxaras_at_inp.demokritos.gr
Sent: Thursday, April 21, 2005 4:17 AM
To: brun_at_pcbrun.cern.ch; roottalk_at_pcroot.cern.ch Subject: [ROOT] TVector3 3D array

Hi all,
I am experiencing a problem trying to construct a cubic cellular grid and assign a TVector3 object at every grid point for a MHD simulation. After including <TVector3.h> and loading libphysics.so, I have tried all declarations (dynamic or not) without success TVector3 CellGridV[][][] and
TVector ***CellGridV = new TVector3[][][]. I cannot send the simplest possible solution right now since I am addressing thought a public computer.
best regards,
Giannis.


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\ Doxaras Ioannis /
\ University of Athens /
\ Division of Nuclear and Particle Physics /
\ NCSR "Demokritos" /
\ Institute of Nuclear Physics /
\ phone: +30 210-7798198 /
\ doxaras_at_gmail.gr /
\ doxaras_at_inp.demokritos.gr /
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ----------------------------------------------

"Institute of Nuclear Physics NCSR Demokritos"  http://www.inp.demokritos.gr/ Received on Fri Apr 22 2005 - 20:27:27 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET