1 /*****************************************************************************
5 ** Purpose: 2-dimension array classes
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: June 2000
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2000 Kevin Rosenberg
12 ** $Id: array2d.h,v 1.3 2000/06/09 01:35:33 kevin Exp $
13 ** $Log: array2d.h,v $
14 ** Revision 1.3 2000/06/09 01:35:33 kevin
15 ** Convert MPI structure to C++ class
18 ** This program is free software; you can redistribute it and/or modify
19 ** it under the terms of the GNU General Public License (version 2) as
20 ** published by the Free Software Foundation.
22 ** This program is distributed in the hope that it will be useful,
23 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
24 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ** GNU General Public License for more details.
27 ** You should have received a copy of the GNU General Public License
28 ** along with this program; if not, write to the Free Software
29 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 ******************************************************************************/
47 Array2d (unsigned int x, unsigned int y)
51 array_data = new T*[nx];
53 for (unsigned int i = 0; i < nx; i++)
54 array_data[i] = new T[ny];
60 for (int i = 0; i < nx; i++)
65 T** getArray (void) const
66 { return array_data; }
68 T* getColumn (unsigned int x) const
69 { return array_data[x]; }
71 T getPoint (unsigned int x, unsigned int y) const
72 { return (array_data[x][y]); }
74 unsigned int sizeofPixel (void) const
77 unsigned int sizeofColumn (void) const
78 { return (sizeof(T) * ny); }
80 unsigned int sizeofArray (void) const
81 { return (sizeof(T) * nx * ny); }