XdmfTopology.hpp 5.87 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 : XdmfTopology.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.                                                 */
/*                                                                           */
/*****************************************************************************/

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
24 25 26
#ifndef XDMFTOPOLOGY_HPP_
#define XDMFTOPOLOGY_HPP_

27 28 29
// Forward Declarations
class XdmfTopologyType;

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

34
/**
35
 * @brief Holds the connectivity information in an XdmfGrid.
36
 *
37 38 39 40
 * XdmfTopology is a required part of an XdmfGrid. It stores the
 * connectivity information for all points contained in an
 * XdmfGrid. XdmfTopology contains an XdmfTopologyType property which
 * should be set that specifies the element type stored.
41 42 43 44 45 46 47 48 49 50 51 52 53
 *
 * In the case of mixed topology types, the connectivity stores
 * topology type ids prior to each element's connectivity
 * information. For element types of varying sizes (Polyvertex,
 * Polyline, and Polygon), the topology type id is followed by a
 * number specifying the number of nodes in the element.  For example,
 * a tetrahedron element (id 6) followed by a polygon element (id 3)
 * with 5 points would look similar the following:
 *
 * 6 20 25 100 200 3 5 300 301 302 303 304
 *
 * The tetrahedron is composed of nodes 20, 25, 100, and 200. The
 * polygon is composed of nodes 300 to 304.
54 55 56 57
 *
 * Elements of type Polyhedron (i.e. N face cells, where each face is a M edge
 * polygon) are in the following format:
 * [nCellFaces, nFace0Pts, id0_0, id0_1, ..., nFace1Pts, id1_0, id1_1, ..., ...]
58
 */
59
class XDMF_EXPORT XdmfTopology : public XdmfArray {
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
60

61
public:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
62

63 64 65
  /**
   * Create a new XdmfTopology.
   *
66 67 68 69
   * Example of use:
   *
   * C++
   *
70
   * @dontinclude ExampleXdmfTopology.cpp
71 72
   * @skipline //#initialization
   * @until //#initialization
73 74 75
   *
   * Python
   *
76
   * @dontinclude XdmfExampleTopology.py
77 78
   * @skipline #//initialization
   * @until #//initialization
79
   *
80
   * @return    Constructed XdmfTopology.
81
   */
82
  static shared_ptr<XdmfTopology> New();
83

84
  virtual ~XdmfTopology();
85

86
  LOKI_DEFINE_VISITABLE(XdmfTopology, XdmfArray)
87
  static const std::string ItemTag;
88

89
  std::map<std::string, std::string> getItemProperties() const;
90

91
  std::string getItemTag() const;
92

93 94 95
  /**
   * Get the number of elements this Topology contains.
   *
96 97 98 99
   * Example of use:
   *
   * C++
   *
100
   * @dontinclude ExampleXdmfTopology.cpp
101 102 103 104
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#getNumberElements
   * @until //#getNumberElements
105 106 107
   *
   * Python
   *
108
   * @dontinclude XdmfExampleTopology.py
109 110 111 112
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//getNumberElements
   * @until #//getNumberElements
113
   *
114
   * @return    Int of number elements in the Topology.
115 116
   */
  virtual unsigned int getNumberElements() const;
117

118 119 120
  /**
   * Get the XdmfTopologyType associated with this topology.
   *
121 122 123 124
   * Example of use:
   *
   * C++
   *
125
   * @dontinclude ExampleXdmfTopology.cpp
126 127 128 129 130 131
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setType
   * @until //#setType
   * @skipline //#getType
   * @until //#getType
132 133 134
   *
   * Python
   *
135
   * @dontinclude XdmfExampleTopology.py
136 137 138 139 140 141
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setType
   * @until #//setType
   * @skipline #//getType
   * @until #//getType
142
   *
143
   * @return    XdmfTopologyType of the topology.
144
   */
145
  shared_ptr<const XdmfTopologyType> getType() const;
146

147 148 149
  /**
   * Set the XdmfTopologyType associated with this topology.
   *
150 151 152 153
   * Example of use:
   *
   * C++
   *
154
   * @dontinclude ExampleXdmfTopology.cpp
155 156 157 158
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setType
   * @until //#setType
159 160 161
   *
   * Python
   *
162
   * @dontinclude XdmfExampleTopology.py
163 164 165 166
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setType
   * @until #//setType
167
   *
168
   * @param     type    The XdmfTopologyType to set.
169
   */
170
  void setType(const shared_ptr<const XdmfTopologyType> type);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
171

172
protected:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
173

174
  XdmfTopology();
175

176 177
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
178
               const std::vector<shared_ptr<XdmfItem> > & childItems,
179
               const XdmfCoreReader * const reader);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
180

181
private:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
182

183 184 185
  XdmfTopology(const XdmfTopology &);  // Not implemented.
  void operator=(const XdmfTopology &);  // Not implemented.

186
  shared_ptr<const XdmfTopologyType> mType;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
187 188 189
};

#endif /* XDMFTOPOLOGY_HPP_ */