Peano
Loading...
Searching...
No Matches
peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader Class Reference

Reads in particle fields from a single .vtu file, or all .vtu at a given snapshot time specified in the provided .pvd file. More...

Inheritance diagram for peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader:
Collaboration diagram for peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader:

Public Member Functions

 __init__ (self, Union[str, None] vtufile=None, Union[float, None] snapshot_time=None, Union[str, None] pvdfile=None, bool verbose=False)
 At initialization, either the vtufile argument needs to be provided, or both the snapshot_time and pvdfile arguments in order to specify what data to read.
 
 load (self)
 Actually read in the data.
 
 get_snapshot_time (self)
 Return the time/timestep information of the read snapshot.
 
 get_all_vtufiles (self)
 Read in and return all .vtu file names from the .pvd file provided by pvdfilename at initialisation.
 
 read_single_vtu_file (self, str vtufilename)
 Read in particle data from a single .vtu file, and return the filled out VTUParticleSet object containing the particle data.
 

Protected Member Functions

 _get_full_vtufile_path (self, str vtufile)
 The .pvd file will provide relative path names to its own file path for the .vtu files.
 
 _get_snapshot_vtu_files_from_pvd (self, str pvdfilename, float time)
 Read in data from the .pvd file provided by pvdfilename.
 

Protected Attributes

 _verbose
 
 _mode
 
 _vtufile
 
 _pvdfile
 
 _snapshot_time
 
 _read_time
 
 _snapshot_time_read
 

Detailed Description

Reads in particle fields from a single .vtu file, or all .vtu at a given snapshot time specified in the provided .pvd file.

Methods

get_all_vtufiles(self): Read in and return all .vtu file names from the .pvd file provided by pvdfilename at initialisation.

load(self): actually read in the data, and return the particle data as a VTUParticleSet object.

read_single_vtu_file(self, vtufilename: str): Read in particle data from a single .vtu file, and return the filled out VTUParticleSet object containing the particle data.

Definition at line 137 of file ParticleVTUReader.py.

Constructor & Destructor Documentation

◆ __init__()

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.__init__ ( self,
Union[str, None] vtufile = None,
Union[float, None] snapshot_time = None,
Union[str, None] pvdfile = None,
bool verbose = False )

At initialization, either the vtufile argument needs to be provided, or both the snapshot_time and pvdfile arguments in order to specify what data to read.

If vtufile is given, the ParticleVTUReader will read in a single .vtu file.

If snapshot_time and pvdfile arguments are given, the ParticleVTUReader will read in all .vtu files corresponding to the snapshot at the provided snapshot_time.

Parameters

vtufile: str path to .vtu file to be read in

snapshot_time: float time of the snapshot to extract

pvdfile: str path to .pvd file to be read in

verbose: bool how talkative the reading process should be

Definition at line 159 of file ParticleVTUReader.py.

Member Function Documentation

◆ _get_full_vtufile_path()

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._get_full_vtufile_path ( self,
str vtufile )
protected

The .pvd file will provide relative path names to its own file path for the .vtu files.

This function returns the full path of the .vtu file.

Definition at line 299 of file ParticleVTUReader.py.

References peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._pvdfile.

Referenced by peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.get_all_vtufiles(), and peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.load().

Here is the caller graph for this function:

◆ _get_snapshot_vtu_files_from_pvd()

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._get_snapshot_vtu_files_from_pvd ( self,
str pvdfilename,
float time )
protected

Read in data from the .pvd file provided by pvdfilename.

Parameters

pvdfilename: str filename to read in from

time: float snapshot time to read in

Returns

vtufilenames: list list of .vtu filenames to read from

Definition at line 317 of file ParticleVTUReader.py.

References peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._read_time, peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._snapshot_time, peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._snapshot_time_read, and peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._verbose.

Referenced by peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.load().

Here is the caller graph for this function:

◆ get_all_vtufiles()

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.get_all_vtufiles ( self)

Read in and return all .vtu file names from the .pvd file provided by pvdfilename at initialisation.

Returns

vtufilenames: list list of .vtu filenames in the .pvd file, with their full path.

Definition at line 271 of file ParticleVTUReader.py.

References peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._get_full_vtufile_path(), and peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._pvdfile.

Here is the call graph for this function:

◆ get_snapshot_time()

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.get_snapshot_time ( self)

Return the time/timestep information of the read snapshot.

This is only available if you read in the .pvd file, not the .vtu file. If the .vtu file has been read, this method returns None. Otherwise, it returns the time of the snapshot, which may vary (slightly) from the snapshot time you specified with when loading the data.

Definition at line 256 of file ParticleVTUReader.py.

References peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._read_time, and peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._snapshot_time_read.

◆ load()

◆ read_single_vtu_file()

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.read_single_vtu_file ( self,
str vtufilename )

Read in particle data from a single .vtu file, and return the filled out VTUParticleSet object containing the particle data.

Parameters

vtufilename: str .vtu filename to read in from.

Returns

particleData: VTUParticleSet object containing all read-in particle data as attributes.

Definition at line 396 of file ParticleVTUReader.py.

References peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._verbose.

Referenced by peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader.load().

Here is the caller graph for this function:

Field Documentation

◆ _mode

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._mode
protected

◆ _pvdfile

◆ _read_time

◆ _snapshot_time

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._snapshot_time
protected

◆ _snapshot_time_read

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._snapshot_time_read
protected

◆ _verbose

◆ _vtufile

peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader._vtufile
protected

The documentation for this class was generated from the following file: