Xdmf.i 11.2 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
16
17
18
#ifdef XDMF_BUILD_DSM
	#include <XdmfHDF5ControllerDSM.hpp>
	#include <XdmfHDF5WriterDSM.hpp>
#endif
19
20
	#include <XdmfHeavyDataController.hpp>
	#include <XdmfHeavyDataWriter.hpp>
21
	#include <XdmfInformation.hpp>
22
23
	#include <XdmfItem.hpp>
	#include <XdmfItemProperty.hpp>
24
	#include <XdmfSystemUtils.hpp>
25
26
27
28
	#include <XdmfVisitor.hpp>
	#include <XdmfWriter.hpp>

	// Xdmf Includes
29
30
31
32
33
34
35
	#include <XdmfAttribute.hpp>
	#include <XdmfAttributeCenter.hpp>
	#include <XdmfAttributeType.hpp>
	#include <XdmfDomain.hpp>
	#include <XdmfGeometry.hpp>
	#include <XdmfGeometryType.hpp>
	#include <XdmfGrid.hpp>
36
37
	#include <XdmfGridCollection.hpp>
	#include <XdmfGridCollectionType.hpp>
38
	#include <XdmfGridCurvilinear.hpp>
39
40
	#include <XdmfGridRectilinear.hpp>
	#include <XdmfGridRegular.hpp>
41
	#include <XdmfGridUnstructured.hpp>
42
	#include <XdmfItemFactory.hpp>
43
	#include <XdmfMap.hpp>
44
	#include <XdmfReader.hpp>
45
46
	#include <XdmfSet.hpp>
	#include <XdmfSetType.hpp>
47
	#include <XdmfTime.hpp>
48
49
50
	#include <XdmfTopology.hpp>
	#include <XdmfTopologyType.hpp>
%}
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
51

52
53
%import XdmfCore.i

54
55
#ifdef SWIGJAVA

56
// Typemaps that work for Java
57

58
59
%typemap(out)  boost::shared_ptr<XdmfItem> {
	if(boost::shared_ptr<XdmfAttribute> value = boost::shared_dynamic_cast<XdmfAttribute>($1))
60
	{
61
		*(boost::shared_ptr< XdmfAttribute > **)&($result) = value ? new boost::shared_ptr< XdmfAttribute >(value) : 0;
62
	}
63
	else if(boost::shared_ptr<XdmfDomain> value = boost::shared_dynamic_cast<XdmfDomain>($1))
64
	{
65
		*(boost::shared_ptr< XdmfDomain > **)&($result) = value ? new boost::shared_ptr< XdmfDomain >(value) : 0;
66
	}
67
	else if(boost::shared_ptr<XdmfGeometry> value = boost::shared_dynamic_cast<XdmfGeometry>($1))
68
	{
69
		*(boost::shared_ptr< XdmfGeometry > **)&($result) = value ? new boost::shared_ptr< XdmfGeometry >(value) : 0;
70
	}
71
	else if(boost::shared_ptr<XdmfGridCollection> value = boost::shared_dynamic_cast<XdmfGridCollection>($1))
72
	{
73
		*(boost::shared_ptr< XdmfGridCollection > **)&($result) = value ? new boost::shared_ptr< XdmfGridCollection >(value) : 0;
74
	}
75
76
77
78
	else if(boost::shared_ptr<XdmfGridCurvilinear> value = boost::shared_dynamic_cast<XdmfGridCurvilinear>($1))
	{
		*(boost::shared_ptr< XdmfGridCurvilinear > **)&($result) = value ? new boost::shared_ptr< XdmfGridCurvilinear >(value) : 0;
	}
79
	else if(boost::shared_ptr<XdmfGridRectilinear> value = boost::shared_dynamic_cast<XdmfGridRectilinear>($1))
80
	{
81
		*(boost::shared_ptr< XdmfGridRectilinear > **)&($result) = value ? new boost::shared_ptr< XdmfGridRectilinear >(value) : 0;
82
	}
83
	else if(boost::shared_ptr<XdmfGridRegular> value = boost::shared_dynamic_cast<XdmfGridRegular>($1))
84
	{
85
		*(boost::shared_ptr< XdmfGridRegular > **)&($result) = value ? new boost::shared_ptr< XdmfGridRegular >(value) : 0;
86
	}
87
88
89
90
	else if(boost::shared_ptr<XdmfGridUnstructured> value = boost::shared_dynamic_cast<XdmfGridUnstructured>($1))
	{
		*(boost::shared_ptr< XdmfGridUnstructured > **)&($result) = value ? new boost::shared_ptr< XdmfGridUnstructured >(value) : 0;
	}
91
	else if(boost::shared_ptr<XdmfInformation> value = boost::shared_dynamic_cast<XdmfInformation>($1))
92
	{
93
		*(boost::shared_ptr< XdmfInformation > **)&($result) = value ? new boost::shared_ptr< XdmfInformation >(value) : 0;
94
	}
95
	else if(boost::shared_ptr<XdmfSet> value = boost::shared_dynamic_cast<XdmfSet>($1))
96
	{
97
		*(boost::shared_ptr< XdmfSet > **)&($result) = value ? new boost::shared_ptr< XdmfSet >(value) : 0;
98
	}
99
	else if(boost::shared_ptr<XdmfTime> value = boost::shared_dynamic_cast<XdmfTime>($1))
100
	{
101
102
103
104
105
		*(boost::shared_ptr< XdmfTime > **)&($result) = value ? new boost::shared_ptr< XdmfTime >(value) : 0;
	}
	else if(boost::shared_ptr<XdmfTopology> value = boost::shared_dynamic_cast<XdmfTopology>($1))
	{
		*(boost::shared_ptr< XdmfTopology > **)&($result) = value ? new boost::shared_ptr< XdmfTopology >(value) : 0;
106
107
108
	}
	else
	{
109
		*(boost::shared_ptr< XdmfItem > **)&($result) = &($1);
110
111
	}
}
112

113
114
115
// Ignore const overloaded methods
%ignore XdmfDomain::getGridCollection(const unsigned int) const;
%ignore XdmfDomain::getGridCollection(const std::string &) const;
116
117
118
119
120
121
122
123
%ignore XdmfDomain::getGridCurvilinear(const unsigned int) const;
%ignore XdmfDomain::getGridCurvilinear(const std::string &) const;
%ignore XdmfDomain::getGridRectilinear(const unsigned int) const;
%ignore XdmfDomain::getGridRectilinear(const std::string &) const;
%ignore XdmfDomain::getGridRegular(const unsigned int) const;
%ignore XdmfDomain::getGridRegular(const std::string &) const;
%ignore XdmfDomain::getGridUnstructured(const unsigned int) const;
%ignore XdmfDomain::getGridUnstructured(const std::string &) const;
124
125
126
127
128
129
%ignore XdmfGrid::getAttribute(const unsigned int) const;
%ignore XdmfGrid::getAttribute(const std::string &) const;
%ignore XdmfGrid::getMap() const;
%ignore XdmfGrid::getSet(const unsigned int) const;
%ignore XdmfGrid::getSet(const std::string &) const;
%ignore XdmfGrid::getTime() const;
130
%ignore XdmfGridCurvilinear::getDimensions() const;
131
132
133
134
135
136
137
138
139
140
%ignore XdmfGridRectilinear::getCoordinates(const unsigned int) const;
%ignore XdmfGridRectilinear::getCoordinates() const;
%ignore XdmfGridRectilinear::getDimensions() const;
%ignore XdmfGridRegular::getBrickSize() const;
%ignore XdmfGridRegular::getDimensions() const;
%ignore XdmfGridRegular::getOrigin() const;
%ignore XdmfSet::getAttribute(const unsigned int) const;
%ignore XdmfSet::getAttribute(const std::string &) const;

// Ignore ItemTags
141
142
143
144
145
%ignore XdmfAttribute::ItemTag;
%ignore XdmfDomain::ItemTag;
%ignore XdmfGeometry::ItemTag;
%ignore XdmfGrid::ItemTag;
%ignore XdmfGridCollection::ItemTag;
146
%ignore XdmfGridCurvilinear::ItemTag;
147
148
149
%ignore XdmfGridRegular::ItemTag;
%ignore XdmfGridRectilinear::ItemTag;
%ignore XdmfMap::ItemTag;
150
151
152
153
154
%ignore XdmfSet::ItemTag;
%ignore XdmfTime::ItemTag;
%ignore XdmfTopology::ItemTag;

%pragma(java) jniclasscode=%{
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	static
	{
		try
		{
			System.loadLibrary("XdmfCoreJava");
		}
		catch (UnsatisfiedLinkError e)
		{
			System.err.println("Native code library failed to load for XdmfCoreJava\n" + e);
			System.exit(1);
		}
		try
		{
			System.loadLibrary("XdmfJava");
		}
		catch (UnsatisfiedLinkError e)
		{
			System.err.println("Native code library failed to load for XdmfJava\n" + e);
			System.exit(1);
		}
	}
176
177
%}

178
#endif */ SWIGJAVA */
179

180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#ifdef SWIGPYTHON

%pythoncode {
	from XdmfCore import *
}

%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))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfDomain>(domain)), 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<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);
	}
203
204
205
206
	else if(boost::shared_ptr<XdmfGridCurvilinear> gridCurvilinear = boost::shared_dynamic_cast<XdmfGridCurvilinear>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGridCurvilinear>(gridCurvilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCurvilinear_t, SWIG_POINTER_OWN);
	}
207
208
209
210
211
212
213
214
	else if(boost::shared_ptr<XdmfGridRectilinear> gridRectilinear = boost::shared_dynamic_cast<XdmfGridRectilinear>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGridRectilinear>(gridRectilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridRectilinear_t, SWIG_POINTER_OWN);
	}
	else if(boost::shared_ptr<XdmfGridRegular> gridRegular = boost::shared_dynamic_cast<XdmfGridRegular>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGridRegular>(gridRegular)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridRegular_t, SWIG_POINTER_OWN);
	}
215
216
217
218
	else if(boost::shared_ptr<XdmfGridUnstructured> gridUnstructured = boost::shared_dynamic_cast<XdmfGridUnstructured>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGridUnstructured>(gridUnstructured)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridUnstructured_t, SWIG_POINTER_OWN);
	}
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
	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);
	}
	else if(boost::shared_ptr<XdmfMap> map = boost::shared_dynamic_cast<XdmfMap>($1))
	{
		$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfMap>(map)), SWIGTYPE_p_boost__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN);
	}
	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);
	}
	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);
	}
	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);
	}
}

#endif /* SWIGPYTHON */

247
// Shared Pointer Templates
248
%shared_ptr(XdmfAttribute)
249
250
%shared_ptr(XdmfAttributeCenter)
%shared_ptr(XdmfAttributeType)
251
252
%shared_ptr(XdmfDomain)
%shared_ptr(XdmfGeometry)
253
%shared_ptr(XdmfGeometryType)
254
255
%shared_ptr(XdmfGrid)
%shared_ptr(XdmfGridCollection)
256
%shared_ptr(XdmfGridCollectionType)
257
%shared_ptr(XdmfGridCurvilinear)
258
259
%shared_ptr(XdmfGridRectilinear)
%shared_ptr(XdmfGridRegular)
260
%shared_ptr(XdmfGridUnstructured)
261
%shared_ptr(XdmfItemFactory)
262
%shared_ptr(XdmfMap)
263
264
265
%shared_ptr(XdmfReader)
%shared_ptr(XdmfSet)
%shared_ptr(XdmfSetType)
266
%shared_ptr(XdmfTime)
267
%shared_ptr(XdmfTopology)
268
%shared_ptr(XdmfTopologyType)
269

270
%include XdmfAttribute.hpp
271
%include XdmfAttributeCenter.hpp
272
%include XdmfAttributeType.hpp
Kenneth Leiter's avatar
Kenneth Leiter committed
273
%include XdmfDomain.hpp
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
274
%include XdmfGeometry.hpp
275
%include XdmfGeometryType.hpp
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
276
%include XdmfGrid.hpp
277
278
%include XdmfGridCollection.hpp
%include XdmfGridCollectionType.hpp
279
%include XdmfGridCurvilinear.hpp
280
281
%include XdmfGridRectilinear.hpp
%include XdmfGridRegular.hpp
282
%include XdmfGridUnstructured.hpp
283
%include XdmfItemFactory.hpp
284
%include XdmfMap.hpp
285
%include XdmfReader.hpp
286
287
%include XdmfSet.hpp
%include XdmfSetType.hpp
288
%include XdmfTime.hpp
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
289
%include XdmfTopology.hpp
290
%include XdmfTopologyType.hpp