XdmfCurvilinearGrid.hpp 7.95 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 57 58
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
   * @skipline newPointsX
   * @until New
59 60 61
   *
   * Python
   *
62 63 64 65
   * @dontinclude XdmfExampleCurvilinearGrid.py
   * @skipline newPointsX
   * @until newPointsY
   * @skipline newPointsX
66
   *
67 68 69 70 71
   * @param xNumPoints the number of points in the x direction.
   * @param yNumPoints the number of points in the y direction.
   *
   * @return constructed curvilinear grid.
   */
72
  static shared_ptr<XdmfCurvilinearGrid>
73 74 75 76 77 78
  New(const unsigned int xNumPoints,
      const unsigned int yNumPoints);

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

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

  virtual ~XdmfCurvilinearGrid();

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

  /**
137 138
   * Get the dimensions of the grid, the number of points in each
   * direction.
139
   *
140 141 142 143
   * Example of use:
   *
   * C++
   *
144 145 146
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
   * Assuming that exampleGrid is a shared pointer to an XdmfCurvilinearGrid object
   * @skipline getDimensions
147 148 149
   *
   * Python
   *
150
   * @dontinclude XdmfExampleCurvilinearGrid.py
151
   * Assuming that exampleGrid is a shared pointer to an XdmfCurvilinearGrid object
152
   * @skipline getDimensions
153
   *
154 155
   * @return XdmfArray containing dimensions of this grid.
   */
156
  shared_ptr<XdmfArray> getDimensions();
157 158

  /**
159 160
   * Get the dimensions of the grid, the number of points in each
   * direction (const version).
161
   *
162 163 164 165
   * Example of use:
   *
   * C++
   *
166 167 168
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
   * Assuming that exampleGrid is a shared pointer to an XdmfCurvilinearGrid object
   * @skipline const
169 170 171
   *
   * Python: Python doesn't have a constant version
   *
172 173
   * @return XdmfArray containing the dimensions of this grid.
   */
174
  shared_ptr<const XdmfArray> getDimensions() const;
175 176 177 178

  /**
   * Get the geometry associated with this grid.
   *
179 180 181 182
   * Example of use:
   *
   * C++
   *
183 184 185
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
   * Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object
   * @skipline getGeometry
186 187 188
   *
   * Python
   *
189
   * @dontinclude XdmfExampleCurvilinearGrid.py
190
   * Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object
191
   * @skipline getGeometry
192
   *
193 194
   * @return the geometry associated with this grid.
   */
195
  shared_ptr<XdmfGeometry> getGeometry();
196 197

  /**
198 199
   * Set the dimensions of the grid, the number of points in each
   * direction.
200
   *
201 202 203 204
   * Example of use:
   *
   * C++
   *
205 206 207 208
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
   * @skipline XdmfArray::New
   * @until setDimensions
   * Assumng that exampleGrid is a shared pointer to an XdmfCurvilinearGrid object
209 210 211
   *
   * Python
   *
212 213 214 215
   * @dontinclude XdmfExampleCurvilinearGrid.py
   * @skip setDimensions
   * @skipline newPoints
   * @until setDimensions
216 217
   * Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object
   *
218 219
   * @param dimensions the dimension of the grid.
   */
220
  void setDimensions(const shared_ptr<XdmfArray> dimensions);
221 222 223 224

  /**
   * Set the geometry associated with this grid.
   *
225 226 227 228
   * Example of use:
   *
   * C++
   *
229 230 231
   * @dontinclude ExampleXdmfCurvilinearGrid.cpp
   * @skipline newData
   * @until setGeometry
232 233 234
   *
   * Python
   *
235 236 237 238
   * @dontinclude XdmfExampleCurvilinearGrid.py
   * @skip setGeometry
   * @skipline newPoints
   * @until insert
239
   * Assuming that exampleGrid is a sharedPointer to an XdmfCurvilinearGrid object
240
   * @skipline setGeometry
241
   *
242 243
   * @param geometry an XdmfGeometry to associate with this grid.
   */
244
  void setGeometry(const shared_ptr<XdmfGeometry> geometry);
245

246
protected:
247

248
  XdmfCurvilinearGrid(const shared_ptr<XdmfArray> numPoints);
249 250 251

  void
  populateItem(const std::map<std::string, std::string> & itemProperties,
252
               const std::vector<shared_ptr<XdmfItem> > & childItems,
253 254
               const XdmfCoreReader * const reader);

255
private:
256 257 258 259 260 261 262 263 264 265

  /**
   * PIMPL
   */
  class XdmfCurvilinearGridImpl;

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

  XdmfCurvilinearGridImpl * mImpl;
266 267 268

};

269
#ifdef _WIN32
270
XDMF_TEMPLATE template class XDMF_EXPORT
271
shared_ptr<XdmfGeometry>;
272
XDMF_TEMPLATE template class XDMF_EXPORT
273
shared_ptr<XdmfArray>;
274
XDMF_TEMPLATE template class XDMF_EXPORT
275
shared_ptr<const XdmfArray>;
276 277
#endif

278
#endif /* XDMFCURVILINEARGRID_HPP_ */