File: XdmfExampleHeavyDataController.py

package info (click to toggle)
xdmf 3.0%2Bgit20190531-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,756 kB
  • sloc: cpp: 67,089; ansic: 5,172; python: 4,566; f90: 1,247; java: 187; fortran: 173; makefile: 83; sh: 28
file content (104 lines) | stat: -rw-r--r-- 2,629 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from Xdmf import *

if __name__ == "__main__":
        #//initialization begin

        newPath = "File path to hdf5 file goes here"
        newSetPath = "path to the set goes here"
        readType = XdmfArrayType.Int32()
        readStarts = UInt32Vector()
        #Three dimensions, all starting at index 0
        readStarts.push_back(0)
        readStarts.push_back(0)
        readStarts.push_back(0)
        readStrides = UInt32Vector()
        #Three dimensions, no skipping between reads
        readStrides.push_back(1)
        readStrides.push_back(1)
        readStrides.push_back(1)
        readCounts = UInt32Vector()
        #Three dimensions, reading 10 values from each
        readCounts.push_back(10)
        readCounts.push_back(10)
        readCounts.push_back(10)
        readDataSize = UInt32Vector()
        #Three dimensions, 10 values in each
        readDataSize.push_back(10)
        readDataSize.push_back(10)
        readDataSize.push_back(10)
        exampleController = XdmfHDF5Controller.New(
                newPath,
                newSetPath,
                readType,
                readStarts,
                readStrides,
                readCounts,
                readDataSize)

        #Using an XdmfHDF5Controller since XdmfHeavyDataController is an abstract class

        #//initialization end

        #//getDimensions begin

        exampleDimensions = exampleController.getDimensions()

        #//getDimensions end

        #//getFilePath begin

        examplePath = exampleController.getFilePath()

        #//getFilePath end

        #//getDescriptor begin

        exampleDescriptor = exampleController.getDescriptor()

        #//getDescriptor end

        #//getName begin

        exampleName = exampleController.getName()

        #//getName end

        #//getSize begin

        exampleSize = exampleController.getSize()

        #//getSize end

        #//getDataspaceSize begin

        exampleDataspaceSize = exampleController.getDataspaceSize()

        #//getDataspaceSize end

        #//getType begin

        exampleType = exampleController.getType()

        #//getType end

        #//read begin

        exampleArray = XdmfArray.New()
        exampleController.read(exampleArray)
        #exampleArray now holds the data that exampleController holds.

        #//read end

        #//setArrayOffset begin

        newArrayOffset = 5#default is 0

        exampleController.setArrayOffset(newArrayOffset)

        #//setArrayOffset end

        #//getArrayOffset begin

        exampleOffset = exampleController.getArrayOffset()

        #//getArrayOffset end