Commit d51c5f3e authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

ENH: Add graphs to Xdmf.

Graphs are stored in compressed sparse row format (XdmfSparseMatrix).
Added ability to partition graphs in XdmfPartitioner.
Added tests for new sparse matrix and graph classes.
parent 0cb8d449
...@@ -211,6 +211,7 @@ if(NOT XDMF_BUILD_CORE_ONLY) ...@@ -211,6 +211,7 @@ if(NOT XDMF_BUILD_CORE_ONLY)
XdmfDomain XdmfDomain
XdmfGeometry XdmfGeometry
XdmfGeometryType XdmfGeometryType
XdmfGraph
XdmfGrid XdmfGrid
XdmfGridCollection XdmfGridCollection
XdmfGridCollectionType XdmfGridCollectionType
......
...@@ -25,6 +25,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -25,6 +25,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
#include <XdmfItem.hpp> #include <XdmfItem.hpp>
#include <XdmfItemProperty.hpp> #include <XdmfItemProperty.hpp>
#include <XdmfSharedPtr.hpp> #include <XdmfSharedPtr.hpp>
#include <XdmfSparseMatrix.hpp>
#include <XdmfSystemUtils.hpp> #include <XdmfSystemUtils.hpp>
#include <XdmfVisitor.hpp> #include <XdmfVisitor.hpp>
#include <XdmfWriter.hpp> #include <XdmfWriter.hpp>
...@@ -37,6 +38,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -37,6 +38,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
#include <XdmfDomain.hpp> #include <XdmfDomain.hpp>
#include <XdmfGeometry.hpp> #include <XdmfGeometry.hpp>
#include <XdmfGeometryType.hpp> #include <XdmfGeometryType.hpp>
#include <XdmfGraph.hpp>
#include <XdmfGrid.hpp> #include <XdmfGrid.hpp>
#include <XdmfGridCollection.hpp> #include <XdmfGridCollection.hpp>
#include <XdmfGridCollectionType.hpp> #include <XdmfGridCollectionType.hpp>
...@@ -139,6 +141,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -139,6 +141,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
%ignore XdmfCurvilinearGrid::ItemTag; %ignore XdmfCurvilinearGrid::ItemTag;
%ignore XdmfDomain::ItemTag; %ignore XdmfDomain::ItemTag;
%ignore XdmfGeometry::ItemTag; %ignore XdmfGeometry::ItemTag;
%ignore XdmfGraph::ItemTag;
%ignore XdmfGrid::ItemTag; %ignore XdmfGrid::ItemTag;
%ignore XdmfGridCollection::ItemTag; %ignore XdmfGridCollection::ItemTag;
%ignore XdmfMap::ItemTag; %ignore XdmfMap::ItemTag;
...@@ -190,6 +193,9 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -190,6 +193,9 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
else if(shared_ptr<XdmfGeometry> geometry = shared_dynamic_cast<XdmfGeometry>($1)) { else if(shared_ptr<XdmfGeometry> geometry = shared_dynamic_cast<XdmfGeometry>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfGraph> graph = shared_dynamic_cast<XdmfGraph>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGraph>(graph)), SWIGTYPE_p_boost__shared_ptrT_XdmfGraph_t, SWIG_POINTER_OWN);
}
else if(shared_ptr<XdmfGridCollection> gridCollection = shared_dynamic_cast<XdmfGridCollection>($1)) { else if(shared_ptr<XdmfGridCollection> gridCollection = shared_dynamic_cast<XdmfGridCollection>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN);
} }
...@@ -268,6 +274,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -268,6 +274,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
%shared_ptr(XdmfDomain) %shared_ptr(XdmfDomain)
%shared_ptr(XdmfGeometry) %shared_ptr(XdmfGeometry)
%shared_ptr(XdmfGeometryType) %shared_ptr(XdmfGeometryType)
%shared_ptr(XdmfGraph)
%shared_ptr(XdmfGrid) %shared_ptr(XdmfGrid)
%shared_ptr(XdmfGridCollection) %shared_ptr(XdmfGridCollection)
%shared_ptr(XdmfGridCollectionType) %shared_ptr(XdmfGridCollectionType)
...@@ -293,6 +300,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -293,6 +300,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
%include XdmfDomain.hpp %include XdmfDomain.hpp
%include XdmfGeometry.hpp %include XdmfGeometry.hpp
%include XdmfGeometryType.hpp %include XdmfGeometryType.hpp
%include XdmfGraph.hpp
%include XdmfGridCollection.hpp %include XdmfGridCollection.hpp
%include XdmfGridCollectionType.hpp %include XdmfGridCollectionType.hpp
%include XdmfItemFactory.hpp %include XdmfItemFactory.hpp
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "XdmfDomain.hpp" #include "XdmfDomain.hpp"
#include "XdmfCurvilinearGrid.hpp" #include "XdmfCurvilinearGrid.hpp"
#include "XdmfGraph.hpp"
#include "XdmfGridCollection.hpp" #include "XdmfGridCollection.hpp"
#include "XdmfRectilinearGrid.hpp" #include "XdmfRectilinearGrid.hpp"
#include "XdmfRegularGrid.hpp" #include "XdmfRegularGrid.hpp"
...@@ -36,6 +37,10 @@ XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain, ...@@ -36,6 +37,10 @@ XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
XdmfCurvilinearGrid, XdmfCurvilinearGrid,
CurvilinearGrid, CurvilinearGrid,
Name) Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
XdmfGraph,
Graph,
Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain, XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
XdmfRectilinearGrid, XdmfRectilinearGrid,
RectilinearGrid, RectilinearGrid,
...@@ -85,7 +90,7 @@ XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperti ...@@ -85,7 +90,7 @@ XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperti
const XdmfCoreReader * const reader) const XdmfCoreReader * const reader)
{ {
XdmfItem::populateItem(itemProperties, childItems, reader); XdmfItem::populateItem(itemProperties, childItems, reader);
for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter = for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter =
childItems.begin(); childItems.begin();
iter != childItems.end(); iter != childItems.end();
++iter) { ++iter) {
...@@ -97,6 +102,10 @@ XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperti ...@@ -97,6 +102,10 @@ XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperti
shared_dynamic_cast<XdmfCurvilinearGrid>(*iter)) { shared_dynamic_cast<XdmfCurvilinearGrid>(*iter)) {
this->insert(grid); this->insert(grid);
} }
else if(shared_ptr<XdmfGraph> graph =
shared_dynamic_cast<XdmfGraph>(*iter)) {
this->insert(graph);
}
else if(shared_ptr<XdmfRectilinearGrid> grid = else if(shared_ptr<XdmfRectilinearGrid> grid =
shared_dynamic_cast<XdmfRectilinearGrid>(*iter)) { shared_dynamic_cast<XdmfRectilinearGrid>(*iter)) {
this->insert(grid); this->insert(grid);
...@@ -116,31 +125,37 @@ void ...@@ -116,31 +125,37 @@ void
XdmfDomain::traverse(const shared_ptr<XdmfBaseVisitor> visitor) XdmfDomain::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
{ {
XdmfItem::traverse(visitor); XdmfItem::traverse(visitor);
for(std::vector<shared_ptr<XdmfGridCollection> >::const_iterator iter = for(std::vector<shared_ptr<XdmfGridCollection> >::const_iterator iter =
mGridCollections.begin(); mGridCollections.begin();
iter != mGridCollections.end(); iter != mGridCollections.end();
++iter) { ++iter) {
(*iter)->accept(visitor); (*iter)->accept(visitor);
} }
for(std::vector<shared_ptr<XdmfCurvilinearGrid> >::const_iterator iter = for(std::vector<shared_ptr<XdmfCurvilinearGrid> >::const_iterator iter =
mCurvilinearGrids.begin(); mCurvilinearGrids.begin();
iter != mCurvilinearGrids.end(); iter != mCurvilinearGrids.end();
++iter) { ++iter) {
(*iter)->accept(visitor); (*iter)->accept(visitor);
} }
for(std::vector<shared_ptr<XdmfRectilinearGrid> >::const_iterator iter = for(std::vector<shared_ptr<XdmfGraph> >::const_iterator iter =
mGraphs.begin();
iter != mGraphs.end();
++iter) {
(*iter)->accept(visitor);
}
for(std::vector<shared_ptr<XdmfRectilinearGrid> >::const_iterator iter =
mRectilinearGrids.begin(); mRectilinearGrids.begin();
iter != mRectilinearGrids.end(); iter != mRectilinearGrids.end();
++iter) { ++iter) {
(*iter)->accept(visitor); (*iter)->accept(visitor);
} }
for(std::vector<shared_ptr<XdmfRegularGrid> >::const_iterator iter = for(std::vector<shared_ptr<XdmfRegularGrid> >::const_iterator iter =
mRegularGrids.begin(); mRegularGrids.begin();
iter != mRegularGrids.end(); iter != mRegularGrids.end();
++iter) { ++iter) {
(*iter)->accept(visitor); (*iter)->accept(visitor);
} }
for(std::vector<shared_ptr<XdmfUnstructuredGrid> >::const_iterator iter = for(std::vector<shared_ptr<XdmfUnstructuredGrid> >::const_iterator iter =
mUnstructuredGrids.begin(); mUnstructuredGrids.begin();
iter != mUnstructuredGrids.end(); iter != mUnstructuredGrids.end();
++iter) { ++iter) {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
// Forward Declarations // Forward Declarations
class XdmfCurvilinearGrid; class XdmfCurvilinearGrid;
class XdmfGraph;
class XdmfGridCollection; class XdmfGridCollection;
class XdmfRectilinearGrid; class XdmfRectilinearGrid;
class XdmfRegularGrid; class XdmfRegularGrid;
...@@ -56,8 +57,9 @@ public: ...@@ -56,8 +57,9 @@ public:
virtual ~XdmfDomain(); virtual ~XdmfDomain();
LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem); LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem);
XDMF_CHILDREN(XdmfGridCollection, GridCollection, Name);
XDMF_CHILDREN(XdmfCurvilinearGrid, CurvilinearGrid, Name); XDMF_CHILDREN(XdmfCurvilinearGrid, CurvilinearGrid, Name);
XDMF_CHILDREN(XdmfGraph, Graph, Name);
XDMF_CHILDREN(XdmfGridCollection, GridCollection, Name);
XDMF_CHILDREN(XdmfRectilinearGrid, RectilinearGrid, Name); XDMF_CHILDREN(XdmfRectilinearGrid, RectilinearGrid, Name);
XDMF_CHILDREN(XdmfRegularGrid, RegularGrid, Name); XDMF_CHILDREN(XdmfRegularGrid, RegularGrid, Name);
XDMF_CHILDREN(XdmfUnstructuredGrid, UnstructuredGrid, Name); XDMF_CHILDREN(XdmfUnstructuredGrid, UnstructuredGrid, Name);
......
/*****************************************************************************/
/* XDMF */
/* eXtensible Data Model and Format */
/* */
/* Id : XdmfGraph.cpp */
/* */
/* 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. */
/* */
/*****************************************************************************/
#include "XdmfAttribute.hpp"
#include "XdmfGraph.hpp"
XDMF_CHILDREN_IMPLEMENTATION(XdmfGraph, XdmfAttribute, Attribute, Name)
shared_ptr<XdmfGraph>
XdmfGraph::New(const unsigned int numberNodes)
{
shared_ptr<XdmfGraph> p(new XdmfGraph(numberNodes));
return p;
}
XdmfGraph::XdmfGraph(const unsigned int numberNodes) :
XdmfSparseMatrix(numberNodes,
numberNodes)
{
}
XdmfGraph::~XdmfGraph()
{
}
const std::string XdmfGraph::ItemTag = "Graph";
std::string
XdmfGraph::getItemTag() const
{
return ItemTag;
}
unsigned int
XdmfGraph::getNumberNodes() const
{
return this->getNumberRows();
}
void
XdmfGraph::populateItem(const std::map<std::string, std::string> & itemProperties,
const std::vector<shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader)
{
XdmfSparseMatrix::populateItem(itemProperties,
childItems,
reader);
for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter =
childItems.begin();
iter != childItems.end();
++iter) {
if(shared_ptr<XdmfAttribute> attribute =
shared_dynamic_cast<XdmfAttribute>(*iter)) {
this->insert(attribute);
}
}
}
void
XdmfGraph::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfSparseMatrix::traverse(visitor);
for(std::vector<shared_ptr<XdmfAttribute> >::const_iterator iter =
mAttributes.begin();
iter != mAttributes.end();
++iter) {
(*iter)->accept(visitor);
}
}
/*****************************************************************************/
/* 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.
*
* @param numberNodes number of nodes in graph.
*
* @return constructed XdmfGraph.
*/
static shared_ptr<XdmfGraph> New(const unsigned int numberNodes);
virtual ~XdmfGraph();
LOKI_DEFINE_VISITABLE(XdmfGraph, XdmfSparseMatrix);
XDMF_CHILDREN(XdmfAttribute, Attribute, Name);
static const std::string ItemTag;
std::string getItemTag() const;
unsigned int getNumberNodes() const;
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_ */
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "XdmfDomain.hpp" #include "XdmfDomain.hpp"
#include "XdmfGeometry.hpp" #include "XdmfGeometry.hpp"
#include "XdmfGeometryType.hpp" #include "XdmfGeometryType.hpp"
#include "XdmfGraph.hpp"
#include "XdmfGridCollection.hpp" #include "XdmfGridCollection.hpp"
#include "XdmfInformation.hpp" #include "XdmfInformation.hpp"
#include "XdmfItemFactory.hpp" #include "XdmfItemFactory.hpp"
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
#include "XdmfRectilinearGrid.hpp" #include "XdmfRectilinearGrid.hpp"
#include "XdmfRegularGrid.hpp" #include "XdmfRegularGrid.hpp"
#include "XdmfSet.hpp" #include "XdmfSet.hpp"
#include "XdmfSparseMatrix.hpp"
#include "XdmfTime.hpp" #include "XdmfTime.hpp"
#include "XdmfTopology.hpp" #include "XdmfTopology.hpp"
#include "XdmfUnstructuredGrid.hpp" #include "XdmfUnstructuredGrid.hpp"
...@@ -124,6 +126,9 @@ XdmfItemFactory::createItem(const std::string & itemTag, ...@@ -124,6 +126,9 @@ XdmfItemFactory::createItem(const std::string & itemTag,
} }
return XdmfGeometry::New(); return XdmfGeometry::New();
} }
else if(itemTag.compare(XdmfGraph::ItemTag) == 0) {
return XdmfGraph::New(0);
}
else if(itemTag.compare(XdmfGrid::ItemTag) == 0) { else if(itemTag.compare(XdmfGrid::ItemTag) == 0) {
// For backwards compatibility with the old format, this tag can // For backwards compatibility with the old format, this tag can
// correspond to multiple XdmfItems. // correspond to multiple XdmfItems.
...@@ -165,6 +170,9 @@ XdmfItemFactory::createItem(const std::string & itemTag, ...@@ -165,6 +170,9 @@ XdmfItemFactory::createItem(const std::string & itemTag,
else if(itemTag.compare(XdmfSet::ItemTag) == 0) { else if(itemTag.compare(XdmfSet::ItemTag) == 0) {
return XdmfSet::New(); return XdmfSet::New();
} }
else if(itemTag.compare(XdmfSparseMatrix::ItemTag) == 0) {
return XdmfSparseMatrix::New(0, 0);
}
else if(itemTag.compare(XdmfTime::ItemTag) == 0) { else if(itemTag.compare(XdmfTime::ItemTag) == 0) {
return XdmfTime::New(); return XdmfTime::New();
} }
......
...@@ -79,6 +79,7 @@ set(XdmfCoreSources ...@@ -79,6 +79,7 @@ set(XdmfCoreSources
XdmfInformation XdmfInformation
XdmfItem XdmfItem
XdmfItemProperty XdmfItemProperty
XdmfSparseMatrix
XdmfSystemUtils XdmfSystemUtils
${CMAKE_BINARY_DIR}/XdmfVersion ${CMAKE_BINARY_DIR}/XdmfVersion
XdmfVisitor XdmfVisitor
......
...@@ -183,6 +183,8 @@ public: ...@@ -183,6 +183,8 @@ public:
/** /**
* Get a copy of a single value stored in this array. * Get a copy of a single value stored in this array.
* *
* @param index the index in the array to copy.
*
* @return the requested value. * @return the requested value.
*/ */
template <typename T> template <typename T>
...@@ -323,7 +325,7 @@ public: ...@@ -323,7 +325,7 @@ public:
template<typename T> template<typename T>
void insert(const unsigned int startIndex, void insert(const unsigned int startIndex,
const T * const valuesPointer, const T * const valuesPointer,
const unsigned int numValues = 1, const unsigned int numValues,
const unsigned int arrayStride = 1, const unsigned int arrayStride = 1,
const unsigned int valuesStride = 1); const unsigned int valuesStride = 1);
...@@ -538,7 +540,7 @@ private: ...@@ -538,7 +540,7 @@ private:
boost::shared_array<const double>, boost::shared_array<const double>,
boost::shared_array<const unsigned char>, boost::shared_array<const unsigned char>,
boost::shared_array<const unsigned short>, boost::shared_array<const unsigned short>,
boost::shared_array<const unsigned int> > ArrayVariant; boost::shared_array<const unsigned int> > ArrayVariant;
ArrayVariant mArray; ArrayVariant mArray;
unsigned int mArrayPointerNumValues; unsigned int mArrayPointerNumValues;
......
...@@ -23,6 +23,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i ...@@ -23,6 +23,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
#include <XdmfItem.hpp> #include <XdmfItem.hpp>
#include <XdmfItemProperty.hpp> #include <XdmfItemProperty.hpp>
#include <XdmfSharedPtr.hpp> #include <XdmfSharedPtr.hpp>
#include <XdmfSparseMatrix.hpp>
#include <XdmfSystemUtils.hpp> #include <XdmfSystemUtils.hpp>
#include <XdmfVersion.hpp> #include <XdmfVersion.hpp>
#include <XdmfVisitor.hpp> #include <XdmfVisitor.hpp>
...@@ -45,6 +46,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i ...@@ -45,6 +46,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
// Ignore ItemTags // Ignore ItemTags
%ignore XdmfArray::ItemTag; %ignore XdmfArray::ItemTag;
%ignore XdmfInformation::ItemTag; %ignore XdmfInformation::ItemTag;
%ignore XdmfSparseMatrix::ItemTag;
// Define equality operators // Define equality operators
%extend XdmfItem { %extend XdmfItem {
...@@ -296,6 +298,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i ...@@ -296,6 +298,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
%shared_ptr(XdmfInformation) %shared_ptr(XdmfInformation)
%shared_ptr(XdmfItem) %shared_ptr(XdmfItem)
%shared_ptr(XdmfItemProperty) %shared_ptr(XdmfItemProperty)
%shared_ptr(XdmfSparseMatrix)
%shared_ptr(XdmfVisitor) %shared_ptr(XdmfVisitor)
%shared_ptr(XdmfWriter) %shared_ptr(XdmfWriter)
...@@ -317,6 +320,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i ...@@ -317,6 +320,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
%include XdmfInformation.hpp %include XdmfInformation.hpp
%include XdmfHDF5Controller.hpp %include XdmfHDF5Controller.hpp
%include XdmfHDF5Writer.hpp %include XdmfHDF5Writer.hpp
%include XdmfSparseMatrix.hpp
%include XdmfWriter.hpp %include XdmfWriter.hpp
%include CMake/VersionSuite/ProjectVersion.hpp %include CMake/VersionSuite/ProjectVersion.hpp
...@@ -395,4 +399,3 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i ...@@ -395,4 +399,3 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
%template(UIntVector) std::vector<unsigned int>; %template(UIntVector) std::vector<unsigned int>;
%template(ItemVector) std::vector<boost::shared_ptr<XdmfItem> >; %template(ItemVector) std::vector<boost::shared_ptr<XdmfItem> >;
/*****************************************************************************/
/* XDMF */
/* eXtensible Data Model and Format */
/* */
/* Id : XdmfSparseMatrix.cpp */
/* */
/* 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. */
/* */
/*****************************************************************************/
#include <iostream>
#include <sstream>
#include "XdmfSparseMatrix.hpp"
#include "XdmfError.hpp"
shared_ptr<XdmfSparseMatrix>
XdmfSparseMatrix::New(const unsigned int numberRows,
const unsigned int numberColumns)
{
shared_ptr<XdmfSparseMatrix> p(new XdmfSparseMatrix(numberRows,
numberColumns));
return p;
}
XdmfSparseMatrix::XdmfSparseMatrix(const unsigned int numberRows,
const unsigned int numberColumns) :
mColumnIndex(XdmfArray::New()),
mName(""),