1 /*****************************************************************************/
2 /* XDMF */
3 /* eXtensible Data Model and Format */
4 /* */
5 /* Id : XdmfDomain.cpp */
6 /* */
7 /* Author: */
8 /* Kenneth Leiter */
9 /* kenneth.leiter@arl.army.mil */
10 /* US Army Research Laboratory */
11 /* Aberdeen Proving Ground, MD */
12 /* */
13 /* Copyright @ 2011 US Army Research Laboratory */
14 /* All Rights Reserved */
15 /* See Copyright.txt for details */
16 /* */
17 /* This software is distributed WITHOUT ANY WARRANTY; without */
18 /* even the implied warranty of MERCHANTABILITY or FITNESS */
19 /* FOR A PARTICULAR PURPOSE. See the above copyright notice */
20 /* for more information. */
21 /* */
22 /*****************************************************************************/
23
24 #include "XdmfDomain.hpp"
25 #include "XdmfCurvilinearGrid.hpp"
26 #include "XdmfGraph.hpp"
27 #include "XdmfGridCollection.hpp"
28 #include "XdmfRectilinearGrid.hpp"
29 #include "XdmfRegularGrid.hpp"
30 #include "XdmfUnstructuredGrid.hpp"
31
32 #ifdef XDMF_BUILD_DSM
33 #include "XdmfDSMBuffer.hpp"
34 #include "XdmfDSMDriver.hpp"
35 #include "XdmfDSMDescription.hpp"
36 #endif
37
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,XdmfGridCollection,GridCollection,Name)38 XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
39 XdmfGridCollection,
40 GridCollection,
41 Name)
42 XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
43 XdmfCurvilinearGrid,
44 CurvilinearGrid,
45 Name)
46 XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
47 XdmfGraph,
48 Graph,
49 Name)
50 XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
51 XdmfRectilinearGrid,
52 RectilinearGrid,
53 Name)
54 XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
55 XdmfRegularGrid,
56 RegularGrid,
57 Name)
58 XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
59 XdmfUnstructuredGrid,
60 UnstructuredGrid,
61 Name)
62
63 shared_ptr<XdmfDomain>
64 XdmfDomain::New()
65 {
66 shared_ptr<XdmfDomain> p(new XdmfDomain());
67 return p;
68 }
69
XdmfDomain()70 XdmfDomain::XdmfDomain()
71 {
72 }
73
XdmfDomain(XdmfDomain & refDomain)74 XdmfDomain::XdmfDomain(XdmfDomain & refDomain) :
75 XdmfItem(refDomain),
76 mGridCollections(refDomain.mGridCollections),
77 mGraphs(refDomain.mGraphs),
78 mCurvilinearGrids(refDomain.mCurvilinearGrids),
79 mRectilinearGrids(refDomain.mRectilinearGrids),
80 mRegularGrids(refDomain.mRegularGrids),
81 mUnstructuredGrids(refDomain.mUnstructuredGrids)
82 {
83 }
84
~XdmfDomain()85 XdmfDomain::~XdmfDomain()
86 {
87 }
88
89 const std::string XdmfDomain::ItemTag = "Domain";
90
91 std::map<std::string, std::string>
getItemProperties() const92 XdmfDomain::getItemProperties() const
93 {
94 std::map<std::string, std::string> domainProperties;
95 return domainProperties;
96 }
97
98 std::string
getItemTag() const99 XdmfDomain::getItemTag() const
100 {
101 return ItemTag;
102 }
103
104 void
populateItem(const std::map<std::string,std::string> & itemProperties,const std::vector<shared_ptr<XdmfItem>> & childItems,const XdmfCoreReader * const reader)105 XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperties,
106 const std::vector<shared_ptr<XdmfItem> > & childItems,
107 const XdmfCoreReader * const reader)
108 {
109 XdmfItem::populateItem(itemProperties, childItems, reader);
110 for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter =
111 childItems.begin();
112 iter != childItems.end();
113 ++iter) {
114 if(shared_ptr<XdmfGridCollection> gridCollection =
115 shared_dynamic_cast<XdmfGridCollection>(*iter)) {
116 this->insert(gridCollection);
117 }
118 else if(shared_ptr<XdmfCurvilinearGrid> grid =
119 shared_dynamic_cast<XdmfCurvilinearGrid>(*iter)) {
120 this->insert(grid);
121 }
122 else if(shared_ptr<XdmfGraph> graph =
123 shared_dynamic_cast<XdmfGraph>(*iter)) {
124 this->insert(graph);
125 }
126 else if(shared_ptr<XdmfRectilinearGrid> grid =
127 shared_dynamic_cast<XdmfRectilinearGrid>(*iter)) {
128 this->insert(grid);
129 }
130 else if(shared_ptr<XdmfRegularGrid> grid =
131 shared_dynamic_cast<XdmfRegularGrid>(*iter)) {
132 this->insert(grid);
133 }
134 else if(shared_ptr<XdmfUnstructuredGrid> grid =
135 shared_dynamic_cast<XdmfUnstructuredGrid>(*iter)) {
136 this->insert(grid);
137 }
138 }
139 }
140
141 void
traverse(const shared_ptr<XdmfBaseVisitor> visitor)142 XdmfDomain::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
143 {
144 #ifdef XDMF_BUILD_DSM
145 // Traverse Data Descriptions before anything
146 XdmfDSMBuffer * dsmBuffer = (XdmfDSMBuffer *)xdmf_dsm_get_manager();
147
148 if (dsmBuffer)
149 {
150 shared_ptr<XdmfDSMDescription> dsmDescription;
151 dsmDescription = XdmfDSMDescription::New();
152 dsmDescription->setPortDescription(dsmBuffer->GetComm()->GetDsmPortName());
153
154 dsmDescription->accept(visitor);
155 }
156 #endif
157
158 XdmfItem::traverse(visitor);
159 for (unsigned int i = 0; i < mGridCollections.size(); ++i)
160 {
161 mGridCollections[i]->accept(visitor);
162 }
163 for (unsigned int i = 0; i < mCurvilinearGrids.size(); ++i)
164 {
165 mCurvilinearGrids[i]->accept(visitor);
166 }
167 for (unsigned int i = 0; i < mGraphs.size(); ++i)
168 {
169 mGraphs[i]->accept(visitor);
170 }
171 for (unsigned int i = 0; i < mRectilinearGrids.size(); ++i)
172 {
173 mRectilinearGrids[i]->accept(visitor);
174 }
175 for (unsigned int i = 0; i < mRegularGrids.size(); ++i)
176 {
177 mRegularGrids[i]->accept(visitor);
178 }
179 for (unsigned int i = 0; i < mUnstructuredGrids.size(); ++i)
180 {
181 mUnstructuredGrids[i]->accept(visitor);
182 }
183 }
184
185 // C Wrappers
186
XdmfDomainNew()187 XDMFDOMAIN * XdmfDomainNew()
188 {
189 try
190 {
191 shared_ptr<XdmfDomain> generatedDomain = XdmfDomain::New();
192 return (XDMFDOMAIN *)((void *)((XdmfItem *)(new XdmfDomain(*generatedDomain.get()))));
193 }
194 catch (...)
195 {
196 shared_ptr<XdmfDomain> generatedDomain = XdmfDomain::New();
197 return (XDMFDOMAIN *)((void *)((XdmfItem *)(new XdmfDomain(*generatedDomain.get()))));
198 }
199 }
200
XdmfDomainGetGridCollection(XDMFDOMAIN * domain,unsigned int index)201 XDMFGRIDCOLLECTION * XdmfDomainGetGridCollection(XDMFDOMAIN * domain, unsigned int index)
202 {
203 XdmfItem * classedPointer = (XdmfItem *)domain;
204 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
205 return (XDMFGRIDCOLLECTION *)((void *)((XdmfItem *)(domainPointer->getGridCollection(index).get())));
206 }
207
XdmfDomainGetGridCollectionByName(XDMFDOMAIN * domain,char * Name)208 XDMFGRIDCOLLECTION * XdmfDomainGetGridCollectionByName(XDMFDOMAIN * domain, char * Name)
209 {
210 XdmfItem * classedPointer = (XdmfItem *)domain;
211 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
212 return (XDMFGRIDCOLLECTION *)((void *)((XdmfItem *)(domainPointer->getGridCollection(Name).get())));
213 }
214
XdmfDomainGetNumberGridCollections(XDMFDOMAIN * domain)215 unsigned int XdmfDomainGetNumberGridCollections(XDMFDOMAIN * domain)
216 {
217 XdmfItem * classedPointer = (XdmfItem *)domain;
218 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
219 return domainPointer->getNumberGridCollections();
220 }
221
XdmfDomainInsertGridCollection(XDMFDOMAIN * domain,XDMFGRIDCOLLECTION * GridCollection,int passControl)222 void XdmfDomainInsertGridCollection(XDMFDOMAIN * domain, XDMFGRIDCOLLECTION * GridCollection, int passControl)
223 {
224 XdmfItem * classedPointer = (XdmfItem *)domain;
225 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
226 if (passControl) {
227 domainPointer->insert(shared_ptr<XdmfGridCollection>((XdmfGridCollection *)GridCollection));
228 }
229 else {
230 domainPointer->insert(shared_ptr<XdmfGridCollection>((XdmfGridCollection *)GridCollection, XdmfNullDeleter()));
231 }
232 }
233
XdmfDomainRemoveGridCollection(XDMFDOMAIN * domain,unsigned int index)234 void XdmfDomainRemoveGridCollection(XDMFDOMAIN * domain, unsigned int index)
235 {
236 XdmfItem * classedPointer = (XdmfItem *)domain;
237 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
238 domainPointer->removeGridCollection(index);
239 }
240
XdmfDomainRemoveGridCollectionByName(XDMFDOMAIN * domain,char * Name)241 void XdmfDomainRemoveGridCollectionByName(XDMFDOMAIN * domain, char * Name)
242 {
243 XdmfItem * classedPointer = (XdmfItem *)domain;
244 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
245 domainPointer->removeGridCollection(Name);
246 }
247
XdmfDomainGetGraph(XDMFDOMAIN * domain,unsigned int index)248 XDMFGRAPH * XdmfDomainGetGraph(XDMFDOMAIN * domain, unsigned int index)
249 {
250 XdmfItem * classedPointer = (XdmfItem *)domain;
251 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
252 return (XDMFGRAPH *)((void *)(domainPointer->getGraph(index).get()));
253 }
254
XdmfDomainGetGraphByName(XDMFDOMAIN * domain,char * Name)255 XDMFGRAPH * XdmfDomainGetGraphByName(XDMFDOMAIN * domain, char * Name)
256 {
257 XdmfItem * classedPointer = (XdmfItem *)domain;
258 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
259 return (XDMFGRAPH *)((void *)(domainPointer->getGraph(Name).get()));
260 }
261
XdmfDomainGetNumberGraphs(XDMFDOMAIN * domain)262 unsigned int XdmfDomainGetNumberGraphs(XDMFDOMAIN * domain)
263 {
264 XdmfItem * classedPointer = (XdmfItem *)domain;
265 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
266 return domainPointer->getNumberGraphs();
267 }
268
XdmfDomainInsertGraph(XDMFDOMAIN * domain,XDMFGRAPH * Graph,int passControl)269 void XdmfDomainInsertGraph(XDMFDOMAIN * domain, XDMFGRAPH * Graph, int passControl)
270 {
271 XdmfItem * classedPointer = (XdmfItem *)domain;
272 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
273 if (passControl) {
274 domainPointer->insert(shared_ptr<XdmfGraph>((XdmfGraph *)Graph));
275 }
276 else {
277 domainPointer->insert(shared_ptr<XdmfGraph>((XdmfGraph *)Graph, XdmfNullDeleter()));
278 }
279 }
280
XdmfDomainRemoveGraph(XDMFDOMAIN * domain,unsigned int index)281 void XdmfDomainRemoveGraph(XDMFDOMAIN * domain, unsigned int index)
282 {
283 XdmfItem * classedPointer = (XdmfItem *)domain;
284 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
285 domainPointer->removeGraph(index);
286 }
287
XdmfDomainRemoveGraphByName(XDMFDOMAIN * domain,char * Name)288 void XdmfDomainRemoveGraphByName(XDMFDOMAIN * domain, char * Name)
289 {
290 XdmfItem * classedPointer = (XdmfItem *)domain;
291 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
292 domainPointer->removeGraph(Name);
293 }
294
XdmfDomainGetCurvilinearGrid(XDMFDOMAIN * domain,unsigned int index)295 XDMFCURVILINEARGRID * XdmfDomainGetCurvilinearGrid(XDMFDOMAIN * domain, unsigned int index)
296 {
297 XdmfItem * classedPointer = (XdmfItem *)domain;
298 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
299 return (XDMFCURVILINEARGRID *)((void *)((XdmfItem *)(domainPointer->getCurvilinearGrid(index).get())));
300 }
301
XdmfDomainGetCurvilinearGridByName(XDMFDOMAIN * domain,char * Name)302 XDMFCURVILINEARGRID * XdmfDomainGetCurvilinearGridByName(XDMFDOMAIN * domain, char * Name)
303 {
304 XdmfItem * classedPointer = (XdmfItem *)domain;
305 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
306 return (XDMFCURVILINEARGRID *)((void *)((XdmfItem *)(domainPointer->getCurvilinearGrid(Name).get())));
307 }
308
XdmfDomainGetNumberCurvilinearGrids(XDMFDOMAIN * domain)309 unsigned int XdmfDomainGetNumberCurvilinearGrids(XDMFDOMAIN * domain)
310 {
311 XdmfItem * classedPointer = (XdmfItem *)domain;
312 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
313 return domainPointer->getNumberCurvilinearGrids();
314 }
315
XdmfDomainInsertCurvilinearGrid(XDMFDOMAIN * domain,XDMFCURVILINEARGRID * CurvilinearGrid,int passControl)316 void XdmfDomainInsertCurvilinearGrid(XDMFDOMAIN * domain, XDMFCURVILINEARGRID * CurvilinearGrid, int passControl)
317 {
318 XdmfItem * classedPointer = (XdmfItem *)domain;
319 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
320 if (passControl) {
321 domainPointer->insert(shared_ptr<XdmfCurvilinearGrid>((XdmfCurvilinearGrid *)CurvilinearGrid));
322 }
323 else {
324 domainPointer->insert(shared_ptr<XdmfCurvilinearGrid>((XdmfCurvilinearGrid *)CurvilinearGrid, XdmfNullDeleter()));
325 }
326 }
327
XdmfDomainRemoveCurvilinearGrid(XDMFDOMAIN * domain,unsigned int index)328 void XdmfDomainRemoveCurvilinearGrid(XDMFDOMAIN * domain, unsigned int index)
329 {
330 XdmfItem * classedPointer = (XdmfItem *)domain;
331 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
332 domainPointer->removeCurvilinearGrid(index);
333 }
334
XdmfDomainRemoveCurvilinearGridByName(XDMFDOMAIN * domain,char * Name)335 void XdmfDomainRemoveCurvilinearGridByName(XDMFDOMAIN * domain, char * Name)
336 {
337 XdmfItem * classedPointer = (XdmfItem *)domain;
338 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
339 domainPointer->removeCurvilinearGrid(Name);
340 }
341
XdmfDomainGetRectilinearGrid(XDMFDOMAIN * domain,unsigned int index)342 XDMFRECTILINEARGRID * XdmfDomainGetRectilinearGrid(XDMFDOMAIN * domain, unsigned int index)
343 {
344 XdmfItem * classedPointer = (XdmfItem *)domain;
345 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
346 return (XDMFRECTILINEARGRID *)((void *)((XdmfItem *)(domainPointer->getRectilinearGrid(index).get())));
347 }
348
XdmfDomainGetRectilinearGridByName(XDMFDOMAIN * domain,char * Name)349 XDMFRECTILINEARGRID * XdmfDomainGetRectilinearGridByName(XDMFDOMAIN * domain, char * Name)
350 {
351 XdmfItem * classedPointer = (XdmfItem *)domain;
352 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
353 return (XDMFRECTILINEARGRID *)((void *)((XdmfItem *)(domainPointer->getRectilinearGrid(Name).get())));
354 }
355
XdmfDomainGetNumberRectilinearGrids(XDMFDOMAIN * domain)356 unsigned int XdmfDomainGetNumberRectilinearGrids(XDMFDOMAIN * domain)
357 {
358 XdmfItem * classedPointer = (XdmfItem *)domain;
359 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
360 return domainPointer->getNumberRectilinearGrids();
361 }
362
XdmfDomainInsertRectilinearGrid(XDMFDOMAIN * domain,XDMFRECTILINEARGRID * RectilinearGrid,int passControl)363 void XdmfDomainInsertRectilinearGrid(XDMFDOMAIN * domain, XDMFRECTILINEARGRID * RectilinearGrid, int passControl)
364 {
365 XdmfItem * classedPointer = (XdmfItem *)domain;
366 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
367 if (passControl) {
368 domainPointer->insert(shared_ptr<XdmfRectilinearGrid>((XdmfRectilinearGrid *)RectilinearGrid));
369 }
370 else {
371 domainPointer->insert(shared_ptr<XdmfRectilinearGrid>((XdmfRectilinearGrid *)RectilinearGrid, XdmfNullDeleter()));
372 }
373 }
374
XdmfDomainRemoveRectilinearGrid(XDMFDOMAIN * domain,unsigned int index)375 void XdmfDomainRemoveRectilinearGrid(XDMFDOMAIN * domain, unsigned int index)
376 {
377 XdmfItem * classedPointer = (XdmfItem *)domain;
378 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
379 domainPointer->removeRectilinearGrid(index);
380 }
381
XdmfDomainRemoveRectilinearGridByName(XDMFDOMAIN * domain,char * Name)382 void XdmfDomainRemoveRectilinearGridByName(XDMFDOMAIN * domain, char * Name)
383 {
384 XdmfItem * classedPointer = (XdmfItem *)domain;
385 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
386 domainPointer->removeRectilinearGrid(Name);
387 }
388
XdmfDomainGetRegularGrid(XDMFDOMAIN * domain,unsigned int index)389 XDMFREGULARGRID * XdmfDomainGetRegularGrid(XDMFDOMAIN * domain, unsigned int index)
390 {
391 XdmfItem * classedPointer = (XdmfItem *)domain;
392 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
393 return (XDMFREGULARGRID *)((void *)((XdmfItem *)(domainPointer->getRegularGrid(index).get())));
394 }
395
XdmfDomainGetRegularGridByName(XDMFDOMAIN * domain,char * Name)396 XDMFREGULARGRID * XdmfDomainGetRegularGridByName(XDMFDOMAIN * domain, char * Name)
397 {
398 XdmfItem * classedPointer = (XdmfItem *)domain;
399 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
400 return (XDMFREGULARGRID *)((void *)((XdmfItem *)(domainPointer->getRegularGrid(Name).get())));
401 }
402
XdmfDomainGetNumberRegularGrids(XDMFDOMAIN * domain)403 unsigned int XdmfDomainGetNumberRegularGrids(XDMFDOMAIN * domain)
404 {
405 XdmfItem * classedPointer = (XdmfItem *)domain;
406 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
407 return domainPointer->getNumberRegularGrids();
408 }
409
XdmfDomainInsertRegularGrid(XDMFDOMAIN * domain,XDMFREGULARGRID * RegularGrid,int passControl)410 void XdmfDomainInsertRegularGrid(XDMFDOMAIN * domain, XDMFREGULARGRID * RegularGrid, int passControl)
411 {
412 XdmfItem * classedPointer = (XdmfItem *)domain;
413 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
414 if (passControl) {
415 domainPointer->insert(shared_ptr<XdmfRegularGrid>((XdmfRegularGrid *)RegularGrid));
416 }
417 else {
418 domainPointer->insert(shared_ptr<XdmfRegularGrid>((XdmfRegularGrid *)RegularGrid, XdmfNullDeleter()));
419 }
420 }
421
XdmfDomainRemoveRegularGrid(XDMFDOMAIN * domain,unsigned int index)422 void XdmfDomainRemoveRegularGrid(XDMFDOMAIN * domain, unsigned int index)
423 {
424 XdmfItem * classedPointer = (XdmfItem *)domain;
425 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
426 domainPointer->removeRegularGrid(index);
427 }
428
XdmfDomainRemoveRegularGridByName(XDMFDOMAIN * domain,char * Name)429 void XdmfDomainRemoveRegularGridByName(XDMFDOMAIN * domain, char * Name)
430 {
431 XdmfItem * classedPointer = (XdmfItem *)domain;
432 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
433 domainPointer->removeRegularGrid(Name);
434 }
435
XdmfDomainGetUnstructuredGrid(XDMFDOMAIN * domain,unsigned int index)436 XDMFUNSTRUCTUREDGRID * XdmfDomainGetUnstructuredGrid(XDMFDOMAIN * domain, unsigned int index)
437 {
438 XdmfItem * classedPointer = (XdmfItem *)domain;
439 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
440 return (XDMFUNSTRUCTUREDGRID *)((void *)((XdmfItem *)(domainPointer->getUnstructuredGrid(index).get())));
441 }
442
XdmfDomainGetUnstructuredGridByName(XDMFDOMAIN * domain,char * Name)443 XDMFUNSTRUCTUREDGRID * XdmfDomainGetUnstructuredGridByName(XDMFDOMAIN * domain, char * Name)
444 {
445 XdmfItem * classedPointer = (XdmfItem *)domain;
446 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
447 return (XDMFUNSTRUCTUREDGRID *)((void *)((XdmfItem *)(domainPointer->getUnstructuredGrid(Name).get())));
448 }
449
XdmfDomainGetNumberUnstructuredGrids(XDMFDOMAIN * domain)450 unsigned int XdmfDomainGetNumberUnstructuredGrids(XDMFDOMAIN * domain)
451 {
452 XdmfItem * classedPointer = (XdmfItem *)domain;
453 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
454 return domainPointer->getNumberUnstructuredGrids();
455 }
456
XdmfDomainInsertUnstructuredGrid(XDMFDOMAIN * domain,XDMFUNSTRUCTUREDGRID * UnstructuredGrid,int passControl)457 void XdmfDomainInsertUnstructuredGrid(XDMFDOMAIN * domain, XDMFUNSTRUCTUREDGRID * UnstructuredGrid, int passControl)
458 {
459 XdmfItem * classedPointer = (XdmfItem *)domain;
460 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
461 if (passControl) {
462 domainPointer->insert(shared_ptr<XdmfUnstructuredGrid>((XdmfUnstructuredGrid *)UnstructuredGrid));
463 }
464 else {
465 domainPointer->insert(shared_ptr<XdmfUnstructuredGrid>((XdmfUnstructuredGrid *)UnstructuredGrid, XdmfNullDeleter()));
466 }
467 }
468
XdmfDomainRemoveUnstructuredGrid(XDMFDOMAIN * domain,unsigned int index)469 void XdmfDomainRemoveUnstructuredGrid(XDMFDOMAIN * domain, unsigned int index)
470 {
471 XdmfItem * classedPointer = (XdmfItem *)domain;
472 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
473 domainPointer->removeUnstructuredGrid(index);
474 }
475
XdmfDomainRemoveUnstructuredGridByName(XDMFDOMAIN * domain,char * Name)476 void XdmfDomainRemoveUnstructuredGridByName(XDMFDOMAIN * domain, char * Name)
477 {
478 XdmfItem * classedPointer = (XdmfItem *)domain;
479 XdmfDomain * domainPointer = dynamic_cast<XdmfDomain *>(classedPointer);
480 domainPointer->removeUnstructuredGrid(Name);
481 }
482
483 XDMF_ITEM_C_CHILD_WRAPPER(XdmfDomain, XDMFDOMAIN)
484