Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
40238fa
Add Catalyst Plugin as a submodule.
francois-kitware Nov 8, 2024
39184ce
Update Changelog.
francois-kitware Nov 8, 2024
167db35
Remove folder.
francois-kitware Jan 28, 2025
6155b93
Add plugin catalyst from https://gitlab.kitware.com/keu-public/pdi-ca…
francois-kitware Jan 28, 2025
8102376
Add francois as author.
francois-kitware Jan 31, 2025
c81978b
Build catalyst plugin with BUILD_UNSTABLE option only.
francois-kitware Jan 31, 2025
d4dadc9
Update copyright
francois-kitware Jan 31, 2025
de4193f
fix bug of cell_points_size
jmorice91 Jul 30, 2025
fe23780
PDI_data remove
jmorice91 Aug 26, 2025
6abc52f
remove unecessary line
jmorice91 Sep 15, 2025
714bc67
adding example for the tutorial
jmorice91 Sep 15, 2025
d371cd5
change data name for ghosts
jmorice91 Sep 15, 2025
c598d9a
Remove example of the tututorial, fix bug of Catalyst_DIR, clean the …
jmorice91 Nov 19, 2025
c985cf2
remove comment for pressure plot
jmorice91 Nov 19, 2025
d150b39
Fix #482, fix suggestion
jmorice91 Nov 21, 2025
11517e5
remove clang-format and gitignore
jmorice91 Nov 24, 2025
31bfc2c
improve the method to take account the integer type
jmorice91 Dec 2, 2025
a246c87
add copyright header
jmorice91 Dec 3, 2025
d14a0ed
change format to snake_case
jmorice91 Dec 5, 2025
d7b8c2a
filename in snake case
jmorice91 Dec 5, 2025
44962cd
small changes
jmorice91 Feb 18, 2026
43bf19f
adding example with catalyst
jmorice91 Apr 14, 2026
881c45f
Update catalyst plugin core
jmorice91 Apr 14, 2026
30a66c4
update catalyst test
jmorice91 Apr 14, 2026
3385ed4
adding test with the ghost
jmorice91 Apr 14, 2026
e4f5415
fix authors list
jmorice91 Apr 24, 2026
0d6f956
update readme
jmorice91 Apr 24, 2026
3262de0
fix Config_error
jmorice91 Apr 28, 2026
574ba6c
adding python support
jmorice91 May 4, 2026
b1acca6
fix indent
jmorice91 May 4, 2026
5848c2f
remove parent_tree in struct for ghost layers
jmorice91 May 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "vendor/run-clang-format"]
path = vendor/run-clang-format
url = https://github.com/Sarcasm/run-clang-format.git
[submodule "vendor/catalyst-2.0.0"]
path = vendor/catalyst-2.0.0
url = https://gitlab.kitware.com/paraview/catalyst
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Benoit Martin - CEA (bmartin@cea.fr)
* support for const data in `PDI_share`, `PDI_expose` and `PDI_multi_expose`
* Initial implementation of the cmake test

François Mazen - Kitware (francois.mazen@kitware.com)
* Catalyst plugin creation

François-Xavier Mordant - CEA (francois-xavier.mordant@cea.fr)
* Fixed CMake issues, internal API enhancement
* Bug fix, JSON plugin
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to

## [Unreleased]

### For users
### Added
* Add Catalyst plugin from Kitware [#496](https://github.com/pdidev/pdi/pull/496)

#### Added

Expand Down
27 changes: 26 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#=============================================================================
# Copyright (C) 2015-2026 Commissariat a l'energie atomique et aux energies alternatives (CEA)
# Copyright (C) 2024-2025 Kitware SAS
#
# All rights reserved.
#
Expand Down Expand Up @@ -76,7 +77,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries rather than static ones"
option(BUILD_TRACE_PLUGIN "Build Trace plugin" ON)
option(BUILD_USER_CODE_PLUGIN "Build User-code plugin" ON)
option(BUILD_JSON_PLUGIN "Build JSON plugin" OFF)
option(ENABLE_BENCHMARKING "Activate benchmarks in the test suite" OFF)
option(BUILD_CATALYST_PLUGIN "Build Catalyst plugin" "${BUILD_UNSTABLE}")



Expand Down Expand Up @@ -419,6 +420,23 @@ if("${BUILD_PYTHON}")
)
endif()

## Catalyst
if("${BUILD_CATALYST_PLUGIN}")
set(CATALYST_WRAP_PYTHON OFF)
if("${BUILD_PYTHON}")
set(CATALYST_WRAP_PYTHON ON)
endif()
sbuild_add_dependency(catalyst "${USE_DEFAULT}"
EMBEDDED_PATH "vendor/catalyst-2.0.0"
CMAKE_CACHE_ARGS
"-DBUILD_TESTING:BOOL=OFF"
"-DCATALYST_BUILD_TESTING:BOOL=OFF"
"-DCATALYST_USE_MPI:BOOL=ON"
"-DCATALYST_WRAP_FORTRAN:BOOL=OFF"
"-DCATALYST_WRAP_PYTHON:BOOL=${CATALYST_WRAP_PYTHON}"
VERSION 2.0.0
)
endif()

## JSON

Expand Down Expand Up @@ -536,3 +554,10 @@ sbuild_add_module(PDI_API_TESTS
INSTALL_COMMAND ""
SUBSTEPS test
)

sbuild_add_module(CATALYST_PLUGIN
ENABLE_BUILD_FLAG BUILD_CATALYST_PLUGIN
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/plugins/catalyst"
DEPENDS PDI catalyst
SUBSTEPS test
)
30 changes: 28 additions & 2 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ end module
endif()
endif()


add_executable(PDI_example_C example.c)
target_link_libraries(PDI_example_C PRIVATE PDI::PDI_C paraconf::paraconf MPI::MPI_C m)


if("${BUILD_FORTRAN}")
add_executable(PDI_example_F example.F90)
target_link_libraries(PDI_example_F PRIVATE PDI::PDI_f90 paraconf::paraconf_f90 MPI_with_mod m)
Expand Down Expand Up @@ -161,3 +159,31 @@ add_test(NAME PDI_example_trace_P COMMAND "${MPIEXEC}" "${MPIEXEC_NUMPROC_FLAG}"
set_property(TEST PDI_example_trace_P PROPERTY TIMEOUT 15)
set_property(TEST PDI_example_trace_P PROPERTY PROCESSORS 3)
endif("${BUILD_PYTHON}")

if("${BUILD_CATALYST_PLUGIN}")
find_package(catalyst REQUIRED)
## These examples are only valid with MPI, check if catalyst is compiling with MPI
if("${CATALYST_USE_MPI}")

## set directory to find the catalyst python script
set(CATALYST_SCRIPT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
## configure the yaml file with the previous directory
configure_file(catalyst_serial.yml.in ${CMAKE_BINARY_DIR}/catalyst_serial.yml) ## keep serial for personal testing
configure_file(catalyst.yml.in ${CMAKE_BINARY_DIR}/catalyst.yml)

add_test(NAME PDI_example_catalyst_C_serial COMMAND "${MPIEXEC}" "${MPIEXEC_NUMPROC_FLAG}" 1 ${MPIEXEC_PREFLAGS} "$<TARGET_FILE:PDI_example_C>" ${MPIEXEC_POSTFLAGS} "${CMAKE_BINARY_DIR}/catalyst_serial.yml")
set_property(TEST PDI_example_catalyst_C_serial PROPERTY TIMEOUT 15)
set_property(TEST PDI_example_catalyst_C_serial PROPERTY PROCESSORS 1)

add_test(NAME PDI_example_catalyst_C COMMAND "${MPIEXEC}" "${MPIEXEC_NUMPROC_FLAG}" 3 ${MPIEXEC_PREFLAGS} "$<TARGET_FILE:PDI_example_C>" ${MPIEXEC_POSTFLAGS} "${CMAKE_BINARY_DIR}/catalyst.yml")
set_property(TEST PDI_example_catalyst_C PROPERTY TIMEOUT 15)
set_property(TEST PDI_example_catalyst_C PROPERTY PROCESSORS 3)

if("${BUILD_PYTHON}" AND "${CATALYST_USE_PYTHON}")
add_test(NAME PDI_example_catalyst_P COMMAND "${MPIEXEC}" "${MPIEXEC_NUMPROC_FLAG}" 1 ${MPIEXEC_PREFLAGS} "$<TARGET_FILE:PDI::pdirun>" "${Python3_EXECUTABLE}" ${MPIEXEC_POSTFLAGS} "${CMAKE_CURRENT_SOURCE_DIR}/example.py" "${CMAKE_BINARY_DIR}/catalyst_serial.yml")
set_property(TEST PDI_example_catalyst_P PROPERTY TIMEOUT 15)
set_property(TEST PDI_example_catalyst_P PROPERTY PROCESSORS 1)
endif("${BUILD_PYTHON}" AND "${CATALYST_USE_PYTHON}")

endif("${CATALYST_USE_MPI}")
endif("${BUILD_CATALYST_PLUGIN}")
56 changes: 56 additions & 0 deletions example/catalyst.yml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# duration in seconds
duration: 1.75
# global [height, width] (excluding boundary conditions or ghosts)
datasize: [60, 12]
# degree of parallelism
parallelism: { height: 3, width: 1 }

# only the following config is passed to PDI
pdi:
metadata: # type of small values for which PDI keeps a copy
iter: int # current iteration id
dsize: { size: 2, type: array, subtype: int } # local data size including ghosts/boundary
psize: { size: 2, type: array, subtype: int } # number of processes in each dimension
pcoord: { size: 2, type: array, subtype: int } # coordinate of the process
data: # type of values for which PDI does not keep a copy
main_field: { size: [ '$dsize[0]', '$dsize[1]' ], type: array, subtype: double }

plugins:
mpi:
catalyst:
scripts:
script1: "@CATALYST_SCRIPT_FOLDER@/catalyst_pipeline_with_rendering.py"
on_event: "newiter"
execute:
state:
timestep: '$iter'
time: '1.0*$iter'
multiblock: 0
channels:
grid:
type: "mesh"
data:
coordsets:
my_coords:
type: "uniform"
dims: { i: '1+$dsize[1]', j: '1+$dsize[0]' }
origin:
x: '1.0*$pcoord[1]*($dsize[1]-2.0)-1.0'
y: '1.0*$pcoord[0]*($dsize[0]-2.0)-1.0'
spacing: { dx: 1.0, dy: 1.0 }
topologies:
my_mesh:
type: "uniform"
coordset: "my_coords"
# elements:
# dims: {offsets: [] strides: []}
fields:
temperature:
association: "element"
topology: "my_mesh"
volume_dependent: "false"
values:
PDI_data_array: "main_field"
size: '$dsize[0]*$dsize[1]'
ghost_layers:
my_mesh: { association: "element", start: ['1', '1'], size: ['$dsize[1]-2', '$dsize[0]-2'] }
131 changes: 131 additions & 0 deletions example/catalyst_pipeline_with_rendering.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# script-version: 2.0
from paraview.simple import *
from paraview import catalyst
import time

# registrationName must match the channel name used in the
# 'CatalystAdaptor'.
producer = TrivialProducer(registrationName="grid")

# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------

# ######## render view temperature

# Create a new 'Render View'
renderView1 = CreateView('RenderView')
# renderView1.Set(
# ViewSize=[800, 600],
# InteractionMode='2D',
# CenterOfRotation=[20.0, 3.0, 0.0],
# CameraPosition=[20.0, 30.0, 408.7],
# CameraFocalPoint=[20.0, 30.0, 0.0],
# CameraFocalDisk=1.0,
# CameraParallelScale=32.0,
# )

renderView1.ViewSize=[800, 600]
renderView1.InteractionMode='2D'
renderView1.CenterOfRotation=[20.0, 3.0, 0.0]
renderView1.CameraPosition=[20.0, 30.0, 408.7]
renderView1.CameraFocalPoint=[20.0, 30.0, 0.0]
renderView1.CameraFocalDisk=1.0,
renderView1.CameraParallelScale=32.0


# get color transfer function/color map for 'temperature'
temperatureLUT = GetColorTransferFunction('temperature')
## RGB: first line: min value, last line: max value
# temperatureLUT.Set(
# RGBPoints=GenerateRGBPoints(
# range_min=0.0,
# range_max=200.0,
# ),
# ScalarRangeInitialized=1.0,
# )


temperatureLUT.RGBPoints=[0.0, 0.231373, 0.298039, 0.752941,
500000.0, 0.865003, 0.865003, 0.865003,
1000000, 0.705882, 0.0156863, 0.14902]

temperatureLUT.ScalarRangeInitialized=1.0



# show data from grid
## wgridDisplay = Show(producer, renderView1, 'UnstructuredGridRepresentation')
gridDisplay = Show(producer, renderView1, 'StructuredGridRepresentation')

gridDisplay.Representation = 'Surface With Edges'
gridDisplay.ColorArrayName = ['CELLS', 'temperature']
gridDisplay.LookupTable = temperatureLUT

# get color legend/bar for temperatureLUT in view renderView1
temperatureLUTColorBar = GetScalarBar(temperatureLUT, renderView1)
temperatureLUTColorBar.Title = 'temperature'

# set color bar visibility
temperatureLUTColorBar.Visibility = 1

# show color legend
gridDisplay.SetScalarBarVisibility(renderView1, True)

# # ----------------------------------------------------------------
# # setup extractors
# # ----------------------------------------------------------------

SetActiveView(renderView1)
# create extractor
pNG2= CreateExtractor('PNG', renderView1, registrationName='PNG2')
# trace defaults for the extractor.
pNG2.Trigger = 'TimeStep'

# init the 'PNG' selected for 'Writer'
pNG2.Writer.FileName = 'temperature_screenshot_{timestep:06d}.png'
pNG2.Writer.ImageResolution=[800, 600]
pNG2.Writer.Format = 'PNG'

# # ----------------------------------------------------------------
# # setup extractor for saving the solution in VTK file
# # ----------------------------------------------------------------

extractor_vtk_file = None

mesh_grid = producer.GetClientSideObject().GetOutputDataObject(0)
if mesh_grid.IsA('vtkUnstructuredGrid'):
extractor_vtk_file = CreateExtractor('VTU', producer, registrationName='VTU')
elif mesh_grid.IsA('vtkMultiBlockDataSet'):
extractor_vtk_file = CreateExtractor('VTM', producer, registrationName='VTM')
elif mesh_grid.IsA('vtkPartitionedDataSet'):
extractor_vtk_file = CreateExtractor('VTPD', producer, registrationName='VTPD')
else:
raise RuntimeError("Unsupported data type: %s. Check that the adaptor is providing channel named %s",
mesh_grid.GetClassName(), "grid")


# ------------------------------------------------------------------------------
# Catalyst options
options = catalyst.Options()
## 0: no client, generate the png images and vtk files.
## 1: interactive
options.EnableCatalystLive = 0


# Greeting to ensure that ctest knows this script is being imported
print("#############################################################")
print("executing catalyst_pipeline")
print("#############################################################")
def catalyst_execute(info):
global producer
producer.UpdatePipeline()
print("-----------------------------------")
print("executing (cycle={}, time={})".format(info.cycle, info.time))
print("bounds:", producer.GetDataInformation().GetBounds())
print("temperature-range:", producer.CellData["temperature"].GetRange(0))
# In a real simulation sleep is not needed. We use it here to slow down the
# "simulation" and make sure ParaView client can catch up with the produced
# results instead of having all of them flashing at once.
if options.EnableCatalystLive:
time.sleep(0.1)
58 changes: 58 additions & 0 deletions example/catalyst_serial.yml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# duration in seconds
duration: 2.75
# global [height, width] (excluding boundary conditions or ghosts)
datasize: [60, 12]
# degree of parallelism
parallelism: { height: 1 , width: 1 }

# only the following config is passed to PDI
pdi:
metadata: # type of small values for which PDI keeps a copy
iter: int # current iteration id
dsize: { size: 2, type: array, subtype: int } # local data size including ghosts/boundary
psize: { size: 2, type: array, subtype: int } # number of processes in each dimension
pcoord: { size: 2, type: array, subtype: int } # coordinate of the process
data: # type of values for which PDI does not keep a copy
main_field: { size: [ '$dsize[0]', '$dsize[1]' ], type: array, subtype: double }

logging: debug
plugins:
mpi:
catalyst:
scripts:
script1: "@CATALYST_SCRIPT_FOLDER@/catalyst_pipeline_with_rendering.py"
on_event: "newiter"
execute:
state:
timestep: $iter
time: 1.0*$iter
multiblock: 0
channels:
grid:
type: "mesh"
data:
coordsets:
my_coords:
type: "uniform"
dims: { i: '1+$dsize[1]', j: '1+$dsize[0]' }
origin:
x: 1.0*$pcoord[1]*($dsize[1]-2.0)-1.0
y: 1.0*$pcoord[0]*($dsize[0]-2.0)-1.0
spacing: { dx: 1.0, dy: 1.0 }
topologies:
my_mesh:
type: "uniform"
coordset: "my_coords"
fields:
temperature:
association: "element"
topology: "my_mesh"
volume_dependent: "false"
values:
PDI_data_array: "main_field"
size: $dsize[0]*$dsize[1]
ghost_layers:
my_mesh:
association: "element"
start: ['1', '1']
size: ['$dsize[1]-2', '$dsize[0]-2']
2 changes: 1 addition & 1 deletion example/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ int main(int argc, char* argv[])
#ifndef WITHOUT_PARACONF
PC_double(PC_get(conf, ".duration"), &duration);
#else
duration = 0.1;
duration = 1.75;
#endif

// get local & add ghosts to sizes
Expand Down
Loading