Fix a few bugs related to particle track files

This commit is contained in:
Paul Romano 2015-06-06 22:13:28 +07:00
parent 57663dd195
commit ffcb4eec2a
3 changed files with 10 additions and 7 deletions

View file

@ -44,7 +44,7 @@ def main():
if not (fname.endswith('.h5') or fname.endswith('.binary')):
raise ValueError("Input file names must either end with '.h5' or"
"'.binary'.")
# Make sure that the output filename ends with '.pvtp'.
if not args.out:
args.out = 'tracks.pvtp'
@ -75,21 +75,21 @@ def main():
n_points = coords.shape[0]
for i in range(n_points):
points.InsertNextPoint(coords[i,:])
# Create VTK line and assign points to line.
line = vtk.vtkPolyLine()
line.GetPointIds().SetNumberOfIds(n_points)
for i in range(n_points):
line.GetPointIds().SetId(i, point_offset+i)
cells.InsertNextCell(line)
point_offset += n_points
data = vtk.vtkPolyData()
data.SetPoints(points)
data.SetLines(cells)
writer = vtk.vtkXMLPPolyDataWriter()
writer.SetInput(data)
writer.SetInputData(data)
writer.SetFileName(args.out)
writer.Write()

View file

@ -62,7 +62,7 @@ def main(file_, o):
grid.GetCellData().AddArray(data)
writer = vtk.vtkXMLImageDataWriter()
writer.SetInput(grid)
writer.SetInputData(grid)
if not o.output[-4:] == ".vti": o.output += ".vti"
writer.SetFileName(o.output)
writer.Write()

View file

@ -126,7 +126,7 @@ contains
if (master) call check_triggers()
#ifdef MPI
call MPI_BCAST(satisfy_triggers, 1, MPI_LOGICAL, 0, &
MPI_COMM_WORLD, mpi_err)
MPI_COMM_WORLD, mpi_err)
#endif
if (satisfy_triggers .or. &
(trigger_on .and. current_batch == n_max_batches)) then
@ -157,6 +157,9 @@ contains
! Copy source attributes to the particle
call copy_source_attributes(p, source_site)
! Determine whether to create track file
if (write_all_tracks) p % write_track = .true.
end subroutine sample_source_particle
end module fixed_source