Xdmf.i 4.51 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
	#include <XdmfCoreItemFactory.hpp>
	#include <XdmfCoreReader.hpp>
	#include <XdmfHDF5Controller.hpp>
	#include <XdmfHDF5Writer.hpp>
15
	#include <XdmfInformation.hpp>
16
17
	#include <XdmfItem.hpp>
	#include <XdmfItemProperty.hpp>
18
	#include <XdmfSystemUtils.hpp>
19
20
21
22
	#include <XdmfVisitor.hpp>
	#include <XdmfWriter.hpp>

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

41
42
43
44
45
%import XdmfCore.i

%pythoncode {
	from XdmfCore import *
}
46

47
48
49
50
51
52
53
%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))
	{
54
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
55
56
57
58
59
60
61
62
63
64
65
66
67
	}
	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);
	}
68
69
70
71
	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);
	}
72
73
74
75
	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);
	}
76
77
78
79
	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);
	}
80
81
82
83
84
85
86
87
88
89
	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);
	}
}

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

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

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

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