XdmfTopology.hpp 5.77 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
class XDMF_EXPORT XdmfTopology : public XdmfArray {
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
56

57
public:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
58

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

80
  virtual ~XdmfTopology();
81

82
  LOKI_DEFINE_VISITABLE(XdmfTopology, XdmfArray)
83
  static const std::string ItemTag;
84

85
  std::map<std::string, std::string> getItemProperties() const;
86

87
  std::string getItemTag() const;
88

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

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

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

168
protected:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
169

170
  XdmfTopology();
171

172 173
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
174
               const std::vector<shared_ptr<XdmfItem> > & childItems,
175
               const XdmfCoreReader * const reader);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
176

177
private:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
178

179 180 181
  XdmfTopology(const XdmfTopology &);  // Not implemented.
  void operator=(const XdmfTopology &);  // Not implemented.

182
  shared_ptr<const XdmfTopologyType> mType;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
183 184
};

185
#ifdef _WIN32
186
XDMF_TEMPLATE template class XDMF_EXPORT
187
shared_ptr<const XdmfTopologyType>;
188 189
#endif

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
190
#endif /* XDMFTOPOLOGY_HPP_ */