Difference between revisions of "VTKpytools/Bar2vtk"

From PHASTA Wiki
Jump to: navigation, search
m
(Add basic usage section)
Line 1: Line 1:
'''bar2vtk''' is a utility from the [[VTKpytools|vtkpytools]] project for converting *bar files (<code>velbar</code> and <code>stsbar</code>) into appropriate VTK files. In particular, it makes use of the [[Barfiletools|barfiletools]] module in the <code>vtkpytools</code> project.
+
'''bar2vtk''' is a utility from the [[VTKpytools|vtkpytools]] project for taking data in *bar files (<code>velbar</code> and <code>stsbar</code>) and loading it into a "blank" VTK Multiblock (VTM) file. In particular, it makes use of the [[Barfiletools|barfiletools]] module in the <code>vtkpytools</code> project.
  
 
Documentation for <code>bar2vtk</code> can be found by running the <code>--help</code> flag, but this will also serve as a more detailed/verbose documentation page as well.
 
Documentation for <code>bar2vtk</code> can be found by running the <code>--help</code> flag, but this will also serve as a more detailed/verbose documentation page as well.
  
 
== Functionality ==
 
== Functionality ==
 +
 +
=== Basic Usage ===
 +
 +
<code>bar2vtk</code> takes three primary arguments: <code>vtkfile</code>, <code>barfiledir</code>, and <code>timestep</code>. The utility will search the <code>barfiledir</code> for the appropriate *bar file(s) based on the <code>timestep</code> argument, and then load them onto the <code>vtkfile</code>.
 +
 +
; <code>vtkfile</code>
 +
: Path to the VTM file that the data is loaded onto. Must match the "blank" [[Barfiletools#VTM_File_Format|VTM file format]].
 +
; <code>barfiledir</code>
 +
: Path to directory where the *bar file(s) are located.
 +
; <code>timestep</code>
 +
: The timestep(s) of the *bar file(s) to be loaded. For [[Bar2vtk#Time_Windows|time windows]], a <code>-</code> is used to delimit between the beginning and ending timestep.
 +
 +
By default, the loaded VTM file will be output to the same path as <code>vtkfile</code> and it's name will be <code>[vtkfile]_[timestep].vtm</code>. This can be changed using the utility [[Bar2vtk#Options|options]].
 +
 +
'''Examples:'''
 +
bar2vtk vtkFiles/example_blank.vtm data/ 10000
 +
 +
* Searches for <code>velbar*.10000*</code> in <code>./data</code>
 +
* Outputs <code>example_blank_10000.vtm</code> to the <code>vtkFiles/</code> directory
 +
 +
=== *bar File Searching ===
 +
When searching for the *bar file(s) in <code>barfiledir</code>, <code>bar2vtk</code> uses a glob of <code>velbar*.{timestep}*</code> to find them. If the glob matches more than one file, it will return an error.
 +
 +
If setting the *bar file paths explicitly using [[Bar2vtk#--velbar_and_--stsbar|<code>--velbar</code> and <code>--stsbar</code>]], <code>barfiledir</code> will be ignored and no globing will occur.
  
 
=== Time Windows ===
 
=== Time Windows ===
 +
Splitting time windows of the *bar files is done my specifying a <code>timestep</code>
  
 
== Options ==
 
== Options ==

Revision as of 08:54, 7 September 2020

bar2vtk is a utility from the vtkpytools project for taking data in *bar files (velbar and stsbar) and loading it into a "blank" VTK Multiblock (VTM) file. In particular, it makes use of the barfiletools module in the vtkpytools project.

Documentation for bar2vtk can be found by running the --help flag, but this will also serve as a more detailed/verbose documentation page as well.

Functionality

Basic Usage

bar2vtk takes three primary arguments: vtkfile, barfiledir, and timestep. The utility will search the barfiledir for the appropriate *bar file(s) based on the timestep argument, and then load them onto the vtkfile.

vtkfile
Path to the VTM file that the data is loaded onto. Must match the "blank" VTM file format.
barfiledir
Path to directory where the *bar file(s) are located.
timestep
The timestep(s) of the *bar file(s) to be loaded. For time windows, a - is used to delimit between the beginning and ending timestep.

By default, the loaded VTM file will be output to the same path as vtkfile and it's name will be [vtkfile]_[timestep].vtm. This can be changed using the utility options.

Examples:

bar2vtk vtkFiles/example_blank.vtm data/ 10000 
  • Searches for velbar*.10000* in ./data
  • Outputs example_blank_10000.vtm to the vtkFiles/ directory

*bar File Searching

When searching for the *bar file(s) in barfiledir, bar2vtk uses a glob of velbar*.{timestep}* to find them. If the glob matches more than one file, it will return an error.

If setting the *bar file paths explicitly using --velbar and --stsbar, barfiledir will be ignored and no globing will occur.

Time Windows

Splitting time windows of the *bar files is done my specifying a timestep

Options

--velbar and --stsbar

These flags allow for explicit setting the path(s) to the velbar and stsbar files. They can take a maximum of two arguments.

When given two paths, it will assume that a time window is to be created, with the first file corresponding to the first timestep in the timestep range.

Examples:

  • bar2vtk [vtmfile] [dataPath] 10000 --velbar /data/path/velbar.file --stsbar /data/path/stsbar.file
    • Will use the files given to do a "single timestep" VTM creation
  • bar2vtk [vtmfile] [dataPath] 10000-20000 --ts0=0 --velbar /data/path/velbar_first.file /data/path/velbar_second.file --stsbar /data/path/stsbar_first.file /data/path/stsbar_second.file
    • Will create a time step window using the /data/path/*bar_first.file files as timestep 10000 and /data/path/*bar_second.file as timestep 20000

--ascii

Ordinarily, the *bar files are assumed to be Fortran binary array files. Using this flag, the file(s) will instead be assumed to be space-delimited plain-text files (ie. ASCII files).

--debug

This flag will add in the raw values from the stsbar file, allowing for better debugging of the files if any strange data comes out from them.

--velonly

Will only load the velbar file(s) into the VTM file.

--vptpath

Path to vtkpytools in case of a desire to do custom testing with a separate module. Not generally recommended to use, mostly for testing/development purposes.

--outpath

The path that the "loaded" VTM file is output to.

-f/--new-file-prefix

Choosing a new file prefix for the "loaded" VTM file. By default, the name of the blank VTM file will be used with _[timestep] being appended to it. If this flag is given, then it's argument will be used as the file prefix.

Examples:

bar2vtk example_blank.vtm data/ 10000 
    # output file name is "example_blank_10000.vtm"
bar2vtk example_blank.vtm data/ 10000 -f otherprefix 
    # output file name is "otherprefix_10000.vtm"