Xdmf.i 4.47 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
19
20
21
22
23
	#include <XdmfItem.hpp>
	#include <XdmfItemProperty.hpp>
	#include <XdmfObject.hpp>
	#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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%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))
	{
		boost::shared_ptr<XdmfDomain> * newDomain = new boost::shared_ptr<XdmfDomain>(domain);
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(newDomain), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
	}
	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);
	}
70
71
72
73
	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);
	}
74
75
76
77
	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);
	}
78
79
80
81
	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);
	}
82
83
84
85
86
87
88
89
90
91
	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);
	}
}

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

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