XdmfExampleItem.py 1.4 KB
Newer Older
1 2 3
from Xdmf import *

if __name__ == "__main__":
4 5
        #Assume that exampleItem is a shared pointer to the ParentClass object
        #Using an XdmfInformation as an example because all XdmfItems have XdmfInformation as a child class
6

7 8
        exampleItem = XdmfInformation.New("Parent", "This is a parent information")
        addChild = XdmfInformation.New("Child", "This is a child information")
9

10
        exampleItem.insert(addChild)
11

12 13
        getIndex = 0
        exampleChild = exampleItem.getInformation(getIndex)
14

15 16
        findingInfo = "Find this"
        exampleStringChild = exampleItem.getInformation(findingInfo)
17

18
        exampleSize = exampleItem.getNumberInformations()
19

20 21
        removeIndex = 0
        exampleItem.removeInformation(removeIndex)
22

23 24
        removeInfo = "Remove this"
        exampleItem.removeInformation(removeInfo)
25

26
        #//initialization begin
27

28
        #Using a shared pointer to an XdmfDomain object as an example
29

30
        exampleDomain = XdmfDomain.New()
31

32
        #//initialization end
33

34
        #//getItemTag begin
35

36
        exampleTag = exampleDomain.getItemTag()
37

38
        #//getItemTag end
39

40
        #//getItemProperties begin
41

42
        propertyMap = exampleDomain.getItemProperties()
43

44
        #//getItemProperties end
45

46
        #//traverse begin
47

48 49 50
        writePath = "file path here"
        exampleWriter = XdmfWriter.New(writepath)
        exampleDomain.traverse(exampleWriter)
51

52
        #//traverse end