Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 29 additions & 1 deletion examples/core/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
from pathlib import Path

from ansys.speos.core import Project, Speos, launcher
from ansys.speos.core.simulation import SimulationInteractive, SimulationInverse
from ansys.speos.core.simulation import (
SimulationInteractive,
SimulationInverse,
SimulationVirtualBSDF,
)

# -

Expand Down Expand Up @@ -183,4 +187,28 @@
simulation4.set_source_paths(source_paths=[SOURCE_NAME]).commit()
print(simulation4)

# ### Virtual BSDF Bench simulation

vbb = p.create_simulation(name="virtual_BSDF", feature_type=SimulationVirtualBSDF)
opt_prop.set_surface_library(
path=str(assets_data_path / "R_test.anisotropicbsdf")
).commit() # change the material property from mirror to bsdf type
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()
20 changes: 20 additions & 0 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 @@ -296,6 +297,13 @@ 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,
Expand Down Expand Up @@ -635,6 +643,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 +891,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