Skip to content

Commit 0e10096

Browse files
committed
perf(geo model): only adjust bottom layers if etching
1 parent a83140f commit 0e10096

3 files changed

Lines changed: 33 additions & 11 deletions

File tree

include/viennaps/models/psGeometricDistributionModels.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class SphereDistribution : public ProcessModelCPU<NumericType, D> {
2020

2121
auto geomModel =
2222
SmartPointer<GeometricModel<NumericType, D>>::New(dist, mask);
23+
geomModel->setDeposition(radius > 0);
2324

2425
this->setGeometricModel(geomModel);
2526
this->setProcessName("SphereDistribution");
@@ -45,6 +46,13 @@ class BoxDistribution : public ProcessModelCPU<NumericType, D> {
4546

4647
auto geomModel =
4748
SmartPointer<GeometricModel<NumericType, D>>::New(dist, mask);
49+
geomModel->setDeposition(true);
50+
for (const auto &halfAxis : halfAxes) {
51+
if (halfAxis < 0) {
52+
geomModel->setDeposition(false);
53+
break;
54+
}
55+
}
4856

4957
this->setGeometricModel(geomModel);
5058
this->setProcessName("BoxDistribution");
@@ -73,6 +81,13 @@ class CustomSphereDistribution : public ProcessModelCPU<NumericType, D> {
7381

7482
auto geomModel =
7583
SmartPointer<GeometricModel<NumericType, D>>::New(dist, mask);
84+
geomModel->setDeposition(true);
85+
for (const auto &radius : radii) {
86+
if (radius < 0) {
87+
geomModel->setDeposition(false);
88+
break;
89+
}
90+
}
7691

7792
this->setGeometricModel(geomModel);
7893
this->setProcessName("CustomSphereDistribution");

include/viennaps/process/psGeometricModel.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ VIENNAPS_TEMPLATE_ND(NumericType, D) class GeometricModel {
1515
nullptr;
1616
SmartPointer<viennals::Domain<NumericType, D>> mask = nullptr;
1717
std::vector<Material> maskMaterials;
18+
bool isDepo = false;
1819

1920
public:
2021
GeometricModel() = default;
@@ -46,6 +47,8 @@ VIENNAPS_TEMPLATE_ND(NumericType, D) class GeometricModel {
4647
auto &getDistribution() const { return dist; }
4748
auto &getMask() const { return mask; }
4849
auto &getMaskMaterials() const { return maskMaterials; }
50+
auto isDeposition() const { return isDepo; }
51+
void setDeposition(bool deposition) { isDepo = deposition; }
4952
};
5053

5154
} // namespace viennaps

include/viennaps/process/psGeometricProcessStrategy.hpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ namespace viennaps {
66

77
VIENNAPS_TEMPLATE_ND(NumericType, D)
88
class GeometricProcessStrategy : public ProcessStrategy<NumericType, D> {
9+
using GeometricKernel = viennals::GeometricAdvect<NumericType, D>;
10+
911
public:
1012
DEFINE_CLASS_NAME(GeometricProcessStrategy)
1113

@@ -94,17 +96,19 @@ class GeometricProcessStrategy : public ProcessStrategy<NumericType, D> {
9496
}
9597
}
9698

97-
viennals::GeometricAdvect<NumericType, D>(
98-
context.domain->getLevelSets().back(), dist, mask)
99-
.apply();
100-
101-
// Intersect all other level sets with the last one to keep them consistent
102-
for (int i = context.domain->getNumberOfLevelSets() - 1; i >= 0; --i) {
103-
viennals::BooleanOperation<NumericType, D>(
104-
context.domain->getLevelSets()[i],
105-
context.domain->getLevelSets().back(),
106-
viennals::BooleanOperationEnum::INTERSECT)
107-
.apply();
99+
GeometricKernel(context.domain->getSurface(), dist, mask).apply();
100+
101+
if (!geometricModel->isDeposition()) {
102+
// If the top level set was etched, we need to make sure that the
103+
// other level sets are still consistent by intersecting them with the
104+
// last level set.
105+
for (int i = context.domain->getNumberOfLevelSets() - 1; i >= 0; --i) {
106+
viennals::BooleanOperation<NumericType, D>(
107+
context.domain->getLevelSets()[i],
108+
context.domain->getLevelSets().back(),
109+
viennals::BooleanOperationEnum::INTERSECT)
110+
.apply();
111+
}
108112
}
109113

110114
return ProcessResult::SUCCESS;

0 commit comments

Comments
 (0)