Peano
Loading...
Searching...
No Matches
find_missing_particleIDs.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
4
5import numpy as np
6import sys
7import os
8
9if len(sys.argv)<=1:
10 print( "Usage: python3 {} vtu-file-name.vtu".format(__file__) )
11 print( " python3 {} vtu-file-name-1.vtu vtu-file-name-2.vtu vtu-file-name-3.vtu ...".format(__file__) )
12 print( " python3 {} *.vtu".format(__file__) )
13 exit(1)
14
15
16for vtufile in sys.argv:
17 if vtufile.endswith(".vtu"):
18 if not os.path.exists(vtufile):
19 raise FileNotFoundError("no file {}".format(vtufile))
20
21 reader = ParticleVTUReader(vtufile=vtufile, verbose=False)
22 partData = reader.load()
23 ids = partData.partid
24 ids = ids.astype(int)
25 ids = np.sort(ids)
26
27 print("First particle ID is", ids[0])
28
29 for i in range(ids.shape[0] - 1):
30 n = ids[i + 1]
31 this = ids[i]
32 while n - this != 1:
33 this += 1
34 print("Missing particle:", this)
Reads in particle fields from a single .vtu file, or all .vtu at a given snapshot time specified in t...