CGNSReader#

class CGNSReader(*args, **kwargs)[source]#

CGNS Reader for .cgns files.

Creates a multi-block dataset and reads unstructured grids and structured meshes from binary files stored in CGNS file format, with data stored at the nodes, cells, or faces.

By default, all point and cell arrays are loaded as well as the boundary patch. This varies from VTK’s defaults. For more details, see vtkCGNSReader.

Examples#

Download Python source code | Download Jupyter notebook

Load a CGNS file. All arrays are loaded by default.

>>> import pyvista as pv
>>> from pyvista import examples
>>> filename = examples.download_cgns_multi(load=False)
>>> reader = pv.CGNSReader(filename)
>>> reader.load_boundary_patch = False
>>> ds = reader.read()
>>> ds[0][0].cell_data
pyvista DataSetAttributes
Association     : CELL
Active Scalars  : None
Active Vectors  : Momentum
Active Texture  : None
Active Normals  : None
Contains arrays :
    Density                 float64    (2928,)
    Momentum                float64    (2928, 3)            VECTORS
    EnergyStagnationDensity float64    (2928,)
    ViscosityEddy           float64    (2928,)
    TurbulentDistance       float64    (2928,)
    TurbulentSANuTilde      float64    (2928,)

Inheritance#

Inherited members are documented on BaseReader, _FileIOBase, PointCellDataSelection.

See them all under Inherited Attributes and Inherited Methods.

Attributes#

CGNSReader.base_array_names

Return the list of all base array names.

CGNSReader.distribute_blocks

Distribute each block in each zone across ranks.

CGNSReader.family_array_names

Return the list of all family array names.

CGNSReader.load_boundary_patch

Return or set loading boundary patches.

CGNSReader.number_base_arrays

Return the number of base arrays.

CGNSReader.number_family_arrays

Return the number of family arrays.

CGNSReader.unsteady_pattern

Return or set using an unsteady pattern.

CGNSReader.vector_3d

Return or set adding an empty dimension to vectors in case of 2D solutions.

Inherited Attributes#

PointCellDataSelection.all_cell_arrays_status

Return the status of all cell arrays.

PointCellDataSelection.all_point_arrays_status

Return the status of all point arrays.

PointCellDataSelection.cell_array_names

Return the list of all cell array names.

_FileIOBase.extension_patterns

Return mapping from regex pattern matching associated with this class.

_FileIOBase.extensions

Return the file extensions associated with this class.

PointCellDataSelection.number_cell_arrays

Return the number of cell arrays.

PointCellDataSelection.number_point_arrays

Return the number of point arrays.

BaseReader.path

Return or set the filename or directory of the reader.

PointCellDataSelection.point_array_names

Return the list of all point array names.

BaseReader.reader

Return the vtk Reader object.

Methods#

CGNSReader.base_array_status(name)

Get status of base array with name.

CGNSReader.disable_all_bases()

Disable reading all bases.

CGNSReader.disable_all_families()

Disable reading all families.

CGNSReader.enable_all_bases()

Enable reading all bases.

CGNSReader.enable_all_families()

Enable reading all families.

CGNSReader.family_array_status(name)

Get status of family array with name.

Inherited Methods#

PointCellDataSelection.cell_array_status

Get status of cell array with name.

PointCellDataSelection.disable_all_cell_arrays

Disable all cell arrays.

PointCellDataSelection.disable_all_point_arrays

Disable all point arrays.

PointCellDataSelection.disable_cell_array

Disable cell array with name.

PointCellDataSelection.disable_point_array

Disable point array with name.

PointCellDataSelection.enable_all_cell_arrays

Enable all cell arrays.

PointCellDataSelection.enable_all_point_arrays

Enable all point arrays.

PointCellDataSelection.enable_cell_array

Enable cell array with name.

PointCellDataSelection.enable_point_array

Enable point array with name.

BaseReader.hide_progress

Hide the progress bar when loading the file.

PointCellDataSelection.point_array_status

Get status of point array with name.

BaseReader.read

Read data in file.

BaseReader.show_progress

Show a progress bar when loading the file.