Skip to content

Commit

Permalink
Refactor basic geometry builders and add new domain setup (#112)
Browse files Browse the repository at this point in the history
* Test domain setup

* Refactor MakeTrench with new domain setup

* Setup python bindings for new setup

* Domain setup Python bindings

* Refactor MakeHole

* Add geometry base builder

* Refactor MakePlane

* Refactor MakeFin

* Refactor GeometryBase

* More geometry builder refactoring

* Domain setup check

* Add Python wrappers

* Rename GeometryBase to GeometryFactory!

* Seperate GeometryFactory from builders

* Update stub files

* Minor fixes

* Format application

* clang format is strange

* Adjust examples with new geometry builders
  • Loading branch information
tobre1 authored Feb 24, 2025
1 parent 7702af0 commit 0a5d1d8
Show file tree
Hide file tree
Showing 52 changed files with 2,177 additions and 1,215 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CPMAddPackage(
NAME ViennaCore
VERSION 1.2.0
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore"
OPTIONS "VIENNACORE_FORMAT_EXCLUDE docs/"
OPTIONS "VIENNACORE_FORMAT_EXCLUDE app/"
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON})

CPMAddPackage(
Expand All @@ -114,7 +114,7 @@ CPMFindPackage(

CPMFindPackage(
NAME ViennaLS
VERSION 4.2.0
VERSION 4.2.1
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaLS"
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON})

Expand Down
9 changes: 4 additions & 5 deletions app/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ template <int D> class Application {
break;

case GeometryType::PLANE:
std::cout << "Plane"
<< "\n\tzPos: " << params->maskZPos << "\n\n";
std::cout << "Plane" << "\n\tzPos: " << params->maskZPos << "\n\n";
if (!geometry->getLevelSets().empty()) {
std::cout << "\tAdding plane to current geometry...\n\n";
MakePlane<NumericType, D>(geometry, params->maskZPos, params->material)
Expand Down Expand Up @@ -341,8 +340,8 @@ template <int D> class Application {
<< "\n\tzPos: " << params->maskZPos
<< "\n\tinvert: " << boolString(params->maskInvert)
<< "\n\txPadding: " << params->xPadding
<< "\n\tyPadding: " << params->yPadding << "\n\tPoint order: "
<< "\n\n";
<< "\n\tyPadding: " << params->yPadding
<< "\n\tPoint order: " << "\n\n";

if constexpr (D == 3) {
typename viennals::Domain<NumericType, D>::BoundaryType boundaryCons[D];
Expand Down Expand Up @@ -604,7 +603,7 @@ template <int D> class Application {

static std::string materialString(const Material material) {
switch (material) {
case Material::None:
case Material::Undefined:
return "None";
case Material::Mask:
return "Mask";
Expand Down
4 changes: 2 additions & 2 deletions app/applicationParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ApplicationParser {
private:
void parseMaterial(const std::string materialString, Material &material) {
if (materialString == "Undefined") {
material = Material::None;
material = Material::Undefined;
} else if (materialString == "Si") {
material = Material::Si;
} else if (materialString == "SiO2") {
Expand Down Expand Up @@ -93,7 +93,7 @@ class ApplicationParser {
material = Material::GaN;
} else {
std::cout << "Unknown material: " << materialString << std::endl;
material = Material::None;
material = Material::Undefined;
}
}

Expand Down
18 changes: 7 additions & 11 deletions examples/TEOSTrenchDeposition/multiTEOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ int main(int argc, char **argv) {
return 1;
}

auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New();
ps::MakeTrench<NumericType, D>(
geometry, params.get("gridDelta") /* grid delta */,
params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/,
params.get("trenchWidth") /*trench width*/,
params.get("trenchHeight") /*trench height*/,
params.get("taperAngle") /* tapering angle */, 0 /*base height*/,
false /*periodic boundary*/, false /*create mask*/,
ps::Material::Si /*material*/)
auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New(
params.get("gridDelta"), params.get("xExtent"), params.get("yExtent"));
ps::MakeTrench<NumericType, D>(geometry,
params.get("trenchWidth") /*trench width*/,
params.get("trenchHeight") /*trench height*/,
params.get("taperAngle") /* tapering angle */)
.apply();

// copy top layer to capture deposition
Expand All @@ -48,10 +45,9 @@ int main(int argc, char **argv) {
process.setNumberOfRaysPerPoint(params.get("numRaysPerPoint"));
process.setProcessDuration(params.get("processTime"));

geometry->saveSurfaceMesh("MulitTEOS_initial.vtp");
geometry->saveVolumeMesh("MulitTEOS_initial");

process.apply();

geometry->saveSurfaceMesh("MulitTEOS_final.vtp");
geometry->saveVolumeMesh("MulitTEOS_final");
}
20 changes: 7 additions & 13 deletions examples/TEOSTrenchDeposition/multiTEOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@

params = vps.ReadConfigFile(args.filename)

geometry = vps.Domain()
vps.MakeTrench(
domain=geometry,
geometry = vps.Domain(
gridDelta=params["gridDelta"],
xExtent=params["xExtent"],
yExtent=params["yExtent"],
)
vps.MakeTrench(
domain=geometry,
trenchWidth=params["trenchWidth"],
trenchDepth=params["trenchHeight"],
taperingAngle=params["taperAngle"],
baseHeight=0.0,
periodicBoundary=False,
makeMask=False,
material=vps.Material.Si,
trenchTaperAngle=params["taperAngle"],
).apply()

# copy top layer to capture deposition
Expand All @@ -53,11 +50,8 @@
process.setNumberOfRaysPerPoint(int(params["numRaysPerPoint"]))
process.setProcessDuration(params["processTime"])

geometry.saveSurfaceMesh("MultiTEOS_initial.vtp")
geometry.saveVolumeMesh("MultiTEOS_initial.vtp")

process.apply()

geometry.saveSurfaceMesh("MultiTEOS_final.vtp")

if args.dim == 2:
geometry.saveVolumeMesh("MultiTEOS_final")
geometry.saveVolumeMesh("MultiTEOS_final.vtp")
22 changes: 8 additions & 14 deletions examples/TEOSTrenchDeposition/singleTEOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ int main(int argc, char **argv) {
return 1;
}

auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New();
ps::MakeTrench<NumericType, D>(
geometry, params.get("gridDelta") /* grid delta */,
params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/,
params.get("trenchWidth") /*trench width*/,
params.get("trenchHeight") /*trench height*/,
params.get("taperAngle") /* tapering angle */, 0 /*base height*/,
false /*periodic boundary*/, false /*create mask*/,
ps::Material::Si /*material*/)
auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New(
params.get("gridDelta"), params.get("xExtent"), params.get("yExtent"));
ps::MakeTrench<NumericType, D>(geometry,
params.get("trenchWidth") /*trench width*/,
params.get("trenchHeight") /*trench height*/,
params.get("taperAngle") /* tapering angle */)
.apply();

// copy top layer to capture deposition
Expand All @@ -46,12 +43,9 @@ int main(int argc, char **argv) {
process.setNumberOfRaysPerPoint(params.get("numRaysPerPoint"));
process.setProcessDuration(params.get("processTime"));

geometry->saveSurfaceMesh("SingleTEOS_initial.vtp");
geometry->saveVolumeMesh("SingleTEOS_initial");

process.apply();

geometry->saveSurfaceMesh("SingleTEOS_final.vtp");

if constexpr (D == 2)
geometry->saveVolumeMesh("SingleTEOS_final");
geometry->saveVolumeMesh("SingleTEOS_final");
}
21 changes: 8 additions & 13 deletions examples/TEOSTrenchDeposition/singleTEOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,19 @@

params = vps.ReadConfigFile(args.filename)

geometry = vps.Domain()
vps.MakeTrench(
domain=geometry,
geometry = vps.Domain(
gridDelta=params["gridDelta"],
xExtent=params["xExtent"],
yExtent=params["yExtent"],
)
vps.MakeTrench(
domain=geometry,
trenchWidth=params["trenchWidth"],
trenchDepth=params["trenchHeight"],
taperingAngle=params["taperAngle"],
baseHeight=0.0,
periodicBoundary=False,
makeMask=False,
material=vps.Material.Si,
trenchTaperAngle=params["taperAngle"],
).apply()


# copy top layer to capture deposition
geometry.duplicateTopLevelSet(vps.Material.SiO2)

Expand All @@ -50,11 +48,8 @@
process.setNumberOfRaysPerPoint(int(params["numRaysPerPoint"]))
process.setProcessDuration(params["processTime"])

geometry.saveSurfaceMesh("SingleTEOS_initial.vtp")
geometry.saveVolumeMesh("SingleTEOS_initial.vtp")

process.apply()

geometry.saveSurfaceMesh("SingleTEOS_final.vtp")

if args.dim == 2:
geometry.saveVolumeMesh("SingleTEOS_final")
geometry.saveVolumeMesh("SingleTEOS_final.vtp")
15 changes: 9 additions & 6 deletions examples/boschProcess/boschProcessEmulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ using NumericType = double;

void etch(SmartPointer<Domain<NumericType, D>> domain,
utils::Parameters &params) {
std::cout << " - Etching - " << std::endl;
typename DirectionalEtching<NumericType, D>::RateSet rateSet;
rateSet.direction = {0.};
rateSet.direction[D - 1] = -1.;
Expand All @@ -27,6 +28,7 @@ void etch(SmartPointer<Domain<NumericType, D>> domain,

void punchThrough(SmartPointer<Domain<NumericType, D>> domain,
utils::Parameters &params) {
std::cout << " - Punching through - " << std::endl;
typename DirectionalEtching<NumericType, D>::RateSet rateSet;
rateSet.direction = {0.};
rateSet.direction[D - 1] = -1.;
Expand All @@ -44,6 +46,7 @@ void punchThrough(SmartPointer<Domain<NumericType, D>> domain,

void deposit(SmartPointer<Domain<NumericType, D>> domain,
NumericType depositionThickness) {
std::cout << " - Deposition - " << std::endl;
domain->duplicateTopLevelSet(Material::Polymer);
auto model = SmartPointer<SphereDistribution<NumericType, D>>::New(
depositionThickness, domain->getGridDelta());
Expand Down Expand Up @@ -77,12 +80,11 @@ int main(int argc, char **argv) {
}

// geometry setup
auto geometry = SmartPointer<Domain<NumericType, D>>::New();
MakeTrench<NumericType, D>(
geometry, params.get("gridDelta"), params.get("xExtent"),
params.get("yExtent"), params.get("trenchWidth"),
params.get("maskHeight"), 0. /* taper angle */, 0. /* base height */,
false /* periodic boundary */, true /* create mask */, Material::Si)
auto geometry = SmartPointer<Domain<NumericType, D>>::New(
params.get("gridDelta"), params.get("xExtent"), params.get("yExtent"));
MakeTrench<NumericType, D>(geometry, params.get("trenchWidth"),
0.0 /* trenchDepth */, 0.0 /* trenchTaperAngle */,
params.get("maskHeight"))
.apply();

const NumericType depositionThickness = params.get("depositionThickness");
Expand All @@ -95,6 +97,7 @@ int main(int argc, char **argv) {
geometry->saveSurfaceMesh(name + std::to_string(n++) + ".vtp");

for (int i = 0; i < numCycles; ++i) {
std::cout << "Cycle " << i + 1 << std::endl;
deposit(geometry, depositionThickness);
geometry->saveSurfaceMesh(name + std::to_string(n++) + ".vtp");
punchThrough(geometry, params);
Expand Down
18 changes: 7 additions & 11 deletions examples/boschProcess/boschProcessEmulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,20 @@
print("Running 3D simulation.")
import viennaps3d as vps


params = vps.ReadConfigFile(args.filename)
vps.Logger.setLogLevel(vps.LogLevel.ERROR)
params = vps.ReadConfigFile(args.filename)
vps.setNumThreads(16)

geometry = vps.Domain()
vps.MakeTrench(
domain=geometry,
geometry = vps.Domain(
gridDelta=params["gridDelta"],
xExtent=params["xExtent"],
yExtent=params["yExtent"],
)
vps.MakeTrench(
domain=geometry,
trenchWidth=params["trenchWidth"],
trenchDepth=params["maskHeight"],
taperingAngle=0.0,
baseHeight=0.0,
periodicBoundary=False,
makeMask=True,
material=vps.Material.Si,
trenchDepth=0.0,
maskHeight=params["maskHeight"],
).apply()


Expand Down
15 changes: 7 additions & 8 deletions examples/boschProcess/boschProcessRayTracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@
hole_shape_str = params.get("holeShape", "Full").strip()

# geometry setup, all units in um
geometry = vps.Domain()
vps.MakeHole(
domain=geometry,
geometry = vps.Domain(
gridDelta=params["gridDelta"],
xExtent=params["xExtent"],
yExtent=params["yExtent"],
)
vps.MakeHole(
domain=geometry,
holeRadius=params["holeRadius"],
holeDepth=params["maskHeight"],
taperingAngle=params["taperAngle"],
holeDepth=0.0,
maskHeight=params["maskHeight"],
maskTaperAngle=params["taperAngle"],
holeShape=shape_map[hole_shape_str],
periodicBoundary=False,
makeMask=True,
material=vps.Material.Si,
).apply()

depoModel = vps.MultiParticleProcess()
Expand Down
11 changes: 5 additions & 6 deletions examples/boschProcess/boschProcessSimulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ int main(int argc, char **argv) {
}

// geometry setup
auto geometry = SmartPointer<Domain<NumericType, D>>::New();
MakeTrench<NumericType, D>(
geometry, params.get("gridDelta"), params.get("xExtent"),
params.get("yExtent"), params.get("trenchWidth"),
params.get("maskHeight"), 0. /* taper angle */, 0. /* base height */,
false /* periodic boundary */, true /* create mask */, Material::Si)
auto geometry = SmartPointer<Domain<NumericType, D>>::New(
params.get("gridDelta"), params.get("xExtent"), params.get("yExtent"));
MakeTrench<NumericType, D>(geometry, params.get("trenchWidth"),
0.0 /* trenchDepth */, 0.0 /* trenchTaperAngle */,
params.get("maskHeight"))
.apply();

const NumericType depositionThickness = params.get("depositionThickness");
Expand Down
19 changes: 8 additions & 11 deletions examples/boschProcess/boschProcessSimulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@
print("Running 3D simulation.")
import viennaps3d as vps

params = vps.ReadConfigFile(args.filename)
vps.Logger.setLogLevel(vps.LogLevel.ERROR)
params = vps.ReadConfigFile(args.filename)
vps.setNumThreads(16)

geometry = vps.Domain()
vps.MakeTrench(
domain=geometry,
geometry = vps.Domain(
gridDelta=params["gridDelta"],
xExtent=params["xExtent"],
yExtent=params["yExtent"],
)
vps.MakeTrench(
domain=geometry,
trenchWidth=params["trenchWidth"],
trenchDepth=params["maskHeight"],
taperingAngle=0.0,
baseHeight=0.0,
periodicBoundary=False,
makeMask=True,
material=vps.Material.Si,
trenchDepth=0.0,
maskHeight=params["maskHeight"],
).apply()

# Isoptropic deposition model
# Isotropic deposition model
depoModel = vps.SingleParticleProcess(
rate=params["depositionThickness"],
stickingProbability=params["depositionStickingProbability"],
Expand Down
Loading

0 comments on commit 0a5d1d8

Please sign in to comment.