XdmfGraph.hpp 3.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfGraph.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.                                                 */
/*                                                                           */
/*****************************************************************************/

#ifndef XDMFGRAPH_HPP_
#define XDMFGRAPH_HPP_

// Forward Declarations
class XdmfAttribute;

// Includes
#include "Xdmf.hpp"
#include "XdmfSparseMatrix.hpp"

/**
 * @brief Graph stored in sparse matrix form.
 *
 * Stores graph information in sparse matrix form. Attributes defining
 * node and edge information can be inserted.
 */
class XDMF_EXPORT XdmfGraph : public XdmfSparseMatrix {

public:

  /**
   * Create a new XdmfGraph.
   *
47 48 49 50 51
   * Example of use:
   *
   * C++
   *
   * @dontinclude ExampleXdmfGraph.cpp
52 53
   * @skipline //#initialization
   * @until //#initialization
54 55 56 57
   *
   * Python
   *
   * @dontinclude XdmfExampleGraph.py
58 59
   * @skipline #//initialization
   * @until #//initialization
60
   *
61 62
   * @param numberNodes number of nodes in graph.
   *
63
   * @return	constructed XdmfGraph.
64 65 66 67 68 69
   */
  static shared_ptr<XdmfGraph> New(const unsigned int numberNodes);

  virtual ~XdmfGraph();

  LOKI_DEFINE_VISITABLE(XdmfGraph, XdmfSparseMatrix);
70
  XDMF_CHILDREN(XdmfGraph, XdmfAttribute, Attribute, Name);
71 72 73 74 75 76
  static const std::string ItemTag;

  std::string getItemTag() const;

  unsigned int getNumberNodes() const;

77 78
  using XdmfSparseMatrix::insert;

79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
  void traverse(const shared_ptr<XdmfBaseVisitor> visitor);

protected:

  XdmfGraph(const unsigned int numberNodes);

  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
               const std::vector<shared_ptr<XdmfItem> > & childItems,
               const XdmfCoreReader * const reader);

private:

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

#ifdef _WIN32
#endif

#endif /* XDMFGRAPH_HPP_ */