XdmfCurvilinearGrid.hpp 8.94 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfCurvilinearGrid.hpp                                             */
/*                                                                           */
/*  Author:                                                                  */
/*     Kenneth Leiter                                                        */
/*     kenneth.leiter@arl.army.mil                                           */
/*     US Army Research Laboratory                                           */
/*     Aberdeen Proving Ground, MD                                           */
/*                                                                           */
/*     Copyright @ 2011 US Army Research Laboratory                          */
/*     All Rights Reserved                                                   */
/*     See Copyright.txt for details                                         */
/*                                                                           */
/*     This software is distributed WITHOUT ANY WARRANTY; without            */
/*     even the implied warranty of MERCHANTABILITY or FITNESS               */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice             */
/*     for more information.                                                 */
/*                                                                           */
/*****************************************************************************/

24 25
#ifndef XDMFCURVILINEARGRID_HPP_
#define XDMFCURVILINEARGRID_HPP_
26

27 28 29
// Forward Declarations
class XdmfArray;

30
// Includes
31
#include "Xdmf.hpp"
32 33 34
#include "XdmfGrid.hpp"

/**
35 36
 * @brief A curvilinear (or structured) grid consisting of cells and
 * points arranged on a regular lattice in space.
37
 *
38 39
 * XdmfCurvilinearGrid represents a mesh of cells and points arranged
 * with regular topology and irregular geometry.
40
 *
41 42
 * In order to define a curvilinear grid, the dimensions of the grid
 * must be supplied along with the coordinates of each point.
43 44
 *
 */
45
class XDMF_EXPORT XdmfCurvilinearGrid : public XdmfGrid {
46

47
public:
48 49 50 51

  /**
   * Create a new curvilinear grid (Two dimensional).
   *
52 53 54 55
   * Example of use:
   *
   * C++
   *
56
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
57 58
   * @skipline //#initializationdim2
   * @until //#initializationdim2
59 60 61
   *
   * Python
   *
62
   * @dontinclude XdmfExampleCurvilinearGrid.py
63 64 65 66
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//constructor2
   * @until #//constructor2
67
   *
68 69
   * @param     xNumPoints      The number of points in the x direction.
   * @param     yNumPoints      The number of points in the y direction.
70
   *
71
   * @return                    Constructed curvilinear grid.
72
   */
73
  static shared_ptr<XdmfCurvilinearGrid>
74 75 76 77 78 79
  New(const unsigned int xNumPoints,
      const unsigned int yNumPoints);

  /**
   * Create a new curvilinear grid (Three dimensional).
   *
80 81 82 83
   * Example of use:
   *
   * C++
   *
84
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
85 86
   * @skipline //#initializationdim3
   * @until //#initializationdim3
87 88 89
   *
   * Python
   *
90
   * @dontinclude XdmfExampleCurvilinearGrid.py
91 92 93 94
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//constructor3
   * @until #//constructor3
95
   *
96 97 98
   * @param     xNumPoints      The number of points in the x direction.
   * @param     yNumPoints      The number of points in the y direction.
   * @param     zNumPoints      The number of points in the z direction.
99
   *
100
   * @return                    Constructed curvilinear grid.
101
   */
102
  static shared_ptr<XdmfCurvilinearGrid>
103 104 105 106 107 108 109
  New(const unsigned int xNumPoints,
      const unsigned int yNumPoints,
      const unsigned int zNumPoints);

  /**
   * Create a new curvilinear grid (N dimensional).
   *
110 111 112 113
   * Example of use:
   *
   * C++
   *
114
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
115 116
   * @skipline //#initializationvector
   * @until //#initializationvector
117 118 119
   *
   * Python
   *
120
   * @dontinclude XdmfExampleCurvilinearGrid.py
121 122 123 124
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//constructorvector
   * @until #//constructorvector
125
   *
126
   * @param     numPoints       The number of points in each direction.
127
   *
128
   * @return                    Constructed curvilinear grid.
129
   */
130 131
  static shared_ptr<XdmfCurvilinearGrid>
  New(const shared_ptr<XdmfArray> numPoints);
132 133 134 135 136 137 138

  virtual ~XdmfCurvilinearGrid();

  LOKI_DEFINE_VISITABLE(XdmfCurvilinearGrid, XdmfGrid);
  static const std::string ItemTag;

  /**
139 140
   * Get the dimensions of the grid, the number of points in each
   * direction.
141
   *
142 143 144 145
   * Example of use:
   *
   * C++
   *
146
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
147 148 149 150 151 152
   * @skipline //#initializationdim3
   * @until //#initializationdim3
   * @skipline //#setDimensions
   * @until //#setDimensions
   * @skipline //#getDimensions
   * @until //#getDimensions
153 154 155
   *
   * Python
   *
156
   * @dontinclude XdmfExampleCurvilinearGrid.py
157 158 159 160 161 162 163 164
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//constructorvector
   * @until #//constructorvector
   * @skipline #//setDimensions
   * @until #//setDimensions
   * @skipline #//getDimensions
   * @until #//getDimensions
165
   *
166
   * @return    XdmfArray containing dimensions of this grid.
167
   */
168
  shared_ptr<XdmfArray> getDimensions();
169 170

  /**
171 172
   * Get the dimensions of the grid, the number of points in each
   * direction (const version).
173
   *
174 175 176 177
   * Example of use:
   *
   * C++
   *
178
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
179 180 181 182 183 184
   * @skipline //#initializationdim3
   * @until //#initializationdim3
   * @skipline //#setDimensions
   * @until //#setDimensions
   * @skipline //#getDimensionsconst
   * @until //#getDimensionsconst
185 186 187
   *
   * Python: Python doesn't have a constant version
   *
188
   * @return    XdmfArray containing the dimensions of this grid.
189
   */
190
  shared_ptr<const XdmfArray> getDimensions() const;
191 192 193 194

  /**
   * Get the geometry associated with this grid.
   *
195 196 197 198
   * Example of use:
   *
   * C++
   *
199
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
200 201 202 203 204 205
   * @skipline //#initializationdim3
   * @until //#initializationdim3
   * @skipline //#setGeometry
   * @until //#setGeometry
   * @skipline //#getGeometry
   * @until //#getGeometry
206 207 208
   *
   * Python
   *
209
   * @dontinclude XdmfExampleCurvilinearGrid.py
210 211 212 213 214 215 216 217
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//constructorvector
   * @until #//constructorvector
   * @skipline #//setGeometry
   * @until #//setGeometry
   * @skipline #//getGeometry
   * @until #//getGeometry
218
   *
219
   * @return    The geometry associated with this grid.
220
   */
221
  shared_ptr<XdmfGeometry> getGeometry();
222 223

  /**
224 225
   * Set the dimensions of the grid, the number of points in each
   * direction.
226
   *
227 228 229 230
   * Example of use:
   *
   * C++
   *
231
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
232 233 234 235
   * @skipline //#initializationdim3
   * @until //#initializationdim3
   * @skipline //#setDimensions
   * @until //#setDimensions
236 237 238
   *
   * Python
   *
239
   * @dontinclude XdmfExampleCurvilinearGrid.py
240 241 242 243 244 245
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//constructorvector
   * @until #//constructorvector
   * @skipline #//setDimensions
   * @until #//setDimensions
246
   *
247
   * @param     dimensions      The dimension of the grid.
248
   */
249
  void setDimensions(const shared_ptr<XdmfArray> dimensions);
250 251 252 253

  /**
   * Set the geometry associated with this grid.
   *
254 255 256 257
   * Example of use:
   *
   * C++
   *
258
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
259 260 261 262
   * @skipline //#initializationdim3
   * @until //#initializationdim3
   * @skipline //#setGeometry
   * @until //#setGeometry
263 264 265
   *
   * Python
   *
266
   * @dontinclude XdmfExampleCurvilinearGrid.py
267 268 269 270 271 272
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//constructorvector
   * @until #//constructorvector
   * @skipline #//setGeometry
   * @until #//setGeometry
273
   *
274
   * @param     geometry        An XdmfGeometry to associate with this grid.
275
   */
276
  void setGeometry(const shared_ptr<XdmfGeometry> geometry);
277

278
protected:
279

280
  XdmfCurvilinearGrid(const shared_ptr<XdmfArray> numPoints);
281 282 283

  void
  populateItem(const std::map<std::string, std::string> & itemProperties,
284
               const std::vector<shared_ptr<XdmfItem> > & childItems,
285 286
               const XdmfCoreReader * const reader);

287
private:
288 289 290 291 292 293 294 295 296 297

  /**
   * PIMPL
   */
  class XdmfCurvilinearGridImpl;

  XdmfCurvilinearGrid(const XdmfCurvilinearGrid &);  // Not implemented.
  void operator=(const XdmfCurvilinearGrid &);  // Not implemented.

  XdmfCurvilinearGridImpl * mImpl;
298 299 300

};

301
#ifdef _WIN32
302
XDMF_TEMPLATE template class XDMF_EXPORT
303
shared_ptr<XdmfGeometry>;
304
XDMF_TEMPLATE template class XDMF_EXPORT
305
shared_ptr<XdmfArray>;
306
XDMF_TEMPLATE template class XDMF_EXPORT
307
shared_ptr<const XdmfArray>;
308 309
#endif

310
#endif /* XDMFCURVILINEARGRID_HPP_ */