Menu

2D array descriptor

Help
ank_psu
2007-12-18
2013-04-02
  • ank_psu

    ank_psu - 2007-12-18

    Hello,

    I was using the syntax as given in driver.cc example  to create a 1D array descriptor. That worked fine. However, I am facing problems in creating a descriptor for a 2D array. Could some one please provide me with a very simple example on creation of an array descriptor for a 2D array. I am not looking for a full-blown example; all I need is just an idea of how that can be done.

    Thanks in advance !!

    Regards,
    Ankur

     
    • PGK

      PGK - 2009-01-09

      Hi Ankur,

      Happy New Year! This snippet is based on the particle/driver.cc
      example you mentioned. It creates a very simple 2D array (3x3).

      double position2[][3] = {{1.1, 1.2, 1.3},
                                              {2.1, 2.2, 2.3},
                                              {3.1, 3.2, 3.3}};
      int rank = 2;
      unsigned long size[] = {3,3};

      F90::Array<double> pos2((double *)position2, rank, size);

      Hope that helps,
      Paul

       

Log in to post a comment.