XdmfUnstructuredGrid.hpp 7.64 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 : XdmfUnstructuredGrid.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 XDMFUNSTRUCTUREDGRID_HPP_
#define XDMFUNSTRUCTUREDGRID_HPP_
26

27
// C Compatible Includes
28
#include "Xdmf.hpp"
29
#include "XdmfGrid.hpp"
30 31 32 33 34 35
#include "XdmfRegularGrid.hpp"

#ifdef __cplusplus

// Forward Declarations
class XdmfRegularGrid;
36 37

/**
38 39
 * @brief An unstructured grid that consists of elements, points, and
 * fields attached to the mesh.
40
 *
41 42 43 44
 * After creating an unstructured grid, the XdmfGeometry and
 * XdmfTopology must be set. The XdmfTopology describes the element
 * types contained in the grid and their connectivity. The
 * XdmfGeometry describes the positions of nodes.
45
 */
46
class XDMF_EXPORT XdmfUnstructuredGrid : public XdmfGrid {
47

48
public:
49

50
  /**
51
   * Create a new XdmfUnstructuredGrid.
52
   *
53 54 55 56
   * Example of use:
   *
   * C++
   *
57
   * @dontinclude ExampleXdmfUnstructuredGrid.cpp
58 59
   * @skipline //#initialization
   * @until //#initialization
60 61 62
   *
   * Python
   *
63
   * @dontinclude XdmfExampleUnstructuredGrid.py
64 65
   * @skipline #//initialization
   * @until #//initialization
66
   *
67
   * @return    Constructed XdmfUnstructuredGrid.
68
   */
69
  static shared_ptr<XdmfUnstructuredGrid> New();
70

71 72 73
  /**
   * Create a new XdmfUnstructuredGrid from a XdmfRegularGrid.
   *
74 75 76 77
   * Example of use:
   *
   * C++
   *
78
   * @dontinclude ExampleXdmfUnstructuredGrid.cpp
79 80
   * @skipline //#initializationregular
   * @until //#initializationregular
81 82 83
   *
   * Python
   *
84
   * @dontinclude XdmfExampleUnstructuredGrid.py
85 86
   * @skipline #//initializationregular
   * @until #//initializationregular
87
   *
88
   * @param     regularGrid     The grid that the unstructured grid will be created from
89
   *
90
   * @return                    Constructed XdmfUnstructuredGrid.
91 92 93 94
   */
  static shared_ptr<XdmfUnstructuredGrid> 
  New(const shared_ptr<XdmfRegularGrid> regularGrid);

95
  virtual ~XdmfUnstructuredGrid();
96

97
  static const std::string ItemTag;
98

99 100 101
  /**
   * Get the geometry associated with this grid.
   *
102 103 104 105
   * Example of use:
   *
   * C++
   *
106
   * @dontinclude ExampleXdmfUnstructuredGrid.cpp
107 108 109 110 111 112
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setGeometry
   * @until //#setGeometry
   * @skipline //#getGeometry
   * @until //#getGeometry
113 114 115
   *
   * Python
   *
116
   * @dontinclude XdmfExampleUnstructuredGrid.py
117 118 119 120 121 122
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setGeometry
   * @until #//setGeometry
   * @skipline #//getGeometry
   * @until #//getGeometry
123
   *
124
   * @return    The geometry associated with this grid.
125
   */
126
  shared_ptr<XdmfGeometry> getGeometry();
127
  using XdmfGrid::getGeometry;
128

129
  virtual std::string getItemTag() const;
130

131 132 133
  /**
   * Get the topology associated with this grid.
   *
134 135 136 137
   * Example of use:
   *
   * C++
   *
138
   * @dontinclude ExampleXdmfUnstructuredGrid.cpp
139 140 141 142 143 144
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setTopology
   * @until //#setTopology
   * @skipline //#getTopology
   * @until //#getTopology
145 146 147
   *
   * Python
   *
148
   * @dontinclude XdmfExampleUnstructuredGrid.py
149 150 151 152 153 154
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setTopology
   * @until #//setTopology
   * @skipline #//getTopology
   * @until #//getTopology
155
   *
156
   * @return    The topology associated with this grid.
157
   */
158
  shared_ptr<XdmfTopology> getTopology();
159
  using XdmfGrid::getTopology;
160

161 162 163 164
  virtual void read();

  virtual void release();

165 166 167
  /**
   * Set the geometry associated with this grid.
   *
168 169 170 171
   * Example of use:
   *
   * C++
   *
172
   * @dontinclude ExampleXdmfUnstructuredGrid.cpp
173 174 175 176
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setGeometry
   * @until //#setGeometry
177 178 179
   *
   * Python
   *
180
   * @dontinclude XdmfExampleUnstructuredGrid.py
181 182 183 184
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setGeometry
   * @until #//setGeometry
185
   *
186
   * @param     geometry        An XdmfGeometry to associate with this grid.
187
   */
188
  void setGeometry(const shared_ptr<XdmfGeometry> geometry);
189

190 191 192
  /**
   * Set the topology associated with this grid.
   *
193 194 195 196
   * Example of use:
   *
   * C++
   *
197
   * @dontinclude ExampleXdmfUnstructuredGrid.cpp
198 199 200 201
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setTopology
   * @until //#setTopology
202 203 204
   *
   * Python
   *
205
   * @dontinclude XdmfExampleUnstructuredGrid.py
206 207 208 209
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setTopology
   * @until #//setTopology
210
   *
211
   * @param     topology        An XdmfTopology to associate with this grid.
212
   */
213
  void setTopology(const shared_ptr<XdmfTopology> topology);
214

215 216
  XdmfUnstructuredGrid(XdmfUnstructuredGrid &);

217
protected:
218

219
  XdmfUnstructuredGrid();
220
  XdmfUnstructuredGrid(const shared_ptr<XdmfRegularGrid> regularGrid);
221

222 223 224
  virtual void
  copyGrid(shared_ptr<XdmfGrid> sourceGrid);

225
private:
226

227 228 229 230 231
  /**
   * PIMPL
   */
  class XdmfUnstructuredGridImpl;

232 233
  XdmfUnstructuredGrid(const XdmfUnstructuredGrid &);  // Not implemented.
  void operator=(const XdmfUnstructuredGrid &);  // Not implemented.
234 235 236

};

237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
#endif

#ifdef __cplusplus
extern "C" {
#endif

// C wrappers go here

struct XDMFUNSTRUCTUREDGRID; // Simply as a typedef to ensure correct typing
typedef struct XDMFUNSTRUCTUREDGRID XDMFUNSTRUCTUREDGRID;

XDMF_EXPORT XDMFUNSTRUCTUREDGRID * XdmfUnstructuredGridNew();

XDMF_EXPORT XDMFUNSTRUCTUREDGRID * XdmfUnstructuredGridNewFromRegularGrid(XDMFREGULARGRID * regularGrid, int * status);

XDMF_EXPORT XDMFGEOMETRY * XdmfUnstructuredGridGetGeometry(XDMFUNSTRUCTUREDGRID * grid);

XDMF_EXPORT XDMFTOPOLOGY * XdmfUnstructuredGridGetTopology(XDMFUNSTRUCTUREDGRID * grid);

XDMF_EXPORT void XdmfUnstructuredGridSetGeometry(XDMFUNSTRUCTUREDGRID * grid, XDMFGEOMETRY * geometry, int passControl);

XDMF_EXPORT void XdmfUnstructuredGridSetTopology(XDMFUNSTRUCTUREDGRID * grid, XDMFTOPOLOGY * topology, int passControl);

XDMF_ITEM_C_CHILD_DECLARE(XdmfUnstructuredGrid, XDMFUNSTRUCTUREDGRID, XDMF)
XDMF_GRID_C_CHILD_DECLARE(XdmfUnstructuredGrid, XDMFUNSTRUCTUREDGRID, XDMF)

#ifdef __cplusplus
}
#endif

267
#endif /* XDMFUNSTRUCTUREDGRID_HPP_ */