Class Reference https://vtk.org/doc/release/7.1/html/classvtkOpenFOAMReader.html
I will summarize the behavior when actually running with python little by little
python 3.7 vtk 8.1.2
Confirmation method
import Vtk
print(vtk.vtkVersion.GetVTKSourceVersion())
>> vtk version 8.1.2
import vtk
filename = "a.foam"
reader = vtk.vtkOpenFOAMReader()
reader.SetFileName(filename)
reader.Update()
print(reader)
print output example
vtkOpenFOAMReader (0x7fedd2c95be0)
Debug: Off
Modified Time: 105700
Reference Count: 2
Registered Events: (none)
Executive: 0x7fedd2caf9b0
ErrorCode: Undefined error: 0
Information: 0x7fedd2cd3f90
AbortExecute: Off
Progress: 1
Progress Text: (None)
File Name: a.foam
Refresh: 0
CreateCellToPoint: 1
CacheMesh: 1
DecomposePolyhedra: 1
PositionsIsIn13Format: 1
ReadZones: 0
SkipZeroTime: 0
ListTimeStepsByControlDict: 0
AddDimensionsToArrayNames: 0
Reader instance 0x7fedd2cbeb70:
Debug: Off
Modified Time: 106395
Reference Count: 1
Registered Events: (none)
DisableAllCellArrays() / EnableAllCellArrays()
CellArray on / off
GetNumberOfCellArrays()
Returns the number of physical variable types contained in the object Example: Include U, p in variable-> 2
reader.GetNumberOfCellArrays()
>> 2
GetCellArrayStatus(name:string) Returns whether ** CellArray ** corresponding to the specified string exists
reader.GetCellArrayStatus("hoge")
>> 0
reader.GetCellArrayStatus("p")
>> 1
GetCellArrayName(index:int)
Returns the name of the physical variable corresponding to the index number
reader.GetCellArrayName(0)
>> 'U'
reader.GetCellArrayName(1)
>> 'p'
reader.GetCellArrayName(1000)
>> None
Display a list of physical variables (** CellArray **) contained in the object
for index in range(reader.GetNumberOfCellArrays()):
nname = reader.GetCellArrayName(index)
print(nname)
>> U p ...
GetNumberOfPatchArrays()
Returns the number of OpenFOAM patches + 1 Because +1 contains ** internalMesh **
reader.GetNumberOfPatchArrays()
>> e.g. 5
GetPatchArrayName(index:int) Returns patch name and internalMesh
reader.GetPatchArrayName(0)
>> 'internalMesh'
reader.GetPatchArrayName(1)
>> e.g. 'walls'
Recommended Posts