Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpostprocessing.py
More file actions
Latest commit
54 lines (47 loc) · 1.44 KB
/
Copy pathpostprocessing.py
File metadata and controls
54 lines (47 loc) · 1.44 KB
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
"""
$ pvbatch postprocessing.py -h
"""
importsys
importargparse
fromparaview.simpleimport (
PlotOverLine,
PVDReader,
SaveData,
UpdatePipeline,
)
defmain(args):
pvd_file=args.pvd
source=PVDReader(registrationName="poisson.pvd", FileName=[pvd_file])
source.PointArrays= [args.field]
UpdatePipeline()
(xmin, xmax, ymin, ymax, zmin, zmax) =source.GetDataInformation().GetBounds()
# init the 'Line' selected for 'Source'
plotOverLine1=PlotOverLine(
registrationName="PlotOverLine1", Input=source, Source="Line"
)
plotOverLine1.Source.Point1= [xmin, ymin, zmin]
plotOverLine1.Source.Point2= [xmax, ymax, zmax]
UpdatePipeline()
# save data
SaveData(
args.csv,
proxy=plotOverLine1,
ChooseArraysToWrite=1,
PointDataArrays=["arc_length", args.field, "vtkValidPointMask"],
)
if__name__=="__main__":
parser=argparse.ArgumentParser(
prog=f"pvbatch {__file__}",
description="Plots the solution over a line and writes the data to file.",
usage="%(prog)s [options] pvd csv",
)
parser.add_argument("pvd", type=str, help="The source pvd filepath.")
parser.add_argument("csv", type=str, help="The target csv filepath.")
parser.add_argument(
"--field",
type=str,
default="u",
help="Field variable to plot (default: u)",
)
args=parser.parse_args(sys.argv[1:])
main(args)