Debian Codegraph @

C++/Include/dim_tbl.h

raw symbols SCIP
1 /*
2 * Definition of Lorene class Dim_tbl
3 *
4 */
5
6 /*
7 * Copyright (c) 1999-2000 Jean-Alain Marck
8 * Copyright (c) 1999-2001 Eric Gourgoulhon
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28
29 #ifndef __DIM_TBL_H_
30 #define __DIM_TBL_H_
31
32
33 /*
34 * $Id: dim_tbl.h,v 1.7 2014/10/13 08:52:33 j_novak Exp $
35 * $Log: dim_tbl.h,v $
36 * Revision 1.7 2014/10/13 08:52:33 j_novak
37 * Lorene classes and functions now belong to the namespace Lorene.
38 *
39 * Revision 1.6 2014/10/06 15:09:39 j_novak
40 * Modified #include directives to use c++ syntax.
41 *
42 * Revision 1.5 2006/09/25 10:01:45 p_grandclement
43 * Addition of N-dimensional Tbl
44 *
45 * Revision 1.4 2004/03/22 13:12:40 j_novak
46 * Modification of comments to use doxygen instead of doc++
47 *
48 * Revision 1.3 2002/10/16 14:36:28 j_novak
49 * Reorganization of #include instructions of standard C++, in order to
50 * use experimental version 3 of gcc.
51 *
52 * Revision 1.2 2002/06/17 14:05:16 j_novak
53 * friend functions are now also declared outside the class definition
54 *
55 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
56 * LORENE
57 *
58 * Revision 2.7 1999/11/23 12:16:24 eric
59 * Modif commentaires (dimension 0 autorisee).
60 *
61 * Revision 2.6 1999/10/01 10:17:10 eric
62 * Amelioration des commentaires.
63 *
64 * Revision 2.5 1999/09/30 12:49:09 eric
65 * Constructeur a 1 parametre rendu explicit.
66 * Amelioration des commentaires
67 *
68 * Revision 2.4 1999/09/24 14:22:36 eric
69 * Declaration de methodes const
70 * Amelioration commentaires.
71 *
72 * Revision 2.3 1999/09/22 11:38:59 eric
73 * *** empty log message ***
74 *
75 * Revision 2.2 1999/09/22 11:24:39 eric
76 * Amelioration commentaires
77 *
78 * Revision 2.1 1999/09/16 16:23:52 eric
79 * Doc++
80 *
81 * Revision 2.0 1999/02/15 10:41:51 hyc
82 * *** empty log message ***
83 *
84 * $Header: /cvsroot/Lorene/C++/Include/dim_tbl.h,v 1.7 2014/10/13 08:52:33 j_novak Exp $
85 *
86 */
87
88 #include <cstdio>
89
90 #include "headcpp.h"
91
92 namespace Lorene {
93 /**
94 * Storage of array dimensions.
95 * This class is designed for internal purposes related to the class
96 * \c Tbl}, namely the storage of the \c Tbl} dimensions.
97 * \ingroup (util)
98 */
99 class Dim_tbl {
100 public:
101 int ndim ; ///< Number of dimensions of the \c Tbl: can be 1, 2 or 3.
102 int* dim ; ///< Array of dimensions (size: \c ndim).
103
104 /**
105 * Total size of the array \c Tbl::t.
106 *
107 * \li \c taille = dim[0] if \c ndim = 1
108 * \li \c taille = dim[0]*dim[1] if \c ndim = 2
109 * \li \c taille = dim[0]*dim[1]*dim[2] if \c ndim = 3
110 *
111 */
112 int taille ;
113
114 public:
115 // Constructeurs
116 /**
117 * 1D constructor
118 * @param size0 [input] Number of elements of the array \c Tbl::t.
119 * Will be assigned to \c dim[0].
120 * The size 0 is allowed for the 1D constructor but
121 * not for the 2D or 3D ones.
122 */
123 explicit Dim_tbl(int size0) ;
124
125 /**
126 * 2D constructor
127 * @param size1 [input] Defines the range [0, size1-1] of the outermost
128 * index in the storage of
129 * the array \c Tbl::t.
130 * Will be assigned to \c dim[1].
131 * @param size0 [input] Defines the range [0, size0-1] of the
132 * innermost index
133 * in the storage of
134 * the array \c Tbl::t.
135 * Will be assigned to \c dim[0].
136 */
137 Dim_tbl(int size1, int size0) ;
138
139 /**
140 * 3D constructor
141 * @param size2 [input] Defines the range [0, size2-1] of the
142 * outermost index in the storage of
143 * the array \c Tbl::t.
144 * Will be assigned to \c dim[2].
145 * @param size1 [input] Defines the range [0, size1-1] of the
146 * intermediate index in the storage of
147 * the array \c Tbl::t.
148 * Will be assigned to \c dim[1].
149 * @param size0 [input] Defines the range [0, size0-1] of the
150 * innermost index in the storage of
151 * the array \c Tbl::t.
152 * Will be assigned to \c dim[0].
153 */
154 Dim_tbl(int size2, int size1, int size0) ;
155
156 /**
157 * N_dimensional constructor
158 * @param n [input] number of dimensions.
159 * @param sizes [input] array of the dimensions.
160 */
161 Dim_tbl(int n, int* sizes) ;
162
163 Dim_tbl(const Dim_tbl & ) ; ///< Copy constructor
164
165 /// Constructor from a file (see \c sauve(FILE*) )
166 explicit Dim_tbl(FILE* ) ;
167
168 ~Dim_tbl() ; ///< Destructor
169
170 void operator=(const Dim_tbl &) ; ///< Assignment
171
172 void sauve(FILE* ) const ; ///< Save in a file
173
174 bool operator==(const Dim_tbl &) const ; ///< Comparison operator
175
176 friend ostream& operator<<(ostream& , const Dim_tbl &) ; ///< Display
177
178 };
179 ostream& operator<<(ostream& , const Dim_tbl &) ;
180
181 }
182 #endif