Salome HOME
f7d91f9ac7cf5721bb55607f606b4023a50d481e
[modules/med.git] / src / MEDOP / tut / medloader / tutorial.py
1 #!/usr/bin/env python
2 # This script illustrates the basic features of MEDLoader
3 # (gboulant, 17 nov 2012)
4 import os
5 filename = "timeseries.med"
6 filepath = os.path.join(os.path.abspath(os.path.dirname(__file__)),filename)
7
8 # _T1A
9 from MEDLoader import MEDLoader
10 meshNames = MEDLoader.GetMeshNames(filepath)
11 # _T1B
12 meshName=meshNames[0]
13 # _T2A
14 fieldNames = MEDLoader.GetAllFieldNamesOnMesh(filepath,meshName)
15 # _T2B
16 fieldName=fieldNames[0]
17 # _T3A
18 listOfTypes = MEDLoader.GetTypesOfField(filepath,meshName,fieldName)
19 # _T3B
20 typeOfDiscretization=listOfTypes[0]
21 # _T4A
22 fieldIterations = MEDLoader.GetFieldIterations(typeOfDiscretization,
23                                                filepath,
24                                                meshName,
25                                                fieldName)
26 # _T4B
27
28 iteration = fieldIterations[0]
29 iterationNumber = iteration[0]
30 iterationOrder  = iteration[1]
31
32 dimrestriction = 0
33 # _T5A
34 mesh = MEDLoader.ReadUMeshFromFile(filepath, meshName, dimrestriction)
35 # _T5B
36 # _T6A
37 field = MEDLoader.ReadField(typeOfDiscretization,
38                             filepath, meshName, dimrestriction,
39                             fieldName, iterationNumber, iterationOrder)
40 # _T6B