XdmfTopology.hpp 5.76 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
   * @code {.cpp}
67
   * shared_ptr<XdmfTopology> exampleTopology = XdmfTopology::New();
68
   * @endcode
69 70 71
   *
   * Python
   *
72
   * @code {.py}
73
   * exampleTopology = XdmfTopology.New()
74
   * @endcode
75
   *
76 77
   * @return constructed XdmfTopology.
   */
78
  static shared_ptr<XdmfTopology> New();
79

80
  virtual ~XdmfTopology();
81

82 83
  LOKI_DEFINE_VISITABLE(XdmfTopology, XdmfArray);
  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
   * @code {.cpp}
97 98
   * //Assuming that exampleTopology is a shared pointer to an XdmfTopology object with values set
   * unsigned int numElements = exampleTopology->getNumberElements();
99
   * @endcode
100 101 102
   *
   * Python
   *
103
   * @code {.py}
104 105 106 107
   * '''
   * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with values set
   * '''
   * numElements = exampleTopology.getNumberElements()
108
   * @endcode
109
   *
110 111 112
   * @return int of number elements in the Topology.
   */
  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
   * @code {.cpp}
122 123
   * //Assuming that exampleTopology is a shared pointer to an XdmfTopology object with its type set
   * shared_ptr<const XdmfTopologyType> exampleType = exampleTopology->getType();
124
   * @endcode
125 126 127
   *
   * Python
   *
128
   * @code {.py}
129 130 131 132
   * '''
   * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with its type set
   * '''
   * exampleType = exampleTopology.getType()
133
   * @endcode
134
   *
135 136
   * @return XdmfTopologyType of the topology.
   */
137
  shared_ptr<const XdmfTopologyType> getType() const;
138

139 140 141
  /**
   * Set the XdmfTopologyType associated with this topology.
   *
142 143 144 145
   * Example of use:
   *
   * C++
   *
146
   * @code {.cpp}
147 148
   * shared_ptr<XdmfTopology> exampleTopology = XdmfTopology::New();
   * exampleTopology->setType(XdmfTopologyType::Pyramid());
149
   * @endcode
150 151 152
   *
   * Python
   *
153
   * @code {.py}
154 155
   * exampleTopology = XdmfTopology.New()
   * exampleTopology.setType(XdmfTopologyType.Pyramid())
156
   * @endcode
157
   *
158 159
   * @param type the XdmfTopologyType to set.
   */
160
  void setType(const shared_ptr<const XdmfTopologyType> type);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
161

162
protected:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
163

164
  XdmfTopology();
165

166 167
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
168
               const std::vector<shared_ptr<XdmfItem> > & childItems,
169
               const XdmfCoreReader * const reader);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
170

171
private:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
172

173 174 175
  XdmfTopology(const XdmfTopology &);  // Not implemented.
  void operator=(const XdmfTopology &);  // Not implemented.

176
  shared_ptr<const XdmfTopologyType> mType;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
177 178
};

179
#ifdef _WIN32
180
XDMF_TEMPLATE template class XDMF_EXPORT
181
shared_ptr<const XdmfTopologyType>;
182 183
#endif

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