Xdmf.i 4.54 KB
Newer Older
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
1 2 3 4 5
/*
XdmfPython.cpp:
swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
*/

6 7
%module Xdmf
%{
8
	// XdmfCore Includes
9
	#include <XdmfArray.hpp>
10
	#include <XdmfArrayType.hpp>
11 12 13 14 15
	#include <XdmfCoreItemFactory.hpp>
	#include <XdmfCoreReader.hpp>
	#include <XdmfDataItem.hpp>
	#include <XdmfHDF5Controller.hpp>
	#include <XdmfHDF5Writer.hpp>
16
	#include <XdmfInformation.hpp>
17 18
	#include <XdmfItem.hpp>
	#include <XdmfItemProperty.hpp>
19
	#include <XdmfSystemUtils.hpp>
20 21 22 23
	#include <XdmfVisitor.hpp>
	#include <XdmfWriter.hpp>

	// Xdmf Includes
24 25 26 27 28 29 30
	#include <XdmfAttribute.hpp>
	#include <XdmfAttributeCenter.hpp>
	#include <XdmfAttributeType.hpp>
	#include <XdmfDomain.hpp>
	#include <XdmfGeometry.hpp>
	#include <XdmfGeometryType.hpp>
	#include <XdmfGrid.hpp>
31 32
	#include <XdmfGridCollection.hpp>
	#include <XdmfGridCollectionType.hpp>
33
	#include <XdmfItemFactory.hpp>
34
	#include <XdmfReader.hpp>
35 36
	#include <XdmfSet.hpp>
	#include <XdmfSetType.hpp>
37
	#include <XdmfTime.hpp>
38 39 40
	#include <XdmfTopology.hpp>
	#include <XdmfTopologyType.hpp>
%}
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
41

42 43 44 45 46
%import XdmfCore.i

%pythoncode {
	from XdmfCore import *
}
47

48 49 50 51 52 53 54
%typemap(out) boost::shared_ptr<XdmfItem> {
	if(boost::shared_ptr<XdmfAttribute> attribute = boost::shared_dynamic_cast<XdmfAttribute>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_boost__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN);
	}
	else if(boost::shared_ptr<XdmfDomain> domain = boost::shared_dynamic_cast<XdmfDomain>($1))
	{
55
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
56 57 58 59 60 61 62 63 64 65 66 67 68
	}
	else if(boost::shared_ptr<XdmfGeometry> geometry = boost::shared_dynamic_cast<XdmfGeometry>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN);
	}
	else if(boost::shared_ptr<XdmfGrid> grid = boost::shared_dynamic_cast<XdmfGrid>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGrid>(grid)), SWIGTYPE_p_boost__shared_ptrT_XdmfGrid_t, SWIG_POINTER_OWN);
	}
	else if(boost::shared_ptr<XdmfGridCollection> gridCollection = boost::shared_dynamic_cast<XdmfGridCollection>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN);
	}
69 70 71 72
	else if(boost::shared_ptr<XdmfInformation> information = boost::shared_dynamic_cast<XdmfInformation>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_boost__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN);
	}
73 74 75 76
	else if(boost::shared_ptr<XdmfSet> set = boost::shared_dynamic_cast<XdmfSet>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfSet>(set)), SWIGTYPE_p_boost__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN);
	}
77 78 79 80
	else if(boost::shared_ptr<XdmfTime> time = boost::shared_dynamic_cast<XdmfTime>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfTime>(time)), SWIGTYPE_p_boost__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN);
	}
81 82 83 84 85 86 87 88 89 90
	else if(boost::shared_ptr<XdmfTopology> topology = boost::shared_dynamic_cast<XdmfTopology>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN);
	}
	else
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfItem>($1)), SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN);
	}
}

91 92 93 94 95 96
%include std_set.i
%template(std_set_uint) std::set<unsigned int>;

// Abstract Base Classes
%template() Loki::Visitor<XdmfSet>;

97
// Shared Pointer Templates
98
%shared_ptr(XdmfAttribute)
99 100
%shared_ptr(XdmfAttributeCenter)
%shared_ptr(XdmfAttributeType)
101 102
%shared_ptr(XdmfDomain)
%shared_ptr(XdmfGeometry)
103
%shared_ptr(XdmfGeometryType)
104 105
%shared_ptr(XdmfGrid)
%shared_ptr(XdmfGridCollection)
106 107
%shared_ptr(XdmfGridCollectionType)
%shared_ptr(XdmfItemFactory)
108 109 110
%shared_ptr(XdmfReader)
%shared_ptr(XdmfSet)
%shared_ptr(XdmfSetType)
111
%shared_ptr(XdmfTime)
112
%shared_ptr(XdmfTopology)
113
%shared_ptr(XdmfTopologyType)
114

115
%include XdmfAttribute.hpp
116
%include XdmfAttributeCenter.hpp
117
%include XdmfAttributeType.hpp
Kenneth Leiter's avatar
Kenneth Leiter committed
118
%include XdmfDomain.hpp
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
119
%include XdmfGeometry.hpp
120
%include XdmfGeometryType.hpp
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
121
%include XdmfGrid.hpp
122 123 124 125
%include XdmfGridCollection.hpp
%include XdmfGridCollectionType.hpp
%include XdmfItemFactory.hpp
%include XdmfReader.hpp
126 127
%include XdmfSet.hpp
%include XdmfSetType.hpp
128
%include XdmfTime.hpp
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
129
%include XdmfTopology.hpp
130
%include XdmfTopologyType.hpp