├── generate
├── __init__.py
└── generate_colormaps.py
├── custom_nodes
├── __init__.py
├── VTKReaders.py
├── VTKSources.py
└── VTKWriters.py
├── generated_nodes
├── __init__.py
└── gen_VTKIntegrator.py
├── examples_data
├── cubeflow
│ ├── 0
│ │ ├── p
│ │ └── U
│ ├── case.foam
│ ├── constant
│ │ └── polyMesh
│ │ │ ├── cellZones
│ │ │ ├── faceZones
│ │ │ ├── pointZones
│ │ │ ├── boundary
│ │ │ ├── neighbour
│ │ │ ├── points
│ │ │ └── owner
│ ├── 0.1
│ │ ├── uniform
│ │ │ └── time
│ │ ├── p
│ │ ├── U
│ │ └── phi
│ ├── 0.2
│ │ ├── uniform
│ │ │ └── time
│ │ ├── p
│ │ ├── U
│ │ └── phi
│ ├── 0.3
│ │ ├── uniform
│ │ │ └── time
│ │ ├── p
│ │ ├── U
│ │ └── phi
│ ├── 0.4
│ │ ├── uniform
│ │ │ └── time
│ │ ├── p
│ │ ├── U
│ │ └── phi
│ └── 0.5
│ │ ├── uniform
│ │ └── time
│ │ ├── p
│ │ ├── U
│ │ └── phi
├── postq.bin
├── postxyz.bin
├── kitchenflow.vtk
├── office.binary.vtk
├── volume_00005.vdb
├── kitchenforniture.vtk
└── FullHead.mhd
├── test
├── test_addon_importable.py
├── blend_files
│ ├── test_template.blend
│ └── test_global_time_keeper.blend
├── install_blender.sh
├── install_bvtk.sh
├── test_global_time_keeper.py
├── test_blender_script.py
├── json_files
│ ├── test_clip.json
│ └── test_head.json
└── test_main.py
├── b_properties.py
├── docs
├── requirements.txt
├── images
│ ├── isosurfaces.png
│ ├── workspace.png
│ ├── editor_selection.png
│ ├── ug_glyphs_result.png
│ ├── global_time_keeper.png
│ ├── ug_contour_result.png
│ ├── ug_boundary_nodesetup.png
│ ├── ug_contour_nodesetup.png
│ ├── ug_cubeflow_geometry.png
│ ├── ug_cut_plane_result.png
│ ├── ug_glyphs_nodesetup.png
│ ├── ug_isosurface_result.png
│ ├── ug_reader_nodesetup.png
│ ├── ug_volumetrics_result.png
│ ├── ug_cut_plane_nodesetup.png
│ ├── ug_isosurface_nodesetup.png
│ ├── ug_stream_tracers_result.png
│ ├── ug_volumetrics_nodesetup.png
│ ├── vtk_to_blender_mesh_node.png
│ ├── ug_stream_tracers_nodesetup.png
│ ├── ug_array_calculator_nodesetup.png
│ └── ug_extract_boundary_patch_nodesetup.png
├── index.rst
├── Makefile
├── whats_new.rst
├── development.rst
└── conf.py
├── .readthedocs.yml
├── favorites_data.py
├── CONTRIBUTORS.md
├── .github
└── workflows
│ └── blender-tests.yml
├── .gitignore
├── pip_install_vtk.md
├── favorites.py
├── README.md
├── utils
└── convert_to_vdb.py
├── showhide_properties.py
├── examples
├── cubeflow_boundary_patch.json
├── cubeflow_base_boundary.json
└── clip.json
├── info.py
├── b_inspect.py
└── cache.py
/generate/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/custom_nodes/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/generated_nodes/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/case.foam:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/test_addon_importable.py:
--------------------------------------------------------------------------------
1 | import BVtkNodes
2 |
--------------------------------------------------------------------------------
/b_properties.py:
--------------------------------------------------------------------------------
1 | b={ 'BVTK_Node_VTKToBlenderType': [True, True],
2 | }
3 |
--------------------------------------------------------------------------------
/custom_nodes/VTKReaders.py:
--------------------------------------------------------------------------------
1 | from ..generated_nodes.gen_VTKReaders import *
2 |
--------------------------------------------------------------------------------
/custom_nodes/VTKSources.py:
--------------------------------------------------------------------------------
1 | from ..generated_nodes.gen_VTKSources import *
2 |
--------------------------------------------------------------------------------
/custom_nodes/VTKWriters.py:
--------------------------------------------------------------------------------
1 | from ..generated_nodes.gen_VTKWriters import *
2 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinx==7.1.2
2 | sphinx-rtd-theme==1.3.0rc1
3 |
4 |
--------------------------------------------------------------------------------
/examples_data/postq.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/examples_data/postq.bin
--------------------------------------------------------------------------------
/docs/images/isosurfaces.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/isosurfaces.png
--------------------------------------------------------------------------------
/docs/images/workspace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/workspace.png
--------------------------------------------------------------------------------
/examples_data/postxyz.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/examples_data/postxyz.bin
--------------------------------------------------------------------------------
/examples_data/kitchenflow.vtk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/examples_data/kitchenflow.vtk
--------------------------------------------------------------------------------
/docs/images/editor_selection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/editor_selection.png
--------------------------------------------------------------------------------
/docs/images/ug_glyphs_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_glyphs_result.png
--------------------------------------------------------------------------------
/examples_data/office.binary.vtk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/examples_data/office.binary.vtk
--------------------------------------------------------------------------------
/examples_data/volume_00005.vdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/examples_data/volume_00005.vdb
--------------------------------------------------------------------------------
/docs/images/global_time_keeper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/global_time_keeper.png
--------------------------------------------------------------------------------
/docs/images/ug_contour_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_contour_result.png
--------------------------------------------------------------------------------
/examples_data/kitchenforniture.vtk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/examples_data/kitchenforniture.vtk
--------------------------------------------------------------------------------
/docs/images/ug_boundary_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_boundary_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/ug_contour_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_contour_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/ug_cubeflow_geometry.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_cubeflow_geometry.png
--------------------------------------------------------------------------------
/docs/images/ug_cut_plane_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_cut_plane_result.png
--------------------------------------------------------------------------------
/docs/images/ug_glyphs_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_glyphs_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/ug_isosurface_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_isosurface_result.png
--------------------------------------------------------------------------------
/docs/images/ug_reader_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_reader_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/ug_volumetrics_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_volumetrics_result.png
--------------------------------------------------------------------------------
/test/blend_files/test_template.blend:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/test/blend_files/test_template.blend
--------------------------------------------------------------------------------
/docs/images/ug_cut_plane_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_cut_plane_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/ug_isosurface_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_isosurface_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/ug_stream_tracers_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_stream_tracers_result.png
--------------------------------------------------------------------------------
/docs/images/ug_volumetrics_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_volumetrics_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/vtk_to_blender_mesh_node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/vtk_to_blender_mesh_node.png
--------------------------------------------------------------------------------
/docs/images/ug_stream_tracers_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_stream_tracers_nodesetup.png
--------------------------------------------------------------------------------
/docs/images/ug_array_calculator_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_array_calculator_nodesetup.png
--------------------------------------------------------------------------------
/test/blend_files/test_global_time_keeper.blend:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/test/blend_files/test_global_time_keeper.blend
--------------------------------------------------------------------------------
/docs/images/ug_extract_boundary_patch_nodesetup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tkeskita/BVtkNodes/HEAD/docs/images/ug_extract_boundary_patch_nodesetup.png
--------------------------------------------------------------------------------
/test/install_blender.sh:
--------------------------------------------------------------------------------
1 | wget https://ftp.nluug.nl/pub/graphics/blender/release/Blender3.3/blender-3.3.3-linux-x64.tar.xz
2 | mkdir $PWD/blender
3 | tar -xvf blender-3.3.3-linux-x64.tar.xz -C $PWD/blender --strip-components=1
4 | #cd blender
5 |
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | # Read the Docs configuration file
2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3 | version: "2"
4 |
5 | build:
6 | os: "ubuntu-22.04"
7 | tools:
8 | python: "3.10"
9 |
10 | python:
11 | install:
12 | - requirements: docs/requirements.txt
13 |
14 | sphinx:
15 | configuration: docs/conf.py
16 |
--------------------------------------------------------------------------------
/examples_data/FullHead.mhd:
--------------------------------------------------------------------------------
1 | ObjectType = Image
2 | NDims = 3
3 | BinaryData = True
4 | BinaryDataByteOrderMSB = False
5 | CompressedData = False
6 | TransformMatrix = -1 0 0 0 1 0 0 0 -1
7 | Offset = 0 0 0
8 | CenterOfRotation = 0 0 0
9 | AnatomicalOrientation = LAS
10 | ElementSpacing = 0.9375 0.9375 1.5
11 | ITK_InputFilterName = MetaImageIO
12 | DimSize = 256 256 94
13 | ElementType = MET_SHORT
14 | ElementDataFile = /home/lorenzo/Downloads/FullHead.raw
15 |
--------------------------------------------------------------------------------
/favorites_data.py:
--------------------------------------------------------------------------------
1 | favorites = [
2 | ('BVTK_Node_VTKToBlenderMeshType', 'VTK To Blender Mesh'),
3 | ('BVTK_Node_InfoType', 'Info'),
4 | ('BVTK_Node_ColorMapperType', 'Color Mapper'),
5 | ('BVTK_Node_ColorRampType', 'Color Ramp'),
6 | ('BVTK_Node_MultiBlockLeafType', 'Multi Block Leaf'),
7 | ('BVTK_Node_TimeSelectorType', 'Time Selector'),
8 | ('BVTK_Node_ImageDataObjectSourceType', 'VTKImageData Object Source'),
9 | ('BVTK_Node_CustomFilterType', 'Custom Filter')
10 | ]
11 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. BVTKNodes documentation master file, created by
2 | sphinx-quickstart on Mon Mar 2 07:59:52 2020.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to BVTKNodes's documentation!
7 | =====================================
8 |
9 | .. toctree::
10 | :maxdepth: 2
11 | :caption: Contents:
12 |
13 | BVTKNodes.rst
14 | ug_nodes.rst
15 | development.rst
16 | whats_new.rst
17 |
--------------------------------------------------------------------------------
/test/install_bvtk.sh:
--------------------------------------------------------------------------------
1 | #Dependencies in pip
2 | $PWD/blender/3.3/python/bin/python3.10 -m ensurepip
3 | $PWD/blender/3.3/python/bin/python3.10 -m pip install --upgrade pip
4 | $PWD/blender/3.3/python/bin/python3.10 -m pip install vtk==9.2.2 pyvista
5 |
6 | #Disable vtkRenderingMatplotlib
7 | sed -i 's/from\ \.vtkRenderingMatplotlib\ import/\#from\ \.vtkRenderingMatplotlib\ import/g' $PWD/blender/3.3/python/lib/python3.10/site-packages/vtkmodules/all.py
8 |
9 | #Install the addon
10 | mkdir $PWD/blender/3.3/scripts/addons/BVtkNodes
11 | unzip BVtkNodes.zip -d $PWD/blender/3.3/scripts/addons/BVtkNodes
12 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SOURCEDIR = .
8 | BUILDDIR = _build
9 |
10 | # Put it first so that "make" without argument is like "make help".
11 | help:
12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13 |
14 | .PHONY: help Makefile
15 |
16 | # Catch-all target: route all unknown targets to Sphinx using the new
17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18 | %: Makefile
19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/examples_data/cubeflow/constant/polyMesh/cellZones:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class regIOobject;
13 | location "constant/polyMesh";
14 | object cellZones;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | 0
19 | ()
20 |
21 | // ************************************************************************* //
22 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/constant/polyMesh/faceZones:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class regIOobject;
13 | location "constant/polyMesh";
14 | object faceZones;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | 0
19 | ()
20 |
21 | // ************************************************************************* //
22 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/constant/polyMesh/pointZones:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class regIOobject;
13 | location "constant/polyMesh";
14 | object pointZones;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | 0
19 | ()
20 |
21 | // ************************************************************************* //
22 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.1/uniform/time:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class dictionary;
13 | location "0.1/uniform";
14 | object time;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | value 0.100000000000000019;
19 |
20 | name "0.1";
21 |
22 | index 20;
23 |
24 | deltaT 0.005;
25 |
26 | deltaT0 0.005;
27 |
28 |
29 | // ************************************************************************* //
30 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.2/uniform/time:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class dictionary;
13 | location "0.2/uniform";
14 | object time;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | value 0.200000000000000094;
19 |
20 | name "0.2";
21 |
22 | index 40;
23 |
24 | deltaT 0.005;
25 |
26 | deltaT0 0.005;
27 |
28 |
29 | // ************************************************************************* //
30 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.3/uniform/time:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class dictionary;
13 | location "0.3/uniform";
14 | object time;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | value 0.300000000000000155;
19 |
20 | name "0.3";
21 |
22 | index 60;
23 |
24 | deltaT 0.005;
25 |
26 | deltaT0 0.005;
27 |
28 |
29 | // ************************************************************************* //
30 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.4/uniform/time:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class dictionary;
13 | location "0.4/uniform";
14 | object time;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | value 0.400000000000000244;
19 |
20 | name "0.4";
21 |
22 | index 80;
23 |
24 | deltaT 0.005;
25 |
26 | deltaT0 0.005;
27 |
28 |
29 | // ************************************************************************* //
30 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.5/uniform/time:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class dictionary;
13 | location "0.5/uniform";
14 | object time;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | value 0.500000000000000333;
19 |
20 | name "0.5";
21 |
22 | index 100;
23 |
24 | deltaT 0.005;
25 |
26 | deltaT0 0.005;
27 |
28 |
29 | // ************************************************************************* //
30 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0/p:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volScalarField;
13 | location "0";
14 | object p;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 2 -2 0 0 0 0];
19 |
20 | internalField uniform 0;
21 |
22 | boundaryField
23 | {
24 | wall
25 | {
26 | type zeroGradient;
27 | }
28 | inlet
29 | {
30 | type zeroGradient;
31 | }
32 | outlet
33 | {
34 | type fixedValue;
35 | value uniform 0;
36 | }
37 | }
38 |
39 |
40 | // ************************************************************************* //
41 |
--------------------------------------------------------------------------------
/CONTRIBUTORS.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ### BVTKNodes Contributors [(current fork)](https://github.com/tkeskita/BVtkNodes)
5 |
6 | [
](https://github.com/tkeskita) |[
](https://github.com/NickGeneva) |[
](https://github.com/thomgrand) |[
](https://github.com/Staars) |
7 | :---:|:---:|:---:|:---:|
8 | [tkeskita](https://github.com/tkeskita)|[NickGeneva](https://github.com/NickGeneva)|[thomgrand](https://github.com/thomgrand)|[Staars](https://github.com/Staars)
9 |
10 | ### Legacy Contributors [(original repository)](https://github.com/simboden/BVtkNodes)
11 |
12 | [Silvano Imboden](https://github.com/simboden), Lorenzo Celli, Paul Mc Manus
--------------------------------------------------------------------------------
/examples_data/cubeflow/0/U:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volVectorField;
13 | location "0";
14 | object U;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 1 -1 0 0 0 0];
19 |
20 | internalField uniform (0 0 0);
21 |
22 | boundaryField
23 | {
24 | wall
25 | {
26 | type noSlip;
27 | }
28 | inlet
29 | {
30 | type fixedValue;
31 | value uniform (0 0.1 0);
32 | }
33 | outlet
34 | {
35 | type pressureInletOutletVelocity;
36 | value uniform (0 0 0);
37 | }
38 | }
39 |
40 |
41 | // ************************************************************************* //
42 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/constant/polyMesh/boundary:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class polyBoundaryMesh;
13 | location "constant/polyMesh";
14 | object boundary;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | 3
19 | (
20 | wall
21 | {
22 | type default;
23 | nFaces 142;
24 | startFace 300;
25 | }
26 | inlet
27 | {
28 | type default;
29 | nFaces 4;
30 | startFace 442;
31 | }
32 | outlet
33 | {
34 | type default;
35 | nFaces 4;
36 | startFace 446;
37 | }
38 | )
39 |
40 | // ************************************************************************* //
41 |
--------------------------------------------------------------------------------
/.github/workflows/blender-tests.yml:
--------------------------------------------------------------------------------
1 | ###########################################################
2 | ## This file is used by github to execute the
3 | ## continuous integration tests automatically
4 | ## For more information on github actions, visit
5 | ## https://docs.github.com/en/actions
6 |
7 |
8 | name: CI Tests
9 |
10 | on:
11 | push:
12 | branches: [ master, ci ]
13 | pull_request:
14 | branches: [ master, ci ]
15 |
16 | jobs:
17 |
18 | run_ci:
19 |
20 | runs-on: ubuntu-latest
21 | strategy:
22 | fail-fast: false
23 | matrix:
24 | python-version: ["3.10"]
25 |
26 | steps:
27 | - uses: actions/checkout@v2
28 | - name: Set up Python ${{ matrix.python-version }}
29 | uses: actions/setup-python@v2
30 | with:
31 | python-version: ${{ matrix.python-version }}
32 | - name: Install dependencies of the test environment
33 | run: |
34 | python -m pip install --upgrade pip
35 | python -m pip install numpy vtk==9.2.6 pyvista==0.42.3
36 | - name: Install the library
37 | run: |
38 | #Zip addon before downloading blender
39 | zip -r BVtkNodes.zip .
40 |
41 | #Install blender and the addon
42 | sh test/install_blender.sh
43 | sh test/install_bvtk.sh
44 |
45 | - name: Run the tests
46 | run: |
47 | export BLENDER_PATH="$PWD/blender/blender"
48 | python test/test_main.py
49 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 |
50 | # Translations
51 | *.mo
52 | *.pot
53 |
54 | # Django stuff:
55 | *.log
56 | local_settings.py
57 | db.sqlite3
58 |
59 | # Flask stuff:
60 | instance/
61 | .webassets-cache
62 |
63 | # Scrapy stuff:
64 | .scrapy
65 |
66 | # Sphinx documentation
67 | docs/_build/
68 |
69 | # PyBuilder
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # pyenv
76 | .python-version
77 |
78 | # celery beat schedule file
79 | celerybeat-schedule
80 |
81 | # SageMath parsed files
82 | *.sage.py
83 |
84 | # Environments
85 | .env
86 | .venv
87 | env/
88 | venv/
89 | ENV/
90 | env.bak/
91 | venv.bak/
92 |
93 | # Spyder project settings
94 | .spyderproject
95 | .spyproject
96 |
97 | # Rope project settings
98 | .ropeproject
99 |
100 | # mkdocs documentation
101 | /site
102 |
103 | # mypy
104 | .mypy_cache/
105 |
106 | # Emacs
107 | *~
108 |
109 | vtklog.txt
110 | vtkdb.sqlite
111 |
--------------------------------------------------------------------------------
/pip_install_vtk.md:
--------------------------------------------------------------------------------
1 | # Installation of VTK in Blender 3.6 Python via Pip
2 |
3 | Note: These instructions also likely work for other Blender and VTK
4 | versions, but the versions applied below are the ones used as an example.
5 |
6 | # On Windows
7 |
8 | Run CMD.EXE as administrator and run commands
9 | ```
10 | cd C:\Program Files\Blender Foundation\Blender\3.6\python\bin
11 | .\python.exe -m ensurepip
12 | .\python.exe -m pip install vtk==9.2.6
13 | ```
14 | or if you need to install newest (possibly unsupported) version of vtk, replace last command with
15 | ```
16 | .\python.exe -m pip install vtk
17 | ```
18 |
19 | # On Linux
20 |
21 | Run on normal terminal commands
22 | ```
23 | cd /path/to/blender-3.6/3.6/python/bin
24 | ./python3.10 -m ensurepip
25 | ./python3.10 -m pip install vtk==9.2.6
26 | ```
27 | or if you need to install newest (possibly unsupported) version of vtk, replace last command with
28 | ```
29 | ./python3.10 -m pip install vtk
30 | ```
31 |
32 | # Testing
33 |
34 | You can test if VTK is found in
35 | [Blender Python Console](https://docs.blender.org/manual/en/latest/editors/python_console.html)
36 | (by default located in the Scripting
37 | [workspace](https://docs.blender.org/manual/en/latest/interface/window_system/workspaces.html)
38 | ) with commands
39 |
40 | ```
41 | import vtk
42 | vtk.vtkVersion().GetVTKVersion()
43 | ```
44 |
45 | which should return VTK version number that was installed.
46 |
47 |
48 | # Workaround for VTK Import Error on Linux
49 |
50 | Blender 2.93 and newer has an issue on Linux, where running `import vtk` command in Blender Python Console raises error
51 |
52 | ```
53 | ImportError: /path/to/blender/X.Y/python/lib/python3.Z/site-packages/vtkmodules/libvtkPythonInterpreter-9.0.so: undefined symbol: Py_Main
54 | ```
55 |
56 | Workaround for this issue is to edit file
57 | `/path/to/blender/X.Y/python/lib/pythonZ/site-packages/vtkmodules/all.py`
58 | and disable import of `vtkRenderingMatplotlib` by commenting out the line like so:
59 |
60 | ```
61 | # from .vtkRenderingMatplotlib import *
62 | ```
63 |
64 | **Note!** Blender 3.3 and newer need the same modification of file
65 | `/path/to/blender/X.Y/python/lib/pythonZ/site-packages/vtk.py`:
66 |
67 | ```
68 | # from .vtkRenderingMatplotlib import *
69 | ```
70 |
--------------------------------------------------------------------------------
/test/test_global_time_keeper.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import argparse
3 | import sys
4 | import os
5 | import numpy as np
6 |
7 | sys.path.append(os.path.dirname(__file__))
8 | from test_blender_script import check_node_statuses, assert_quit
9 |
10 |
11 | def check_cone_validity(cone_node, cone_mesh):
12 | vertices = np.zeros(shape=[len(cone_mesh.data.vertices), 3])
13 | cone_mesh.data.vertices.foreach_get("co", vertices.reshape([-1]))
14 | center = np.array(cone_node.m_Center)
15 | direction = np.array(cone_node.m_Direction)
16 | height = cone_node.m_Height
17 | radius = cone_node.m_Radius
18 | circle_center = center - direction / 2
19 | assert_quit(
20 | np.isclose(np.linalg.norm(circle_center - vertices[0]), height, atol=1e-4),
21 | "The cone had not the expected height of %f" % (height),
22 | )
23 | assert_quit(
24 | np.allclose(
25 | np.linalg.norm(vertices[1:] - circle_center[np.newaxis], axis=-1),
26 | radius,
27 | atol=1e-4,
28 | ),
29 | "The cone had not the expected radius of %f" % (radius),
30 | )
31 |
32 |
33 | def test_frame_updates():
34 |
35 | node_tree = bpy.data.node_groups["NodeTree"]
36 | cone_node = node_tree.nodes["vtkConeSource"]
37 | cone_mesh = bpy.data.objects["mesh"]
38 | keyframes = np.concatenate(
39 | [np.linspace(0.5, 0.5, num=4), np.linspace(0.5, 2.5, num=6)]
40 | )
41 |
42 | for frame in range(1, 11):
43 | print("Testing frame %d" % frame)
44 | keyframe = keyframes[frame - 1]
45 | bpy.context.scene.frame_current = frame
46 | bpy.context.view_layer.update()
47 | check_cone_validity(cone_node, cone_mesh)
48 | assert_quit(
49 | np.isclose(cone_node.m_Radius, keyframe),
50 | "The radius of the cone node was not successfully update after changing to frame %d (expected value %f, actual value %f)"
51 | % (frame, keyframe, cone_node.m_Radius),
52 | )
53 |
54 |
55 | if __name__ == "__main__":
56 | try:
57 | check_node_statuses()
58 | test_frame_updates()
59 | except Exception as ex:
60 | print(str(ex), file=sys.stderr)
61 | sys.exit(1)
62 |
63 | # Success - Quit
64 | sys.exit(0)
65 |
--------------------------------------------------------------------------------
/generated_nodes/gen_VTKIntegrator.py:
--------------------------------------------------------------------------------
1 | # Generated definitions for VTK class group: Integrator
2 | # VTK version: 9.2.6
3 |
4 | from ..core import *
5 | TYPENAMES = []
6 |
7 | #--------------------------------------------------------------
8 | class VTKRungeKutta2(Node, BVTK_Node):
9 |
10 | bl_idname = 'VTKRungeKutta2Type'
11 | bl_label = 'vtkRungeKutta2'
12 |
13 | m_ObjectName: bpy.props.StringProperty(name='ObjectName', default="", update=BVTK_Node.outdate_vtk_status)
14 |
15 | b_properties: bpy.props.BoolVectorProperty(name="", size=1, get=BVTK_Node.get_b, set=BVTK_Node.set_b)
16 |
17 | def m_properties( self ):
18 | return ['m_ObjectName',]
19 | def m_connections( self ):
20 | return ([], [], ['FunctionSet'], ['self'])
21 |
22 | add_class( VTKRungeKutta2 )
23 | TYPENAMES.append('VTKRungeKutta2Type' )
24 |
25 | #--------------------------------------------------------------
26 | class VTKRungeKutta4(Node, BVTK_Node):
27 |
28 | bl_idname = 'VTKRungeKutta4Type'
29 | bl_label = 'vtkRungeKutta4'
30 |
31 | m_ObjectName: bpy.props.StringProperty(name='ObjectName', default="", update=BVTK_Node.outdate_vtk_status)
32 |
33 | b_properties: bpy.props.BoolVectorProperty(name="", size=1, get=BVTK_Node.get_b, set=BVTK_Node.set_b)
34 |
35 | def m_properties( self ):
36 | return ['m_ObjectName',]
37 | def m_connections( self ):
38 | return ([], [], ['FunctionSet'], ['self'])
39 |
40 | add_class( VTKRungeKutta4 )
41 | TYPENAMES.append('VTKRungeKutta4Type' )
42 |
43 | #--------------------------------------------------------------
44 | class VTKRungeKutta45(Node, BVTK_Node):
45 |
46 | bl_idname = 'VTKRungeKutta45Type'
47 | bl_label = 'vtkRungeKutta45'
48 |
49 | m_ObjectName: bpy.props.StringProperty(name='ObjectName', default="", update=BVTK_Node.outdate_vtk_status)
50 |
51 | b_properties: bpy.props.BoolVectorProperty(name="", size=1, get=BVTK_Node.get_b, set=BVTK_Node.set_b)
52 |
53 | def m_properties( self ):
54 | return ['m_ObjectName',]
55 | def m_connections( self ):
56 | return ([], [], ['FunctionSet'], ['self'])
57 |
58 | add_class( VTKRungeKutta45 )
59 | TYPENAMES.append('VTKRungeKutta45Type' )
60 |
61 | #--------------------------------------------------------------
62 | menu_items = [ NodeItem(x) for x in TYPENAMES ]
63 | CATEGORIES.append( BVTK_NodeCategory( 'Integrator', 'Integrator', items=menu_items) )
--------------------------------------------------------------------------------
/favorites.py:
--------------------------------------------------------------------------------
1 | from .core import *
2 | from . import favorites_data
3 |
4 | # -----------------------------------------------------------------------------
5 | # Favorites panel
6 | # -----------------------------------------------------------------------------
7 |
8 | # Favorites must be an array of (node.bl_idname, node.bl_label) tuples
9 | favorites = favorites_data.favorites
10 | favorites_file = favorites_data.__file__
11 |
12 |
13 | class BVTK_PT_Favorites(bpy.types.Panel):
14 | """BVTK Favorites Panel"""
15 |
16 | bl_label = "Favorites"
17 | bl_space_type = "NODE_EDITOR"
18 | bl_region_type = "UI"
19 | bl_category = "Favorites"
20 |
21 | @classmethod
22 | def poll(cls, context):
23 | return context.space_data.tree_type == "BVTK_NodeTreeType"
24 |
25 | def draw(self, context):
26 | global favorites
27 | active_node = context.active_node
28 | layout = self.layout
29 | # Button to add active node to favorites
30 | if active_node:
31 | add = layout.operator(
32 | "node.bvtk_update_favorites", icon="ZOOM_IN", text=active_node.bl_label
33 | )
34 | add.label = active_node.bl_label
35 | add.type = active_node.bl_idname
36 | layout.separator()
37 | # Favorites buttons
38 | for f in favorites:
39 | row = layout.row(align=True)
40 | remove = row.operator(
41 | "node.bvtk_update_favorites", icon="PANEL_CLOSE", text=""
42 | )
43 | remove.label = f[1]
44 | remove.type = f[0]
45 | remove.remove = True
46 | op = row.operator("node.add_node", text=f[1])
47 | op.type = f[0]
48 | op.use_transform = True
49 |
50 |
51 | class BVTK_OT_UpdateFavorites(bpy.types.Operator):
52 | """Update favorites operator"""
53 |
54 | bl_idname = "node.bvtk_update_favorites"
55 | bl_label = "add/remove favorites"
56 |
57 | remove: bpy.props.BoolProperty(default=False)
58 | label: bpy.props.StringProperty()
59 | type: bpy.props.StringProperty()
60 |
61 | def execute(self, context):
62 | global favorites
63 | global favorites_file
64 | fav = (self.type, self.label)
65 | if self.remove:
66 | favorites.remove(fav)
67 | else:
68 | if fav in favorites:
69 | self.report({"INFO"}, "Already in favorites")
70 | return {"FINISHED"}
71 | favorites.append(fav)
72 | open(favorites_file, "w").write(
73 | "favorites = " + repr(favorites).replace("),", "),\n")
74 | )
75 | self.remove = False
76 | return {"FINISHED"}
77 |
78 |
79 | add_ui_class(BVTK_PT_Favorites)
80 | add_ui_class(BVTK_OT_UpdateFavorites)
81 |
--------------------------------------------------------------------------------
/generate/generate_colormaps.py:
--------------------------------------------------------------------------------
1 | import matplotlib
2 | import matplotlib.pyplot as plt
3 | import json
4 | import numpy as np
5 |
6 |
7 | class NDArrayEncoder(json.JSONEncoder):
8 | def default(self, obj):
9 | if isinstance(obj, np.ndarray):
10 | return np.array_str(obj, precision=6)
11 | return super(NDArrayEncoder, self).default(obj)
12 |
13 |
14 | # https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html
15 |
16 | cmaps = {}
17 |
18 | cmaps["perc_sequential"] = ["viridis", "plasma", "inferno", "magma", "cividis"]
19 |
20 | cmaps["sequential"] = [
21 | "Greys",
22 | "Purples",
23 | "Blues",
24 | "Greens",
25 | "Oranges",
26 | "Reds",
27 | "YlOrBr",
28 | "YlOrRd",
29 | "OrRd",
30 | "PuRd",
31 | "RdPu",
32 | "BuPu",
33 | "GnBu",
34 | "PuBu",
35 | "YlGnBu",
36 | "PuBuGn",
37 | "BuGn",
38 | "YlGn",
39 | ]
40 |
41 | cmaps["diverging"] = [
42 | "PiYG",
43 | "PRGn",
44 | "BrBG",
45 | "PuOr",
46 | "RdGy",
47 | "RdBu",
48 | "RdYlBu",
49 | "RdYlGn",
50 | "Spectral",
51 | "coolwarm",
52 | "bwr",
53 | "seismic",
54 | ]
55 | cmaps["cyclic"] = ["twilight", "twilight_shifted", "hsv"]
56 | cmaps["qualitative"] = [
57 | "Pastel1",
58 | "Pastel2",
59 | "Paired",
60 | "Accent",
61 | "Dark2",
62 | "Set1",
63 | "Set2",
64 | "Set3",
65 | "tab10",
66 | "tab20",
67 | "tab20b",
68 | "tab20c",
69 | ]
70 | cmaps["misc"] = [
71 | "flag",
72 | "prism",
73 | "ocean",
74 | "gist_earth",
75 | "terrain",
76 | "gist_stern",
77 | "gnuplot",
78 | "gnuplot2",
79 | "CMRmap",
80 | "cubehelix",
81 | "brg",
82 | "gist_rainbow",
83 | "rainbow",
84 | "jet",
85 | "nipy_spectral",
86 | "gist_ncar",
87 | ]
88 |
89 | cmaps_keys = list(cmaps.keys())
90 | cmap_rgb_filename = "colormaps/colormaps_rgb.json"
91 | cmap_hsv_filename = "colormaps/colormaps_hsv.json"
92 |
93 | if __name__ == "__main__":
94 |
95 | all_cmaps_rgb = {}
96 | all_cmaps_hsv = {}
97 |
98 | # We remove the initial classification between the different colormaps and save them in a flat format
99 | for key, val in cmaps.items():
100 | for single_map in val:
101 | cmap = plt.cm.get_cmap(single_map)
102 |
103 | colors = cmap(np.linspace(0, 1, num=64))
104 | assert np.allclose(
105 | colors[..., -1], 1.0
106 | ) # Check that alpha channel is 1 and remove it
107 | colors = colors[..., :-1]
108 | all_cmaps_rgb[single_map] = colors.tolist()
109 | all_cmaps_hsv[single_map] = matplotlib.colors.rgb_to_hsv(colors).tolist()
110 |
111 | for cmap_filename, all_cmaps in zip(
112 | [cmap_rgb_filename, cmap_hsv_filename], [all_cmaps_rgb, all_cmaps_hsv]
113 | ):
114 | json_str = json.dumps(all_cmaps, indent=2)
115 | with open(cmap_filename, "w") as f:
116 | f.write(json_str)
117 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.5/p:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volScalarField;
13 | location "0.5";
14 | object p;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 2 -2 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | 0.0219403
24 | 0.0204281
25 | 0.0218272
26 | 0.0218272
27 | 0.0206145
28 | 0.0238654
29 | 0.0206145
30 | 0.0211567
31 | 0.0213467
32 | 0.0211567
33 | 0.0198661
34 | 0.0243344
35 | 0.0203703
36 | 0.0225316
37 | 0.0243344
38 | 0.0198661
39 | 0.0205677
40 | 0.020798
41 | 0.020798
42 | 0.0205677
43 | 0.0196521
44 | 0.0208572
45 | 0.0195556
46 | 0.023326
47 | 0.0246004
48 | 0.0195556
49 | 0.0310755
50 | 0.023326
51 | 0.0208572
52 | 0.0196521
53 | 0.0206664
54 | 0.0188032
55 | 0.021768
56 | 0.0188032
57 | 0.0206664
58 | 0.0196941
59 | 0.0218186
60 | 0.0177633
61 | 0.0190571
62 | 0.0211873
63 | 0.0203099
64 | 0.0294739
65 | 0.0239404
66 | 0.0211873
67 | 0.0177633
68 | 0.0294739
69 | 0.0190571
70 | 0.0218186
71 | 0.0196941
72 | 0.0191642
73 | 0.0204353
74 | 0.0204353
75 | 0.0191642
76 | 0.021002
77 | 0.0179031
78 | 0.0207335
79 | 0.0214084
80 | 0.0190436
81 | 0.016486
82 | 0.0195967
83 | 0.021043
84 | 0.0190436
85 | 0.0282776
86 | 0.0195967
87 | 0.0214084
88 | 0.0179031
89 | 0.016486
90 | 0.0207335
91 | 0.021002
92 | 0.0211204
93 | 0.012701
94 | 0.0211204
95 | 0.0198267
96 | 0.0207234
97 | 0.019528
98 | 0.0222711
99 | 0.0204676
100 | 0.021301
101 | 0.0107818
102 | 0.0174738
103 | 0.0192427
104 | 0.021301
105 | 0.019528
106 | 0.0174738
107 | 0.0204676
108 | 0.0207234
109 | 0.0222711
110 | 0.0198267
111 | 0.0143945
112 | 0.0143945
113 | 0.0200583
114 | 0.0195892
115 | 0.0215657
116 | 0.0111869
117 | 0.0224819
118 | 0.0194876
119 | 0.0202721
120 | 0.0111869
121 | 0.0182994
122 | 0.0194876
123 | 0.0215657
124 | 0.0224819
125 | 0.0195892
126 | 0.0200583
127 | 0.0162917
128 | 0.0202954
129 | 0.0196068
130 | 0.0207223
131 | 0.0117286
132 | 0.0200618
133 | 0.0177266
134 | 0.0207223
135 | 0.0200618
136 | 0.0196068
137 | 0.0202954
138 | 0.0199309
139 | 0.0177554
140 | 0.0214456
141 | 0.0202073
142 | 0.0177554
143 | 0.0199309
144 | 0.0198354
145 | 0.0180946
146 | 0.0198354
147 | 0.0199739
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type zeroGradient;
156 | }
157 | inlet
158 | {
159 | type zeroGradient;
160 | }
161 | outlet
162 | {
163 | type fixedValue;
164 | value uniform 0;
165 | }
166 | }
167 |
168 |
169 | // ************************************************************************* //
170 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.1/p:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volScalarField;
13 | location "0.1";
14 | object p;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 2 -2 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | 0.0339276
24 | 0.0333053
25 | 0.0334929
26 | 0.0334929
27 | 0.0337367
28 | 0.0418905
29 | 0.0337367
30 | 0.0316737
31 | 0.032755
32 | 0.0316737
33 | 0.030584
34 | 0.0431806
35 | 0.0335892
36 | 0.0158286
37 | 0.0431806
38 | 0.030584
39 | 0.0289808
40 | 0.0315158
41 | 0.0315158
42 | 0.0289808
43 | 0.02863
44 | 0.0310024
45 | 0.0308213
46 | 0.0244984
47 | 0.0434097
48 | 0.0308213
49 | 0.0448273
50 | 0.0244984
51 | 0.0310024
52 | 0.02863
53 | 0.0293244
54 | 0.0235606
55 | 0.0369192
56 | 0.0235606
57 | 0.0293244
58 | 0.0284665
59 | 0.0302962
60 | 0.0243532
61 | 0.0208041
62 | 0.0317083
63 | 0.0332176
64 | 0.0606479
65 | 0.0307212
66 | 0.0317083
67 | 0.0243532
68 | 0.0606479
69 | 0.0208041
70 | 0.0302962
71 | 0.0284665
72 | 0.0245856
73 | 0.036949
74 | 0.036949
75 | 0.0245856
76 | 0.0294302
77 | 0.0243081
78 | 0.0294802
79 | 0.0294085
80 | 0.0308351
81 | 0.0172507
82 | 0.0243394
83 | 0.0308397
84 | 0.0308351
85 | 0.0726173
86 | 0.0243394
87 | 0.0294085
88 | 0.0243081
89 | 0.0172507
90 | 0.0294802
91 | 0.0294302
92 | 0.0428483
93 | 0.0182849
94 | 0.0428483
95 | 0.0291668
96 | 0.0286076
97 | 0.0343885
98 | 0.0400917
99 | 0.0297008
100 | 0.0302583
101 | -0.00729719
102 | 0.02427
103 | 0.025163
104 | 0.0302583
105 | 0.0343885
106 | 0.02427
107 | 0.0297008
108 | 0.0286076
109 | 0.0400917
110 | 0.0291668
111 | 0.0297968
112 | 0.0297968
113 | 0.0327028
114 | 0.0291829
115 | 0.0318104
116 | -0.00113866
117 | 0.040369
118 | 0.0276632
119 | 0.0220388
120 | -0.00113866
121 | 0.0234179
122 | 0.0276632
123 | 0.0318104
124 | 0.040369
125 | 0.0291829
126 | 0.0327028
127 | 0.0436774
128 | 0.032801
129 | 0.028777
130 | 0.0243262
131 | 0.00657271
132 | 0.0294571
133 | 0.0233091
134 | 0.0243262
135 | 0.0294571
136 | 0.028777
137 | 0.032801
138 | 0.0291868
139 | 0.0237982
140 | 0.0277807
141 | 0.0269207
142 | 0.0237982
143 | 0.0291868
144 | 0.0260943
145 | 0.0247897
146 | 0.0260943
147 | 0.0256658
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type zeroGradient;
156 | }
157 | inlet
158 | {
159 | type zeroGradient;
160 | }
161 | outlet
162 | {
163 | type fixedValue;
164 | value uniform 0;
165 | }
166 | }
167 |
168 |
169 | // ************************************************************************* //
170 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.2/p:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volScalarField;
13 | location "0.2";
14 | object p;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 2 -2 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | 0.0258623
24 | 0.0232656
25 | 0.0256846
26 | 0.0256846
27 | 0.0240687
28 | 0.0306289
29 | 0.0240687
30 | 0.0247023
31 | 0.0248527
32 | 0.0247023
33 | 0.0234836
34 | 0.0321145
35 | 0.0240619
36 | 0.0203201
37 | 0.0321145
38 | 0.0234836
39 | 0.0238388
40 | 0.0239548
41 | 0.0239548
42 | 0.0238388
43 | 0.0235028
44 | 0.024982
45 | 0.0232321
46 | 0.024146
47 | 0.0327799
48 | 0.0232321
49 | 0.0349506
50 | 0.024146
51 | 0.024982
52 | 0.0235028
53 | 0.0244157
54 | 0.0193478
55 | 0.0272414
56 | 0.0193478
57 | 0.0244157
58 | 0.0237064
59 | 0.0257995
60 | 0.0193979
61 | 0.0193153
62 | 0.025499
63 | 0.0250298
64 | 0.0395999
65 | 0.0270875
66 | 0.025499
67 | 0.0193979
68 | 0.0395999
69 | 0.0193153
70 | 0.0257995
71 | 0.0237064
72 | 0.0203212
73 | 0.0263406
74 | 0.0263406
75 | 0.0203212
76 | 0.0244849
77 | 0.0196406
78 | 0.0244461
79 | 0.0246283
80 | 0.023245
81 | 0.0161201
82 | 0.0212567
83 | 0.024986
84 | 0.023245
85 | 0.0435664
86 | 0.0212567
87 | 0.0246283
88 | 0.0196406
89 | 0.0161201
90 | 0.0244461
91 | 0.0244849
92 | 0.0290906
93 | 0.0145865
94 | 0.0290906
95 | 0.0231814
96 | 0.0234399
97 | 0.025001
98 | 0.0293907
99 | 0.024286
100 | 0.0251225
101 | 0.00404957
102 | 0.0197021
103 | 0.0216405
104 | 0.0251225
105 | 0.025001
106 | 0.0197021
107 | 0.024286
108 | 0.0234399
109 | 0.0293907
110 | 0.0231814
111 | 0.0196729
112 | 0.0196729
113 | 0.0236696
114 | 0.0231983
115 | 0.0259905
116 | 0.00637817
117 | 0.030116
118 | 0.0230254
119 | 0.0224997
120 | 0.00637817
121 | 0.0197919
122 | 0.0230254
123 | 0.0259905
124 | 0.030116
125 | 0.0231983
126 | 0.0236696
127 | 0.0255623
128 | 0.0242064
129 | 0.0234333
130 | 0.0242677
131 | 0.00916599
132 | 0.0240684
133 | 0.0198422
134 | 0.0242677
135 | 0.0240684
136 | 0.0234333
137 | 0.0242064
138 | 0.023284
139 | 0.0202057
140 | 0.0268243
141 | 0.0230117
142 | 0.0202057
143 | 0.023284
144 | 0.0222486
145 | 0.0212178
146 | 0.0222486
147 | 0.0222013
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type zeroGradient;
156 | }
157 | inlet
158 | {
159 | type zeroGradient;
160 | }
161 | outlet
162 | {
163 | type fixedValue;
164 | value uniform 0;
165 | }
166 | }
167 |
168 |
169 | // ************************************************************************* //
170 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.4/p:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volScalarField;
13 | location "0.4";
14 | object p;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 2 -2 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | 0.0225898
24 | 0.020627
25 | 0.0224511
26 | 0.0224511
27 | 0.0209555
28 | 0.0248573
29 | 0.0209555
30 | 0.0217473
31 | 0.0218619
32 | 0.0217473
33 | 0.0203014
34 | 0.0255485
35 | 0.0207515
36 | 0.022203
37 | 0.0255485
38 | 0.0203014
39 | 0.0211017
40 | 0.0212759
41 | 0.0212759
42 | 0.0211017
43 | 0.0202317
44 | 0.0214257
45 | 0.0199602
46 | 0.0234485
47 | 0.0259259
48 | 0.0199602
49 | 0.0315464
50 | 0.0234485
51 | 0.0214257
52 | 0.0202317
53 | 0.0212878
54 | 0.018839
55 | 0.0227087
56 | 0.018839
57 | 0.0212878
58 | 0.0203372
59 | 0.0225311
60 | 0.017846
61 | 0.0189692
62 | 0.0218131
63 | 0.021006
64 | 0.0308507
65 | 0.0244278
66 | 0.0218131
67 | 0.017846
68 | 0.0308507
69 | 0.0189692
70 | 0.0225311
71 | 0.0203372
72 | 0.0193435
73 | 0.0213771
74 | 0.0213771
75 | 0.0193435
76 | 0.0215394
77 | 0.0180482
78 | 0.0212716
79 | 0.0219549
80 | 0.0196378
81 | 0.0163262
82 | 0.0197632
83 | 0.0216631
84 | 0.0196378
85 | 0.0304453
86 | 0.0197632
87 | 0.0219549
88 | 0.0180482
89 | 0.0163262
90 | 0.0212716
91 | 0.0215394
92 | 0.0223637
93 | 0.0130212
94 | 0.0223637
95 | 0.0202266
96 | 0.0211256
97 | 0.0203306
98 | 0.0233161
99 | 0.0209963
100 | 0.0219754
101 | 0.00974374
102 | 0.0176863
103 | 0.0195153
104 | 0.0219754
105 | 0.0203306
106 | 0.0176863
107 | 0.0209963
108 | 0.0211256
109 | 0.0233161
110 | 0.0202266
111 | 0.0152049
112 | 0.0152049
113 | 0.0204516
114 | 0.0200149
115 | 0.0223238
116 | 0.0104145
117 | 0.0236551
118 | 0.0199303
119 | 0.0207725
120 | 0.0104145
121 | 0.018373
122 | 0.0199303
123 | 0.0223238
124 | 0.0236551
125 | 0.0200149
126 | 0.0204516
127 | 0.0176716
128 | 0.0207644
129 | 0.0201157
130 | 0.0214493
131 | 0.0112485
132 | 0.020639
133 | 0.0178349
134 | 0.0214493
135 | 0.020639
136 | 0.0201157
137 | 0.0207644
138 | 0.0203702
139 | 0.0179155
140 | 0.0224876
141 | 0.0207034
142 | 0.0179155
143 | 0.0203702
144 | 0.0202629
145 | 0.0183704
146 | 0.0202629
147 | 0.0204214
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type zeroGradient;
156 | }
157 | inlet
158 | {
159 | type zeroGradient;
160 | }
161 | outlet
162 | {
163 | type fixedValue;
164 | value uniform 0;
165 | }
166 | }
167 |
168 |
169 | // ************************************************************************* //
170 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.3/p:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volScalarField;
13 | location "0.3";
14 | object p;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 2 -2 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | 0.0236685
24 | 0.0212034
25 | 0.0234983
26 | 0.0234983
27 | 0.0217551
28 | 0.0266795
29 | 0.0217551
30 | 0.0226805
31 | 0.022765
32 | 0.0226805
33 | 0.0212449
34 | 0.0277081
35 | 0.0216322
36 | 0.0216072
37 | 0.0277081
38 | 0.0212449
39 | 0.0219472
40 | 0.0220488
41 | 0.0220488
42 | 0.0219472
43 | 0.0213466
44 | 0.0225425
45 | 0.0209069
46 | 0.0236818
47 | 0.0282329
48 | 0.0209069
49 | 0.0325016
50 | 0.0236818
51 | 0.0225425
52 | 0.0213466
53 | 0.0222982
54 | 0.0188448
55 | 0.0242271
56 | 0.0188448
57 | 0.0222982
58 | 0.0215181
59 | 0.0236998
60 | 0.0182344
61 | 0.0189861
62 | 0.0229839
63 | 0.0222989
64 | 0.0334763
65 | 0.0253076
66 | 0.0229839
67 | 0.0182344
68 | 0.0334763
69 | 0.0189861
70 | 0.0236998
71 | 0.0215181
72 | 0.0195701
73 | 0.0229912
74 | 0.0229912
75 | 0.0195701
76 | 0.0225158
77 | 0.0184892
78 | 0.0223064
79 | 0.0228554
80 | 0.020772
81 | 0.0161159
82 | 0.0201672
83 | 0.0227475
84 | 0.020772
85 | 0.0344931
86 | 0.0201672
87 | 0.0228554
88 | 0.0184892
89 | 0.0161159
90 | 0.0223064
91 | 0.0225158
92 | 0.02454
93 | 0.0135383
94 | 0.02454
95 | 0.0211118
96 | 0.0218473
97 | 0.0218128
98 | 0.0252481
99 | 0.0220423
100 | 0.0230465
101 | 0.00791685
102 | 0.0182235
103 | 0.0201421
104 | 0.0230465
105 | 0.0218128
106 | 0.0182235
107 | 0.0220423
108 | 0.0218473
109 | 0.0252481
110 | 0.0211118
111 | 0.0166309
112 | 0.0166309
113 | 0.0213299
114 | 0.0209845
115 | 0.0235367
116 | 0.00908453
117 | 0.0257738
118 | 0.0208831
119 | 0.0214849
120 | 0.00908453
121 | 0.018683
122 | 0.0208831
123 | 0.0235367
124 | 0.0257738
125 | 0.0209845
126 | 0.0213299
127 | 0.0201617
128 | 0.0217539
129 | 0.0211736
130 | 0.022556
131 | 0.0104879
132 | 0.0217333
133 | 0.0183204
134 | 0.022556
135 | 0.0217333
136 | 0.0211736
137 | 0.0217539
138 | 0.0212471
139 | 0.0185075
140 | 0.0241481
141 | 0.0215018
142 | 0.0185075
143 | 0.0212471
144 | 0.0209479
145 | 0.0191675
146 | 0.0209479
147 | 0.0210721
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type zeroGradient;
156 | }
157 | inlet
158 | {
159 | type zeroGradient;
160 | }
161 | outlet
162 | {
163 | type fixedValue;
164 | value uniform 0;
165 | }
166 | }
167 |
168 |
169 | // ************************************************************************* //
170 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/constant/polyMesh/neighbour:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class labelList;
13 | note "nPoints:216 nCells:125 nFaces:450 nInternalFaces:300";
14 | location "constant/polyMesh";
15 | object neighbour;
16 | }
17 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
18 |
19 |
20 | 300
21 | (
22 | 1
23 | 2
24 | 3
25 | 4
26 | 5
27 | 6
28 | 4
29 | 7
30 | 8
31 | 6
32 | 8
33 | 9
34 | 10
35 | 11
36 | 12
37 | 11
38 | 13
39 | 14
40 | 12
41 | 14
42 | 15
43 | 10
44 | 16
45 | 17
46 | 12
47 | 17
48 | 18
49 | 15
50 | 18
51 | 19
52 | 20
53 | 21
54 | 22
55 | 21
56 | 23
57 | 24
58 | 22
59 | 24
60 | 25
61 | 23
62 | 26
63 | 27
64 | 24
65 | 27
66 | 28
67 | 25
68 | 28
69 | 29
70 | 20
71 | 30
72 | 31
73 | 22
74 | 31
75 | 32
76 | 25
77 | 32
78 | 33
79 | 29
80 | 33
81 | 34
82 | 35
83 | 36
84 | 37
85 | 36
86 | 38
87 | 39
88 | 37
89 | 39
90 | 40
91 | 38
92 | 41
93 | 42
94 | 39
95 | 42
96 | 43
97 | 40
98 | 43
99 | 44
100 | 41
101 | 45
102 | 42
103 | 45
104 | 46
105 | 43
106 | 46
107 | 47
108 | 44
109 | 47
110 | 48
111 | 35
112 | 49
113 | 37
114 | 49
115 | 50
116 | 40
117 | 50
118 | 51
119 | 44
120 | 51
121 | 52
122 | 48
123 | 52
124 | 53
125 | 54
126 | 53
127 | 55
128 | 56
129 | 54
130 | 56
131 | 57
132 | 55
133 | 58
134 | 59
135 | 56
136 | 59
137 | 60
138 | 57
139 | 60
140 | 61
141 | 58
142 | 62
143 | 59
144 | 62
145 | 63
146 | 60
147 | 63
148 | 64
149 | 61
150 | 64
151 | 65
152 | 62
153 | 66
154 | 63
155 | 66
156 | 67
157 | 64
158 | 67
159 | 68
160 | 65
161 | 68
162 | 54
163 | 69
164 | 57
165 | 69
166 | 70
167 | 61
168 | 70
169 | 71
170 | 65
171 | 71
172 | 72
173 | 73
174 | 73
175 | 74
176 | 72
177 | 75
178 | 76
179 | 73
180 | 76
181 | 77
182 | 74
183 | 77
184 | 78
185 | 75
186 | 79
187 | 76
188 | 79
189 | 80
190 | 77
191 | 80
192 | 81
193 | 78
194 | 81
195 | 82
196 | 79
197 | 83
198 | 80
199 | 83
200 | 84
201 | 81
202 | 84
203 | 85
204 | 82
205 | 85
206 | 83
207 | 86
208 | 84
209 | 86
210 | 87
211 | 85
212 | 87
213 | 74
214 | 88
215 | 78
216 | 88
217 | 89
218 | 82
219 | 89
220 | 90
221 | 91
222 | 91
223 | 92
224 | 92
225 | 93
226 | 90
227 | 94
228 | 91
229 | 94
230 | 95
231 | 92
232 | 95
233 | 96
234 | 93
235 | 96
236 | 97
237 | 94
238 | 98
239 | 95
240 | 98
241 | 99
242 | 96
243 | 99
244 | 100
245 | 97
246 | 100
247 | 98
248 | 101
249 | 99
250 | 101
251 | 102
252 | 100
253 | 102
254 | 101
255 | 103
256 | 102
257 | 103
258 | 93
259 | 104
260 | 97
261 | 104
262 | 105
263 | 105
264 | 106
265 | 106
266 | 107
267 | 107
268 | 108
269 | 105
270 | 109
271 | 106
272 | 109
273 | 110
274 | 107
275 | 110
276 | 111
277 | 108
278 | 111
279 | 109
280 | 112
281 | 110
282 | 112
283 | 113
284 | 111
285 | 113
286 | 112
287 | 114
288 | 113
289 | 114
290 | 114
291 | 108
292 | 115
293 | 115
294 | 116
295 | 116
296 | 117
297 | 117
298 | 115
299 | 118
300 | 116
301 | 118
302 | 119
303 | 117
304 | 119
305 | 118
306 | 120
307 | 119
308 | 120
309 | 120
310 | 121
311 | 121
312 | 122
313 | 122
314 | 121
315 | 123
316 | 122
317 | 123
318 | 123
319 | 124
320 | 124
321 | 124
322 | )
323 |
324 |
325 | // ************************************************************************* //
326 |
--------------------------------------------------------------------------------
/docs/whats_new.rst:
--------------------------------------------------------------------------------
1 | .. _whats_new:
2 |
3 | What's New
4 | ==========
5 |
6 | This information applies to the
7 | `tkeskita/bvtknodes `_ version.
8 |
9 | Version 0.11
10 | ------------
11 |
12 | - 2024-07-19: BVTKNodes upgrade to Blender LTS version 4.2
13 | (Python 3.11) required no class or VTK changes.
14 |
15 | - 2023-12-31: Motion Blur is available in VTK To Blender Mesh
16 | Node. Mesh motion blur is implemented using Blender Shape
17 | Keys, based on mesh point transformation by a vector point field.
18 |
19 | Version 0.10
20 | ------------
21 |
22 | - 2023-08-19: Resurrected VTK To Blender Volume Node. This was possible since
23 | pyopenvdb is now included in Blender 3.6 by default.
24 |
25 | - 2023-08-18: Upgrade to Blender LTS version 3.6 (Python 3.10) and VTK 9.2.6.
26 | The previous Blender LTS version 3.3 (Python 3.10) still works as well
27 | with VTK 9.2.6. This upgrade required no class changes.
28 |
29 | - 2023-06-09: Fixed a bug where negative scalar values were colored incorrectly
30 | with Color Mapper node (absolute values of data was shown).
31 |
32 | - 2023-01-21: Upgrade to Blender LTS version 3.3 (Python 3.10) and VTK 9.2.2.
33 | The previous Blender LTS version 2.93 (Python 3.9) still works as well
34 | with VTK 9.2.2.
35 |
36 | Version 0.9
37 | -----------
38 |
39 | - 2022-07-28: Color Mapper Node now supports vector arrays as well as
40 | scalar arrays as input. For vectors, magnitude of the vector is used
41 | for the color scale.
42 |
43 | - 2022-06-12: Changed Custom Filter to fix it's tree import/export.
44 |
45 | - 2022-06-05: Fixed importing of colors for Color Ramp node.
46 |
47 | - 2022-05-28: Fixed Property listing bug for Blender 2.93 (properties were not
48 | shown in the Properties tab).
49 |
50 | - 2022-05-28: Added VTK To Blender Image Node to convert vtkImageData
51 | to a Blender Image.
52 |
53 | Version 0.8 (2022-01-16)
54 | ------------------------
55 |
56 | - Upgrade to Blender LTS version 2.93 and VTK 9.1.0. The previous
57 | Blender LTS version 2.83 still works as well with VTK 9.1.0.
58 |
59 | Version 0.7 (2021-09-18)
60 | ------------------------
61 |
62 | - Supported Blender LTS version 2.83 and VTK 9.0.1.
63 | - New node update system, where VTK updates are independent of node
64 | editing actions. User has now option to change **Update Mode** in
65 | the Inspect Panel, which determines when changes in nodes are
66 | updated to VTK objects. Most useful options include *No Automatic
67 | Updates* and *Update All Automatically*.
68 |
69 | - Nodes have now :ref:`node_status` information, which is shown by node colors.
70 |
71 | - Values of dynamic enumeration lists are stored in string properties,
72 | so that it is possible to pre-define whole node trees without need to
73 | run updates on nodes. This allows full pre-definition of node trees
74 | e.g. for JSON imports.
75 |
76 | - several new *cubeflow* node tree examples (in
77 | :ref:`json_importexport` Tab) available for :ref:`ug_nodes`.
78 |
79 | - Development for this release was made in
80 | `pull request #46 `_.
81 |
82 |
83 | Previous versions
84 | -----------------
85 |
86 | - A testing framework helps developers catch regression bugs.
87 |
88 | - :ref:`global_time_keeper` node allows animation of many node properties
89 | by Blender's Keyframes feature.
90 |
91 | - Improved Custom Code editing.
92 |
93 | - Matplotlib color maps are available as presets in Color Ramp node.
94 |
95 | - Several bug fixes and small usability improvements.
96 |
97 | - More information in `pull requests at github `_.
98 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BVTKNodes
2 | [](https://github.com/tkeskita/BVtkNodes/actions/workflows/blender-tests.yml) [](https://bvtknodes.readthedocs.io) [](https://github.com/tkeskita/BVtkNodes/blob/master/LICENSE) [](https://github.com/tkeskita/BVtkNodes/archive/master.zip) 
3 |
4 | BVTKNodes is a Blender add-on that wraps the Visualization Toolkit (VTK) library for scientific visualization in Blender.
5 | The high-level features of this add-on include:
6 |
7 | - Node system for developing VTK pipelines
8 | - Converters from VTK data to Blender meshes, particles and volumes
9 | - Common scientific color maps
10 |
11 | BVTKNodes can be used with Blender's powerful 3D modeling and rendering tools to make figures that are both informative as well as visually stunning.
12 | This fork builds on the [original repository](https://github.com/simboden/BVtkNodes). Aim is to provide continued updates to newer Blender/VTK versions, new features, bug fixes and community involvement.
13 |
14 | [**Docs**](https://bvtknodes.readthedocs.io/en/latest/) | [**Install Guide**](https://bvtknodes.readthedocs.io/en/latest/BVTKNodes.html#installation-of-vtk-for-blender) | [**Examples**](https://bvtknodes.readthedocs.io/en/latest/BVTKNodes.html#simple-example-human-head-visualization) | [**Gallery**](https://blenderartists.org/t/bvtknodes-gallery/1161079) | [**What's New**](https://bvtknodes.readthedocs.io/en/latest/whats_new.html)
15 |
16 | ### Dependencies
17 | - [Blender LTS version 4.2 or 3.6](https://www.blender.org/download/lts/)
18 | - [VTK library version 9.2.6](https://pypi.org/project/vtk/9.2.6/)
19 |
20 | ### Quick Start
21 | - Download the BVTKNode repository add-on as a .zip file.
22 | - Start Blender, go to “Edit” –> “Preferences” –> “Add-ons” –> “Install” –> open the add-on zip file.
23 | - Activate the “BVTKNodes” add-on in Preferences by clicking on the checkbox. Add-on is located in Node category, “Community” level of Blender add-ons.
24 |
25 | See the [installation guide](https://bvtknodes.readthedocs.io/en/latest/BVTKNodes.html#installation-of-vtk-for-blender) for more details.
26 |
27 |
28 | ## More About BVTKNodes
29 | [The Visualization Toolkit (VTK)](https://www.vtk.org/) is an open source library for scientific data processing and visualization.
30 | BVTKNodes is an add-on for [Blender](https://www.blender.org/), a free and open source 3D creation suite.
31 | This add-on makes it possible to create and execute VTK pipelines configured in Blender Node Editor, to produce surface mesh objects, which can be then modified and visualized in Blender.
32 | While 3D visualization software such as [Paraview](https://www.paraview.org/) exist for scientific applications, BVTKNodes provides access to Blender's high quality and photorealistic rendering and mesh editing tools.
33 | The original add-on was first presented at [Blender Conference 2018](https://www.youtube.com/watch?v=KcF4LBTTyvk).
34 |
35 |
36 |
37 |
38 |
39 | ## Contributing
40 | - Pull Requests: New features and bug fixes are welcome!
41 | - GitHub Issues: Bug reports, new feature ideas, install issues, thoughts, etc. Please check the [docs](https://bvtknodes.readthedocs.io/en/latest/BVTKNodes.html#help-with-issues) first.
42 | - If you use this add-on, please star this project in GitHub!
43 |
44 | List of contributors can be found in [CONTRIBUTORS.md](https://github.com/tkeskita/BVtkNodes/blob/master/CONTRIBUTORS.md).
45 |
--------------------------------------------------------------------------------
/utils/convert_to_vdb.py:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # convert_to_vdb.py - Create OpenVDB (.vdb) volume data file from
3 | # image data in argument JSON file. JSON file is generated using
4 | # "VTK To OpenVDB Exporter" node in BVTKNodes (Blender add-on).
5 | #
6 | # Run example: python3 convert_to_vdb.py volume_00001.json
7 | #
8 | # Requirement: pyopenvdb module must be available to Python
9 | #
10 | # If you get error like:
11 | # "libjemalloc.so.2: cannot allocate memory in static TLS block"
12 | # then prepend command with LD_PRELOAD:
13 | # LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 python3 convert_to_vdb.py volume_00001.json
14 | # ------------------------------------------------------------------------------
15 |
16 | import sys
17 | import json
18 |
19 | try:
20 | import pyopenvdb
21 |
22 | vdb = pyopenvdb
23 | except ImportError:
24 | print(
25 | "ERROR: Python can't import pyopenvdb. Please see "
26 | + "VTK To OpenVDB Exporter node documentation for more information."
27 | )
28 | raise
29 |
30 |
31 | def create_grid(background_value, dims, array, grid_name, atype):
32 | """
33 | Return an OpenVDB grid with dimensions dims containing data from array.
34 | """
35 |
36 | if array == None:
37 | return None
38 |
39 | if atype == "scalar":
40 | grid = vdb.FloatGrid(background_value)
41 | elif atype == "vector":
42 | grid = vdb.Vec3SGrid()
43 | else:
44 | raise TypeError("Unknown type %s" % str(atype))
45 |
46 | grid.gridClass = vdb.GridClass.FOG_VOLUME
47 | grid.name = grid_name
48 |
49 | # Create grid by looping over points with accessor
50 | acc = grid.getAccessor()
51 | for i in range(dims[0]):
52 | for j in range(dims[1]):
53 | for k in range(dims[2]):
54 | idx = i + j * dims[0] + k * dims[0] * dims[1]
55 | value = array[idx]
56 | if atype == "scalar":
57 | if value == None:
58 | continue
59 | if value > background_value:
60 | acc.setValueOn((i, j, k), value)
61 |
62 | elif atype == "vector":
63 | if value[0] == None:
64 | continue
65 | acc.setValueOn((i, j, k), value)
66 | return grid
67 |
68 |
69 | def count_active_voxels(grids):
70 | """
71 | Counts the number of active voxels in list of OpenVDB grids
72 | """
73 |
74 | n = 0
75 | for grid in grids:
76 | n += grid.activeVoxelCount()
77 | return n
78 |
79 |
80 | def create_vdb(
81 | vdb_filename,
82 | background_value,
83 | dims,
84 | density_data,
85 | color_data,
86 | flame_data,
87 | temperature_data,
88 | ):
89 | """
90 | Create vdb file from argument data.
91 | """
92 |
93 | density_grid = create_grid(
94 | background_value, dims, density_data, "density", "scalar"
95 | )
96 | color_grid = create_grid(background_value, dims, color_data, "color", "vector")
97 | flame_grid = create_grid(background_value, dims, flame_data, "flame", "scalar")
98 | temperature_grid = create_grid(
99 | background_value, dims, temperature_data, "temperature", "scalar"
100 | )
101 |
102 | grids = [density_grid, color_grid, flame_grid, temperature_grid]
103 | grids = [g for g in grids if g is not None]
104 | nvoxels = count_active_voxels(grids)
105 | vdb.write(vdb_filename, grids=grids)
106 | print(
107 | "%s: %d grids, %d active voxels exported." % (vdb_filename, len(grids), nvoxels)
108 | )
109 |
110 |
111 | # Main program: Process all arguments
112 |
113 | for filename in sys.argv[1:]:
114 | with open(filename, "r") as read_file:
115 | (
116 | background_value,
117 | dims,
118 | density_data,
119 | color_data,
120 | flame_data,
121 | temperature_data,
122 | ) = json.load(read_file)
123 | vdb_filename = filename.replace(".json", ".vdb")
124 | create_vdb(
125 | vdb_filename,
126 | background_value,
127 | dims,
128 | density_data,
129 | color_data,
130 | flame_data,
131 | temperature_data,
132 | )
133 |
--------------------------------------------------------------------------------
/showhide_properties.py:
--------------------------------------------------------------------------------
1 | from .core import l # Import logging
2 | from . import core
3 | import bpy
4 | from .cache import BVTKCache
5 |
6 |
7 | class BVTK_PT_ShowHide_Properties(bpy.types.Panel):
8 | """BVTK Show/hide properties panel"""
9 |
10 | bl_label = "Show/Hide Properties"
11 | bl_space_type = "NODE_EDITOR"
12 | bl_region_type = "UI"
13 | bl_category = "Properties"
14 |
15 | @classmethod
16 | def poll(cls, context):
17 | return (
18 | context.active_node is not None
19 | and context.space_data.tree_type == "BVTK_NodeTreeType"
20 | and hasattr(context.active_node, "b_properties")
21 | )
22 |
23 | def draw(self, context):
24 | layout = self.layout
25 | active_node = context.active_node
26 | m_properties = context.active_node.m_properties()
27 | for i in range(len(m_properties)):
28 | row = layout.row()
29 | row.prop(active_node, "b_properties", index=i)
30 | # Take property name from m_properties
31 | mp = m_properties[i]
32 | if mp.startswith("m_") or mp.startswith("e_"):
33 | mp = mp[2:]
34 | row.label(text=mp)
35 |
36 | # Custom code editing operators
37 | row = layout.row()
38 | row.operator("node.bvtk_custom_code_edit", text="Edit Custom Code")
39 | row = layout.row()
40 | row.operator("node.bvtk_custom_code_save", text="Save Custom Code")
41 |
42 |
43 | class BVTK_OT_Edit_Custom_Code(bpy.types.Operator):
44 | """Edit Custom Code text string for Active Node in Text Editor"""
45 |
46 | bl_idname = "node.bvtk_custom_code_edit"
47 | bl_label = "Edit Custom Code"
48 | node_id: bpy.props.IntProperty(default=0) # Used to save node button press is from
49 |
50 | def execute(self, context):
51 | if self.node_id == 0: # Call from properities panel
52 | active_node = context.active_node
53 | else: # Call from node
54 | # Get node based on node_id tag and make it active
55 | active_node = BVTKCache.get_node(self.node_id)
56 | active_node.select = True
57 |
58 | nt = BVTKCache.get_tree(self.node_id)
59 | nt.nodes.active = active_node
60 |
61 | name = "BVTK"
62 | if name not in bpy.data.texts.keys():
63 | text = bpy.data.texts.new(name)
64 | else:
65 | text = bpy.data.texts[name]
66 | text.from_string(active_node.custom_code)
67 | flag = True
68 | areas = context.screen.areas
69 | for area in areas:
70 | if area.type == "TEXT_EDITOR":
71 | for space in area.spaces:
72 | if space.type == "TEXT_EDITOR":
73 | if flag:
74 | space.text = text
75 | space.top = 0
76 | flag = False
77 | self.report(
78 | {"INFO"}, "Edit node %r " % active_node.name + "in text editor %r" % name
79 | )
80 | return {"FINISHED"}
81 |
82 |
83 | class BVTK_OT_Save_Custom_Code(bpy.types.Operator):
84 | """Save Custom Code text from Text Editor to Active Node"""
85 |
86 | bl_idname = "node.bvtk_custom_code_save"
87 | bl_label = "Save Custom Code"
88 | node_id: bpy.props.IntProperty(default=0) # Used to save node button press is from
89 |
90 | def execute(self, context):
91 | if self.node_id == 0: # Call from properities panel
92 | active_node = context.active_node
93 | else: # Call from node
94 | # Get node based on node_id tag and make it active
95 | active_node = BVTKCache.get_node(self.node_id)
96 | active_node.select = True
97 |
98 | nt = BVTKCache.get_tree(self.node_id)
99 | nt.nodes.active = active_node
100 |
101 | name = "BVTK"
102 | if name not in bpy.data.texts.keys():
103 | self.report({"ERROR"}, "No %r text found in text editor!" % name)
104 | return {"FINISHED"}
105 | else:
106 | active_node.custom_code = bpy.data.texts[name].as_string()
107 | self.report({"INFO"}, "Saved Custom Code from %r" % name)
108 | return {"FINISHED"}
109 |
110 |
111 | core.add_ui_class(BVTK_PT_ShowHide_Properties)
112 | core.add_class(BVTK_OT_Edit_Custom_Code)
113 | core.add_class(BVTK_OT_Save_Custom_Code)
114 |
--------------------------------------------------------------------------------
/test/test_blender_script.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import argparse
3 | import sys
4 | import os
5 | import json
6 |
7 | # Import the addon to be able to import the node tree
8 | from BVtkNodes.tree import insert_into_node_tree
9 | from BVtkNodes.cache import BVTKCache
10 |
11 |
12 | def assert_quit(condition, message):
13 | if not condition:
14 | print("Testscript failed with the message '" + message + "'", file=sys.stderr)
15 | sys.exit(1)
16 |
17 |
18 | def parse_standard_test_args():
19 | """Parses special parameters for the python file after the '--'.
20 | For more details see the background job template in the blender python scripting UI
21 | """
22 | # get the args passed to blender after "--", all of which are ignored by
23 | # blender so scripts may receive their own arguments
24 | argv = sys.argv
25 |
26 | if "--" not in argv:
27 | argv = [] # as if no args are passed
28 | else:
29 | argv = argv[argv.index("--") + 1 :] # get all args after "--"
30 |
31 | parser = argparse.ArgumentParser()
32 |
33 | parser.add_argument(
34 | "-j",
35 | "--json",
36 | dest="json",
37 | type=str,
38 | required=True,
39 | help="The json testcase to be executed",
40 | )
41 |
42 | args = parser.parse_args(argv)
43 | json_fname = args.json
44 | json_fname = bpy.path.abspath(
45 | json_fname
46 | ) # Replace blender relative paths with absolute paths
47 |
48 | assert_quit(os.path.isfile(json_fname), "File %s not found" % (json_fname))
49 |
50 | return json_fname
51 |
52 |
53 | def import_json_node_tree(json_fname):
54 | try:
55 | # Note: The below modifications to the areas work when the Blender GUI is available, but will NOT work for the headless testing environment.
56 | # This is the reason insert_into_node_tree is called directly
57 | # Search for the Node Editor in the areas
58 | # node_editor_ind = next(area_i for area_i, area in enumerate(bpy.context.screen.areas) if area.type == "NODE_EDITOR")
59 | # print("Ind: " + str(node_editor_ind))
60 | # print(*[area.type for area in bpy.context.screen.areas])
61 | # area = bpy.context.screen.areas[node_editor_ind]
62 | # area.type = "NODE_EDITOR"
63 | # area.ui_type = 'BVTK_NodeTreeType' #Switch to BVTK Node tree view
64 | # override = bpy.context.copy()
65 | # override['area'] = area
66 | # bpy.context.area = area
67 | # bpy.context.area.type = "NODE_EDITOR" #Change the UI to node editor type
68 | # bpy.context.area.ui_type = 'BVTK_NodeTreeType' #And switch to BVTK Node tree view
69 | # bpy.ops.node.new_node_tree() #Create a new node tree (this assumes there is none present in the .blend file)
70 | # bpy.ops.node.bvtk_node_tree_import(filepath=json_fname, confirm=False)
71 | with open(json_fname, "r") as json_file:
72 | json_data = json.load(json_file)
73 |
74 | # Disable updating nodes during node creation
75 | bpy.context.scene.bvtknodes_settings.update_mode = "no-automatic-updates"
76 |
77 | # Import nodes
78 | node_tree_name = "NodeTree"
79 | assert_quit(node_tree_name in bpy.data.node_groups, "Found no BVTK NodeTree")
80 | node_tree = bpy.data.node_groups[node_tree_name]
81 | insert_into_node_tree(node_tree, json_data["nodes"], json_data["links"])
82 |
83 | # Set automatic update mode and update
84 | bpy.context.scene.bvtknodes_settings.update_mode = "update-all"
85 | BVTKCache.update_all()
86 |
87 | except Exception as ex:
88 | assert_quit(False, "Importing the json node tree failed with %s" % (ex))
89 |
90 |
91 | def import_cli_tree():
92 | import_json_node_tree(parse_standard_test_args())
93 |
94 |
95 | def check_node_statuses():
96 | """Check that status of all nodes is up-to-date"""
97 | from BVtkNodes.core import get_all_bvtk_nodes
98 |
99 | nodes = get_all_bvtk_nodes()
100 | for node in nodes:
101 | if node.vtk_status != "up-to-date":
102 | assert_quit(False, "Test failed with %s" % node.name)
103 |
104 |
105 | if __name__ == "__main__":
106 | try:
107 | import_cli_tree()
108 | check_node_statuses()
109 | print("Success")
110 | except Exception as ex:
111 | assert_quit(False, "Test failed with %s" % (ex))
112 | # Success - Quit
113 | # sys.exit(0)
114 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/constant/polyMesh/points:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class vectorField;
13 | location "constant/polyMesh";
14 | object points;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 |
19 | 216
20 | (
21 | (0.6 0.6 0)
22 | (1 0.6 0)
23 | (1 1 0)
24 | (0.6 1 0)
25 | (-1 0.6 0)
26 | (-0.6 0.6 0)
27 | (-0.6 1 0)
28 | (-1 1 0)
29 | (-0.2 0.6 0)
30 | (-0.2 1 0)
31 | (0.2 0.6 0)
32 | (0.2 1 0)
33 | (-1 -1 0)
34 | (-0.6 -1 0)
35 | (-0.6 -0.6 0)
36 | (-1 -0.6 0)
37 | (-0.6 -0.2 0)
38 | (-1 -0.2 0)
39 | (-0.6 0.2 0)
40 | (-1 0.2 0)
41 | (-0.2 -1 0)
42 | (-0.2 -0.6 0)
43 | (-0.2 -0.2 0)
44 | (-0.2 0.2 0)
45 | (0.2 -1 0)
46 | (0.2 -0.6 0)
47 | (0.2 -0.2 0)
48 | (0.2 0.2 0)
49 | (0.6 -1 0)
50 | (0.6 -0.6 0)
51 | (0.6 -0.2 0)
52 | (0.6 0.2 0)
53 | (1 -1 0)
54 | (1 -0.6 0)
55 | (1 -0.2 0)
56 | (1 0.2 0)
57 | (0.6 0.6 0.4)
58 | (1 0.6 0.4)
59 | (1 1 0.4)
60 | (0.6 1 0.4)
61 | (-1 0.6 0.4)
62 | (-0.6 0.6 0.4)
63 | (-0.6 1 0.4)
64 | (-1 1 0.4)
65 | (-0.2 0.6 0.4)
66 | (-0.2 1 0.4)
67 | (0.2 0.6 0.4)
68 | (0.2 1 0.4)
69 | (-1 -1 0.4)
70 | (-0.6 -1 0.4)
71 | (-0.6 -0.6 0.4)
72 | (-1 -0.6 0.4)
73 | (-0.6 -0.2 0.4)
74 | (-1 -0.2 0.4)
75 | (-0.6 0.2 0.4)
76 | (-1 0.2 0.4)
77 | (-0.2 -1 0.4)
78 | (-0.2 -0.6 0.4)
79 | (-0.2 -0.2 0.4)
80 | (-0.2 0.2 0.4)
81 | (0.2 -1 0.4)
82 | (0.2 -0.6 0.4)
83 | (0.2 -0.2 0.4)
84 | (0.2 0.2 0.4)
85 | (0.6 -1 0.4)
86 | (0.6 -0.6 0.4)
87 | (0.6 -0.2 0.4)
88 | (0.6 0.2 0.4)
89 | (1 -1 0.4)
90 | (1 -0.6 0.4)
91 | (1 -0.2 0.4)
92 | (1 0.2 0.4)
93 | (0.6 0.6 0.8)
94 | (1 0.6 0.8)
95 | (1 1 0.8)
96 | (0.6 1 0.8)
97 | (-1 0.6 0.8)
98 | (-0.6 0.6 0.8)
99 | (-0.6 1 0.8)
100 | (-1 1 0.8)
101 | (-0.2 0.6 0.8)
102 | (-0.2 1 0.8)
103 | (0.2 0.6 0.8)
104 | (0.2 1 0.8)
105 | (-1 -1 0.8)
106 | (-0.6 -1 0.8)
107 | (-0.6 -0.6 0.8)
108 | (-1 -0.6 0.8)
109 | (-0.6 -0.2 0.8)
110 | (-1 -0.2 0.8)
111 | (-0.6 0.2 0.8)
112 | (-1 0.2 0.8)
113 | (-0.2 -1 0.8)
114 | (-0.2 -0.6 0.8)
115 | (-0.2 -0.2 0.8)
116 | (-0.2 0.2 0.8)
117 | (0.2 -1 0.8)
118 | (0.2 -0.6 0.8)
119 | (0.2 -0.2 0.8)
120 | (0.2 0.2 0.8)
121 | (0.6 -1 0.8)
122 | (0.6 -0.6 0.8)
123 | (0.6 -0.2 0.8)
124 | (0.6 0.2 0.8)
125 | (1 -1 0.8)
126 | (1 -0.6 0.8)
127 | (1 -0.2 0.8)
128 | (1 0.2 0.8)
129 | (0.6 0.6 1.2)
130 | (1 0.6 1.2)
131 | (1 1 1.2)
132 | (0.6 1 1.2)
133 | (-1 0.6 1.2)
134 | (-0.6 0.6 1.2)
135 | (-0.6 1 1.2)
136 | (-1 1 1.2)
137 | (-0.2 0.6 1.2)
138 | (-0.2 1 1.2)
139 | (0.2 0.6 1.2)
140 | (0.2 1 1.2)
141 | (-1 -1 1.2)
142 | (-0.6 -1 1.2)
143 | (-0.6 -0.6 1.2)
144 | (-1 -0.6 1.2)
145 | (-0.6 -0.2 1.2)
146 | (-1 -0.2 1.2)
147 | (-0.6 0.2 1.2)
148 | (-1 0.2 1.2)
149 | (-0.2 -1 1.2)
150 | (-0.2 -0.6 1.2)
151 | (-0.2 -0.2 1.2)
152 | (-0.2 0.2 1.2)
153 | (0.2 -1 1.2)
154 | (0.2 -0.6 1.2)
155 | (0.2 -0.2 1.2)
156 | (0.2 0.2 1.2)
157 | (0.6 -1 1.2)
158 | (0.6 -0.6 1.2)
159 | (0.6 -0.2 1.2)
160 | (0.6 0.2 1.2)
161 | (1 -1 1.2)
162 | (1 -0.6 1.2)
163 | (1 -0.2 1.2)
164 | (1 0.2 1.2)
165 | (0.6 0.6 1.6)
166 | (1 0.6 1.6)
167 | (1 1 1.6)
168 | (0.6 1 1.6)
169 | (-1 0.6 1.6)
170 | (-0.6 0.6 1.6)
171 | (-0.6 1 1.6)
172 | (-1 1 1.6)
173 | (-0.2 0.6 1.6)
174 | (-0.2 1 1.6)
175 | (0.2 0.6 1.6)
176 | (0.2 1 1.6)
177 | (-1 -1 1.6)
178 | (-0.6 -1 1.6)
179 | (-0.6 -0.6 1.6)
180 | (-1 -0.6 1.6)
181 | (-0.6 -0.2 1.6)
182 | (-1 -0.2 1.6)
183 | (-0.6 0.2 1.6)
184 | (-1 0.2 1.6)
185 | (-0.2 -1 1.6)
186 | (-0.2 -0.6 1.6)
187 | (-0.2 -0.2 1.6)
188 | (-0.2 0.2 1.6)
189 | (0.2 -1 1.6)
190 | (0.2 -0.6 1.6)
191 | (0.2 -0.2 1.6)
192 | (0.2 0.2 1.6)
193 | (0.6 -1 1.6)
194 | (0.6 -0.6 1.6)
195 | (0.6 -0.2 1.6)
196 | (0.6 0.2 1.6)
197 | (1 -1 1.6)
198 | (1 -0.6 1.6)
199 | (1 -0.2 1.6)
200 | (1 0.2 1.6)
201 | (0.6 0.6 2)
202 | (1 0.6 2)
203 | (1 1 2)
204 | (0.6 1 2)
205 | (-1 0.6 2)
206 | (-0.6 0.6 2)
207 | (-0.6 1 2)
208 | (-1 1 2)
209 | (-0.2 0.6 2)
210 | (-0.2 1 2)
211 | (0.2 0.6 2)
212 | (0.2 1 2)
213 | (-1 -1 2)
214 | (-0.6 -1 2)
215 | (-0.6 -0.6 2)
216 | (-1 -0.6 2)
217 | (-0.6 -0.2 2)
218 | (-1 -0.2 2)
219 | (-0.6 0.2 2)
220 | (-1 0.2 2)
221 | (-0.2 -1 2)
222 | (-0.2 -0.6 2)
223 | (-0.2 -0.2 2)
224 | (-0.2 0.2 2)
225 | (0.2 -1 2)
226 | (0.2 -0.6 2)
227 | (0.2 -0.2 2)
228 | (0.2 0.2 2)
229 | (0.6 -1 2)
230 | (0.6 -0.6 2)
231 | (0.6 -0.2 2)
232 | (0.6 0.2 2)
233 | (1 -1 2)
234 | (1 -0.6 2)
235 | (1 -0.2 2)
236 | (1 0.2 2)
237 | )
238 |
239 |
240 | // ************************************************************************* //
241 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/constant/polyMesh/owner:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class labelList;
13 | note "nPoints:216 nCells:125 nFaces:450 nInternalFaces:300";
14 | location "constant/polyMesh";
15 | object owner;
16 | }
17 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
18 |
19 |
20 | 450
21 | (
22 | 0
23 | 0
24 | 0
25 | 1
26 | 1
27 | 1
28 | 2
29 | 2
30 | 2
31 | 3
32 | 3
33 | 3
34 | 4
35 | 4
36 | 4
37 | 5
38 | 5
39 | 5
40 | 6
41 | 6
42 | 6
43 | 7
44 | 7
45 | 7
46 | 8
47 | 8
48 | 8
49 | 9
50 | 9
51 | 9
52 | 10
53 | 10
54 | 10
55 | 11
56 | 11
57 | 11
58 | 12
59 | 12
60 | 12
61 | 13
62 | 13
63 | 13
64 | 14
65 | 14
66 | 14
67 | 15
68 | 15
69 | 15
70 | 16
71 | 16
72 | 16
73 | 17
74 | 17
75 | 17
76 | 18
77 | 18
78 | 18
79 | 19
80 | 19
81 | 19
82 | 20
83 | 20
84 | 20
85 | 21
86 | 21
87 | 21
88 | 22
89 | 22
90 | 22
91 | 23
92 | 23
93 | 23
94 | 24
95 | 24
96 | 24
97 | 25
98 | 25
99 | 25
100 | 26
101 | 26
102 | 27
103 | 27
104 | 27
105 | 28
106 | 28
107 | 28
108 | 29
109 | 29
110 | 29
111 | 30
112 | 30
113 | 31
114 | 31
115 | 31
116 | 32
117 | 32
118 | 32
119 | 33
120 | 33
121 | 33
122 | 34
123 | 34
124 | 35
125 | 35
126 | 36
127 | 36
128 | 36
129 | 37
130 | 37
131 | 37
132 | 38
133 | 38
134 | 38
135 | 39
136 | 39
137 | 39
138 | 40
139 | 40
140 | 40
141 | 41
142 | 41
143 | 42
144 | 42
145 | 42
146 | 43
147 | 43
148 | 43
149 | 44
150 | 44
151 | 44
152 | 45
153 | 45
154 | 46
155 | 46
156 | 46
157 | 47
158 | 47
159 | 47
160 | 48
161 | 48
162 | 49
163 | 49
164 | 50
165 | 50
166 | 50
167 | 51
168 | 51
169 | 51
170 | 52
171 | 52
172 | 53
173 | 53
174 | 54
175 | 54
176 | 55
177 | 55
178 | 55
179 | 56
180 | 56
181 | 56
182 | 57
183 | 57
184 | 57
185 | 58
186 | 58
187 | 59
188 | 59
189 | 59
190 | 60
191 | 60
192 | 60
193 | 61
194 | 61
195 | 61
196 | 62
197 | 62
198 | 63
199 | 63
200 | 63
201 | 64
202 | 64
203 | 64
204 | 65
205 | 65
206 | 66
207 | 66
208 | 67
209 | 67
210 | 67
211 | 68
212 | 68
213 | 69
214 | 69
215 | 70
216 | 70
217 | 70
218 | 71
219 | 71
220 | 72
221 | 72
222 | 73
223 | 73
224 | 74
225 | 74
226 | 75
227 | 75
228 | 76
229 | 76
230 | 76
231 | 77
232 | 77
233 | 77
234 | 78
235 | 78
236 | 78
237 | 79
238 | 79
239 | 80
240 | 80
241 | 80
242 | 81
243 | 81
244 | 81
245 | 82
246 | 82
247 | 83
248 | 83
249 | 84
250 | 84
251 | 84
252 | 85
253 | 85
254 | 86
255 | 86
256 | 87
257 | 87
258 | 88
259 | 88
260 | 89
261 | 89
262 | 90
263 | 91
264 | 91
265 | 92
266 | 92
267 | 93
268 | 93
269 | 94
270 | 94
271 | 95
272 | 95
273 | 95
274 | 96
275 | 96
276 | 96
277 | 97
278 | 97
279 | 98
280 | 98
281 | 99
282 | 99
283 | 99
284 | 100
285 | 100
286 | 101
287 | 101
288 | 102
289 | 102
290 | 103
291 | 104
292 | 105
293 | 106
294 | 106
295 | 107
296 | 107
297 | 108
298 | 109
299 | 109
300 | 110
301 | 110
302 | 110
303 | 111
304 | 111
305 | 112
306 | 112
307 | 113
308 | 113
309 | 114
310 | 115
311 | 116
312 | 116
313 | 117
314 | 118
315 | 118
316 | 119
317 | 119
318 | 120
319 | 121
320 | 122
321 | 123
322 | 0
323 | 30
324 | 16
325 | 7
326 | 2
327 | 90
328 | 72
329 | 53
330 | 35
331 | 75
332 | 55
333 | 36
334 | 20
335 | 58
336 | 38
337 | 21
338 | 10
339 | 41
340 | 23
341 | 11
342 | 4
343 | 26
344 | 13
345 | 5
346 | 1
347 | 0
348 | 0
349 | 30
350 | 30
351 | 16
352 | 7
353 | 2
354 | 90
355 | 90
356 | 72
357 | 53
358 | 35
359 | 75
360 | 58
361 | 26
362 | 13
363 | 5
364 | 1
365 | 3
366 | 3
367 | 49
368 | 49
369 | 31
370 | 17
371 | 8
372 | 105
373 | 105
374 | 91
375 | 73
376 | 54
377 | 94
378 | 79
379 | 45
380 | 27
381 | 14
382 | 6
383 | 9
384 | 9
385 | 69
386 | 69
387 | 50
388 | 32
389 | 18
390 | 115
391 | 115
392 | 106
393 | 92
394 | 74
395 | 109
396 | 98
397 | 83
398 | 66
399 | 66
400 | 46
401 | 28
402 | 15
403 | 19
404 | 19
405 | 88
406 | 51
407 | 33
408 | 121
409 | 121
410 | 116
411 | 107
412 | 93
413 | 118
414 | 112
415 | 101
416 | 86
417 | 86
418 | 67
419 | 47
420 | 29
421 | 34
422 | 34
423 | 104
424 | 71
425 | 52
426 | 124
427 | 124
428 | 122
429 | 117
430 | 108
431 | 123
432 | 120
433 | 114
434 | 103
435 | 103
436 | 87
437 | 68
438 | 48
439 | 34
440 | 104
441 | 89
442 | 71
443 | 52
444 | 124
445 | 122
446 | 117
447 | 108
448 | 123
449 | 119
450 | 111
451 | 97
452 | 120
453 | 113
454 | 100
455 | 82
456 | 114
457 | 102
458 | 85
459 | 65
460 | 103
461 | 87
462 | 68
463 | 48
464 | 41
465 | 26
466 | 62
467 | 45
468 | 88
469 | 70
470 | 104
471 | 89
472 | )
473 |
474 |
475 | // ************************************************************************* //
476 |
--------------------------------------------------------------------------------
/examples/cubeflow_boundary_patch.json:
--------------------------------------------------------------------------------
1 | {
2 | "links": [
3 | {
4 | "from_node_name": "vtkOpenFOAMReader",
5 | "from_socket_identifier": "output",
6 | "to_node_name": "Time Selector",
7 | "to_socket_identifier": "input"
8 | },
9 | {
10 | "from_node_name": "Time Selector",
11 | "from_socket_identifier": "output",
12 | "to_node_name": "Multi Block Leaf",
13 | "to_socket_identifier": "input"
14 | },
15 | {
16 | "from_node_name": "Multi Block Leaf",
17 | "from_socket_identifier": "output",
18 | "to_node_name": "Multi Block Leaf.001",
19 | "to_socket_identifier": "input"
20 | },
21 | {
22 | "from_node_name": "Multi Block Leaf.001",
23 | "from_socket_identifier": "output",
24 | "to_node_name": "VTK To Blender Mesh",
25 | "to_socket_identifier": "input"
26 | }
27 | ],
28 | "nodes": [
29 | {
30 | "bl_idname": "VTKOpenFOAMReaderType",
31 | "color": [
32 | 0.5,
33 | 0.5,
34 | 0.5
35 | ],
36 | "custom_code": "DisableAllPatchArrays()\nUpdate()\nEnableAllPatchArrays()",
37 | "height": 100.0,
38 | "hide": false,
39 | "label": "",
40 | "location": [
41 | -550.0,
42 | 250.0
43 | ],
44 | "m_AddDimensionsToArrayNames": false,
45 | "m_CacheMesh": true,
46 | "m_CopyDataToCellZones": false,
47 | "m_CreateCellToPoint": true,
48 | "m_DecomposePolyhedra": false,
49 | "m_FileName": "$/cubeflow/case.foam",
50 | "m_ListTimeStepsByControlDict": false,
51 | "m_PositionsIsIn13Format": false,
52 | "m_ReadZones": false,
53 | "m_SkipZeroTime": false,
54 | "m_Use64BitFloats": true,
55 | "m_Use64BitLabels": false,
56 | "mute": false,
57 | "name": "vtkOpenFOAMReader",
58 | "show_options": true,
59 | "show_preview": false,
60 | "width": 200.0
61 | },
62 | {
63 | "bl_idname": "BVTK_Node_TimeSelectorType",
64 | "color": [
65 | 0.5,
66 | 0.5,
67 | 0.5
68 | ],
69 | "custom_code": "",
70 | "height": 100.0,
71 | "hide": false,
72 | "label": "",
73 | "location": [
74 | -300.0,
75 | 250.0
76 | ],
77 | "mute": false,
78 | "name": "Time Selector",
79 | "show_options": true,
80 | "show_preview": false,
81 | "time_index": 5,
82 | "use_scene_time": true,
83 | "width": 200.0
84 | },
85 | {
86 | "bl_idname": "BVTK_Node_MultiBlockLeafType",
87 | "block": "boundary",
88 | "color": [
89 | 0.5,
90 | 0.5,
91 | 0.5
92 | ],
93 | "custom_code": "",
94 | "height": 100.0,
95 | "hide": false,
96 | "label": "",
97 | "location": [
98 | -30.0,
99 | 250.0
100 | ],
101 | "mute": false,
102 | "name": "Multi Block Leaf",
103 | "show_options": true,
104 | "show_preview": false,
105 | "width": 200.0
106 | },
107 | {
108 | "bl_idname": "BVTK_Node_MultiBlockLeafType",
109 | "block": "inlet",
110 | "color": [
111 | 0.5,
112 | 0.5,
113 | 0.5
114 | ],
115 | "custom_code": "",
116 | "height": 100.0,
117 | "hide": false,
118 | "label": "",
119 | "location": [
120 | 240,
121 | 250
122 | ],
123 | "mute": false,
124 | "name": "Multi Block Leaf.001",
125 | "show_options": true,
126 | "show_preview": false,
127 | "width": 200.0
128 | },
129 | {
130 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
131 | "color": [
132 | 0.5,
133 | 0.5,
134 | 0.5
135 | ],
136 | "create_all_verts": true,
137 | "create_edges": true,
138 | "create_faces": true,
139 | "custom_code": "",
140 | "generate_material": true,
141 | "height": 100.0,
142 | "hide": false,
143 | "label": "",
144 | "location": [
145 | 500.0,
146 | 250.0
147 | ],
148 | "m_Name": "mesh",
149 | "mute": false,
150 | "name": "VTK To Blender Mesh",
151 | "recalc_norms": false,
152 | "show_options": true,
153 | "show_preview": false,
154 | "smooth": false,
155 | "width": 200.0
156 | }
157 | ]
158 | }
159 |
--------------------------------------------------------------------------------
/examples/cubeflow_base_boundary.json:
--------------------------------------------------------------------------------
1 | {
2 | "links": [
3 | {
4 | "from_node_name": "vtkOpenFOAMReader",
5 | "from_socket_identifier": "output",
6 | "to_node_name": "Time Selector",
7 | "to_socket_identifier": "input"
8 | },
9 | {
10 | "from_node_name": "Time Selector",
11 | "from_socket_identifier": "output",
12 | "to_node_name": "Multi Block Leaf",
13 | "to_socket_identifier": "input"
14 | },
15 | {
16 | "from_node_name": "Multi Block Leaf",
17 | "from_socket_identifier": "output",
18 | "to_node_name": "Info",
19 | "to_socket_identifier": "input"
20 | },
21 | {
22 | "from_node_name": "Info",
23 | "from_socket_identifier": "output",
24 | "to_node_name": "VTK To Blender Mesh",
25 | "to_socket_identifier": "input"
26 | }
27 | ],
28 | "nodes": [
29 | {
30 | "bl_idname": "VTKOpenFOAMReaderType",
31 | "color": [
32 | 0.6000000238418579,
33 | 0.800000011920929,
34 | 0.20000000298023224
35 | ],
36 | "custom_code": "",
37 | "height": 100.0,
38 | "hide": false,
39 | "label": "",
40 | "location": [
41 | -550,
42 | 250
43 | ],
44 | "m_AddDimensionsToArrayNames": false,
45 | "m_CacheMesh": true,
46 | "m_CopyDataToCellZones": false,
47 | "m_CreateCellToPoint": true,
48 | "m_DecomposePolyhedra": false,
49 | "m_FileName": "$/cubeflow/case.foam",
50 | "m_ListTimeStepsByControlDict": false,
51 | "m_PositionsIsIn13Format": false,
52 | "m_ReadZones": false,
53 | "m_SkipZeroTime": false,
54 | "m_Use64BitFloats": true,
55 | "m_Use64BitLabels": false,
56 | "mute": false,
57 | "name": "vtkOpenFOAMReader",
58 | "show_options": true,
59 | "show_preview": false,
60 | "width": 200.0
61 | },
62 | {
63 | "bl_idname": "BVTK_Node_TimeSelectorType",
64 | "color": [
65 | 0.6000000238418579,
66 | 0.800000011920929,
67 | 0.20000000298023224
68 | ],
69 | "custom_code": "",
70 | "height": 100.0,
71 | "hide": false,
72 | "label": "",
73 | "location": [
74 | -300,
75 | 250
76 | ],
77 | "mute": false,
78 | "name": "Time Selector",
79 | "show_options": true,
80 | "show_preview": false,
81 | "time_index": 1,
82 | "use_scene_time": true,
83 | "width": 200.0
84 | },
85 | {
86 | "bl_idname": "BVTK_Node_MultiBlockLeafType",
87 | "block": "internalMesh",
88 | "color": [
89 | 0.6000000238418579,
90 | 0.800000011920929,
91 | 0.20000000298023224
92 | ],
93 | "custom_code": "",
94 | "height": 100.0,
95 | "hide": false,
96 | "label": "",
97 | "location": [
98 | -30,
99 | 250
100 | ],
101 | "mute": false,
102 | "name": "Multi Block Leaf",
103 | "show_options": true,
104 | "show_preview": false,
105 | "width": 200.0
106 | },
107 | {
108 | "bl_idname": "BVTK_Node_InfoType",
109 | "color": [
110 | 0.6000000238418579,
111 | 0.800000011920929,
112 | 0.20000000298023224
113 | ],
114 | "custom_code": "",
115 | "height": 100.0,
116 | "hide": false,
117 | "label": "",
118 | "location": [
119 | 220,
120 | 250
121 | ],
122 | "mute": false,
123 | "name": "Info",
124 | "show_options": true,
125 | "show_preview": false,
126 | "width": 200.0
127 | },
128 | {
129 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
130 | "color": [
131 | 0.6000000238418579,
132 | 0.800000011920929,
133 | 0.20000000298023224
134 | ],
135 | "create_all_verts": true,
136 | "create_edges": true,
137 | "create_faces": true,
138 | "custom_code": "",
139 | "generate_material": true,
140 | "height": 100.0,
141 | "hide": false,
142 | "label": "",
143 | "location": [
144 | 500,
145 | 250
146 | ],
147 | "m_Name": "mesh",
148 | "mute": false,
149 | "name": "VTK To Blender Mesh",
150 | "recalc_norms": false,
151 | "show_options": true,
152 | "show_preview": false,
153 | "smooth": false,
154 | "width": 200.0
155 | }
156 | ]
157 | }
158 |
--------------------------------------------------------------------------------
/test/json_files/test_clip.json:
--------------------------------------------------------------------------------
1 | {
2 | "links": [
3 | {
4 | "from_node_name": "vtkClipPolyData",
5 | "from_socket_identifier": "output 0",
6 | "to_node_name": "VTK To Blender Mesh",
7 | "to_socket_identifier": "input"
8 | },
9 | {
10 | "from_node_name": "vtkClipPolyData",
11 | "from_socket_identifier": "output 1",
12 | "to_node_name": "VTK To Blender Mesh.001",
13 | "to_socket_identifier": "input"
14 | },
15 | {
16 | "from_node_name": "vtkSphereSource",
17 | "from_socket_identifier": "output",
18 | "to_node_name": "vtkClipPolyData",
19 | "to_socket_identifier": "input"
20 | },
21 | {
22 | "from_node_name": "vtkPlane",
23 | "from_socket_identifier": "self",
24 | "to_node_name": "vtkClipPolyData",
25 | "to_socket_identifier": "ClipFunction"
26 | }
27 | ],
28 | "nodes": [
29 | {
30 | "bl_idname": "VTKClipPolyDataType",
31 | "color": [
32 | 0.6079999804496765,
33 | 0.6079999804496765,
34 | 0.6079999804496765
35 | ],
36 | "custom_code": "",
37 | "height": 100.0,
38 | "hide": false,
39 | "label": "",
40 | "location": [
41 | 0.0,
42 | 300.0
43 | ],
44 | "m_GenerateClipScalars": true,
45 | "m_GenerateClippedOutput": true,
46 | "m_InsideOut": true,
47 | "m_Value": 0.0,
48 | "mute": false,
49 | "name": "vtkClipPolyData",
50 | "show_options": true,
51 | "show_preview": false,
52 | "width": 200.0
53 | },
54 | {
55 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
56 | "color": [
57 | 0.6079999804496765,
58 | 0.6079999804496765,
59 | 0.6079999804496765
60 | ],
61 | "custom_code": "",
62 | "generate_material": false,
63 | "height": 100.0,
64 | "hide": false,
65 | "label": "",
66 | "location": [
67 | 300.0,
68 | 300.0
69 | ],
70 | "m_Name": "mesh",
71 | "mute": false,
72 | "name": "VTK To Blender Mesh",
73 | "show_options": true,
74 | "show_preview": false,
75 | "smooth": false,
76 | "width": 200.0
77 | },
78 | {
79 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
80 | "color": [
81 | 0.6079999804496765,
82 | 0.6079999804496765,
83 | 0.6079999804496765
84 | ],
85 | "custom_code": "",
86 | "generate_material": false,
87 | "height": 100.0,
88 | "hide": false,
89 | "label": "",
90 | "location": [
91 | 300.0,
92 | 50.0
93 | ],
94 | "m_Name": "mesh2",
95 | "mute": false,
96 | "name": "VTK To Blender Mesh.001",
97 | "show_options": true,
98 | "show_preview": false,
99 | "smooth": false,
100 | "width": 200.0
101 | },
102 | {
103 | "bl_idname": "VTKSphereSourceType",
104 | "color": [
105 | 0.6079999804496765,
106 | 0.6079999804496765,
107 | 0.6079999804496765
108 | ],
109 | "custom_code": "",
110 | "height": 100.0,
111 | "hide": false,
112 | "label": "",
113 | "location": [
114 | -400.0,
115 | 300.0
116 | ],
117 | "m_Center": [
118 | 0.0,
119 | 0.0,
120 | 0.0
121 | ],
122 | "m_EndPhi": 180.0,
123 | "m_EndTheta": 360.0,
124 | "m_LatLongTessellation": true,
125 | "m_PhiResolution": 20,
126 | "m_Radius": 1.0,
127 | "m_StartPhi": 0.0,
128 | "m_StartTheta": 0.0,
129 | "m_ThetaResolution": 20,
130 | "mute": false,
131 | "name": "vtkSphereSource",
132 | "show_options": true,
133 | "show_preview": false,
134 | "width": 200.0
135 | },
136 | {
137 | "bl_idname": "VTKPlaneType",
138 | "color": [
139 | 0.6079999804496765,
140 | 0.6079999804496765,
141 | 0.6079999804496765
142 | ],
143 | "custom_code": "",
144 | "height": 100.0,
145 | "hide": false,
146 | "label": "",
147 | "location": [
148 | -400.0,
149 | 0.0
150 | ],
151 | "m_Normal": [
152 | 1.0,
153 | 1.0,
154 | 1.0
155 | ],
156 | "m_Origin": [
157 | 0.0,
158 | 0.0,
159 | 0.0
160 | ],
161 | "mute": false,
162 | "name": "vtkPlane",
163 | "show_options": true,
164 | "show_preview": false,
165 | "width": 285.1534118652344
166 | }
167 | ]
168 | }
169 |
--------------------------------------------------------------------------------
/examples/clip.json:
--------------------------------------------------------------------------------
1 | {
2 | "links": [
3 | {
4 | "from_node_name": "vtkSphereSource",
5 | "from_socket_identifier": "output",
6 | "to_node_name": "vtkClipPolyData",
7 | "to_socket_identifier": "input"
8 | },
9 | {
10 | "from_node_name": "vtkPlane",
11 | "from_socket_identifier": "output",
12 | "to_node_name": "vtkClipPolyData",
13 | "to_socket_identifier": "ClipFunction"
14 | },
15 | {
16 | "from_node_name": "vtkClipPolyData",
17 | "from_socket_identifier": "output 0",
18 | "to_node_name": "VTK To Blender Mesh",
19 | "to_socket_identifier": "input"
20 | },
21 | {
22 | "from_node_name": "vtkClipPolyData",
23 | "from_socket_identifier": "output 1",
24 | "to_node_name": "VTK To Blender Mesh.001",
25 | "to_socket_identifier": "input"
26 | }
27 | ],
28 | "nodes": [
29 | {
30 | "bl_idname": "VTKSphereSourceType",
31 | "color": [
32 | 0.5,
33 | 0.5,
34 | 0.5
35 | ],
36 | "custom_code": "",
37 | "height": 100.0,
38 | "hide": false,
39 | "label": "",
40 | "location": [
41 | -400.0,
42 | 300.0
43 | ],
44 | "m_Center": [
45 | 0.0,
46 | 0.0,
47 | 0.0
48 | ],
49 | "m_EndPhi": 180.0,
50 | "m_EndTheta": 360.0,
51 | "m_LatLongTessellation": true,
52 | "m_PhiResolution": 20,
53 | "m_Radius": 1.0,
54 | "m_StartPhi": 0.0,
55 | "m_StartTheta": 0.0,
56 | "m_ThetaResolution": 20,
57 | "mute": false,
58 | "name": "vtkSphereSource",
59 | "show_options": true,
60 | "show_preview": false,
61 | "width": 200.0
62 | },
63 | {
64 | "bl_idname": "VTKPlaneType",
65 | "color": [
66 | 0.5,
67 | 0.5,
68 | 0.5
69 | ],
70 | "custom_code": "",
71 | "height": 100.0,
72 | "hide": false,
73 | "label": "",
74 | "location": [
75 | -400.0,
76 | -100.0
77 | ],
78 | "m_Normal": [
79 | 1.0,
80 | 1.0,
81 | 1.0
82 | ],
83 | "m_Origin": [
84 | 0.0,
85 | 0.0,
86 | 0.0
87 | ],
88 | "mute": false,
89 | "name": "vtkPlane",
90 | "orientation_object": "",
91 | "show_options": true,
92 | "show_preview": false,
93 | "width": 285.1534118652344
94 | },
95 | {
96 | "bl_idname": "VTKClipPolyDataType",
97 | "color": [
98 | 0.5,
99 | 0.5,
100 | 0.5
101 | ],
102 | "custom_code": "",
103 | "height": 100.0,
104 | "hide": false,
105 | "label": "",
106 | "location": [
107 | 0.0,
108 | 300.0
109 | ],
110 | "m_GenerateClipScalars": true,
111 | "m_GenerateClippedOutput": true,
112 | "m_InsideOut": true,
113 | "m_Value": 0.0,
114 | "mute": false,
115 | "name": "vtkClipPolyData",
116 | "show_options": true,
117 | "show_preview": false,
118 | "width": 200.0
119 | },
120 | {
121 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
122 | "color": [
123 | 0.5,
124 | 0.5,
125 | 0.5
126 | ],
127 | "create_all_verts": false,
128 | "create_edges": true,
129 | "create_faces": true,
130 | "custom_code": "",
131 | "generate_material": false,
132 | "height": 100.0,
133 | "hide": false,
134 | "label": "",
135 | "location": [
136 | 300.0,
137 | 300.0
138 | ],
139 | "m_Name": "mesh",
140 | "mute": false,
141 | "name": "VTK To Blender Mesh",
142 | "recalc_norms": false,
143 | "show_options": true,
144 | "show_preview": false,
145 | "smooth": false,
146 | "width": 200.0
147 | },
148 | {
149 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
150 | "color": [
151 | 0.5,
152 | 0.5,
153 | 0.5
154 | ],
155 | "create_all_verts": false,
156 | "create_edges": true,
157 | "create_faces": true,
158 | "custom_code": "",
159 | "generate_material": false,
160 | "height": 100.0,
161 | "hide": false,
162 | "label": "",
163 | "location": [
164 | 300.0,
165 | -40.0
166 | ],
167 | "m_Name": "mesh2",
168 | "mute": false,
169 | "name": "VTK To Blender Mesh.001",
170 | "recalc_norms": false,
171 | "show_options": true,
172 | "show_preview": false,
173 | "smooth": false,
174 | "width": 200.0
175 | }
176 | ]
177 | }
178 |
--------------------------------------------------------------------------------
/info.py:
--------------------------------------------------------------------------------
1 | from .core import l # Import logging
2 | from .core import *
3 |
4 |
5 | class BVTK_Node_Info(Node, BVTK_Node):
6 | """BVTK Info Node"""
7 |
8 | bl_idname = "BVTK_Node_InfoType"
9 | bl_label = "Info"
10 |
11 | def m_properties(self):
12 | return []
13 |
14 | def m_connections(self):
15 | return (["input"], ["output"], [], [])
16 |
17 | def apply_properties_special(self):
18 | """Special update function to generate info text from VTK objects
19 | """
20 | text = ""
21 | fs1 = "{:.5g}"
22 | fs2 = "{k} [{i}] ({data_type_name}{n_comps}): '{name}': {range_text}"
23 |
24 | (
25 | input_node,
26 | vtk_output_obj,
27 | vtk_connection,
28 | ) = self.get_input_node_and_output_vtk_objects("input")
29 |
30 | text += "Type: " + vtk_output_obj.__class__.__name__ + "\n"
31 |
32 | # Print block names for vtkMultiBlockDataSet
33 | if hasattr(vtk_output_obj, "GetNumberOfBlocks"):
34 | for i in range(vtk_output_obj.GetNumberOfBlocks()):
35 | block = vtk_output_obj.GetBlock(i)
36 | if not hasattr(vtk_output_obj, "GetMetaData"):
37 | text += " Block " + str(i) + ": No meta data available\n"
38 | continue
39 | meta_data = vtk_output_obj.GetMetaData(i)
40 | if not meta_data:
41 | continue
42 | block_name = meta_data.Get(vtk.vtkCompositeDataSet.NAME())
43 | text += (
44 | " Block "
45 | + str(i)
46 | + ": %r" % block_name
47 | + " ("
48 | + (block.__class__.__name__ if block else "Empty Block")
49 | + ")\n"
50 | )
51 |
52 | if hasattr(vtk_output_obj, "GetNumberOfPoints"):
53 | text += "Points: " + str(vtk_output_obj.GetNumberOfPoints()) + "\n"
54 | if hasattr(vtk_output_obj, "GetNumberOfCells"):
55 | text += "Cells: " + str(vtk_output_obj.GetNumberOfCells()) + "\n"
56 | if hasattr(vtk_output_obj, "GetBounds"):
57 | # GetBounds() can fail, so use try-except for getting bounds
58 | try:
59 | bounds = vtk_output_obj.GetBounds()
60 | text += (
61 | "X range: "
62 | + fs1.format(bounds[0])
63 | + " - "
64 | + fs1.format(bounds[1])
65 | + "\n"
66 | )
67 | text += (
68 | "Y range: "
69 | + fs1.format(bounds[2])
70 | + " - "
71 | + fs1.format(bounds[3])
72 | + "\n"
73 | )
74 | text += (
75 | "Z range: "
76 | + fs1.format(bounds[4])
77 | + " - "
78 | + fs1.format(bounds[5])
79 | + "\n"
80 | )
81 | except:
82 | pass
83 | data = {}
84 | if hasattr(vtk_output_obj, "GetPointData"):
85 | data["Point data"] = vtk_output_obj.GetPointData()
86 | if hasattr(vtk_output_obj, "GetCellData"):
87 | data["Cell data"] = vtk_output_obj.GetCellData()
88 | if hasattr(vtk_output_obj, "GetFieldData"):
89 | data["Field data"] = vtk_output_obj.GetFieldData()
90 | for k in data:
91 | d = data[k]
92 | for i in range(d.GetNumberOfArrays()):
93 | arr = d.GetArray(i)
94 | data_type_name = arr.GetDataTypeAsString()
95 | n_comps = arr.GetNumberOfComponents()
96 | name = arr.GetName()
97 |
98 | if name is None or data_type_name is None or n_comps is None:
99 | text += (
100 | "Warning: Invalid array encountered: number="
101 | + str(i)
102 | + " name="
103 | + str(name)
104 | + " data_type_name="
105 | + str(data_type_name)
106 | + " n_comps="
107 | + str(n_comps)
108 | + "\n"
109 | )
110 |
111 | range_text = ""
112 | for n in range(n_comps):
113 | r = arr.GetRange(n)
114 | range_text += (
115 | "[" + fs1.format(r[0]) + ", " + fs1.format(r[1]) + "] "
116 | )
117 | text += fs2.format(
118 | k=k,
119 | i=i,
120 | data_type_name=data_type_name,
121 | n_comps=n_comps,
122 | name=name,
123 | range_text=range_text,
124 | )
125 | text += "\n"
126 | self.ui_message = text
127 | return "up-to-date"
128 |
129 | def get_vtk_output_object_special(self, socketname="output"):
130 | """Pass on VTK output from input as output"""
131 | (
132 | input_node,
133 | vtk_output_obj,
134 | vtk_connection,
135 | ) = self.get_input_node_and_output_vtk_objects()
136 | return vtk_output_obj
137 |
138 | def init_vtk(self):
139 | self.set_vtk_status("out-of-date")
140 | return None
141 |
142 |
143 | TYPENAMES = []
144 | add_class(BVTK_Node_Info)
145 | TYPENAMES.append("BVTK_Node_InfoType")
146 |
147 | menu_items = [NodeItem(x) for x in TYPENAMES]
148 | CATEGORIES.append(BVTK_NodeCategory("Debug", "Debug", items=menu_items))
149 |
--------------------------------------------------------------------------------
/docs/development.rst:
--------------------------------------------------------------------------------
1 | .. _development:
2 |
3 | Development
4 | ===========
5 | BVTKNodes is a community driven `open-source project `_.
6 | If you want to develop and improve BVTKNodes for everyone, please feel free to head over to `our current github repository `_.
7 |
8 | Terminology
9 | -----------
10 |
11 | - (BVTK) node = a Blender node object in BVTK node tree
12 | - generated node = VTK node which has been automatically generated
13 | - custom node = customized version of a generated node
14 | - VTK node = a generated or a custom node which implements a VTK class
15 | - special node = all other nodes in BVTK node tree
16 | - socket = Blender socket in a node
17 | - VTK object = instance of vtkObject class
18 | - VTK connection = instance of vtkAlgorithmOutput class
19 |
20 | BVTK Core
21 | ---------
22 |
23 | The `tkeskita/bvtknodes `_
24 | version includes a modified core functionality for BVTK Nodes, which
25 | allows custom functionality to be plugged in for custom nodes.
26 | These can be used by adding special functions to nodes:
27 |
28 | - **init_special()** - special function to run when node is created.
29 | - **draw_buttons_special()** - special node UI contents.
30 | - **init_vtk()** - creation and initialization of VTK object.
31 | - **apply_inputs()** - update input connections to VTK object.
32 | - **validate_and_update_values_special()** - optional node value
33 | validation and update routine.
34 | - **apply_properties_special()** - special function to run for setting
35 | properties and update VTK object for special nodes.
36 | - **get_vtk_output_object_special()** - special function to provide
37 | VTK output object for special nodes.
38 |
39 | Please see current custom nodes located in `custom_nodes` folder in
40 | the source for examples.
41 |
42 | Writing Code
43 | ------------
44 |
45 | Python code formatting style used in this project is `black
46 | `_. All Python code should be formatted
47 | with command `black file.py` available e.g. via `pip install black`,
48 | except for autogenerated code files, like:
49 |
50 | - generated_nodes/\*.py
51 | - b_properties.py
52 | - favorites_data.py
53 |
54 | At least some short `doc strings
55 | `_ should be included, they
56 | are much appreciated! If you wish to improve our doc strings further,
57 | please use `Google style Python docstrings
58 | `_.
59 |
60 | Testing Framework
61 | -----------------
62 | BVTKNodes includes a testing framework (located in the `test` directory) that should help with checking new updates and finding bugs.
63 |
64 | Executing Tests
65 | ***************
66 | * First, make sure that BVTKNodes is correctly installed (see :ref:`general_installation`) by running one of the examples located in the Tree Tab.
67 | * Tests require that BVTKNodes is importable to Python by command
68 | `import BVtkNodes`. This requires that the root folder name of
69 | BVTKNodes is named exactly as `BVtkNodes`. If you've installed
70 | BVTKNodes by downloading zip file from Github, the folder name is
71 | most likely `BVtkNodes-master` (you can see the full path in Blender
72 | Preferences -> Add-ons list), and the tests fail. In this case you
73 | can disable BVTKNodes add-on in Blender, rename the folder, and
74 | re-enable the add-on.
75 | * Set environment variable *BLENDER_PATH* to the Blender executable that you want to test.
76 | * Run ``python test/test_main.py`` with a Python environment that has NumPy (and optionally PyVista, best installed using pip) package installed.
77 |
78 | Running the tests should result in an "OK" output similar to the following:
79 |
80 | .. code-block:: bash
81 |
82 | ........
83 | ----------------------------------------------------------------------
84 | Ran 8 tests in 36.380s
85 |
86 | OK
87 |
88 | .. note::
89 | Tests can be also run from Blender's Python environment (see :ref:`vtk_installation`).
90 |
91 |
92 | Writing Tests
93 | *************
94 |
95 | BVTKNodes is currently not extensively tested and would benefit from additional tests.
96 | Nonetheless, we hope that new features would include at least one test to check that the features are working as expected.
97 |
98 | Typical test applies `test_template.blend` file which includes an empty node tree, and a JSON file that defines the node tree.
99 | Optionally an additional Python script can be provided to run special commands.
100 | If no additional script is provided, a general `test_blender_script.py` is called.
101 | This script executes the tree once (using the `Update All` node, which must be present in the node tree) and checks for any errors.
102 | For discussion about testing, please check `#57 `_.
103 | See :ref:`Tree ` on how to create the JSON file from an existing node tree.
104 |
105 | ``BVTKMainExamples`` in `test_main.py` lists all JSON files with their corresponding Python scripts and executes them as follows:
106 |
107 | * Blender is called with flags ``--python [script] --background --python-exit-code 1 -- -j [JSON file] [additional parameters]``.
108 | * The Python script is executed. Note that you can use utility functions from `test_blender_script.py` for parsing additional parameters and to create the node tree.
109 | * After execution, Blender exits.
110 |
111 | The test is assumed successful if the return code of Blender is zero.
112 | Exceptions in the script, or custom assertions must return a different return code to indicate failure.
113 | It is also possible to provide a small reference data file and compare test result to it (see the `test_glyphs_and_writers` test case).
114 | Alternatively, you can compare the data directly inside the script (see the `test_global_time_keeper` test case).
115 | Please try to keep test cases small, effective, and avoid binary files if possible.
116 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # Configuration file for the Sphinx documentation builder.
4 | #
5 | # This file does only contain a selection of the most common options. For a
6 | # full list see the documentation:
7 | # http://www.sphinx-doc.org/en/master/config
8 |
9 | # -- Path setup --------------------------------------------------------------
10 |
11 | # If extensions (or modules to document with autodoc) are in another directory,
12 | # add these directories to sys.path here. If the directory is relative to the
13 | # documentation root, use os.path.abspath to make it absolute, like shown here.
14 | #
15 | #import os
16 | #import sys
17 | #sys.path.insert(0, os.path.abspath('.'))
18 | #
19 | # Failed: Tried to remove current dir to circumvent readthedocs import of
20 | # inspect.py from root, but this file seems not to have an effect there.
21 | #sys.path.remove(sys.path[0])
22 |
23 | # -- Project information -----------------------------------------------------
24 |
25 | project = u'BVTKNodes'
26 | copyright = u'2023, BVTKNodes Developers'
27 | author = u'BVTKNodes Developers'
28 |
29 | # The short X.Y version
30 | version = u''
31 | # The full version, including alpha/beta/rc tags
32 | release = u'0.11'
33 |
34 |
35 | # -- General configuration ---------------------------------------------------
36 |
37 | # If your documentation needs a minimal Sphinx version, state it here.
38 | #
39 | # needs_sphinx = '1.0'
40 |
41 | # Add any Sphinx extension module names here, as strings. They can be
42 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
43 | # ones.
44 | extensions = [
45 | ]
46 |
47 | # Add any paths that contain templates here, relative to this directory.
48 | templates_path = ['_templates']
49 |
50 | # The suffix(es) of source filenames.
51 | # You can specify multiple suffix as a list of string:
52 | #
53 | # source_suffix = ['.rst', '.md']
54 | source_suffix = '.rst'
55 |
56 | # The master toctree document.
57 | master_doc = 'index'
58 |
59 | # The language for content autogenerated by Sphinx. Refer to documentation
60 | # for a list of supported languages.
61 | #
62 | # This is also used if you do content translation via gettext catalogs.
63 | # Usually you set "language" from the command line for these cases.
64 | language = None
65 |
66 | # List of patterns, relative to source directory, that match files and
67 | # directories to ignore when looking for source files.
68 | # This pattern also affects html_static_path and html_extra_path.
69 | exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
70 |
71 | # The name of the Pygments (syntax highlighting) style to use.
72 | pygments_style = None
73 |
74 |
75 | # -- Options for HTML output -------------------------------------------------
76 |
77 | # The theme to use for HTML and HTML Help pages. See the documentation for
78 | # a list of builtin themes.
79 | #
80 | #html_theme = 'alabaster'
81 | html_theme = 'sphinx_rtd_theme'
82 |
83 | # Theme options are theme-specific and customize the look and feel of a theme
84 | # further. For a list of options available for each theme, see the
85 | # documentation.
86 | #
87 | # html_theme_options = {}
88 |
89 | # Add any paths that contain custom static files (such as style sheets) here,
90 | # relative to this directory. They are copied after the builtin static files,
91 | # so a file named "default.css" will overwrite the builtin "default.css".
92 | html_static_path = ['_static']
93 |
94 | # Custom sidebar templates, must be a dictionary that maps document names
95 | # to template names.
96 | #
97 | # The default sidebars (for documents that don't match any pattern) are
98 | # defined by theme itself. Builtin themes are using these templates by
99 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
100 | # 'searchbox.html']``.
101 | #
102 | # html_sidebars = {}
103 |
104 |
105 | # -- Options for HTMLHelp output ---------------------------------------------
106 |
107 | # Output file base name for HTML help builder.
108 | htmlhelp_basename = 'BVTKNodesdoc'
109 |
110 |
111 | # -- Options for LaTeX output ------------------------------------------------
112 |
113 | latex_elements = {
114 | # The paper size ('letterpaper' or 'a4paper').
115 | #
116 | # 'papersize': 'letterpaper',
117 |
118 | # The font size ('10pt', '11pt' or '12pt').
119 | #
120 | # 'pointsize': '10pt',
121 |
122 | # Additional stuff for the LaTeX preamble.
123 | #
124 | # 'preamble': '',
125 |
126 | # Latex figure (float) alignment
127 | #
128 | # 'figure_align': 'htbp',
129 | }
130 |
131 | # Grouping the document tree into LaTeX files. List of tuples
132 | # (source start file, target name, title,
133 | # author, documentclass [howto, manual, or own class]).
134 | latex_documents = [
135 | (master_doc, 'BVTKNodes.tex', u'BVTKNodes Documentation',
136 | u'Silvano Imboden, Lorenzo Celli, Paul McManus, Tuomo Keskitalo', 'manual'),
137 | ]
138 |
139 |
140 | # -- Options for manual page output ------------------------------------------
141 |
142 | # One entry per manual page. List of tuples
143 | # (source start file, name, description, authors, manual section).
144 | man_pages = [
145 | (master_doc, 'bvtknodes', u'BVTKNodes Documentation',
146 | [author], 1)
147 | ]
148 |
149 |
150 | # -- Options for Texinfo output ----------------------------------------------
151 |
152 | # Grouping the document tree into Texinfo files. List of tuples
153 | # (source start file, target name, title, author,
154 | # dir menu entry, description, category)
155 | texinfo_documents = [
156 | (master_doc, 'BVTKNodes', u'BVTKNodes Documentation',
157 | author, 'BVTKNodes', 'One line description of project.',
158 | 'Miscellaneous'),
159 | ]
160 |
161 |
162 | # -- Options for Epub output -------------------------------------------------
163 |
164 | # Bibliographic Dublin Core info.
165 | epub_title = project
166 |
167 | # The unique identifier of the text. This can be a ISBN number
168 | # or the project homepage.
169 | #
170 | # epub_identifier = ''
171 |
172 | # A unique identification for the text.
173 | #
174 | # epub_uid = ''
175 |
176 | # A list of files that should not be packed into the epub file.
177 | epub_exclude_files = ['search.html']
178 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.1/U:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volVectorField;
13 | location "0.1";
14 | object U;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 1 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | (-0.00230287 0.00434819 0.00230287)
24 | (-0.00262447 0.0141055 0.00262447)
25 | (-0.00638556 0.00410876 0.00257494)
26 | (-0.00257494 0.00410876 0.00638556)
27 | (-0.00759978 0.0131115 0.00276081)
28 | (-0.00349672 0.0210236 0.00349672)
29 | (-0.00276081 0.0131115 0.00759978)
30 | (-0.0085731 0.003266 0.00305327)
31 | (-0.00718406 0.00400549 0.00718406)
32 | (-0.00305327 0.003266 0.0085731)
33 | (-0.00951119 0.00915648 0.00287115)
34 | (-0.011589 0.0196109 0.00341612)
35 | (-0.00790377 0.0124605 0.00790377)
36 | (-0.00432263 0.0520341 0.00432263)
37 | (-0.00341612 0.0196109 0.011589)
38 | (-0.00287115 0.00915648 0.00951119)
39 | (-0.00681705 0.00327123 0.00497889)
40 | (-0.0110789 0.00352918 0.00828731)
41 | (-0.00828731 0.00352918 0.0110789)
42 | (-0.00497889 0.00327123 0.00681705)
43 | (-0.00697317 0.00841428 0.0039025)
44 | (-0.0133693 0.0125855 0.00289409)
45 | (-0.0107651 0.00947259 0.00794353)
46 | (-0.0163687 0.048588 0.0041171)
47 | (-0.0110751 0.0185143 0.0110751)
48 | (-0.00794353 0.00947259 0.0107651)
49 | (-0.00725095 0.0435047 0.00725095)
50 | (-0.0041171 0.048588 0.0163687)
51 | (-0.00289409 0.0125855 0.0133693)
52 | (-0.0039025 0.00841428 0.00697317)
53 | (-0.00232707 0.00315162 0.00529652)
54 | (-0.00920282 0.00444734 0.0126677)
55 | (-0.0141789 0.00376243 0.0141789)
56 | (-0.0126677 0.00444734 0.00920282)
57 | (-0.00529652 0.00315162 0.00232707)
58 | (-0.00243609 0.00781379 0.00406772)
59 | (-0.00814438 0.0107725 0.00304928)
60 | (-0.00830198 0.0105086 0.0105762)
61 | (-0.0183055 0.0169997 0.00308805)
62 | (-0.0131585 0.0125382 0.0083193)
63 | (-0.0123022 0.00935463 0.0123022)
64 | (-0.0457264 0.0409087 0.00676325)
65 | (-0.0152775 0.0455318 0.0152775)
66 | (-0.0083193 0.0125382 0.0131585)
67 | (-0.0105762 0.0105086 0.00830198)
68 | (-0.00676325 0.0409087 0.0457264)
69 | (-0.00308805 0.0169997 0.0183055)
70 | (-0.00304928 0.0107725 0.00814438)
71 | (-0.00406772 0.00781379 0.00243609)
72 | (-0.0027372 0.00448363 0.0132914)
73 | (-0.0120505 0.00566656 0.0369463)
74 | (-0.0369463 0.00566656 0.0120505)
75 | (-0.0132914 0.00448363 0.0027372)
76 | (-0.00285947 0.00943417 0.00301664)
77 | (-0.0026801 0.0102559 0.0108717)
78 | (-0.0100057 0.0124439 0.00283677)
79 | (-0.00840511 0.0119733 0.00861)
80 | (-0.0101172 0.0127478 0.0259394)
81 | (-0.0489405 0.0104228 0.00396614)
82 | (-0.0172684 0.0161028 0.0095105)
83 | (-0.0110672 0.0111914 0.0110672)
84 | (-0.0259394 0.0127478 0.0101172)
85 | (-0.0428163 0.0385526 0.0428163)
86 | (-0.0095105 0.0161028 0.0172684)
87 | (-0.00861 0.0119733 0.00840511)
88 | (-0.0108717 0.0102559 0.0026801)
89 | (-0.00396614 0.0104228 0.0489405)
90 | (-0.00283677 0.0124439 0.0100057)
91 | (-0.00301664 0.00943417 0.00285947)
92 | (-0.00316459 0.00585598 0.0379139)
93 | (-0.0337276 0.106618 0.0337276)
94 | (-0.0379139 0.00585598 0.00316459)
95 | (-0.00365708 0.00892483 0.0025889)
96 | (-0.00289933 0.0110298 0.00840805)
97 | (-0.00290319 0.0129818 0.0263188)
98 | (-0.0159341 0.006822 0.00326875)
99 | (-0.00967407 0.0123305 0.00821599)
100 | (-0.00843911 0.0132706 0.0141158)
101 | (-0.0225176 0.033737 0.0225176)
102 | (-0.0458316 0.00961223 0.0145126)
103 | (-0.0115633 0.0109323 0.0115633)
104 | (-0.0141158 0.0132706 0.00843911)
105 | (-0.0263188 0.0129818 0.00290319)
106 | (-0.0145126 0.00961223 0.0458316)
107 | (-0.00821599 0.0123305 0.00967407)
108 | (-0.00840805 0.0110298 0.00289933)
109 | (-0.00326875 0.006822 0.0159341)
110 | (-0.0025889 0.00892483 0.00365708)
111 | (-0.00425318 0.0994601 0.034544)
112 | (-0.034544 0.0994601 0.00425318)
113 | (-0.00620341 0.00415359 0.002638)
114 | (-0.0034879 0.00937754 0.00726007)
115 | (-0.00279775 0.0131654 0.0142619)
116 | (-0.00335017 0.0343801 0.0228256)
117 | (-0.0148536 0.00642355 0.0105939)
118 | (-0.00798304 0.0104929 0.0110205)
119 | (-0.0117466 0.0268612 0.0117466)
120 | (-0.0228256 0.0343801 0.00335017)
121 | (-0.0164702 0.00533852 0.0164702)
122 | (-0.0110205 0.0104929 0.00798304)
123 | (-0.0142619 0.0131654 0.00279775)
124 | (-0.0105939 0.00642355 0.0148536)
125 | (-0.00726007 0.00937754 0.0034879)
126 | (-0.002638 0.00415359 0.00620341)
127 | (-0.00433626 0.0921698 0.00433626)
128 | (-0.00567725 0.00411935 0.00761484)
129 | (-0.00283642 0.00973708 0.010202)
130 | (-0.00321021 0.0271152 0.0120537)
131 | (-0.00339431 0.035084 0.00339431)
132 | (-0.00939249 0.00439867 0.0125485)
133 | (-0.00842788 0.0137514 0.00842788)
134 | (-0.0120537 0.0271152 0.00321021)
135 | (-0.0125485 0.00439867 0.00939249)
136 | (-0.010202 0.00973708 0.00283642)
137 | (-0.00761484 0.00411935 0.00567725)
138 | (-0.00338894 0.00375778 0.00955936)
139 | (-0.00278739 0.0139652 0.00818126)
140 | (-0.00320207 0.0275327 0.00320207)
141 | (-0.00802486 0.004749 0.00802486)
142 | (-0.00818126 0.0139652 0.00278739)
143 | (-0.00955936 0.00375778 0.00338894)
144 | (-0.00279573 0.00465252 0.0070478)
145 | (-0.00265241 0.0144959 0.00265241)
146 | (-0.0070478 0.00465252 0.00279573)
147 | (-0.00246475 0.00475384 0.00246475)
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type noSlip;
156 | }
157 | inlet
158 | {
159 | type fixedValue;
160 | value uniform (0 0.1 0);
161 | }
162 | outlet
163 | {
164 | type pressureInletOutletVelocity;
165 | value nonuniform List 4((-0.00425318 0.0994601 0.034544) (-0.0337276 0.106618 0.0337276) (-0.00433626 0.0921698 0.00433626) (-0.034544 0.0994601 0.00425318));
166 | }
167 | }
168 |
169 |
170 | // ************************************************************************* //
171 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.2/U:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volVectorField;
13 | location "0.2";
14 | object U;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 1 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | (-0.00227042 0.00402129 0.00227042)
24 | (-0.00250033 0.0145215 0.00250033)
25 | (-0.00639214 0.00395219 0.00263485)
26 | (-0.00263485 0.00395219 0.00639214)
27 | (-0.00758728 0.0139257 0.00275721)
28 | (-0.00326749 0.0198213 0.00326749)
29 | (-0.00275721 0.0139257 0.00758728)
30 | (-0.00866563 0.00308895 0.00308885)
31 | (-0.00730754 0.0039947 0.00730754)
32 | (-0.00308885 0.00308895 0.00866563)
33 | (-0.00964008 0.00907911 0.00287981)
34 | (-0.0123485 0.019243 0.00334657)
35 | (-0.00808554 0.0136046 0.00808554)
36 | (-0.00361055 0.0510008 0.00361055)
37 | (-0.00334657 0.019243 0.0123485)
38 | (-0.00287981 0.00907911 0.00964008)
39 | (-0.00674755 0.00318184 0.00550362)
40 | (-0.0117429 0.00345566 0.00776284)
41 | (-0.00776284 0.00345566 0.0117429)
42 | (-0.00550362 0.00318184 0.00674755)
43 | (-0.00695321 0.00852038 0.00442475)
44 | (-0.0142713 0.011732 0.00282137)
45 | (-0.0115401 0.00965412 0.00770808)
46 | (-0.0162948 0.0490423 0.0036263)
47 | (-0.0120975 0.0188742 0.0120975)
48 | (-0.00770808 0.00965412 0.0115401)
49 | (-0.00588215 0.0468405 0.00588215)
50 | (-0.0036263 0.0490423 0.0162948)
51 | (-0.00282137 0.011732 0.0142713)
52 | (-0.00442475 0.00852038 0.00695321)
53 | (-0.00220481 0.00297046 0.00569704)
54 | (-0.0096457 0.00446498 0.0119723)
55 | (-0.0135886 0.0034349 0.0135886)
56 | (-0.0119723 0.00446498 0.0096457)
57 | (-0.00569704 0.00297046 0.00220481)
58 | (-0.00239628 0.00761351 0.00454024)
59 | (-0.00818843 0.01077 0.00318602)
60 | (-0.00888457 0.0111719 0.0105052)
61 | (-0.0179979 0.0156281 0.00277649)
62 | (-0.0144395 0.0121543 0.00834281)
63 | (-0.0123146 0.00894296 0.0123146)
64 | (-0.0457854 0.0453308 0.00571044)
65 | (-0.0157574 0.0473144 0.0157574)
66 | (-0.00834281 0.0121543 0.0144395)
67 | (-0.0105052 0.0111719 0.00888457)
68 | (-0.00571044 0.0453308 0.0457854)
69 | (-0.00277649 0.0156281 0.0179979)
70 | (-0.00318602 0.01077 0.00818843)
71 | (-0.00454024 0.00761351 0.00239628)
72 | (-0.0025839 0.0043344 0.0120369)
73 | (-0.0114517 0.00526537 0.0366256)
74 | (-0.0366256 0.00526537 0.0114517)
75 | (-0.0120369 0.0043344 0.0025839)
76 | (-0.00297864 0.00918239 0.00310491)
77 | (-0.00267291 0.0105283 0.0103934)
78 | (-0.0092685 0.0129825 0.00283667)
79 | (-0.00874916 0.0126261 0.00865242)
80 | (-0.010055 0.0123642 0.0282703)
81 | (-0.0491178 0.010175 0.00333868)
82 | (-0.0176825 0.0154486 0.00915764)
83 | (-0.0111747 0.0106092 0.0111747)
84 | (-0.0282703 0.0123642 0.010055)
85 | (-0.0440476 0.0439433 0.0440476)
86 | (-0.00915764 0.0154486 0.0176825)
87 | (-0.00865242 0.0126261 0.00874916)
88 | (-0.0103934 0.0105283 0.00267291)
89 | (-0.00333868 0.010175 0.0491178)
90 | (-0.00283667 0.0129825 0.0092685)
91 | (-0.00310491 0.00918239 0.00297864)
92 | (-0.0026584 0.005197 0.0365084)
93 | (-0.0341159 0.105278 0.0341159)
94 | (-0.0365084 0.005197 0.0026584)
95 | (-0.00375342 0.00875413 0.00254832)
96 | (-0.0030433 0.011404 0.00805623)
97 | (-0.00261392 0.0121171 0.0279781)
98 | (-0.0145335 0.00756753 0.00314842)
99 | (-0.00935892 0.0132446 0.00840424)
100 | (-0.00831054 0.0131505 0.0145319)
101 | (-0.0249797 0.0339914 0.0249797)
102 | (-0.047353 0.00976166 0.0140078)
103 | (-0.0112993 0.0102154 0.0112993)
104 | (-0.0145319 0.0131505 0.00831054)
105 | (-0.0279781 0.0121171 0.00261392)
106 | (-0.0140078 0.00976166 0.047353)
107 | (-0.00840424 0.0132446 0.00935892)
108 | (-0.00805623 0.011404 0.0030433)
109 | (-0.00314842 0.00756753 0.0145335)
110 | (-0.00254832 0.00875413 0.00375342)
111 | (-0.00351651 0.0996311 0.0341508)
112 | (-0.0341508 0.0996311 0.00351651)
113 | (-0.00685041 0.00421729 0.00251557)
114 | (-0.00362095 0.00949347 0.00714893)
115 | (-0.00265873 0.0126674 0.0141156)
116 | (-0.00300384 0.0337923 0.0248684)
117 | (-0.014176 0.00733964 0.011322)
118 | (-0.0077014 0.010378 0.0116403)
119 | (-0.0119767 0.0291912 0.0119767)
120 | (-0.0248684 0.0337923 0.00300384)
121 | (-0.0158311 0.00512967 0.0158311)
122 | (-0.0116403 0.010378 0.0077014)
123 | (-0.0141156 0.0126674 0.00265873)
124 | (-0.011322 0.00733964 0.014176)
125 | (-0.00714893 0.00949347 0.00362095)
126 | (-0.00251557 0.00421729 0.00685041)
127 | (-0.00340402 0.0941345 0.00340402)
128 | (-0.0064323 0.00428476 0.00757945)
129 | (-0.00276831 0.00926769 0.0105137)
130 | (-0.00296414 0.0288081 0.0119187)
131 | (-0.00291369 0.0336033 0.00291369)
132 | (-0.00879228 0.0045607 0.0135431)
133 | (-0.00880836 0.013912 0.00880836)
134 | (-0.0119187 0.0288081 0.00296414)
135 | (-0.0135431 0.0045607 0.00879228)
136 | (-0.0105137 0.00926769 0.00276831)
137 | (-0.00757945 0.00428476 0.0064323)
138 | (-0.00344695 0.00370565 0.00975314)
139 | (-0.00273831 0.0136097 0.00839669)
140 | (-0.00280622 0.0285717 0.00280622)
141 | (-0.00824717 0.00512164 0.00824717)
142 | (-0.00839669 0.0136097 0.00273831)
143 | (-0.00975314 0.00370565 0.00344695)
144 | (-0.0028637 0.00481645 0.00711842)
145 | (-0.00248921 0.0135845 0.00248921)
146 | (-0.00711842 0.00481645 0.0028637)
147 | (-0.00242747 0.00470627 0.00242747)
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type noSlip;
156 | }
157 | inlet
158 | {
159 | type fixedValue;
160 | value uniform (0 0.1 0);
161 | }
162 | outlet
163 | {
164 | type pressureInletOutletVelocity;
165 | value nonuniform List 4((-0.00351651 0.0996311 0.0341508) (-0.0341159 0.105278 0.0341159) (-0.00340402 0.0941345 0.00340402) (-0.0341508 0.0996311 0.00351651));
166 | }
167 | }
168 |
169 |
170 | // ************************************************************************* //
171 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.4/U:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volVectorField;
13 | location "0.4";
14 | object U;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 1 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | (-0.00219901 0.00331002 0.00219901)
24 | (-0.00231448 0.0145446 0.00231448)
25 | (-0.00631838 0.00349336 0.00273375)
26 | (-0.00273375 0.00349336 0.00631838)
27 | (-0.00743323 0.0145807 0.00278303)
28 | (-0.00295588 0.0194708 0.00295588)
29 | (-0.00278303 0.0145807 0.00743323)
30 | (-0.0086197 0.00269874 0.00315496)
31 | (-0.00746482 0.00376542 0.00746482)
32 | (-0.00315496 0.00269874 0.0086197)
33 | (-0.00955314 0.00888196 0.0029577)
34 | (-0.0130054 0.0196967 0.00322564)
35 | (-0.00831675 0.0148933 0.00831675)
36 | (-0.00308811 0.0497375 0.00308811)
37 | (-0.00322564 0.0196967 0.0130054)
38 | (-0.0029577 0.00888196 0.00955314)
39 | (-0.00652318 0.00296252 0.00601285)
40 | (-0.0123132 0.00319905 0.00721784)
41 | (-0.00721784 0.00319905 0.0123132)
42 | (-0.00601285 0.00296252 0.00652318)
43 | (-0.0067558 0.0087319 0.00510995)
44 | (-0.0148643 0.0110195 0.00271617)
45 | (-0.0123496 0.00992442 0.00747465)
46 | (-0.0170167 0.0488894 0.0032852)
47 | (-0.0131924 0.0201785 0.0131924)
48 | (-0.00747465 0.00992442 0.0123496)
49 | (-0.00515961 0.0509834 0.00515961)
50 | (-0.0032852 0.0488894 0.0170167)
51 | (-0.00271617 0.0110195 0.0148643)
52 | (-0.00510995 0.0087319 0.0067558)
53 | (-0.00202581 0.00264257 0.0059965)
54 | (-0.00994512 0.00428452 0.0114)
55 | (-0.01308 0.00299032 0.01308)
56 | (-0.0114 0.00428452 0.00994512)
57 | (-0.0059965 0.00264257 0.00202581)
58 | (-0.00231029 0.00731155 0.00510298)
59 | (-0.00805437 0.0107709 0.00337421)
60 | (-0.00945517 0.0120538 0.0106351)
61 | (-0.0182022 0.0140842 0.00249926)
62 | (-0.015697 0.0120741 0.0083274)
63 | (-0.0124092 0.00862673 0.0124092)
64 | (-0.0446546 0.0505713 0.00513528)
65 | (-0.0170602 0.0483368 0.0170602)
66 | (-0.0083274 0.0120741 0.015697)
67 | (-0.0106351 0.0120538 0.00945517)
68 | (-0.00513528 0.0505713 0.0446546)
69 | (-0.00249926 0.0140842 0.0182022)
70 | (-0.00337421 0.0107709 0.00805437)
71 | (-0.00510298 0.00731155 0.00231029)
72 | (-0.00237911 0.00394693 0.0109405)
73 | (-0.0110355 0.00495094 0.036117)
74 | (-0.036117 0.00495094 0.0110355)
75 | (-0.0109405 0.00394693 0.00237911)
76 | (-0.00319123 0.00867704 0.00318004)
77 | (-0.0026372 0.010763 0.0100916)
78 | (-0.00864672 0.0129691 0.00289048)
79 | (-0.00907092 0.01352 0.00879364)
80 | (-0.0101681 0.0123346 0.0301691)
81 | (-0.0482154 0.00993757 0.00280485)
82 | (-0.0187368 0.0146336 0.00897304)
83 | (-0.0112055 0.0101389 0.0112055)
84 | (-0.0301691 0.0123346 0.0101681)
85 | (-0.0439291 0.0503125 0.0439291)
86 | (-0.00897304 0.0146336 0.0187368)
87 | (-0.00879364 0.01352 0.00907092)
88 | (-0.0100916 0.010763 0.0026372)
89 | (-0.00280485 0.00993757 0.0482154)
90 | (-0.00289048 0.0129691 0.00864672)
91 | (-0.00318004 0.00867704 0.00319123)
92 | (-0.00225871 0.00465809 0.0348969)
93 | (-0.034751 0.104136 0.034751)
94 | (-0.0348969 0.00465809 0.00225871)
95 | (-0.00396392 0.00807595 0.00251246)
96 | (-0.00329293 0.0117063 0.00761788)
97 | (-0.00239374 0.011578 0.0291953)
98 | (-0.0130884 0.00800312 0.00294951)
99 | (-0.00926172 0.0138568 0.0087497)
100 | (-0.00814554 0.0132256 0.0148111)
101 | (-0.0271783 0.0347133 0.0271783)
102 | (-0.0476249 0.00996055 0.0135556)
103 | (-0.0112077 0.00929941 0.0112077)
104 | (-0.0148111 0.0132256 0.00814554)
105 | (-0.0291953 0.011578 0.00239374)
106 | (-0.0135556 0.00996055 0.0476249)
107 | (-0.0087497 0.0138568 0.00926172)
108 | (-0.00761788 0.0117063 0.00329293)
109 | (-0.00294951 0.00800312 0.0130884)
110 | (-0.00251246 0.00807595 0.00396392)
111 | (-0.00312858 0.0997041 0.0339394)
112 | (-0.0339394 0.0997041 0.00312858)
113 | (-0.00737422 0.00407499 0.00229802)
114 | (-0.00389641 0.00924687 0.0069678)
115 | (-0.00255325 0.0122766 0.0135954)
116 | (-0.00297386 0.0336682 0.0266459)
117 | (-0.0134396 0.008143 0.0118106)
118 | (-0.00749249 0.0100719 0.0125127)
119 | (-0.0119977 0.0310535 0.0119977)
120 | (-0.0266459 0.0336682 0.00297386)
121 | (-0.0149369 0.00484349 0.0149369)
122 | (-0.0125127 0.0100719 0.00749249)
123 | (-0.0135954 0.0122766 0.00255325)
124 | (-0.0118106 0.008143 0.0134396)
125 | (-0.0069678 0.00924687 0.00389641)
126 | (-0.00229802 0.00407499 0.00737422)
127 | (-0.00284796 0.0955739 0.00284796)
128 | (-0.00715759 0.00436536 0.00725468)
129 | (-0.00271839 0.00850532 0.0108292)
130 | (-0.00273915 0.0299709 0.0114274)
131 | (-0.00276102 0.0326652 0.00276102)
132 | (-0.00806068 0.00476687 0.0141738)
133 | (-0.00935727 0.0137974 0.00935727)
134 | (-0.0114274 0.0299709 0.00273915)
135 | (-0.0141738 0.00476687 0.00806068)
136 | (-0.0108292 0.00850532 0.00271839)
137 | (-0.00725468 0.00436536 0.00715759)
138 | (-0.00350103 0.00363444 0.00951324)
139 | (-0.00271046 0.0128194 0.00865224)
140 | (-0.0023974 0.0291067 0.0023974)
141 | (-0.00828003 0.00581321 0.00828003)
142 | (-0.00865224 0.0128194 0.00271046)
143 | (-0.00951324 0.00363444 0.00350103)
144 | (-0.00293563 0.00522106 0.00685705)
145 | (-0.00229178 0.012172 0.00229178)
146 | (-0.00685705 0.00522106 0.00293563)
147 | (-0.00229573 0.0048815 0.00229573)
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type noSlip;
156 | }
157 | inlet
158 | {
159 | type fixedValue;
160 | value uniform (0 0.1 0);
161 | }
162 | outlet
163 | {
164 | type pressureInletOutletVelocity;
165 | value nonuniform List 4((-0.00312858 0.0997041 0.0339394) (-0.034751 0.104136 0.034751) (-0.00284796 0.0955739 0.00284796) (-0.0339394 0.0997041 0.00312858));
166 | }
167 | }
168 |
169 |
170 | // ************************************************************************* //
171 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.3/U:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volVectorField;
13 | location "0.3";
14 | object U;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 1 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | (-0.00223553 0.00363226 0.00223553)
24 | (-0.00239035 0.014605 0.00239035)
25 | (-0.00636568 0.00371028 0.002694)
26 | (-0.002694 0.00371028 0.00636568)
27 | (-0.00748544 0.0143568 0.00276439)
28 | (-0.00308358 0.0195221 0.00308358)
29 | (-0.00276439 0.0143568 0.00748544)
30 | (-0.00865744 0.00289911 0.00313213)
31 | (-0.00740676 0.00388442 0.00740676)
32 | (-0.00313213 0.00289911 0.00865744)
33 | (-0.00958186 0.00899903 0.00291678)
34 | (-0.0127433 0.01941 0.00327529)
35 | (-0.0081917 0.0143721 0.0081917)
36 | (-0.00327053 0.0502708 0.00327053)
37 | (-0.00327529 0.01941 0.0127433)
38 | (-0.00291678 0.00899903 0.00958186)
39 | (-0.00662604 0.00309079 0.00583166)
40 | (-0.0121079 0.00334624 0.00743812)
41 | (-0.00743812 0.00334624 0.0121079)
42 | (-0.00583166 0.00309079 0.00662604)
43 | (-0.00684314 0.0086494 0.00482611)
44 | (-0.0146643 0.011288 0.00276423)
45 | (-0.0119953 0.0098236 0.00756374)
46 | (-0.0166032 0.0490062 0.00339652)
47 | (-0.0127328 0.0195186 0.0127328)
48 | (-0.00756374 0.0098236 0.0119953)
49 | (-0.00535752 0.0491222 0.00535752)
50 | (-0.00339652 0.0490062 0.0166032)
51 | (-0.00276423 0.011288 0.0146643)
52 | (-0.00482611 0.0086494 0.00684314)
53 | (-0.00210077 0.00281409 0.0059161)
54 | (-0.00984677 0.00440798 0.011616)
55 | (-0.0132598 0.0031961 0.0132598)
56 | (-0.011616 0.00440798 0.00984677)
57 | (-0.0059161 0.00281409 0.00210077)
58 | (-0.00234918 0.00745677 0.00488214)
59 | (-0.00813584 0.0107673 0.00330046)
60 | (-0.00922076 0.0116883 0.0105641)
61 | (-0.0180305 0.0147312 0.00260293)
62 | (-0.0151955 0.0120618 0.00833981)
63 | (-0.0123497 0.00874888 0.0123497)
64 | (-0.0453046 0.0482464 0.00529027)
65 | (-0.0163958 0.0479868 0.0163958)
66 | (-0.00833981 0.0120618 0.0151955)
67 | (-0.0105641 0.0116883 0.00922076)
68 | (-0.00529027 0.0482464 0.0453046)
69 | (-0.00260293 0.0147312 0.0180305)
70 | (-0.00330046 0.0107673 0.00813584)
71 | (-0.00488214 0.00745677 0.00234918)
72 | (-0.00246391 0.00415846 0.0113732)
73 | (-0.0111762 0.00506676 0.0363293)
74 | (-0.0363293 0.00506676 0.0111762)
75 | (-0.0113732 0.00415846 0.00246391)
76 | (-0.00309813 0.00890986 0.00316312)
77 | (-0.00265197 0.0106906 0.0102059)
78 | (-0.00887618 0.0130562 0.00286155)
79 | (-0.00895051 0.0131314 0.00872967)
80 | (-0.010094 0.0122986 0.0294412)
81 | (-0.0487326 0.0100249 0.00300337)
82 | (-0.0181974 0.0149832 0.00900854)
83 | (-0.0112034 0.0103171 0.0112034)
84 | (-0.0294412 0.0122986 0.010094)
85 | (-0.0441797 0.047491 0.0441797)
86 | (-0.00900854 0.0149832 0.0181974)
87 | (-0.00872967 0.0131314 0.00895051)
88 | (-0.0102059 0.0106906 0.00265197)
89 | (-0.00300337 0.0100249 0.0487326)
90 | (-0.00286155 0.0130562 0.00887618)
91 | (-0.00316312 0.00890986 0.00309813)
92 | (-0.00240458 0.00485972 0.0355791)
93 | (-0.0344496 0.104574 0.0344496)
94 | (-0.0355791 0.00485972 0.00240458)
95 | (-0.00386866 0.00841132 0.00252304)
96 | (-0.00318129 0.0116058 0.00781412)
97 | (-0.00247152 0.0117561 0.0287609)
98 | (-0.0136996 0.00787324 0.00303476)
99 | (-0.00925857 0.0136666 0.00858139)
100 | (-0.00821702 0.0131739 0.0146952)
101 | (-0.0263128 0.0343664 0.0263128)
102 | (-0.0476804 0.00986103 0.0137336)
103 | (-0.0112038 0.00969617 0.0112038)
104 | (-0.0146952 0.0131739 0.00821702)
105 | (-0.0287609 0.0117561 0.00247152)
106 | (-0.0137336 0.00986103 0.0476804)
107 | (-0.00858139 0.0136666 0.00925857)
108 | (-0.00781412 0.0116058 0.00318129)
109 | (-0.00303476 0.00787324 0.0136996)
110 | (-0.00252304 0.00841132 0.00386866)
111 | (-0.0032349 0.0996798 0.0340082)
112 | (-0.0340082 0.0996798 0.0032349)
113 | (-0.00720695 0.00414882 0.00239718)
114 | (-0.00376329 0.0093991 0.00704453)
115 | (-0.0025911 0.0124309 0.0138281)
116 | (-0.00293781 0.0336885 0.0259654)
117 | (-0.0137609 0.00784034 0.0116482)
118 | (-0.00756039 0.010232 0.0121211)
119 | (-0.011991 0.0303563 0.011991)
120 | (-0.0259654 0.0336885 0.00293781)
121 | (-0.0153331 0.00496094 0.0153331)
122 | (-0.0121211 0.010232 0.00756039)
123 | (-0.0138281 0.0124309 0.0025911)
124 | (-0.0116482 0.00784034 0.0137609)
125 | (-0.00704453 0.0093991 0.00376329)
126 | (-0.00239718 0.00414882 0.00720695)
127 | (-0.00302279 0.0950424 0.00302279)
128 | (-0.00689512 0.00433003 0.00741947)
129 | (-0.00273568 0.0088586 0.0107017)
130 | (-0.00281703 0.0295821 0.0116407)
131 | (-0.00277754 0.0330325 0.00277754)
132 | (-0.00837727 0.00467439 0.0139859)
133 | (-0.00911132 0.0138688 0.00911132)
134 | (-0.0116407 0.0295821 0.00281703)
135 | (-0.0139859 0.00467439 0.00837727)
136 | (-0.0107017 0.0088586 0.00273568)
137 | (-0.00741947 0.00433003 0.00689512)
138 | (-0.0034912 0.00365528 0.00966934)
139 | (-0.00271471 0.0131789 0.00854195)
140 | (-0.00255245 0.0289891 0.00255245)
141 | (-0.00830597 0.00548463 0.00830597)
142 | (-0.00854195 0.0131789 0.00271471)
143 | (-0.00966934 0.00365528 0.0034912)
144 | (-0.00291068 0.0050159 0.00701667)
145 | (-0.00237119 0.0127811 0.00237119)
146 | (-0.00701667 0.0050159 0.00291068)
147 | (-0.00236648 0.00476597 0.00236648)
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type noSlip;
156 | }
157 | inlet
158 | {
159 | type fixedValue;
160 | value uniform (0 0.1 0);
161 | }
162 | outlet
163 | {
164 | type pressureInletOutletVelocity;
165 | value nonuniform List 4((-0.0032349 0.0996798 0.0340082) (-0.0344496 0.104574 0.0344496) (-0.00302279 0.0950424 0.00302279) (-0.0340082 0.0996798 0.0032349));
166 | }
167 | }
168 |
169 |
170 | // ************************************************************************* //
171 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.5/U:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class volVectorField;
13 | location "0.5";
14 | object U;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 1 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 125
22 | (
23 | (-0.00216044 0.00306143 0.00216044)
24 | (-0.00226301 0.0144264 0.00226301)
25 | (-0.0062614 0.00331868 0.00275645)
26 | (-0.00275645 0.00331868 0.0062614)
27 | (-0.00742162 0.0147 0.00280839)
28 | (-0.00286673 0.0195151 0.00286673)
29 | (-0.00280839 0.0147 0.00742162)
30 | (-0.00856681 0.00251569 0.00316036)
31 | (-0.00749626 0.00366231 0.00749626)
32 | (-0.00316036 0.00251569 0.00856681)
33 | (-0.00956213 0.00876201 0.00299544)
34 | (-0.013197 0.0200176 0.00319395)
35 | (-0.00845452 0.0152748 0.00845452)
36 | (-0.00298829 0.0493325 0.00298829)
37 | (-0.00319395 0.0200176 0.013197)
38 | (-0.00299544 0.00876201 0.00956213)
39 | (-0.00643015 0.0028204 0.00610839)
40 | (-0.0124317 0.00305201 0.00706041)
41 | (-0.00706041 0.00305201 0.0124317)
42 | (-0.00610839 0.0028204 0.00643015)
43 | (-0.00670006 0.00878065 0.00531112)
44 | (-0.0149753 0.0108432 0.00267636)
45 | (-0.0126511 0.00999413 0.00742654)
46 | (-0.0174584 0.0487704 0.00323772)
47 | (-0.0135531 0.0208187 0.0135531)
48 | (-0.00742654 0.00999413 0.0126511)
49 | (-0.0051196 0.052603 0.0051196)
50 | (-0.00323772 0.0487704 0.0174584)
51 | (-0.00267636 0.0108432 0.0149753)
52 | (-0.00531112 0.00878065 0.00670006)
53 | (-0.00196817 0.00246632 0.00600237)
54 | (-0.00999182 0.00414247 0.0112591)
55 | (-0.0129834 0.00281919 0.0129834)
56 | (-0.0112591 0.00414247 0.00999182)
57 | (-0.00600237 0.00246632 0.00196817)
58 | (-0.00228114 0.00717941 0.00524067)
59 | (-0.00796752 0.0107806 0.00342027)
60 | (-0.00964071 0.0123273 0.0107061)
61 | (-0.0184369 0.0135832 0.00243468)
62 | (-0.0160632 0.0121334 0.00832072)
63 | (-0.0124946 0.00855455 0.0124946)
64 | (-0.0439413 0.0525693 0.00511434)
65 | (-0.0177163 0.0485648 0.0177163)
66 | (-0.00832072 0.0121334 0.0160632)
67 | (-0.0107061 0.0123273 0.00964071)
68 | (-0.00511434 0.0525693 0.0439413)
69 | (-0.00243468 0.0135832 0.0184369)
70 | (-0.00342027 0.0107806 0.00796752)
71 | (-0.00524067 0.00717941 0.00228114)
72 | (-0.00231975 0.00373511 0.0106294)
73 | (-0.0109552 0.00488714 0.0359599)
74 | (-0.0359599 0.00488714 0.0109552)
75 | (-0.0106294 0.00373511 0.00231975)
76 | (-0.00325741 0.0084871 0.0031739)
77 | (-0.00263195 0.010792 0.0100071)
78 | (-0.00850202 0.0128203 0.00291763)
79 | (-0.00915248 0.0138324 0.00884864)
80 | (-0.0102584 0.0124168 0.0306825)
81 | (-0.0476537 0.00989444 0.00267919)
82 | (-0.0192748 0.0143604 0.00899942)
83 | (-0.0112104 0.0100302 0.0112104)
84 | (-0.0306825 0.0124168 0.0102584)
85 | (-0.0435007 0.0527373 0.0435007)
86 | (-0.00899942 0.0143604 0.0192748)
87 | (-0.00884864 0.0138324 0.00915248)
88 | (-0.0100071 0.010792 0.00263195)
89 | (-0.00267919 0.00989444 0.0476537)
90 | (-0.00291763 0.0128203 0.00850202)
91 | (-0.0031739 0.0084871 0.00325741)
92 | (-0.00216761 0.00453501 0.0343517)
93 | (-0.0350278 0.103838 0.0350278)
94 | (-0.0343517 0.00453501 0.00216761)
95 | (-0.00403688 0.00777042 0.00250781)
96 | (-0.0033822 0.0117559 0.00745661)
97 | (-0.00235156 0.0114891 0.0294567)
98 | (-0.0125937 0.0080463 0.00288612)
99 | (-0.00931398 0.0139328 0.00890276)
100 | (-0.00809388 0.013299 0.0149155)
101 | (-0.0277987 0.0350272 0.0277987)
102 | (-0.047395 0.0100735 0.013421)
103 | (-0.0112616 0.00898977 0.0112616)
104 | (-0.0149155 0.013299 0.00809388)
105 | (-0.0294567 0.0114891 0.00235156)
106 | (-0.013421 0.0100735 0.047395)
107 | (-0.00890276 0.0139328 0.00931398)
108 | (-0.00745661 0.0117559 0.0033822)
109 | (-0.00288612 0.0080463 0.0125937)
110 | (-0.00250781 0.00777042 0.00403688)
111 | (-0.00311017 0.0997204 0.0339018)
112 | (-0.0339018 0.0997204 0.00311017)
113 | (-0.0074301 0.004006 0.00221413)
114 | (-0.00401487 0.00908162 0.00691082)
115 | (-0.00252965 0.0121719 0.0134177)
116 | (-0.0030582 0.0336697 0.0271005)
117 | (-0.0131678 0.00833558 0.0118894)
118 | (-0.00746512 0.00992164 0.0128348)
119 | (-0.0120123 0.0315312 0.0120123)
120 | (-0.0271005 0.0336697 0.0030582)
121 | (-0.0146079 0.00476264 0.0146079)
122 | (-0.0128348 0.00992164 0.00746512)
123 | (-0.0134177 0.0121719 0.00252965)
124 | (-0.0118894 0.00833558 0.0131678)
125 | (-0.00691082 0.00908162 0.00401487)
126 | (-0.00221413 0.004006 0.0074301)
127 | (-0.00277528 0.0959203 0.00277528)
128 | (-0.00729874 0.004396 0.00710101)
129 | (-0.00271254 0.0082035 0.0109129)
130 | (-0.00270018 0.0301822 0.0112667)
131 | (-0.00279897 0.0323771 0.00279897)
132 | (-0.00780733 0.00484046 0.0142383)
133 | (-0.00955767 0.0137227 0.00955767)
134 | (-0.0112667 0.0301822 0.00270018)
135 | (-0.0142383 0.00484046 0.00780733)
136 | (-0.0109129 0.0082035 0.00271254)
137 | (-0.00710101 0.004396 0.00729874)
138 | (-0.00348874 0.00362931 0.00934748)
139 | (-0.00271664 0.0125149 0.00872726)
140 | (-0.00229799 0.0290869 0.00229799)
141 | (-0.00822401 0.00608574 0.00822401)
142 | (-0.00872726 0.0125149 0.00271664)
143 | (-0.00934748 0.00362931 0.00348874)
144 | (-0.00294836 0.005392 0.00669467)
145 | (-0.00223449 0.0116828 0.00223449)
146 | (-0.00669467 0.005392 0.00294836)
147 | (-0.00222769 0.00498378 0.00222769)
148 | )
149 | ;
150 |
151 | boundaryField
152 | {
153 | wall
154 | {
155 | type noSlip;
156 | }
157 | inlet
158 | {
159 | type fixedValue;
160 | value uniform (0 0.1 0);
161 | }
162 | outlet
163 | {
164 | type pressureInletOutletVelocity;
165 | value nonuniform List 4((-0.00311017 0.0997204 0.0339018) (-0.0350278 0.103838 0.0350278) (-0.00277528 0.0959203 0.00277528) (-0.0339018 0.0997204 0.00311017));
166 | }
167 | }
168 |
169 |
170 | // ************************************************************************* //
171 |
--------------------------------------------------------------------------------
/test/test_main.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest
3 | import subprocess
4 | import numpy as np
5 |
6 | try:
7 | import pyvista as pv
8 |
9 | pv_enabled = True
10 | except ImportError as err:
11 | pv_enabled = False
12 |
13 |
14 | class BVTKBaseTest(unittest.TestCase):
15 | def __init__(self, test_name=None):
16 | super(BVTKBaseTest, self).__init__(test_name)
17 |
18 | self.test_dir = os.path.dirname(__file__) + "/"
19 | self.blender_files_dir = self.test_dir + "/blend_files/"
20 | self.base_script = self.test_dir + "test_blender_script.py"
21 | self.test_output_dir = self.test_dir + "/output/"
22 | self.blender_path = os.environ["BLENDER_PATH"]
23 | if not os.path.isdir(self.test_output_dir):
24 | os.mkdir(self.test_output_dir)
25 |
26 | def emptyOutputDir(self):
27 | # Empty the output directory
28 | for root, dirs, files in os.walk(self.test_output_dir):
29 | for f in files:
30 | os.unlink(os.path.join(root, f))
31 |
32 | def setUp(self):
33 | self.emptyOutputDir()
34 |
35 | def tearDown(self):
36 | self.emptyOutputDir()
37 |
38 | def runTestCase(self, blend_file, python_script=None, python_params=None):
39 | """Standard
40 |
41 | Parameters
42 | ----------
43 | blend_file : str
44 | name of the blend file inside blend_files
45 | python_script : str, optional
46 | The script that will be executed inside blender, by default self.base_script
47 | """
48 | if python_script is None:
49 | python_script = self.base_script
50 | else:
51 | python_script = self.test_dir + python_script
52 |
53 | self.assertTrue(
54 | os.path.exists(python_script),
55 | "The provided python script %s was not found" % (python_script),
56 | )
57 |
58 | proc = subprocess.Popen(
59 | [
60 | self.blender_path,
61 | "--addons",
62 | "BVtkNodes", # Activate the addon, even if not set using the user preferences
63 | "--background",
64 | self.blender_files_dir + blend_file,
65 | "--python-exit-code",
66 | "1", # Exit with failure if the python script fails
67 | "--python",
68 | python_script,
69 | ]
70 | + ([] if python_params is None else ["--"] + python_params),
71 | shell=False,
72 | stdout=subprocess.PIPE,
73 | stderr=subprocess.PIPE,
74 | )
75 |
76 | # wait for the process to terminate
77 | proc_output, proc_err = proc.communicate()
78 | returncode = proc.returncode
79 | stdout_msg = proc_output.decode(
80 | "utf-8"
81 | ) # Stdout and Stderr will be displayed if the test fails
82 | stderr_msg = proc_err.decode("utf-8")
83 | self.assertTrue(
84 | returncode == 0,
85 | "Blender STDOUT:%s%s--------------%sSTDERR:%s%s--------------"
86 | % (os.linesep, stdout_msg, os.linesep, os.linesep, stderr_msg),
87 | )
88 |
89 | def compareWrittenFile(self, produced_file, reference_file, pv_type=None):
90 | if not pv_enabled:
91 | self.skipTest(
92 | "Import of pyvista failed. File comparison will not be performed"
93 | )
94 |
95 | self.assertFalse(
96 | produced_file.endswith("vtk") and pv_type is None, "Unknown vtk type"
97 | )
98 |
99 | if pv_type is None:
100 | file_ending_map = {
101 | "vtp": pv.PolyData,
102 | "vtu": pv.UnstructuredGrid,
103 | "vti": pv.UniformGrid,
104 | }
105 | self.assertTrue(produced_file[-3:] in file_ending_map, "Unknown vtk type")
106 | pv_type = file_ending_map[produced_file[-3:]]
107 |
108 | test_dir = os.path.dirname(__file__)
109 | output_mesh = pv_type(test_dir + "/output/" + produced_file)
110 | ref_mesh = pv_type(test_dir + "/test_data/" + reference_file)
111 |
112 | self.assertTrue(
113 | np.allclose(output_mesh.points, ref_mesh.points, atol=1e-4),
114 | "The points of the two meshes differ",
115 | )
116 |
117 | return output_mesh, ref_mesh # For further processing
118 |
119 |
120 | class BVTKMainExamples(BVTKBaseTest):
121 | def test_addon_importable(self):
122 | self.runTestCase("test_template.blend", "test_addon_importable.py")
123 |
124 | def test_append(self):
125 | self.runTestCase(
126 | "test_template.blend",
127 | python_params=["-j", "//../json_files/test_append_triangle.json"],
128 | )
129 |
130 | def test_clip(self):
131 | self.runTestCase(
132 | "test_template.blend",
133 | python_params=["-j", "//../json_files/test_clip.json"],
134 | )
135 |
136 | def test_cone(self):
137 | self.runTestCase(
138 | "test_template.blend",
139 | python_params=["-j", "//../json_files/test_cone.json"],
140 | )
141 |
142 | def test_fin(self):
143 | self.runTestCase(
144 | "test_template.blend", python_params=["-j", "//../json_files/test_fin.json"]
145 | )
146 |
147 | def test_head(self):
148 | self.runTestCase(
149 | "test_template.blend",
150 | python_params=["-j", "//../json_files/test_head.json"],
151 | )
152 |
153 | def test_kitchen(self):
154 | self.runTestCase(
155 | "test_template.blend",
156 | python_params=["-j", "//../json_files/test_kitchen.json"],
157 | )
158 |
159 | def test_global_time_keeper(self):
160 | self.runTestCase("test_global_time_keeper.blend", "test_global_time_keeper.py")
161 |
162 | def test_glyphs_and_writers(self):
163 | self.runTestCase(
164 | "test_template.blend",
165 | python_params=["-j", "//../json_files/test_glyphs_and_writers.json"],
166 | )
167 | self.compareWrittenFile(
168 | "test_glyphs_and_writers.vtp", "test_glyphs_and_writers.vtp"
169 | )
170 |
171 |
172 | if __name__ == "__main__":
173 | unittest.main(verbosity=1)
174 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.1/phi:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class surfaceScalarField;
13 | location "0.1";
14 | object phi;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 3 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 300
22 | (
23 | -0.00141862
24 | 0.000709311
25 | 0.000709311
26 | 0.000813542
27 | -0.0030457
28 | 0.000813542
29 | -0.00132828
30 | 0.00123627
31 | 0.000801325
32 | -0.00132828
33 | 0.000801325
34 | 0.00123627
35 | 0.0014451
36 | -0.00281879
37 | 0.00085895
38 | 0.00112934
39 | -0.00530438
40 | 0.00112934
41 | 0.00085895
42 | -0.00281879
43 | 0.0014451
44 | -0.00101645
45 | 0.00129947
46 | 0.00095325
47 | -0.00128292
48 | 0.00144279
49 | 0.00144279
50 | -0.00101645
51 | 0.00095325
52 | 0.00129947
53 | 0.00136527
54 | -0.00183128
55 | 0.000894661
56 | 0.00217289
57 | -0.00495683
58 | 0.00109449
59 | 0.00154324
60 | -0.0026515
61 | 0.00154324
62 | 0.00152408
63 | -0.00835253
64 | 0.00152408
65 | 0.00109449
66 | -0.00495683
67 | 0.00217289
68 | 0.000894661
69 | -0.00183128
70 | 0.00136527
71 | -0.000965856
72 | 0.000724981
73 | 0.00154034
74 | -0.00106658
75 | 0.00175197
76 | 0.00171064
77 | -0.00106658
78 | 0.00171064
79 | 0.00175197
80 | -0.000965856
81 | 0.00154034
82 | 0.000724981
83 | 0.000758358
84 | -0.00158907
85 | 0.00123012
86 | 0.00166562
87 | -0.00222643
88 | 0.000902416
89 | 0.00162153
90 | -0.00184419
91 | 0.00159398
92 | 0.00299342
93 | -0.00785985
94 | 0.00143367
95 | 0.00209851
96 | -0.00465955
97 | 0.00209851
98 | 0.00159398
99 | -0.00184419
100 | 0.00162153
101 | 0.00382373
102 | 0.00382373
103 | 0.00143367
104 | -0.00785985
105 | 0.00299342
106 | 0.000902416
107 | -0.00222643
108 | 0.00166562
109 | 0.00123012
110 | -0.00158907
111 | 0.000758358
112 | -0.000906636
113 | 0.00163162
114 | -0.00123764
115 | 0.000895234
116 | 0.00363472
117 | -0.00105723
118 | 0.00223926
119 | 0.00223926
120 | -0.00123764
121 | 0.00363472
122 | 0.000895234
123 | -0.000906636
124 | 0.00163162
125 | -0.00142691
126 | 0.00127863
127 | 0.000898687
128 | -0.0017795
129 | 0.00095736
130 | 0.000846878
131 | -0.00187273
132 | 0.00263987
133 | 0.00212249
134 | -0.00232996
135 | 0.000974456
136 | 0.00171302
137 | -0.00216753
138 | 0.00161125
139 | 0.00192018
140 | -0.00170963
141 | 0.00192018
142 | 0.00838673
143 | 0.00357716
144 | 0.00281075
145 | -0.0074137
146 | 0.00281075
147 | 0.00161125
148 | -0.00216753
149 | 0.00171302
150 | 0.00263987
151 | -0.00187273
152 | 0.000846878
153 | 0.00357716
154 | 0.00838673
155 | 0.000974456
156 | -0.00232996
157 | 0.00212249
158 | 0.00095736
159 | -0.0017795
160 | 0.000898687
161 | 0.00127863
162 | -0.00142691
163 | -0.00121675
164 | 0.0037436
165 | -0.00141985
166 | 0.00112891
167 | 0.00616492
168 | -0.00141985
169 | 0.00616492
170 | 0.00112891
171 | -0.00121675
172 | 0.0037436
173 | -0.00147546
174 | 0.000947229
175 | -0.00177266
176 | 0.00268143
177 | 0.00115069
178 | -0.00169211
179 | 0.000884421
180 | 0.000912554
181 | -0.0018703
182 | 0.00175539
183 | 0.000972963
184 | -0.0021815
185 | 0.00434873
186 | 0.00468437
187 | 0.0013724
188 | 0.00203609
189 | -0.00219737
190 | 0.00177896
191 | 0.00163507
192 | -0.00175728
193 | 0.00163507
194 | 0.00434873
195 | -0.0021815
196 | 0.000972963
197 | 0.0078703
198 | 0.0078703
199 | 0.00177896
200 | -0.00219737
201 | 0.00203609
202 | 0.00175539
203 | -0.0018703
204 | 0.000912554
205 | 0.00268143
206 | -0.00177266
207 | 0.0013724
208 | 0.00468437
209 | 0.000884421
210 | -0.00169211
211 | 0.00115069
212 | 0.000947229
213 | -0.00147546
214 | -0.00143364
215 | 0.00630615
216 | -0.0103378
217 | 0.00277336
218 | 0.00277336
219 | -0.00143364
220 | 0.00630615
221 | -0.00112725
222 | 0.000802479
223 | -0.0016368
224 | 0.00172391
225 | -0.00218679
226 | 0.00440754
227 | 0.001945
228 | 0.00104725
229 | 0.00109926
230 | -0.0016435
231 | 0.00159446
232 | 0.000882442
233 | -0.00191884
234 | 0.00224537
235 | 0.00184259
236 | -0.00532548
237 | 0.00184259
238 | 0.00438836
239 | 0.00265698
240 | 0.00159025
241 | -0.00137987
242 | 0.00159025
243 | 0.00224537
244 | -0.00191884
245 | 0.000882442
246 | 0.00440754
247 | -0.00218679
248 | 0.00265698
249 | 0.00438836
250 | 0.00159446
251 | -0.0016435
252 | 0.00109926
253 | 0.00172391
254 | -0.0016368
255 | 0.00104725
256 | 0.001945
257 | 0.000802479
258 | -0.00112725
259 | -0.00976649
260 | 0.00284209
261 | -0.00976649
262 | 0.00284209
263 | 0.000817757
264 | -0.00115728
265 | 0.00142222
266 | -0.00187308
267 | 0.00229264
268 | -0.00538336
269 | 0.001867
270 | 0.0017889
271 | 0.00200321
272 | 0.000886709
273 | -0.00126651
274 | 0.00164567
275 | 0.00110789
276 | -0.00305052
277 | 0.00110789
278 | 0.001867
279 | -0.00538336
280 | 0.00196704
281 | 0.00196704
282 | 0.00164567
283 | -0.00126651
284 | 0.000886709
285 | 0.00229264
286 | -0.00187308
287 | 0.00200321
288 | 0.0017889
289 | 0.00142222
290 | -0.00115728
291 | 0.000817757
292 | -0.00918711
293 | 0.00144938
294 | -0.0011368
295 | 0.00157265
296 | -0.00310697
297 | 0.00112414
298 | -0.0054531
299 | 0.00106854
300 | 0.0016352
301 | 0.000877437
302 | -0.00151405
303 | 0.000877437
304 | 0.00112414
305 | -0.00310697
306 | 0.0016352
307 | 0.00106854
308 | 0.00157265
309 | -0.0011368
310 | 0.00144938
311 | 0.00138112
312 | -0.00149256
313 | 0.000835679
314 | -0.00320482
315 | 0.000878171
316 | 0.000878171
317 | 0.000835679
318 | -0.00149256
319 | 0.00138112
320 | 0.000766731
321 | -0.00153346
322 | 0.000766731
323 | )
324 | ;
325 |
326 | boundaryField
327 | {
328 | wall
329 | {
330 | type calculated;
331 | value uniform 0;
332 | }
333 | inlet
334 | {
335 | type calculated;
336 | value nonuniform List 4(-0.016 -0.016 -0.016 -0.016);
337 | }
338 | outlet
339 | {
340 | type calculated;
341 | value nonuniform List 4(0.0160039 0.0171209 0.0148713 0.0160039);
342 | }
343 | }
344 |
345 |
346 | // ************************************************************************* //
347 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.4/phi:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class surfaceScalarField;
13 | location "0.4";
14 | object phi;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 3 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 300
22 | (
23 | -0.00135211
24 | 0.000676057
25 | 0.000676057
26 | 0.000756769
27 | -0.00286565
28 | 0.000756769
29 | -0.00137226
30 | 0.00121621
31 | 0.000832107
32 | -0.00137226
33 | 0.000832107
34 | 0.00121621
35 | 0.00139321
36 | -0.00288466
37 | 0.000875965
38 | 0.00121711
39 | -0.00529987
40 | 0.00121711
41 | 0.000875965
42 | -0.00288466
43 | 0.00139321
44 | -0.000885299
45 | 0.00123693
46 | 0.000864579
47 | -0.00141938
48 | 0.0015418
49 | 0.0015418
50 | -0.000885299
51 | 0.000864579
52 | 0.00123693
53 | 0.00131154
54 | -0.0016663
55 | 0.000862672
56 | 0.00234081
57 | -0.00526474
58 | 0.00125638
59 | 0.00164097
60 | -0.00294939
61 | 0.00164097
62 | 0.00153346
63 | -0.00836679
64 | 0.00153346
65 | 0.00125638
66 | -0.00526474
67 | 0.00234081
68 | 0.000862672
69 | -0.0016663
70 | 0.00131154
71 | -0.000896668
72 | 0.000664071
73 | 0.00146952
74 | -0.00100481
75 | 0.00185118
76 | 0.00156001
77 | -0.00100481
78 | 0.00156001
79 | 0.00185118
80 | -0.000896668
81 | 0.00146952
82 | 0.000664071
83 | 0.000719008
84 | -0.00163232
85 | 0.00132818
86 | 0.0017523
87 | -0.00194188
88 | 0.00086409
89 | 0.0018055
90 | -0.00184168
91 | 0.00153501
92 | 0.0029553
93 | -0.0082407
94 | 0.00155412
95 | 0.00241676
96 | -0.00527015
97 | 0.00241676
98 | 0.00153501
99 | -0.00184168
100 | 0.0018055
101 | 0.0038166
102 | 0.0038166
103 | 0.00155412
104 | -0.0082407
105 | 0.0029553
106 | 0.00086409
107 | -0.00194188
108 | 0.0017523
109 | 0.00132818
110 | -0.00163232
111 | 0.000719008
112 | -0.000766056
113 | 0.00143013
114 | -0.00124851
115 | 0.000943735
116 | 0.00362548
117 | -0.00088714
118 | 0.00200358
119 | 0.00200358
120 | -0.00124851
121 | 0.00362548
122 | 0.000943735
123 | -0.000766056
124 | 0.00143013
125 | -0.00133185
126 | 0.0012848
127 | 0.00093764
128 | -0.00181885
129 | 0.00100119
130 | 0.000931912
131 | -0.00214885
132 | 0.00310211
133 | 0.00204383
134 | -0.00191778
135 | 0.000887365
136 | 0.00191086
137 | -0.00206597
138 | 0.00159429
139 | 0.00187371
140 | -0.00156453
141 | 0.00187371
142 | 0.00781253
143 | 0.00376338
144 | 0.00299737
145 | -0.00815665
146 | 0.00299737
147 | 0.00159429
148 | -0.00206597
149 | 0.00191086
150 | 0.00310211
151 | -0.00214885
152 | 0.000931912
153 | 0.00376338
154 | 0.00781253
155 | 0.000887365
156 | -0.00191778
157 | 0.00204383
158 | 0.00100119
159 | -0.00181885
160 | 0.00093764
161 | 0.0012848
162 | -0.00133185
163 | -0.00112254
164 | 0.0034964
165 | -0.00132007
166 | 0.00102034
167 | 0.00592879
168 | -0.00132007
169 | 0.00592879
170 | 0.00102034
171 | -0.00112254
172 | 0.0034964
173 | -0.00129126
174 | 0.000897057
175 | -0.00188547
176 | 0.00297964
177 | 0.00105908
178 | -0.00175031
179 | 0.000916211
180 | 0.00101667
181 | -0.00209414
182 | 0.00184067
183 | 0.000966531
184 | -0.00213919
185 | 0.0048284
186 | 0.00462886
187 | 0.00126589
188 | 0.00214445
189 | -0.00198057
190 | 0.00165488
191 | 0.00156263
192 | -0.0015012
193 | 0.00156263
194 | 0.0048284
195 | -0.00213919
196 | 0.000966531
197 | 0.00768505
198 | 0.00768505
199 | 0.00165488
200 | -0.00198057
201 | 0.00214445
202 | 0.00184067
203 | -0.00209414
204 | 0.00101667
205 | 0.00297964
206 | -0.00188547
207 | 0.00126589
208 | 0.00462886
209 | 0.000916211
210 | -0.00175031
211 | 0.00105908
212 | 0.000897057
213 | -0.00129126
214 | -0.00123651
215 | 0.00575324
216 | -0.0106173
217 | 0.00289194
218 | 0.00289194
219 | -0.00123651
220 | 0.00575324
221 | -0.00100243
222 | 0.000770247
223 | -0.00160946
224 | 0.00163771
225 | -0.00199809
226 | 0.00470775
227 | 0.00174594
228 | 0.0011326
229 | 0.00109604
230 | -0.00183941
231 | 0.00170989
232 | 0.000838902
233 | -0.0017856
234 | 0.00221082
235 | 0.00229475
236 | -0.00554999
237 | 0.00229475
238 | 0.00462557
239 | 0.00234481
240 | 0.00147597
241 | -0.00114338
242 | 0.00147597
243 | 0.00221082
244 | -0.0017856
245 | 0.000838902
246 | 0.00470775
247 | -0.00199809
248 | 0.00234481
249 | 0.00462557
250 | 0.00170989
251 | -0.00183941
252 | 0.00109604
253 | 0.00163771
254 | -0.00160946
255 | 0.0011326
256 | 0.00174594
257 | 0.000770247
258 | -0.00100243
259 | -0.0101523
260 | 0.00280967
261 | -0.0101523
262 | 0.00280967
263 | 0.000743518
264 | -0.00112589
265 | 0.00138271
266 | -0.00159323
267 | 0.00207176
268 | -0.00538508
269 | 0.00223533
270 | 0.00175265
271 | 0.00216611
272 | 0.00082768
273 | -0.00123386
274 | 0.00180644
275 | 0.00113725
276 | -0.00340285
277 | 0.00113725
278 | 0.00223533
279 | -0.00538508
280 | 0.00177311
281 | 0.00177311
282 | 0.00180644
283 | -0.00123386
284 | 0.00082768
285 | 0.00207176
286 | -0.00159323
287 | 0.00216611
288 | 0.00175265
289 | 0.00138271
290 | -0.00112589
291 | 0.000743518
292 | -0.00971412
293 | 0.00137028
294 | -0.00100688
295 | 0.00162404
296 | -0.00323931
297 | 0.00106324
298 | -0.00524347
299 | 0.000964753
300 | 0.00174061
301 | 0.00093162
302 | -0.00165322
303 | 0.00093162
304 | 0.00106324
305 | -0.00323931
306 | 0.00174061
307 | 0.000964753
308 | 0.00162404
309 | -0.00100688
310 | 0.00137028
311 | 0.00132815
312 | -0.00152188
313 | 0.000838227
314 | -0.003117
315 | 0.000914
316 | 0.000914
317 | 0.000838227
318 | -0.00152188
319 | 0.00132815
320 | 0.000720272
321 | -0.00144054
322 | 0.000720272
323 | )
324 | ;
325 |
326 | boundaryField
327 | {
328 | wall
329 | {
330 | type calculated;
331 | value uniform 0;
332 | }
333 | inlet
334 | {
335 | type calculated;
336 | value nonuniform List 4(-0.016 -0.016 -0.016 -0.016);
337 | }
338 | outlet
339 | {
340 | type calculated;
341 | value nonuniform List 4(0.0159878 0.016691 0.0153335 0.0159878);
342 | }
343 | }
344 |
345 |
346 | // ************************************************************************* //
347 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.3/phi:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class surfaceScalarField;
13 | location "0.3";
14 | object phi;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 3 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 300
22 | (
23 | -0.00137321
24 | 0.000686604
25 | 0.000686604
26 | 0.000764964
27 | -0.00290314
28 | 0.000764964
29 | -0.00136439
30 | 0.00122591
31 | 0.000825086
32 | -0.00136439
33 | 0.000825086
34 | 0.00122591
35 | 0.00140386
36 | -0.00286832
37 | 0.000865043
38 | 0.00119796
39 | -0.00529906
40 | 0.00119796
41 | 0.000865043
42 | -0.00286832
43 | 0.00140386
44 | -0.000914644
45 | 0.00125343
46 | 0.000887115
47 | -0.00138232
48 | 0.00151625
49 | 0.00151625
50 | -0.000914644
51 | 0.000887115
52 | 0.00125343
53 | 0.00132763
54 | -0.0017068
55 | 0.000868377
56 | 0.00231688
57 | -0.00520394
58 | 0.0012167
59 | 0.00161124
60 | -0.00287471
61 | 0.00161124
62 | 0.00150495
63 | -0.00830896
64 | 0.00150495
65 | 0.0012167
66 | -0.00520394
67 | 0.00231688
68 | 0.000868377
69 | -0.0017068
70 | 0.00132763
71 | -0.000910933
72 | 0.000675493
73 | 0.00148887
74 | -0.00101701
75 | 0.00183828
76 | 0.0015821
77 | -0.00101701
78 | 0.0015821
79 | 0.00183828
80 | -0.000910933
81 | 0.00148887
82 | 0.000675493
83 | 0.000730632
84 | -0.00162353
85 | 0.0013096
86 | 0.00173704
87 | -0.00199662
88 | 0.000869666
89 | 0.00176767
90 | -0.00183824
91 | 0.00153317
92 | 0.0029217
93 | -0.00812167
94 | 0.00150098
95 | 0.00235106
96 | -0.00514343
97 | 0.00235106
98 | 0.00153317
99 | -0.00183824
100 | 0.00176767
101 | 0.00384552
102 | 0.00384552
103 | 0.00150098
104 | -0.00812167
105 | 0.0029217
106 | 0.000869666
107 | -0.00199662
108 | 0.00173704
109 | 0.0013096
110 | -0.00162353
111 | 0.000730632
112 | -0.000801594
113 | 0.00147709
114 | -0.0012397
115 | 0.000936025
116 | 0.00363082
117 | -0.00091364
118 | 0.00203892
119 | 0.00203892
120 | -0.0012397
121 | 0.00363082
122 | 0.000936025
123 | -0.000801594
124 | 0.00147709
125 | -0.00135901
126 | 0.00128805
127 | 0.000936917
128 | -0.00181851
129 | 0.0009951
130 | 0.000910355
131 | -0.00208786
132 | 0.00301507
133 | 0.00203602
134 | -0.00200451
135 | 0.00089357
136 | 0.00186005
137 | -0.00207762
138 | 0.00160005
139 | 0.00187138
140 | -0.00159006
141 | 0.00187138
142 | 0.00796696
143 | 0.00375689
144 | 0.00291327
145 | -0.007968
146 | 0.00291327
147 | 0.00160005
148 | -0.00207762
149 | 0.00186005
150 | 0.00301507
151 | -0.00208786
152 | 0.000910355
153 | 0.00375689
154 | 0.00796696
155 | 0.00089357
156 | -0.00200451
157 | 0.00203602
158 | 0.0009951
159 | -0.00181851
160 | 0.000936917
161 | 0.00128805
162 | -0.00135901
163 | -0.00114021
164 | 0.00355333
165 | -0.00132147
166 | 0.00103564
167 | 0.00595557
168 | -0.00132147
169 | 0.00595557
170 | 0.00103564
171 | -0.00114021
172 | 0.00355333
173 | -0.00134046
174 | 0.000918366
175 | -0.00187068
176 | 0.00292887
177 | 0.0010774
178 | -0.00176032
179 | 0.000900434
180 | 0.000993727
181 | -0.00204255
182 | 0.00181611
183 | 0.000960676
184 | -0.00213362
185 | 0.00473793
186 | 0.00468001
187 | 0.00128244
188 | 0.00209122
189 | -0.00202547
190 | 0.00166347
191 | 0.00157769
192 | -0.00154534
193 | 0.00157769
194 | 0.00473793
195 | -0.00213362
196 | 0.000960676
197 | 0.00777289
198 | 0.00777289
199 | 0.00166347
200 | -0.00202547
201 | 0.00209122
202 | 0.00181611
203 | -0.00204255
204 | 0.000993727
205 | 0.00292887
206 | -0.00187068
207 | 0.00128244
208 | 0.00468001
209 | 0.000900434
210 | -0.00176032
211 | 0.0010774
212 | 0.000918366
213 | -0.00134046
214 | -0.00125987
215 | 0.00584884
216 | -0.0105714
217 | 0.00285909
218 | 0.00285909
219 | -0.00125987
220 | 0.00584884
221 | -0.00103906
222 | 0.00077601
223 | -0.00161924
224 | 0.00166065
225 | -0.00202641
226 | 0.00465608
227 | 0.00180126
228 | 0.00111842
229 | 0.00109017
230 | -0.00181173
231 | 0.00167068
232 | 0.000842949
233 | -0.00179895
234 | 0.00221618
235 | 0.0022047
236 | -0.00550498
237 | 0.0022047
238 | 0.0046186
239 | 0.00241126
240 | 0.00148637
241 | -0.00119114
242 | 0.00148637
243 | 0.00221618
244 | -0.00179895
245 | 0.000842949
246 | 0.00465608
247 | -0.00202641
248 | 0.00241126
249 | 0.0046186
250 | 0.00167068
251 | -0.00181173
252 | 0.00109017
253 | 0.00166065
254 | -0.00161924
255 | 0.00111842
256 | 0.00180126
257 | 0.00077601
258 | -0.00103906
259 | -0.0100924
260 | 0.00281089
261 | -0.0100924
262 | 0.00281089
263 | 0.000762196
264 | -0.00113584
265 | 0.00138278
266 | -0.00164516
267 | 0.00212235
268 | -0.00539587
269 | 0.00216421
270 | 0.00177459
271 | 0.0021507
272 | 0.000837917
273 | -0.00124218
274 | 0.00176236
275 | 0.00113392
276 | -0.00334046
277 | 0.00113392
278 | 0.00216421
279 | -0.00539587
280 | 0.00181569
281 | 0.00181569
282 | 0.00176236
283 | -0.00124218
284 | 0.000837917
285 | 0.00212235
286 | -0.00164516
287 | 0.0021507
288 | 0.00177459
289 | 0.00138278
290 | -0.00113584
291 | 0.000762196
292 | -0.00963488
293 | 0.00140095
294 | -0.00103673
295 | 0.00161227
296 | -0.00322285
297 | 0.00108326
298 | -0.00530646
299 | 0.000997306
300 | 0.0017269
301 | 0.000908545
302 | -0.00163283
303 | 0.000908545
304 | 0.00108326
305 | -0.00322285
306 | 0.0017269
307 | 0.000997306
308 | 0.00161227
309 | -0.00103673
310 | 0.00140095
311 | 0.00136152
312 | -0.00153314
313 | 0.000831106
314 | -0.00313994
315 | 0.000910486
316 | 0.000910486
317 | 0.000831106
318 | -0.00153314
319 | 0.00136152
320 | 0.000738863
321 | -0.00147773
322 | 0.000738863
323 | )
324 | ;
325 |
326 | boundaryField
327 | {
328 | wall
329 | {
330 | type calculated;
331 | value uniform 0;
332 | }
333 | inlet
334 | {
335 | type calculated;
336 | value nonuniform List 4(-0.016 -0.016 -0.016 -0.016);
337 | }
338 | outlet
339 | {
340 | type calculated;
341 | value nonuniform List 4(0.0159895 0.0167644 0.0152566 0.0159895);
342 | }
343 | }
344 |
345 |
346 | // ************************************************************************* //
347 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.5/phi:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class surfaceScalarField;
13 | location "0.5";
14 | object phi;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 3 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 300
22 | (
23 | -0.00133157
24 | 0.000665786
25 | 0.000665786
26 | 0.000753653
27 | -0.00283888
28 | 0.000753653
29 | -0.00137496
30 | 0.00120586
31 | 0.000834892
32 | -0.00137496
33 | 0.000834892
34 | 0.00120586
35 | 0.00139086
36 | -0.0029014
37 | 0.000889237
38 | 0.00123154
39 | -0.00530196
40 | 0.00123154
41 | 0.000889237
42 | -0.0029014
43 | 0.00139086
44 | -0.000862696
45 | 0.00122171
46 | 0.000846845
47 | -0.00144704
48 | 0.00155841
49 | 0.00155841
50 | -0.000862696
51 | 0.000846845
52 | 0.00122171
53 | 0.00130385
54 | -0.00163501
55 | 0.000859317
56 | 0.00235519
57 | -0.00531307
58 | 0.00128801
59 | 0.00167349
60 | -0.00301555
61 | 0.00167349
62 | 0.00156713
63 | -0.00843622
64 | 0.00156713
65 | 0.00128801
66 | -0.00531307
67 | 0.00235519
68 | 0.000859317
69 | -0.00163501
70 | 0.00130385
71 | -0.000887054
72 | 0.000654608
73 | 0.00145415
74 | -0.000998572
75 | 0.00185621
76 | 0.00154762
77 | -0.000998572
78 | 0.00154762
79 | 0.00185621
80 | -0.000887054
81 | 0.00145415
82 | 0.000654608
83 | 0.000710968
84 | -0.00163611
85 | 0.00134194
86 | 0.00176025
87 | -0.00190112
88 | 0.000861044
89 | 0.00183785
90 | -0.00184652
91 | 0.00154291
92 | 0.00300075
93 | -0.00835521
94 | 0.00160852
95 | 0.00246636
96 | -0.00537225
97 | 0.00246636
98 | 0.00154291
99 | -0.00184652
100 | 0.00183785
101 | 0.00378189
102 | 0.00378189
103 | 0.00160852
104 | -0.00835521
105 | 0.00300075
106 | 0.000861044
107 | -0.00190112
108 | 0.00176025
109 | 0.00134194
110 | -0.00163611
111 | 0.000710968
112 | -0.000738398
113 | 0.00139301
114 | -0.00125827
115 | 0.000947658
116 | 0.00362098
117 | -0.000869734
118 | 0.00198249
119 | 0.00198249
120 | -0.00125827
121 | 0.00362098
122 | 0.000947658
123 | -0.000738398
124 | 0.00139301
125 | -0.0013074
126 | 0.00127997
127 | 0.000933467
128 | -0.00181378
129 | 0.00100446
130 | 0.00094949
131 | -0.00219326
132 | 0.00316528
133 | 0.00205985
134 | -0.00184804
135 | 0.000887827
136 | 0.00195008
137 | -0.00206017
138 | 0.00159099
139 | 0.0018818
140 | -0.00154751
141 | 0.0018818
142 | 0.00767254
143 | 0.00375414
144 | 0.00308512
145 | -0.00832545
146 | 0.00308512
147 | 0.00159099
148 | -0.00206017
149 | 0.00195008
150 | 0.00316528
151 | -0.00219326
152 | 0.00094949
153 | 0.00375414
154 | 0.00767254
155 | 0.000887827
156 | -0.00184804
157 | 0.00205985
158 | 0.00100446
159 | -0.00181378
160 | 0.000933467
161 | 0.00127997
162 | -0.0013074
163 | -0.00110825
164 | 0.00344891
165 | -0.00132578
166 | 0.00101153
167 | 0.00591772
168 | -0.00132578
169 | 0.00591772
170 | 0.00101153
171 | -0.00110825
172 | 0.00344891
173 | -0.00125199
174 | 0.000878059
175 | -0.00189019
176 | 0.0030114
177 | 0.00104749
178 | -0.0017326
179 | 0.00093117
180 | 0.00103083
181 | -0.00213065
182 | 0.0018611
183 | 0.000974484
184 | -0.00214837
185 | 0.00489518
186 | 0.00456972
187 | 0.00125478
188 | 0.00219847
189 | -0.00194345
190 | 0.00165776
191 | 0.00155263
192 | -0.00147079
193 | 0.00155263
194 | 0.00489518
195 | -0.00214837
196 | 0.000974484
197 | 0.00759141
198 | 0.00759141
199 | 0.00165776
200 | -0.00194345
201 | 0.00219847
202 | 0.0018611
203 | -0.00213065
204 | 0.00103083
205 | 0.0030114
206 | -0.00189019
207 | 0.00125478
208 | 0.00456972
209 | 0.00093117
210 | -0.0017326
211 | 0.00104749
212 | 0.000878059
213 | -0.00125199
214 | -0.00122461
215 | 0.00568505
216 | -0.0106516
217 | 0.00292283
218 | 0.00292283
219 | -0.00122461
220 | 0.00568505
221 | -0.00097049
222 | 0.000765991
223 | -0.00159998
224 | 0.00161868
225 | -0.0019795
226 | 0.00474078
227 | 0.00169729
228 | 0.00113983
229 | 0.00110567
230 | -0.0018522
231 | 0.00174552
232 | 0.000836017
233 | -0.00178163
234 | 0.00221097
235 | 0.00236265
236 | -0.00558652
237 | 0.00236265
238 | 0.00461045
239 | 0.00229228
240 | 0.00147681
241 | -0.0011089
242 | 0.00147681
243 | 0.00221097
244 | -0.00178163
245 | 0.000836017
246 | 0.00474078
247 | -0.0019795
248 | 0.00229228
249 | 0.00461045
250 | 0.00174552
251 | -0.0018522
252 | 0.00110567
253 | 0.00161868
254 | -0.00159998
255 | 0.00113983
256 | 0.00169729
257 | 0.000765991
258 | -0.00097049
259 | -0.010191
260 | 0.00281175
261 | -0.010191
262 | 0.00281175
263 | 0.000726804
264 | -0.00111501
265 | 0.00138669
266 | -0.00156066
267 | 0.00203586
268 | -0.00537385
269 | 0.00228624
270 | 0.00172985
271 | 0.00216823
272 | 0.000822615
273 | -0.00122455
274 | 0.00184263
275 | 0.00114122
276 | -0.00344701
277 | 0.00114122
278 | 0.00228624
279 | -0.00537385
280 | 0.00173783
281 | 0.00173783
282 | 0.00184263
283 | -0.00122455
284 | 0.000822615
285 | 0.00203586
286 | -0.00156066
287 | 0.00216823
288 | 0.00172985
289 | 0.00138669
290 | -0.00111501
291 | 0.000726804
292 | -0.0097608
293 | 0.00134164
294 | -0.000981931
295 | 0.00163058
296 | -0.0032452
297 | 0.00104842
298 | -0.00518832
299 | 0.000937152
300 | 0.00174436
301 | 0.000951389
302 | -0.00166452
303 | 0.000951389
304 | 0.00104842
305 | -0.0032452
306 | 0.00174436
307 | 0.000937152
308 | 0.00163058
309 | -0.000981931
310 | 0.00134164
311 | 0.00129686
312 | -0.00150659
313 | 0.000843358
314 | -0.00309147
315 | 0.000912106
316 | 0.000912106
317 | 0.000843358
318 | -0.00150659
319 | 0.00129686
320 | 0.000702377
321 | -0.00140475
322 | 0.000702377
323 | )
324 | ;
325 |
326 | boundaryField
327 | {
328 | wall
329 | {
330 | type calculated;
331 | value uniform 0;
332 | }
333 | inlet
334 | {
335 | type calculated;
336 | value nonuniform List 4(-0.016 -0.016 -0.016 -0.016);
337 | }
338 | outlet
339 | {
340 | type calculated;
341 | value nonuniform List 4(0.0159872 0.0166414 0.0153843 0.0159872);
342 | }
343 | }
344 |
345 |
346 | // ************************************************************************* //
347 |
--------------------------------------------------------------------------------
/examples_data/cubeflow/0.2/phi:
--------------------------------------------------------------------------------
1 | /*--------------------------------*- C++ -*----------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Version: 7
6 | \\/ M anipulation |
7 | \*---------------------------------------------------------------------------*/
8 | FoamFile
9 | {
10 | version 2.0;
11 | format ascii;
12 | class surfaceScalarField;
13 | location "0.2";
14 | object phi;
15 | }
16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17 |
18 | dimensions [0 3 -1 0 0 0 0];
19 |
20 | internalField nonuniform List
21 | 300
22 | (
23 | -0.00139429
24 | 0.000697145
25 | 0.000697145
26 | 0.000782644
27 | -0.00295958
28 | 0.000782644
29 | -0.00134792
30 | 0.0012325
31 | 0.000812569
32 | -0.00134792
33 | 0.000812569
34 | 0.0012325
35 | 0.00142738
36 | -0.00285155
37 | 0.000858889
38 | 0.00117028
39 | -0.00530014
40 | 0.00117028
41 | 0.000858889
42 | -0.00285155
43 | 0.00142738
44 | -0.000957802
45 | 0.00127453
46 | 0.000915768
47 | -0.0013321
48 | 0.00147862
49 | 0.00147862
50 | -0.000957802
51 | 0.000915768
52 | 0.00127453
53 | 0.00135281
54 | -0.00176056
55 | 0.000877327
56 | 0.00227241
57 | -0.00511724
58 | 0.00116357
59 | 0.00158483
60 | -0.00278399
61 | 0.00158483
62 | 0.00149027
63 | -0.00828068
64 | 0.00149027
65 | 0.00116357
66 | -0.00511724
67 | 0.00227241
68 | 0.000877327
69 | -0.00176056
70 | 0.00135281
71 | -0.000932154
72 | 0.000693828
73 | 0.00151286
74 | -0.00103918
75 | 0.00180978
76 | 0.00162378
77 | -0.00103918
78 | 0.00162378
79 | 0.00180978
80 | -0.000932154
81 | 0.00151286
82 | 0.000693828
83 | 0.000745339
84 | -0.00160795
85 | 0.00128327
86 | 0.00170864
87 | -0.00207753
88 | 0.00088073
89 | 0.00171628
90 | -0.0018372
91 | 0.00154391
92 | 0.00291556
93 | -0.00799627
94 | 0.00145374
95 | 0.00225522
96 | -0.00496729
97 | 0.00225522
98 | 0.00154391
99 | -0.0018372
100 | 0.00171628
101 | 0.00385966
102 | 0.00385966
103 | 0.00145374
104 | -0.00799627
105 | 0.00291556
106 | 0.00088073
107 | -0.00207753
108 | 0.00170864
109 | 0.00128327
110 | -0.00160795
111 | 0.000745339
112 | -0.000845553
113 | 0.00153938
114 | -0.00123795
115 | 0.000921424
116 | 0.00363917
117 | -0.000958728
118 | 0.00210315
119 | 0.00210315
120 | -0.00123795
121 | 0.00363917
122 | 0.000921424
123 | -0.000845553
124 | 0.00153938
125 | -0.00139077
126 | 0.00129056
127 | 0.000924414
128 | -0.00180542
129 | 0.000981697
130 | 0.00088119
131 | -0.00200045
132 | 0.00288085
133 | 0.00204808
134 | -0.00212311
135 | 0.000913058
136 | 0.00179391
137 | -0.0021011
138 | 0.00160593
139 | 0.00187931
140 | -0.00162953
141 | 0.00187931
142 | 0.00814665
143 | 0.00371673
144 | 0.00284063
145 | -0.00774107
146 | 0.00284063
147 | 0.00160593
148 | -0.0021011
149 | 0.00179391
150 | 0.00288085
151 | -0.00200045
152 | 0.00088119
153 | 0.00371673
154 | 0.00814665
155 | 0.000913058
156 | -0.00212311
157 | 0.00204808
158 | 0.000981697
159 | -0.00180542
160 | 0.000924414
161 | 0.00129056
162 | -0.00139077
163 | -0.00116913
164 | 0.00362994
165 | -0.00133684
166 | 0.00106469
167 | 0.00601446
168 | -0.00133684
169 | 0.00601446
170 | 0.00106469
171 | -0.00116913
172 | 0.00362994
173 | -0.00140517
174 | 0.000938818
175 | -0.00183885
176 | 0.00284147
177 | 0.00110785
178 | -0.00175189
179 | 0.00088671
180 | 0.000956593
181 | -0.00196486
182 | 0.00178343
183 | 0.000958869
184 | -0.0021369
185 | 0.00460136
186 | 0.00471252
187 | 0.00131102
188 | 0.00204494
189 | -0.00208791
190 | 0.00169556
191 | 0.00159871
192 | -0.00161509
193 | 0.00159871
194 | 0.00460136
195 | -0.0021369
196 | 0.000958869
197 | 0.0078462
198 | 0.0078462
199 | 0.00169556
200 | -0.00208791
201 | 0.00204494
202 | 0.00178343
203 | -0.00196486
204 | 0.000956593
205 | 0.00284147
206 | -0.00183885
207 | 0.00131102
208 | 0.00471252
209 | 0.00088671
210 | -0.00175189
211 | 0.00110785
212 | 0.000938818
213 | -0.00140517
214 | -0.00130482
215 | 0.00599944
216 | -0.0104999
217 | 0.00282229
218 | 0.00282229
219 | -0.00130482
220 | 0.00599944
221 | -0.00108353
222 | 0.000786206
223 | -0.00162887
224 | 0.00168543
225 | -0.00207494
226 | 0.00457046
227 | 0.00186899
228 | 0.00109164
229 | 0.00109206
230 | -0.00175588
231 | 0.00163061
232 | 0.000850972
233 | -0.00183671
234 | 0.00223098
235 | 0.00207275
236 | -0.00544264
237 | 0.00207275
238 | 0.00456626
239 | 0.00250305
240 | 0.00151905
241 | -0.00126206
242 | 0.00151905
243 | 0.00223098
244 | -0.00183671
245 | 0.000850972
246 | 0.00457046
247 | -0.00207494
248 | 0.00250305
249 | 0.00456626
250 | 0.00163061
251 | -0.00175588
252 | 0.00109206
253 | 0.00168543
254 | -0.00162887
255 | 0.00109164
256 | 0.00186899
257 | 0.000786206
258 | -0.00108353
259 | -0.00999005
260 | 0.00281831
261 | -0.00999005
262 | 0.00281831
263 | 0.00078546
264 | -0.00114809
265 | 0.00139748
266 | -0.00173672
267 | 0.00219819
268 | -0.00540309
269 | 0.00205624
270 | 0.00179427
271 | 0.00210776
272 | 0.000855521
273 | -0.00125062
274 | 0.00170805
275 | 0.00112985
276 | -0.00324037
277 | 0.00112985
278 | 0.00205624
279 | -0.00540309
280 | 0.00187202
281 | 0.00187202
282 | 0.00170805
283 | -0.00125062
284 | 0.000855521
285 | 0.00219819
286 | -0.00173672
287 | 0.00210776
288 | 0.00179427
289 | 0.00139748
290 | -0.00114809
291 | 0.00078546
292 | -0.00949224
293 | 0.00143163
294 | -0.00107829
295 | 0.00159457
296 | -0.0031848
297 | 0.00110975
298 | -0.00537976
299 | 0.00103432
300 | 0.00169483
301 | 0.000884852
302 | -0.00159398
303 | 0.000884852
304 | 0.00110975
305 | -0.0031848
306 | 0.00169483
307 | 0.00103432
308 | 0.00159457
309 | -0.00107829
310 | 0.00143163
311 | 0.00138766
312 | -0.00153026
313 | 0.000824886
314 | -0.00316026
315 | 0.000897844
316 | 0.000897844
317 | 0.000824886
318 | -0.00153026
319 | 0.00138766
320 | 0.000755246
321 | -0.00151049
322 | 0.000755246
323 | )
324 | ;
325 |
326 | boundaryField
327 | {
328 | wall
329 | {
330 | type calculated;
331 | value uniform 0;
332 | }
333 | inlet
334 | {
335 | type calculated;
336 | value nonuniform List 4(-0.016 -0.016 -0.016 -0.016);
337 | }
338 | outlet
339 | {
340 | type calculated;
341 | value nonuniform List 4(0.0159935 0.0168842 0.0151289 0.0159935);
342 | }
343 | }
344 |
345 |
346 | // ************************************************************************* //
347 |
--------------------------------------------------------------------------------
/b_inspect.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bpy.utils.previews
3 | from .core import *
4 | from .cache import BVTKCache
5 |
6 | # -----------------------------------------------------------------------------
7 | # Debug panel and node documentation panel (information about
8 | # active node's vtk object)
9 | # -----------------------------------------------------------------------------
10 | class BVTK_PT_Inspect(bpy.types.Panel):
11 | """Panel for operators which printing information about active node's
12 | VTK object
13 | """
14 |
15 | bl_label = "Inspect"
16 | bl_space_type = "NODE_EDITOR"
17 | bl_region_type = "UI"
18 | bl_category = "Inspect"
19 |
20 | @classmethod
21 | def poll(cls, context):
22 | return context.space_data.tree_type == "BVTK_NodeTreeType"
23 |
24 | def draw(self, context):
25 | layout = self.layout
26 | from . import bl_info
27 |
28 | layout.label(
29 | text="BVTKNodes version: " + ".".join(str(i) for i in bl_info["version"])
30 | )
31 | layout.label(text="VTK version: " + vtk.vtkVersion().GetVTKVersion())
32 |
33 | layout.label(text="Update Mode:")
34 | layout.prop(context.scene.bvtknodes_settings, "update_mode", text="")
35 | layout.separator()
36 |
37 | active_node = context.active_node
38 | if not active_node:
39 | return None
40 | layout.operator("node.bvtk_node_update").node_path = node_path(active_node)
41 |
42 | vtkobj = active_node.get_vtk_obj()
43 | if vtkobj:
44 | column = layout.column(align=True)
45 | o = column.operator("node.bvtk_set_text_editor", text="Documentation")
46 | o.print = 0
47 | o = column.operator("node.bvtk_set_text_editor", text="Node Status")
48 | o.print = 1
49 | o = column.operator("node.bvtk_set_text_editor", text="Output Status")
50 | o.print = 2
51 | o = column.operator(
52 | "node.bvtk_open_website", text=" Online Documentation", icon="WORLD"
53 | )
54 | o.href = "https://www.vtk.org/doc/nightly/html/class{}.html".format(
55 | active_node.bl_label
56 | )
57 | else:
58 | layout.label(text="No active VTK node to inspect")
59 |
60 |
61 | # -----------------------------------------------------------------------------
62 | # Function to add buttons to Python Console header
63 | # -----------------------------------------------------------------------------
64 | def draw_console_header(self, context):
65 | node_tree = None
66 | for area in context.screen.areas:
67 | if area.type == "NODE_EDITOR":
68 | for space in area.spaces:
69 | if space.type == "NODE_EDITOR":
70 | node_tree = space.node_tree.name
71 |
72 | if node_tree:
73 | self.layout.separator()
74 | row = self.layout.row(align=True)
75 | o = row.operator("console.insert", text="Get Node")
76 | o.text = "x=bpy.data.node_groups['" + node_tree + "'].nodes.active"
77 | o = row.operator("console.insert", text="Get VTK Object")
78 | o.text = (
79 | "x=bpy.data.node_groups['" + node_tree + "'].nodes.active.get_vtk_obj()"
80 | )
81 | o = row.operator("console.insert", text="Get Node Output")
82 | o.text = (
83 | "x=bpy.data.node_groups['"
84 | + node_tree
85 | + "'].nodes.active.get_vtk_obj().GetOutput()"
86 | )
87 |
88 |
89 | # -----------------------------------------------------------------------------
90 | # Operators
91 | # -----------------------------------------------------------------------------
92 | class BVTK_OT_SetTextEditor(bpy.types.Operator):
93 | """Add node info to the text editor"""
94 |
95 | bl_idname = "node.bvtk_set_text_editor"
96 | bl_label = "Print info (BVTK in text editor)"
97 |
98 | # 0 to print doc, 1 to print node status, 2 to print outputs status
99 | print: bpy.props.IntProperty(default=0)
100 |
101 | def execute(self, context):
102 | active_node = context.active_node
103 | vtkobj = active_node.get_vtk_obj()
104 | classname = vtkobj.__class__.__name__
105 | if self.print == 0:
106 | inner = self.text_block("DOCUMENTATION " + classname, str(vtkobj.__doc__))
107 | if self.print == 1:
108 | inner = self.text_block(classname, str(vtkobj))
109 | if self.print == 2:
110 | socketnames = active_node.get_output_socket_names()
111 | inner = ""
112 | for socketname in socketnames:
113 | vtk_output_obj = active_node.get_vtk_output_object(socketname)
114 | inner += self.text_block(socketname, str(vtk_output_obj))
115 | text = self.get_text("BVTK", inner)
116 | flag = True
117 | areas = context.screen.areas
118 | for area in areas:
119 | if area.type == "TEXT_EDITOR":
120 | for space in area.spaces:
121 | if space.type == "TEXT_EDITOR":
122 | if flag:
123 | space.text = text
124 | space.top = 0
125 | flag = False
126 | if flag:
127 | self.report({"INFO"}, "See 'BVTK' in the text editor")
128 | return {"FINISHED"}
129 |
130 | def get_text(self, name, inner):
131 | """Get text object"""
132 | if name not in bpy.data.texts.keys():
133 | text = bpy.data.texts.new(name)
134 | else:
135 | text = bpy.data.texts[name]
136 | text.from_string(inner)
137 | return text
138 |
139 | def text_block(self, title, content):
140 | """Pretty print text content with title"""
141 | s = "-" * 50 + "\n" + title + "\n" + "-" * 50 + "\n" + content + "\n"
142 | if content == "None":
143 | s += "\n\n"
144 | return s
145 |
146 |
147 | class BVTK_OT_OpenWebsite(bpy.types.Operator):
148 | bl_idname = "node.bvtk_open_website"
149 | bl_label = "Open Web Browser"
150 | bl_description = "Open web site in web browser"
151 |
152 | href: bpy.props.StringProperty()
153 |
154 | def execute(self, context):
155 | import webbrowser
156 |
157 | webbrowser.open(self.href)
158 | return {"FINISHED"}
159 |
160 |
161 | # Register classes
162 | add_ui_class(BVTK_PT_Inspect)
163 | add_ui_class(BVTK_OT_SetTextEditor)
164 | add_ui_class(BVTK_OT_OpenWebsite)
165 |
--------------------------------------------------------------------------------
/test/json_files/test_head.json:
--------------------------------------------------------------------------------
1 | {
2 | "links": [
3 | {
4 | "from_node_name": "vtkContourFilter",
5 | "from_socket_identifier": "output",
6 | "to_node_name": "VTK To Blender Mesh",
7 | "to_socket_identifier": "input"
8 | },
9 | {
10 | "from_node_name": "vtkXMLImageDataReader",
11 | "from_socket_identifier": "output",
12 | "to_node_name": "vtkImageGaussianSmooth",
13 | "to_socket_identifier": "input"
14 | },
15 | {
16 | "from_node_name": "vtkImageGaussianSmooth",
17 | "from_socket_identifier": "output",
18 | "to_node_name": "vtkContourFilter",
19 | "to_socket_identifier": "input"
20 | },
21 | {
22 | "from_node_name": "vtkImageGaussianSmooth",
23 | "from_socket_identifier": "output",
24 | "to_node_name": "vtkContourFilter.001",
25 | "to_socket_identifier": "input"
26 | },
27 | {
28 | "from_node_name": "vtkContourFilter.001",
29 | "from_socket_identifier": "output",
30 | "to_node_name": "VTK To Blender Mesh.001",
31 | "to_socket_identifier": "input"
32 | }
33 | ],
34 | "nodes": [
35 | {
36 | "additional_properties": {
37 | "m_ContourValues": [
38 | 66.0
39 | ]
40 | },
41 | "bl_idname": "VTKContourFilterType",
42 | "color": [
43 | 0.5,
44 | 0.5,
45 | 0.5
46 | ],
47 | "custom_code": "",
48 | "height": 100.0,
49 | "hide": false,
50 | "label": "",
51 | "location": [
52 | 0.0,
53 | 300.0
54 | ],
55 | "m_ArrayComponent": 0,
56 | "m_ComputeGradients": true,
57 | "m_ComputeNormals": true,
58 | "m_ComputeScalars": true,
59 | "m_GenerateTriangles": true,
60 | "m_NumberOfContours": 1,
61 | "mute": false,
62 | "name": "vtkContourFilter",
63 | "show_options": true,
64 | "show_preview": false,
65 | "width": 200.0
66 | },
67 | {
68 | "bl_idname": "VTKXMLImageDataReaderType",
69 | "color": [
70 | 0.5,
71 | 0.5,
72 | 0.5
73 | ],
74 | "custom_code": "",
75 | "height": 100.0,
76 | "hide": false,
77 | "label": "",
78 | "location": [
79 | -500.0,
80 | 300.0
81 | ],
82 | "m_FileName": "//../../examples_data/head.vti",
83 | "m_ReadFromInputString": false,
84 | "m_TimeStep": 0,
85 | "m_TimeStepRange": [
86 | 0,
87 | 0
88 | ],
89 | "m_WholeSlices": true,
90 | "mute": false,
91 | "name": "vtkXMLImageDataReader",
92 | "show_options": true,
93 | "show_preview": false,
94 | "width": 200.0
95 | },
96 | {
97 | "bl_idname": "VTKImageGaussianSmoothType",
98 | "color": [
99 | 0.5,
100 | 0.5,
101 | 0.5
102 | ],
103 | "custom_code": "",
104 | "e_SplitMode": "Slab",
105 | "height": 100.0,
106 | "hide": false,
107 | "label": "",
108 | "location": [
109 | -250.0,
110 | 300.0
111 | ],
112 | "m_DesiredBytesPerPiece": 65536,
113 | "m_Dimensionality": 3,
114 | "m_EnableSMP": false,
115 | "m_GlobalDefaultEnableSMP": false,
116 | "m_MinimumPieceSize": [
117 | 16,
118 | 1,
119 | 1
120 | ],
121 | "m_NumberOfThreads": 4,
122 | "m_RadiusFactors": [
123 | 1.2000000476837158,
124 | 1.2000000476837158,
125 | 1.2000000476837158
126 | ],
127 | "m_StandardDeviations": [
128 | 1.5,
129 | 1.5,
130 | 1.5
131 | ],
132 | "mute": false,
133 | "name": "vtkImageGaussianSmooth",
134 | "show_options": true,
135 | "show_preview": false,
136 | "width": 200.0
137 | },
138 | {
139 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
140 | "color": [
141 | 0.5,
142 | 0.5,
143 | 0.5
144 | ],
145 | "custom_code": "",
146 | "generate_material": false,
147 | "height": 100.0,
148 | "hide": false,
149 | "label": "",
150 | "location": [
151 | 300.0,
152 | 300.0
153 | ],
154 | "m_Name": "skel",
155 | "mute": false,
156 | "name": "VTK To Blender Mesh",
157 | "show_options": true,
158 | "show_preview": false,
159 | "smooth": true,
160 | "width": 200.0
161 | },
162 | {
163 | "bl_idname": "BVTK_Node_VTKToBlenderMeshType",
164 | "color": [
165 | 0.5,
166 | 0.5,
167 | 0.5
168 | ],
169 | "custom_code": "",
170 | "generate_material": false,
171 | "height": 100.0,
172 | "hide": false,
173 | "label": "",
174 | "location": [
175 | 300.0,
176 | 0.0
177 | ],
178 | "m_Name": "skin",
179 | "mute": false,
180 | "name": "VTK To Blender Mesh.001",
181 | "show_options": true,
182 | "show_preview": false,
183 | "smooth": true,
184 | "width": 200.0
185 | },
186 | {
187 | "additional_properties": {
188 | "m_ContourValues": [
189 | 20.0
190 | ]
191 | },
192 | "bl_idname": "VTKContourFilterType",
193 | "color": [
194 | 0.5,
195 | 0.5,
196 | 0.5
197 | ],
198 | "custom_code": "",
199 | "height": 100.0,
200 | "hide": false,
201 | "label": "",
202 | "location": [
203 | 0.0,
204 | 0.0
205 | ],
206 | "m_ArrayComponent": 0,
207 | "m_ComputeGradients": true,
208 | "m_ComputeNormals": true,
209 | "m_ComputeScalars": true,
210 | "m_GenerateTriangles": true,
211 | "m_NumberOfContours": 1,
212 | "mute": false,
213 | "name": "vtkContourFilter.001",
214 | "show_options": true,
215 | "show_preview": false,
216 | "width": 200.0
217 | }
218 | ]
219 | }
220 |
--------------------------------------------------------------------------------
/cache.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import bpy
3 | import vtk
4 | import functools
5 | from . import core
6 |
7 | l = logging.getLogger(__name__)
8 |
9 | # TODO: Modify Global Time Keeper and remove these?
10 | persistent_storage = {"nodes": {}}
11 |
12 | # It is sometimes not possible to save instance variables in a class, which is why we use this node
13 | class PersistentStorageUser:
14 | def free(self):
15 | if self.name in persistent_storage["nodes"]:
16 | del persistent_storage["nodes"][self.name]
17 |
18 | def get_persistent_storage(self):
19 | if self.name not in persistent_storage["nodes"]:
20 | persistent_storage["nodes"][self.name] = {}
21 | return persistent_storage["nodes"][self.name]
22 |
23 |
24 | nodeMaxId: int = 0 # Maximum node id number. 0 means not assigned.
25 | nodeIdMap: dict = {} # node_id -> node
26 | treeIdMap: dict = {} # node_id -> node tree
27 | vtkCache: dict = {} # node_id -> VTK object
28 |
29 |
30 | class BVTKCache:
31 | """Class for navigation between nodes and VTK objects.
32 | node_id property is used as key in map dictionaries.
33 | All VTK nodes must have an entry in the cache dictionaries.
34 | vtkCache entry can be None if there is no VTK object.
35 | """
36 |
37 | @classmethod
38 | def reset_cache(cls):
39 | """Create new empty node cache variables.
40 | """
41 | # Zero the map dictionaries
42 | global nodeMaxId, nodeIdMap, treeIdMap, vtkCache
43 | nodeMaxId = 0
44 | nodeIdMap = {}
45 | treeIdMap = {}
46 | vtkCache = {}
47 |
48 | @classmethod
49 | def add_new_node(cls, node):
50 | """Create VTK object for argument node and add mapping between node
51 | and VTK object.
52 | """
53 | if node.bl_label.startswith("vtk"):
54 | vtk_class = getattr(vtk, node.bl_label, None)
55 | if vtk_class is None:
56 | node.vtk_status = "none"
57 | l.error("Bad VTK class name " + node.bl_label)
58 | return
59 | vtk_obj = vtk_class()
60 | vtkCache[node] = vtk_obj
61 | nodeCache[vtk_obj] = node
62 | node.vtk_status = "uninitialized"
63 | l.debug("Created VTK object of type " + node.bl_label)
64 | else:
65 | node.vtk_status = "none"
66 |
67 | @classmethod
68 | def init_vtkobj(cls, node):
69 | """Instantiate the nodes vtkobj and store it in VTKCache.
70 | """
71 | global vtkCache
72 |
73 | # create the node vtk_obj if needed
74 | if node.bl_label.startswith("vtk"):
75 | vtk_class = getattr(vtk, node.bl_label, None)
76 | if vtk_class is None:
77 | l.error("bad classname " + node.bl_label)
78 | return
79 | vtkCache[node.node_id] = vtk_class()
80 | l.debug(
81 | "Created VTK object of type "
82 | + node.bl_label
83 | + ", id "
84 | + str(node.node_id)
85 | )
86 | else:
87 | vtkCache[node.node_id] = None
88 |
89 | # Rebuild from existing nodes
90 | bvtk_nodes = core.get_all_bvtk_nodes()
91 |
92 | for node in bvtk_nodes:
93 | # Uninitialized node, create VTK object
94 | if node.node_id == 0 or BVTKCache.get_vtk_obj(node.node_id) == None:
95 | vtk_obj = node.init_vtk()
96 | cls.map_node(node, vtk_obj)
97 | # Update nodeMaxId if needed, to avoid doubles
98 | if node.node_id > nodeMaxId:
99 | nodeMaxId = node.node_id
100 |
101 | # Force resetting of VTK connections
102 | for node in bvtk_nodes:
103 | node.connected_input_names = "" # Reset namelist to force update
104 | node.update()
105 |
106 | @classmethod
107 | def update_all(cls):
108 | """Go through all nodes and update those that are not up-to-date.
109 | """
110 | bvtk_nodes = core.get_all_bvtk_nodes()
111 | for node in bvtk_nodes:
112 | if node.vtk_status != "up-to-date":
113 | node.update_vtk()
114 |
115 | @classmethod
116 | def map_node(cls, node, vtk_obj=None):
117 | """Assign node ID to node and add VTK object and mappings to cache.
118 | """
119 | global nodeMaxId, nodeIdMap, treeIdMap, vtkCache
120 |
121 | # node_id value 0 indicates a new node, for which a new number
122 | # is to be assigned. For existing nodes use old node_id number.
123 | if node.node_id == 0:
124 | nodeMaxId += 1
125 | node.node_id = nodeMaxId
126 | if node.node_id in vtkCache:
127 | raise ValueError(
128 | "Internal Error: Cache already contains node_id #%d" % node.node_id
129 | )
130 | vtkCache[node.node_id] = vtk_obj
131 | nodeIdMap[node.node_id] = node
132 | tree = node.id_data
133 | treeIdMap[node.node_id] = tree
134 |
135 | if node.node_id == nodeMaxId:
136 | l.debug("Mapped new node: %s, id #%d" % (node.name, node.node_id))
137 | else:
138 | l.debug("Remapped old node: %s, id #%d" % (node.name, node.node_id))
139 |
140 | @classmethod
141 | def unmap_node(cls, node):
142 | """Remove node from cache. To be called from node.free().
143 | Remove node from cache dictionaries.
144 | """
145 | global nodeIdMap, treeIdMap, vtkCache
146 |
147 | if node.node_id in nodeIdMap:
148 | del nodeIdMap[node.node_id]
149 | if node.node_id in treeIdMap:
150 | del treeIdMap[node.node_id]
151 | if node.node_id in vtkCache:
152 | del vtkCache[node.node_id]
153 | l.debug("Unmapped node: %s, id #%d" % (node.name, node.node_id))
154 |
155 | @classmethod
156 | def get_node(cls, node_id: int):
157 | """Get node corresponding to node_id.
158 | Called by Node Write and Edit/Save Custom Code.
159 | """
160 | global nodeIdMap
161 |
162 | if node_id in nodeIdMap:
163 | return nodeIdMap[node_id]
164 | else:
165 | raise Exception("not found node_id " + str(node_id))
166 |
167 | @classmethod
168 | def get_tree(cls, node_id: int):
169 | """Get node tree corresponding to node_id.
170 | Called by Node Write and Edit/Save Custom Code.
171 | """
172 | global treeIdMap
173 |
174 | if node_id in treeIdMap:
175 | return treeIdMap[node_id]
176 | else:
177 | raise Exception("not found node_id " + str(node_id))
178 |
179 | @classmethod
180 | def get_vtk_obj(cls, node_id: int):
181 | """Get the VTK object from vtkCache by node ID number.
182 | """
183 | global vtkCache
184 |
185 | if node_id in vtkCache:
186 | return vtkCache[node_id]
187 | return None
188 |
189 | @classmethod
190 | def vtk_obj_in_cache(cls, node_id: int):
191 | """Return True if an object (or None) is in cache.
192 | """
193 | global vtkCache
194 |
195 | if node_id in vtkCache:
196 | return True
197 | return False
198 |
--------------------------------------------------------------------------------