Skip to content

Commit 57adce5

Browse files
committed
fix: concepts fallback forward declaration
1 parent 49533f2 commit 57adce5

File tree

7 files changed

+808
-858
lines changed

7 files changed

+808
-858
lines changed

include/viennaps/process/psProcess.hpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,20 @@ VIENNAPS_TEMPLATE_ND(NumericType, D) class Process {
6262
context_.processDuration = duration;
6363
}
6464

65-
template <ProcessParamConcept ParamType>
66-
void setParameters(const ParamType &params) {
67-
if constexpr (std::is_same_v<ParamType, RayTracingParameters>) {
68-
context_.rayTracingParams = params;
69-
} else if constexpr (std::is_same_v<ParamType, AdvectionParameters>) {
70-
context_.advectionParams = params;
71-
} else if constexpr (std::is_same_v<ParamType, CoverageParameters>) {
72-
context_.coverageParams = params;
73-
} else if constexpr (std::is_same_v<ParamType,
74-
AtomicLayerProcessParameters>) {
75-
context_.atomicLayerParams = params;
76-
}
65+
void setParameters(const RayTracingParameters &p) {
66+
context_.rayTracingParams = p;
67+
}
68+
69+
void setParameters(const AdvectionParameters &p) {
70+
context_.advectionParams = p;
71+
}
72+
73+
void setParameters(const CoverageParameters &p) {
74+
context_.coverageParams = p;
75+
}
76+
77+
void setParameters(const AtomicLayerProcessParameters &p) {
78+
context_.atomicLayerParams = p;
7779
}
7880

7981
void setFluxEngineType(FluxEngineType type) { fluxEngineType_ = type; }

include/viennaps/process/psProcessParams.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ struct AtomicLayerProcessParameters {
128128
auto toMetaDataString() const { return util::metaDataToString(toMetaData()); }
129129
};
130130

131-
template <class ParamType>
132-
concept ProcessParamConcept =
133-
std::is_same_v<ParamType, RayTracingParameters> ||
134-
std::is_same_v<ParamType, AdvectionParameters> ||
135-
std::is_same_v<ParamType, CoverageParameters> ||
136-
std::is_same_v<ParamType, AtomicLayerProcessParameters>;
137-
138131
template <typename NumericType> class ProcessParams {
139132
private:
140133
std::vector<NumericType> scalarData;

include/viennaps/psPreCompileMacros.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ concept Dimension = (D == 2 || D == 3);
4848
template <Numeric NTypeName, int DName> \
4949
requires Dimension<DName>
5050

51+
#define VIENNAPS_TEMPLATE_ND_FWD(NTypeName, DName) \
52+
template <Numeric NTypeName, int DName> \
53+
requires Dimension<DName>
54+
5155
#else
5256

5357
// Fallback path (no concepts)
@@ -57,9 +61,16 @@ inline constexpr bool Numeric_v =
5761

5862
template <int D> inline constexpr bool Dimension_v = (D == 2 || D == 3);
5963

64+
// No default argument here -> avoids "redefinition of default argument"
6065
#define VIENNAPS_TEMPLATE_ND(NTypeName, DName) \
66+
template <typename NTypeName, int DName, \
67+
std::enable_if_t<Numeric_v<NTypeName> && Dimension_v<DName>, int> \
68+
SFINAE>
69+
70+
// Forward-decl helper that supplies a concrete SFINAE argument
71+
#define VIENNAPS_TEMPLATE_ND_FWD(NTypeName, DName) \
6172
template < \
6273
typename NTypeName, int DName, \
6374
std::enable_if_t<Numeric_v<NTypeName> && Dimension_v<DName>, int> = 0>
6475

65-
#endif
76+
#endif

include/viennaps/psVTKRenderWindow.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace viennaps {
4949
enum class RenderMode { SURFACE, INTERFACE, VOLUME };
5050

5151
// forward declaration of Domain
52-
VIENNAPS_TEMPLATE_ND(NumericType, D) class Domain;
52+
VIENNAPS_TEMPLATE_ND_FWD(NumericType, D) class Domain;
5353

5454
/// Lightweight VTK-based viewer for one or more ViennaPS domains.
5555
///

python/pyWrapDimension.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,23 +1286,23 @@ template <int D> void bindApi(py::module &module) {
12861286
py::arg("path"),
12871287
"Set the path for intermediate output files during the process.")
12881288
.def("setParameters",
1289-
(void(ProcessTD::*)(const AdvectionParameters &)) &
1290-
ProcessTD::template setParameters<AdvectionParameters>,
1289+
py::overload_cast<const AdvectionParameters &>(
1290+
&ProcessTD::setParameters),
12911291
py::arg("parameters"),
12921292
"Set the advection parameters for the process.")
12931293
.def("setParameters",
1294-
(void(ProcessTD::*)(const RayTracingParameters &)) &
1295-
ProcessTD::template setParameters<RayTracingParameters>,
1294+
py::overload_cast<const RayTracingParameters &>(
1295+
&ProcessTD::setParameters),
12961296
py::arg("parameters"),
12971297
"Set the ray tracing parameters for the process.")
12981298
.def("setParameters",
1299-
(void(ProcessTD::*)(const CoverageParameters &)) &
1300-
ProcessTD::template setParameters<CoverageParameters>,
1299+
py::overload_cast<const CoverageParameters &>(
1300+
&ProcessTD::setParameters),
13011301
py::arg("parameters"),
13021302
"Set the coverage parameters for the process.")
13031303
.def("setParameters",
1304-
(void(ProcessTD::*)(const AtomicLayerProcessParameters &)) &
1305-
ProcessTD::template setParameters<AtomicLayerProcessParameters>,
1304+
py::overload_cast<const AtomicLayerProcessParameters &>(
1305+
&ProcessTD::setParameters),
13061306
py::arg("parameters"),
13071307
"Set the atomic layer parameters for the process.");
13081308

python/viennaps/__init__.pyi

Lines changed: 16 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ which includes surface and volume representations,
88
a ray tracer, and physical models for the simulation of
99
microelectronic fabrication processes.
1010
"""
11-
1211
from __future__ import annotations
1312
import sys as _sys
1413
import viennals as ls
@@ -108,142 +107,41 @@ from viennaps.d2 import Writer
108107
from . import _core
109108
from . import d2
110109
from . import d3
111-
112-
__all__: list[str] = [
113-
"AdvectionCallback",
114-
"AdvectionParameters",
115-
"AtomicLayerProcessParameters",
116-
"BoundaryType",
117-
"BoxDistribution",
118-
"CF4O2Etching",
119-
"CF4O2Parameters",
120-
"CF4O2ParametersIons",
121-
"CF4O2ParametersMask",
122-
"CF4O2ParametersPassivation",
123-
"CF4O2ParametersSi",
124-
"CF4O2ParametersSiGe",
125-
"CSVFileProcess",
126-
"CoverageParameters",
127-
"DenseCellSet",
128-
"DirectionalProcess",
129-
"Domain",
130-
"DomainSetup",
131-
"Extrude",
132-
"FaradayCageEtching",
133-
"FaradayCageParameters",
134-
"FluorocarbonEtching",
135-
"FluorocarbonMaterialParameters",
136-
"FluorocarbonParameters",
137-
"FluorocarbonParametersIons",
138-
"FluxEngineType",
139-
"GDSGeometry",
140-
"GDSReader",
141-
"GeometricTrenchDeposition",
142-
"GeometryFactory",
143-
"HBrO2Etching",
144-
"HoleShape",
145-
"IBEParameters",
146-
"IBEParametersCos4Yield",
147-
"Interpolation",
148-
"IonBeamEtching",
149-
"IsotropicProcess",
150-
"Length",
151-
"LengthUnit",
152-
"LogLevel",
153-
"Logger",
154-
"MakeFin",
155-
"MakeHole",
156-
"MakePlane",
157-
"MakeStack",
158-
"MakeTrench",
159-
"Material",
160-
"MaterialCategory",
161-
"MaterialInfo",
162-
"MaterialMap",
163-
"MetaDataLevel",
164-
"MultiParticleProcess",
165-
"NormalizationType",
166-
"OxideRegrowth",
167-
"PROXY_DIM",
168-
"Planarize",
169-
"PlasmaEtchingParameters",
170-
"PlasmaEtchingParametersIons",
171-
"PlasmaEtchingParametersMask",
172-
"PlasmaEtchingParametersPassivation",
173-
"PlasmaEtchingParametersPolymer",
174-
"PlasmaEtchingParametersSubstrate",
175-
"Process",
176-
"ProcessModel",
177-
"ProcessModelBase",
178-
"ProcessParams",
179-
"RateGrid",
180-
"RateSet",
181-
"RayTracingParameters",
182-
"Reader",
183-
"RenderMode",
184-
"SF6C4F8Etching",
185-
"SF6O2Etching",
186-
"SelectiveEpitaxy",
187-
"SingleParticleALD",
188-
"SingleParticleProcess",
189-
"Slice",
190-
"SpatialScheme",
191-
"SphereDistribution",
192-
"StencilLocalLaxFriedrichsScalar",
193-
"TEOSDeposition",
194-
"TEOSPECVD",
195-
"TemporalScheme",
196-
"Time",
197-
"TimeUnit",
198-
"ToDiskMesh",
199-
"VTKRenderWindow",
200-
"WetEtching",
201-
"Writer",
202-
"constants",
203-
"d2",
204-
"d3",
205-
"gpu",
206-
"gpuAvailable",
207-
"ls",
208-
"readConfigFile",
209-
"setDimension",
210-
"setNumThreads",
211-
"util",
212-
"version",
213-
]
214-
215-
def __dir__(): ...
216-
def __getattr__(name): ...
217-
def _module_ptx_path(): ...
218-
def _windows_dll_path(): ...
110+
__all__: list[str] = ['AdvectionCallback', 'AdvectionParameters', 'AtomicLayerProcessParameters', 'BoundaryType', 'BoxDistribution', 'CF4O2Etching', 'CF4O2Parameters', 'CF4O2ParametersIons', 'CF4O2ParametersMask', 'CF4O2ParametersPassivation', 'CF4O2ParametersSi', 'CF4O2ParametersSiGe', 'CSVFileProcess', 'CoverageParameters', 'DenseCellSet', 'DirectionalProcess', 'Domain', 'DomainSetup', 'Extrude', 'FaradayCageEtching', 'FaradayCageParameters', 'FluorocarbonEtching', 'FluorocarbonMaterialParameters', 'FluorocarbonParameters', 'FluorocarbonParametersIons', 'FluxEngineType', 'GDSGeometry', 'GDSReader', 'GeometricTrenchDeposition', 'GeometryFactory', 'HBrO2Etching', 'HoleShape', 'IBEParameters', 'IBEParametersCos4Yield', 'Interpolation', 'IonBeamEtching', 'IsotropicProcess', 'Length', 'LengthUnit', 'LogLevel', 'Logger', 'MakeFin', 'MakeHole', 'MakePlane', 'MakeStack', 'MakeTrench', 'Material', 'MaterialCategory', 'MaterialInfo', 'MaterialMap', 'MetaDataLevel', 'MultiParticleProcess', 'NormalizationType', 'OxideRegrowth', 'PROXY_DIM', 'Planarize', 'PlasmaEtchingParameters', 'PlasmaEtchingParametersIons', 'PlasmaEtchingParametersMask', 'PlasmaEtchingParametersPassivation', 'PlasmaEtchingParametersPolymer', 'PlasmaEtchingParametersSubstrate', 'Process', 'ProcessModel', 'ProcessModelBase', 'ProcessParams', 'RateGrid', 'RateSet', 'RayTracingParameters', 'Reader', 'RenderMode', 'SF6C4F8Etching', 'SF6O2Etching', 'SelectiveEpitaxy', 'SingleParticleALD', 'SingleParticleProcess', 'Slice', 'SpatialScheme', 'SphereDistribution', 'StencilLocalLaxFriedrichsScalar', 'TEOSDeposition', 'TEOSPECVD', 'TemporalScheme', 'Time', 'TimeUnit', 'ToDiskMesh', 'VTKRenderWindow', 'WetEtching', 'Writer', 'constants', 'd2', 'd3', 'gpu', 'gpuAvailable', 'ls', 'readConfigFile', 'setDimension', 'setNumThreads', 'util', 'version']
111+
def __dir__():
112+
...
113+
def __getattr__(name):
114+
...
115+
def _module_ptx_path():
116+
...
117+
def _windows_dll_path():
118+
...
219119
def readConfigFile(fileName: str):
220120
"""
221121
Read a config file in the ViennaPS standard config file format.
222-
122+
223123
Parameters
224124
----------
225125
fileName: str
226126
Name of the config file.
227-
127+
228128
Returns
229129
-------
230130
dict
231131
A dictionary containing the parameters from the config file.
232-
132+
233133
"""
234-
235134
def setDimension(d: int):
236135
"""
237136
Set the dimension of the simulation (2 or 3).
238-
137+
239138
Parameters
240139
----------
241140
d: int
242141
Dimension of the simulation (2 or 3).
243-
142+
244143
"""
245-
246144
PROXY_DIM: int = 2
247-
__version__: str = "4.2.2"
248-
version: str = "4.2.2"
145+
__version__: str = '4.2.2'
146+
version: str = '4.2.2'
249147
_C = _core

0 commit comments

Comments
 (0)