3 A simple Python script to visualise the number of lifts, drops, ... over
4 the simulation runtime.
13import matplotlib.pyplot
as plt
21 "lifts-into-sieve-set": [],
22 "drops-from-sieve-set": [],
23 "skipped-drops-from-sieve-set": [],
28 "incoming particles (previously known as halos)": [],
29 "incoming particles (previously unseen)": [],
30 "redundantly shared particles (local on multiple trees)": [],
31 "added virtual particles (flying into halo)": [],
32 "replaced virtual particles (halo updates)": [],
33 "dropped virtual particles": [],
34 "eliminated local spatial duplicates": [],
35 "eliminated virtual spatial duplicates": []
38 (
"local cells",
"refined"): [],
39 (
"remote cells",
"refined"): [],
40 (
"local cells",
"unrefined"): [],
41 (
"remote cells",
"unrefined"): []
48 rhs = line.split( key +
"=" )[1]
50 rhs = rhs.split(
",")[0]
54 print(
"ERROR in line {} for key {}".format(line,key) )
60 rhs = line.split( key[0] +
"=(" )[1].split(
")")[0]
62 float( rhs.split(
"/")[0] ),
63 float( rhs.split(
"/")[1] )
67 print(
"ERROR for _getTupleFromLine in line {} for key {}".format(line, key) )
77 Return true if entry for key is not empty and not all values are exactly the same
81 print(
"search for entry for key {}".format(key) )
84 print(
"no key {}".format(key) )
88 print(
"no entry for key {}".format(key) )
92 if first_mesh_association_data_entry!=values:
97 if "reduceAndPrintStatistics":
111 file = open( filename,
"r" )
114 result.parse_line(line, verbose)
118if __name__ ==
"__main__":
119 parser = argparse.ArgumentParser( description=
"ExaHyPE 2 - Particle toolbox postprocessing" )
120 parser.add_argument(
"file", help=
"Input file")
121 parser.add_argument(
"--verbose",
"-v", dest=
"verbose", action=
"store_true", help=
"Verbose output")
122 args = parser.parse_args()
128 gs = fig.add_gridspec(2, hspace=0)
129 axs = gs.subplots(sharex=
True, sharey=
False)
130 for key
in mesh_association_dataset.mesh_association_data.keys():
131 if mesh_association_dataset.entry_holds_interesting_data(key, args.verbose):
132 axs[0].
plot(mesh_association_dataset.mesh_association_data[key], label=key)
133 for key
in mesh_association_dataset.grid_data.keys():
135 axs[1].
plot(mesh_association_dataset.grid_data[key], label=
"{}/{}".format(key[0],key[1]))
137 print(
"ERROR: Cannot find data for {}".format(key) )
141 plt.xlabel(
"Mesh sweeps")
142 plt.savefig(args.file +
".pdf")
143 plt.savefig(args.file +
".png")
_getValueFromLine(self, line, key, verbose)
parse_line(self, line, verbose)
entry_holds_interesting_data(self, key, verbose)
Return true if entry for key is not empty and not all values are exactly the same.
_getTupleFromLine(self, line, key, verbose)
parseParticleGridStatistics(filename, verbose)