Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fe961f5
Add support VBB
Oct 25, 2025
e17e8d5
Add support VBB
Oct 25, 2025
51cae9f
Merge remote-tracking branch 'origin/feat/add-VBB' into feat/add-VBB
Oct 25, 2025
221d620
chore: adding changelog file 763.added.md [dependabot-skip]
pyansys-ci-bot Oct 25, 2025
8e4ee3b
add unit test for creating virtual bsdf bench simulation
Nov 4, 2025
a29c1d2
add example
Nov 4, 2025
8859063
improve vbsdf example
Nov 4, 2025
5d5bdb2
add support load an exported vbsdf simulation
Nov 4, 2025
c31458b
fix default type error
Nov 4, 2025
8070f17
fix default type error
Nov 4, 2025
ea8526f
add vbsdf speos asset file
Nov 4, 2025
7e15dcc
fix issue of changing uniform properties
Nov 16, 2025
f940f55
add un-support set_sensor and set_source paths mathod in virtualbsdf
Nov 17, 2025
62932d8
refactor geom_distance_tolerance from child to base
Nov 17, 2025
8047d6f
refactor max_impact from child to base
Nov 17, 2025
ba35267
check type in the function init
Nov 21, 2025
8888e1d
simplify the class type name
Nov 21, 2025
fbf3d50
Merge branch 'main' into feat/add-VBB
pluAtAnsys Nov 21, 2025
abf3d37
Merge branch 'main' into feat/add-VBB
pluAtAnsys Dec 9, 2025
69f3254
typo and remove not-used unspecified symmetric option
Dec 15, 2025
cf15746
Merge branch 'main' into feat/add-VBB
pluAtAnsys Dec 16, 2025
b9bd975
ci: auto fixes from pre-commit.com hooks.
pre-commit-ci[bot] Dec 16, 2025
eadd018
fix not creating parent directories
Dec 16, 2025
86d324d
fix example issues
Dec 16, 2025
ba401b3
Update examples/core/simulation.py
pluAtAnsys Dec 16, 2025
9acfe7d
Update src/ansys/speos/core/simulation.py
pluAtAnsys Dec 16, 2025
de1985c
ci: auto fixes from pre-commit.com hooks.
pre-commit-ci[bot] Dec 16, 2025
f2adbdd
Merge branch 'main' into feat/add-VBB
StefanThoene Dec 16, 2025
fba7e5a
add missing return type and docstrings
Dec 17, 2025
4cb9e42
fix docstring for getter and setter methods
Dec 17, 2025
dce46ad
fix docstring for getter and setter methods
Dec 17, 2025
41d02dc
Merge remote-tracking branch 'origin/feat/add-VBB' into feat/add-VBB
Dec 17, 2025
585deff
fix docstring
Dec 17, 2025
7a1041a
fix docstring and broken link
Dec 17, 2025
113369d
add missing docstring info
Dec 17, 2025
4dcd978
Merge branch 'main' into feat/add-VBB
pluAtAnsys Dec 17, 2025
fcda9c9
fix docstring typo
Dec 17, 2025
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
1 change: 1 addition & 0 deletions doc/changelog.d/763.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add supporting virtual bsdf bench
40 changes: 30 additions & 10 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,36 @@ def copy_assets_to_output_dir(app: sphinx.application.Sphinx, exception: Excepti
exception : Exception
Exception encountered during the building of the documentation.
"""
if app.builder.name == "html":
SOURCE_ASSETS = pathlib.Path(app.outdir) / "_static" / "assets" / "download"
ASSETS_DIRECTORY = pathlib.Path(app.outdir).parent.parent.parent / "tests" / "assets"

logger.info("Extracting assets to output directory...")
zip_path = pathlib.Path(shutil.make_archive("assets", "zip", ASSETS_DIRECTORY))
zip_path = shutil.move(zip_path, SOURCE_ASSETS / zip_path.name)
logger.info(f"Extracted assets to {zip_path}.")
else:
logger.info(f"Skip assets extraction with build {app.builder.name}.")
if app.builder.name != "html":
logger.info(
"Skip assets extraction with build %s.",
app.builder.name,
)
return

source_assets = pathlib.Path(app.outdir).parent.parent.parent / "tests" / "assets"

output_dir = pathlib.Path(app.outdir) / "_static" / "assets" / "download"

if not source_assets.exists():
logger.warning(
"Assets directory not found at %s; skipping asset packaging.",
source_assets,
)
return

output_dir.mkdir(parents=True, exist_ok=True)

logger.info("Packaging assets for documentation output...")

archive_base = output_dir / "assets"
zip_path = shutil.make_archive(
base_name=str(archive_base),
format="zip",
root_dir=str(source_assets),
)

logger.info("Assets packaged at %s.", zip_path)


def remove_examples_from_source_dir(app: sphinx.application.Sphinx, exception: Exception):
Expand Down
37 changes: 32 additions & 5 deletions examples/core/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
from ansys.speos.core.kernel.client import (
default_docker_channel,
)
from ansys.speos.core.simulation import SimulationInteractive, SimulationInverse
from ansys.speos.core.simulation import (
SimulationInteractive,
SimulationInverse,
SimulationVirtualBSDF,
)

# -

Expand Down Expand Up @@ -132,9 +136,9 @@
simulation2_direct = p.create_simulation(name="Simulation.2")
simulation2_direct.set_ambient_material_file_uri(
uri=str(assets_data_path / "AIR.material")
).set_colorimetric_standard_CIE_1964().set_weight_none().set_geom_distance_tolerance(
0.01
).set_max_impact(200).set_dispersion(False)
).set_colorimetric_standard_CIE_1964().set_weight_none().set_dispersion(False)
simulation2_direct.geom_distance_tolerance = 0.01
simulation2_direct.max_impact = 200
simulation2_direct.set_sensor_paths([SENSOR_NAME]).set_source_paths([SOURCE_NAME]).commit()
print(simulation2_direct)

Expand Down Expand Up @@ -164,7 +168,7 @@
#
# Possibility to reset local values from the one available in the server.

simulation1.set_max_impact(1000) # adjust max impact but no commit
simulation1.max_impact = 1000 # adjust max impact but no commit
simulation1.reset() # reset -> this will apply the server value to the local value
simulation1.delete() # delete (to display the local value with the below print)
print(simulation1)
Expand All @@ -186,4 +190,27 @@
simulation4.set_source_paths(source_paths=[SOURCE_NAME]).commit()
print(simulation4)

# ### Virtual BSDF Bench simulation

# Change the material property from mirror to bsdf type
opt_prop.set_surface_library(path=str(assets_data_path / "R_test.anisotropicbsdf")).commit()
vbb = p.create_simulation(name="virtual_BSDF", feature_type=SimulationVirtualBSDF)
vbb.axis_system = [
0.36,
1.73,
2.0,
1.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
1.0,
] # change the coordinate VBSDF to body center
vbb.commit()
results = vbb.compute_CPU()
print(results)

speos.close()
47 changes: 38 additions & 9 deletions src/ansys/speos/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
SimulationDirect,
SimulationInteractive,
SimulationInverse,
SimulationVirtualBSDF,
)
from ansys.speos.core.source import (
SourceAmbientNaturalLight,
Expand Down Expand Up @@ -225,7 +226,8 @@ def create_source(
)
case _:
msg = "Requested feature {} does not exist in supported list {}".format(
feature_type, [SourceSurface, SourceLuminaire, SourceRayFile]
feature_type,
[SourceSurface, SourceLuminaire, SourceRayFile, SourceAmbientNaturalLight],
)
raise TypeError(msg)
self._features.append(feature)
Expand All @@ -237,7 +239,7 @@ def create_simulation(
description: str = "",
feature_type: type = SimulationDirect,
metadata: Optional[Mapping[str, str]] = None,
) -> Union[SimulationDirect, SimulationInteractive, SimulationInverse]:
) -> Union[SimulationDirect, SimulationInteractive, SimulationInverse, SimulationVirtualBSDF]:
"""Create a new Simulation feature.

Parameters
Expand All @@ -261,7 +263,8 @@ def create_simulation(
-------
Union[ansys.speos.core.simulation.SimulationDirect,\
ansys.speos.core.simulation.SimulationInteractive,\
ansys.speos.core.simulation.SimulationInverse]
ansys.speos.core.simulation.SimulationInverse, \
ansys.speos.core.simulation.SimulationVirtualBSDF]
Simulation class instance
"""
if metadata is None:
Expand Down Expand Up @@ -296,13 +299,21 @@ def create_simulation(
description=description,
metadata=metadata,
)
case "SimulationVirtualBSDF":
feature = SimulationVirtualBSDF(
project=self,
name=name,
description=description,
metadata=metadata,
)
case _:
msg = "Requested feature {} does not exist in supported list {}".format(
feature_type,
[
SimulationDirect,
SimulationInverse,
SimulationInteractive,
SimulationVirtualBSDF,
],
)
raise TypeError(msg)
Expand Down Expand Up @@ -437,12 +448,15 @@ def find(
SourceSurface,
SourceLuminaire,
SourceRayFile,
SourceAmbientNaturalLight,
SensorIrradiance,
SensorRadiance,
SensorCamera,
Sensor3DIrradiance,
SimulationDirect,
SimulationInverse,
SimulationInteractive,
SimulationVirtualBSDF,
part.Part,
body.Body,
face.Face,
Expand All @@ -466,12 +480,15 @@ def find(

Returns
-------
List[Union[ansys.speos.core.opt_prop.OptProp, ansys.speos.core.source.Surface, \
ansys.speos.core.source.RayFile, ansys.speos.core.source.Luminaire, \
ansys.speos.core.sensor.Camera, \
ansys.speos.core.sensor.Radiance, ansys.speos.core.sensor.Irradiance, \
ansys.speos.core.simulation.Direct, ansys.speos.core.simulation.Interactive, \
ansys.speos.core.simulation.Inverse, ansys.speos.core.part.Part, \
List[Union[ansys.speos.core.opt_prop.OptProp, ansys.speos.core.source.SourceSurface, \
ansys.speos.core.source.SourceRayFile, ansys.speos.core.source.SourceLuminaire, \
ansys.speos.core.source.SourceAmbientNaturalLight, ansys.speos.core.sensor.SensorCamera, \
ansys.speos.core.sensor.SensorRadiance, ansys.speos.core.sensor.SensorIrradiance, \
ansys.speos.core.sensor.Sensor3DIrradiance, \
ansys.speos.core.simulation.SimulationVirtualBSDF, \
ansys.speos.core.simulation.SimulationDirect, \
ansys.speos.core.simulation.SimulationInteractive, \
ansys.speos.core.simulation.SimulationInverse, ansys.speos.core.part.Part, \
ansys.speos.core.body.Body, \
ansys.speos.core.face.Face, ansys.speos.core.part.Part.SubPart]]
Found features.
Expand Down Expand Up @@ -635,6 +652,11 @@ def _to_dict(self) -> dict:
name=inside_dict["name"],
feature_type=SimulationInteractive,
)
if len(sim_feat) == 0:
sim_feat = self.find(
name=inside_dict["name"],
feature_type=SimulationVirtualBSDF,
)
sim_feat = sim_feat[0]
if sim_feat.job_link is None:
inside_dict["simulation_properties"] = (
Expand Down Expand Up @@ -878,6 +900,13 @@ def _fill_features(self):
simulation_instance=sim_inst,
default_values=False,
)
elif simulation_template_link.HasField("virtual_bsdf_bench_simulation_template"):
sim_feat = SimulationVirtualBSDF(
project=self,
name=sim_inst.name,
simulation_instance=sim_inst,
default_values=False,
)
if sim_feat is not None:
self._features.append(sim_feat)

Expand Down
Loading
Loading