XdmfCurvilinearGrid.hpp 5.27 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 52 53 54 55 56

  /**
   * Create a new curvilinear grid (Two dimensional).
   *
   * @param xNumPoints the number of points in the x direction.
   * @param yNumPoints the number of points in the y direction.
   *
   * @return constructed curvilinear grid.
   */
57
  static shared_ptr<XdmfCurvilinearGrid>
58 59 60 61 62 63 64 65
  New(const unsigned int xNumPoints,
      const unsigned int yNumPoints);

  /**
   * Create a new curvilinear grid (Three dimensional).
   *
   * @param xNumPoints the number of points in the x direction.
   * @param yNumPoints the number of points in the y direction.
66
   * @param zNumPoints the number of points in the z direction.
67 68 69
   *
   * @return constructed curvilinear grid.
   */
70
  static shared_ptr<XdmfCurvilinearGrid>
71 72 73 74 75 76 77 78 79 80 81
  New(const unsigned int xNumPoints,
      const unsigned int yNumPoints,
      const unsigned int zNumPoints);

  /**
   * Create a new curvilinear grid (N dimensional).
   *
   * @param numPoints the number of points in each direction.
   *
   * @return constructed curvilinear grid.
   */
82 83
  static shared_ptr<XdmfCurvilinearGrid>
  New(const shared_ptr<XdmfArray> numPoints);
84 85 86 87 88 89 90

  virtual ~XdmfCurvilinearGrid();

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

  /**
91 92
   * Get the dimensions of the grid, the number of points in each
   * direction.
93 94 95
   *
   * @return XdmfArray containing dimensions of this grid.
   */
96
  shared_ptr<XdmfArray> getDimensions();
97 98

  /**
99 100
   * Get the dimensions of the grid, the number of points in each
   * direction (const version).
101 102 103
   *
   * @return XdmfArray containing the dimensions of this grid.
   */
104
  shared_ptr<const XdmfArray> getDimensions() const;
105 106 107 108 109 110

  /**
   * Get the geometry associated with this grid.
   *
   * @return the geometry associated with this grid.
   */
111
  shared_ptr<XdmfGeometry> getGeometry();
112 113

  /**
114 115
   * Set the dimensions of the grid, the number of points in each
   * direction.
116 117 118
   *
   * @param dimensions the dimension of the grid.
   */
119
  void setDimensions(const shared_ptr<XdmfArray> dimensions);
120 121 122 123 124 125

  /**
   * Set the geometry associated with this grid.
   *
   * @param geometry an XdmfGeometry to associate with this grid.
   */
126
  void setGeometry(const shared_ptr<XdmfGeometry> geometry);
127

128
protected:
129

130
  XdmfCurvilinearGrid(const shared_ptr<XdmfArray> numPoints);
131 132 133

  void
  populateItem(const std::map<std::string, std::string> & itemProperties,
134
               const std::vector<shared_ptr<XdmfItem> > & childItems,
135 136
               const XdmfCoreReader * const reader);

137
private:
138 139 140 141 142 143 144 145 146 147

  /**
   * PIMPL
   */
  class XdmfCurvilinearGridImpl;

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

  XdmfCurvilinearGridImpl * mImpl;
148 149 150

};

151
#ifdef _WIN32
152
XDMF_TEMPLATE template class XDMF_EXPORT
153
shared_ptr<XdmfGeometry>;
154
XDMF_TEMPLATE template class XDMF_EXPORT
155
shared_ptr<XdmfArray>;
156
XDMF_TEMPLATE template class XDMF_EXPORT
157
shared_ptr<const XdmfArray>;
158 159
#endif

160
#endif /* XDMFCURVILINEARGRID_HPP_ */