9if __name__ ==
"__main__":
10 parser = argparse.ArgumentParser(description=
"Peano 4 - Render Script")
15 help=
"Display only fine grid",
21 help=
"Average over cell data (reduces resolution/memory)",
27 help=
"Compute norm over each point",
33 help=
"Shrink or expand patches/cells. Off by default, i.e. set to 1.0",
36 "--eliminate-relative-paths",
39 help=
"If you invoke the script on a different directory than your current working directory, ensure that all meta files written do not hold relative paths",
45 help=
"If the patch file names its unknowns, write one additional array per variable (scalar or vector), so filters can address it by name",
47 parser.add_argument(
"--dir", default=
".", help=
"Output directory")
53 help=
"Run in a chatty mode",
60 help=
"Input file is single snapshot (and not meta file)",
69 help=
"Number of workers processing the snapshots in parallel",
73 choices=[
"vtu-unstructured"],
74 default=
"vtu-unstructured",
79 "--start-snapshot-index",
82 help=
"Set the snapshot number where the merge starts (all snapshots before will be ignored), default is 0 (starts from beginning)",
87 "--end-snapshot-index",
90 help=
"Set the snapshot number where the merge ends (all snapshots after will be ignored), default is -1 (ends at the last)",
93 parser.add_argument(dest=
"filename", help=
"Input file name")
94 args = parser.parse_args()
97 if not os.path.exists(args.filename):
99 "Specified input file '{}' does not exist, exiting...".format(args.filename)
102 total_snapshot_number = 0
103 with open(args.filename,
"r")
as metafile:
104 for line
in metafile.readlines():
105 if "timestamp" in line:
106 total_snapshot_number += 1
108 if (args.start > args.end
and args.end != -1)
or args.start < 0
or args.end < -1:
109 raise Exception(
"Specified snapshot index is wrong, please check.")
111 start_snapshot = args.start
113 total_snapshot_number - 1
115 elif args.end > (total_snapshot_number - 1):
116 start_snapshot = args.start
117 end_snapshot = total_snapshot_number - 1
119 "Warning: specified end snapshot index exceeds the total number, reset to the last snapshot."
122 start_snapshot = args.start
123 end_snapshot = args.end
126 "The meta file includes",
127 total_snapshot_number,
128 "snapshots, processing snapshot",
135 if args.type ==
"vtu-unstructured":
137 file_name=args.filename,
138 output_directory=args.dir,
139 verbose=args.verbose,
140 start=start_snapshot,
142 split_unknowns=args.split_unknowns,
148 if args.filter_average:
149 visualiser.append_filter(
152 if args.filter_fine_grid:
153 visualiser.append_filter(
156 if args.norm_calculator:
157 visualiser.append_filter(
160 if args.shrink_cells != 1.0:
161 visualiser.append_filter(
163 args.shrink_cells, verbose=args.verbose
168 visualiser.display_single_file()
170 visualiser.display(args.max_workers)
Calculate some value per voxel/sample point.
Extract the fine grid information.
The visualiser is first and foremost a persistency layer around datasets.