XdmfTopologyType.hpp 7.33 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 : XdmfTopologyType.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 26
#ifndef XDMFTOPOLOGYTYPE_HPP_
#define XDMFTOPOLOGYTYPE_HPP_

27
// Includes
28
#include "Xdmf.hpp"
29
#include "XdmfItemProperty.hpp"
Kenneth Leiter's avatar
Kenneth Leiter committed
30

31
/**
32 33
 * @brief Property describing the types of elements stored in an
 * XdmfTopology.
34
 *
35 36 37 38
 * XdmfTopologyType is a property used by XdmfTopology to specify the
 * element types stored. A specific XdmfTopologyType can be created by
 * calling one of the static methods in the class,
 * i.e. XdmfTopologyType::Tetrahedron().
39 40
 *
 * Xdmf supports the following topology types:
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
 *   NoTopologyType
 *   Polyvertex - Unconnected Points
 *   Polyline - Line Segments
 *   Polygon - N Edge Polygon
 *   Triangle - 3 Edge Polygon
 *   Quadrilateral - 4 Edge Polygon
 *   Tetrahedron - 4 Triangular Faces
 *   Wedge - 4 Triangular Faces, Quadrilateral Base
 *   Hexahedron - 6 Quadrilateral Faces
 *   Edge_3 - 3 Node Quadratic Line
 *   Triangle_6 - 6 Node Quadratic Triangle
 *   Quadrilateral_8 - 8 Node Quadratic Quadrilateral
 *   Quadrilateral_9 - 9 Node Bi-Quadratic Quadrilateral
 *   Tetrahedron_10 - 10 Node Quadratic Tetrahedron
 *   Pyramid_13 - 13 Node Quadratic Pyramid
 *   Wedge_15 - 15 Node Quadratic Wedge
 *   Wedge_18 - 18 Node Bi-Quadratic Wedge
 *   Hexahedron_20 - 20 Node Quadratic Hexahedron
 *   Hexahedron_24 - 24 Node Bi-Quadratic Hexahedron
 *   Hexahedron_27 - 27 Node Tri-Quadratic Hexahedron
 *   Hexahedron_64 - 64 Node Tri-Cubic Hexahedron
 *   Hexahedron_64_GLL - 64 Node Spectral Tri-Cubic Hexahedron with Gauss-Lobatto-Legendre points.
 *   Hexahedron_125 - 125 Node Tri-Quartic Hexahedron
 *   Hexahedron_125_GLL - 125 Node Spectral Tri-Quartic Hexahedron with Gauss-Lobatto-Legendre points.
 *   Mixed - Mixture of Unstructured Topologies
66
 */
67
class XDMF_EXPORT XdmfTopologyType : public XdmfItemProperty {
68

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
 public:

  virtual ~XdmfTopologyType();

  friend class XdmfTopology;

  enum CellType {
    NoCellType,
    Linear,
    Quadratic,
    Cubic,
    Quartic,
    Arbitrary,
    Structured
  };

85 86 87
  /**
   * Supported Xdmf Topology Types
   */
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
  static boost::shared_ptr<const XdmfTopologyType> NoTopologyType();
  static boost::shared_ptr<const XdmfTopologyType> Polyvertex();
  static boost::shared_ptr<const XdmfTopologyType> Polyline();
  static boost::shared_ptr<const XdmfTopologyType>
    Polygon(const unsigned int nodesPerElement);
  static boost::shared_ptr<const XdmfTopologyType> Triangle();
  static boost::shared_ptr<const XdmfTopologyType> Quadrilateral();
  static boost::shared_ptr<const XdmfTopologyType> Tetrahedron();
  static boost::shared_ptr<const XdmfTopologyType> Pyramid();
  static boost::shared_ptr<const XdmfTopologyType> Wedge();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron();
  static boost::shared_ptr<const XdmfTopologyType> Edge_3();
  static boost::shared_ptr<const XdmfTopologyType> Triangle_6();
  static boost::shared_ptr<const XdmfTopologyType> Quadrilateral_8();
  static boost::shared_ptr<const XdmfTopologyType> Quadrilateral_9();
  static boost::shared_ptr<const XdmfTopologyType> Tetrahedron_10();
  static boost::shared_ptr<const XdmfTopologyType> Pyramid_13();
  static boost::shared_ptr<const XdmfTopologyType> Wedge_15();
  static boost::shared_ptr<const XdmfTopologyType> Wedge_18();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron_20();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron_24();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron_27();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron_64();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron_64_GLL();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron_125();
  static boost::shared_ptr<const XdmfTopologyType> Hexahedron_125_GLL();
  static boost::shared_ptr<const XdmfTopologyType> Mixed();

116 117 118 119 120 121 122 123 124 125
  /**
   * Get a topology type from id.
   *
   * @param id of the topology type.
   *
   * @return topology type corresponding to id - if no topology type is found
   * an NULL pointer is returned.
   */
  static boost::shared_ptr<const XdmfTopologyType> New(const unsigned int id);

126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
  /**
   * Get the cell type associated with this topology type.
   *
   * @return a CellType containing the cell type.
   */
  CellType getCellType() const;

  /**
   * Get the id of this cell type, necessary in order to create grids
   * containing mixed cells.
   *
   * @return the ID of the topology type.
   */
  virtual unsigned int getID() const;

  /**
   * Get the name of this topology type.
   *
   * @return the name of this topology type.
   */
  virtual std::string getName() const;

  /**
149 150
   * Get the number of nodes per element associated with this topology
   * type.
151 152 153 154 155 156 157 158 159 160 161
   *
   * @return an unsigned int containing number of nodes per element.
   */
  virtual unsigned int getNodesPerElement() const;

  void
  getProperties(std::map<std::string, std::string> & collectedProperties) const;

 protected:

  /**
162 163 164 165
   * Protected constructor for XdmfTopologyType. The constructor is
   * protected because all topology types supported by Xdmf should be
   * accessed through more specific static methods that construct
   * XdmfTopologyType - i.e. XdmfTopologyType::Tetrahedron()
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
   */
  XdmfTopologyType(const unsigned int nodesPerElement,
                   const std::string & name,
                   const CellType cellType,
                   const unsigned int id);

 private:

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

  static boost::shared_ptr<const XdmfTopologyType>
  New(const std::map<std::string, std::string> & itemProperties);

  const CellType mCellType;
  const unsigned int mID;
  const std::string mName;
  const unsigned int mNodesPerElement;
184

185 186 187
};

#endif /* XDMFTOPOLOGYTYPE_HPP_ */