-
Notifications
You must be signed in to change notification settings - Fork 0
/
GeometricBosch.cpp
93 lines (74 loc) · 2.82 KB
/
GeometricBosch.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <iostream>
#include <lsBooleanOperation.hpp>
#include <lsExpand.hpp>
#include <lsGeometricAdvect.hpp>
#include <lsMakeGeometry.hpp>
#include <lsToDiskMesh.hpp>
#include <lsToMesh.hpp>
#include <lsToSurfaceMesh.hpp>
#include <lsVTKWriter.hpp>
#include <lsWriteVisualizationMesh.hpp>
#include "BoschProcess.hpp"
#include "MakeMask.hpp"
int main() {
omp_set_num_threads(16);
constexpr int D = 2;
typedef double NumericType;
double gridDelta = 0.25;
double extent = 12;
double bounds[2 * D] = {-extent, extent, -extent, extent};
if (D == 3) {
bounds[4] = -extent;
bounds[5] = extent;
}
typename lsDomain<NumericType, D>::BoundaryType boundaryCons[D];
for (unsigned i = 0; i < D - 1; ++i) {
boundaryCons[i] =
lsDomain<NumericType, D>::BoundaryType::REFLECTIVE_BOUNDARY;
}
boundaryCons[D - 1] =
lsDomain<NumericType, D>::BoundaryType::INFINITE_BOUNDARY;
auto mask = lsSmartPointer<lsDomain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);
auto levelSet = lsSmartPointer<lsDomain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);
std::array<NumericType, 3> maskOrigin = {};
NumericType maskRadius = extent / 4.0;
MakeMask<NumericType, D> maskCreator(levelSet, mask);
maskCreator.setMaskOrigin(maskOrigin);
maskCreator.setMaskRadius(maskRadius);
maskCreator.apply();
std::cout << "Output initial" << std::endl;
auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();
// lsToMesh<NumericType, D>(levelSet, mesh).apply();
// lsVTKWriter(mesh, "Surface_i_p.vtp").apply();
lsToSurfaceMesh<NumericType, D>(levelSet, mesh).apply();
lsVTKWriter(mesh, "Surface_i.vtp").apply();
// lsToMesh<NumericType, D>(mask, mesh).apply();
// lsVTKWriter(mesh, "Surface_m_p.vtp").apply();
lsToSurfaceMesh<NumericType, D>(mask, mesh).apply();
lsVTKWriter(mesh, "Surface_m.vtp").apply();
NumericType bottomFraction = 0.2;
NumericType etchRate = -2.0;
BoschProcess<NumericType, D> processKernel(levelSet, mask);
processKernel.setNumCycles(200);
processKernel.setIsotropicRate(etchRate);
processKernel.setStartWidth(2 * maskRadius);
processKernel.setBottomWidth(2 * maskRadius * bottomFraction);
processKernel.setStartOfTapering(-190);
processKernel.setTopOffset(etchRate / 3);
processKernel.apply();
// levelSet->print();
lsToSurfaceMesh<NumericType, D>(levelSet, mesh).apply();
lsVTKWriter(mesh, "surface.vtp").apply();
// lsToMesh<NumericType, D>(levelSet, mesh).apply();
// lsVTKWriter(mesh, "points-1.vtp").apply();
std::cout << "Making volume output..." << std::endl;
auto volumeMeshing =
lsSmartPointer<lsWriteVisualizationMesh<NumericType, D>>::New();
volumeMeshing->insertNextLevelSet(mask);
volumeMeshing->insertNextLevelSet(levelSet);
volumeMeshing->setFileName("bosch");
volumeMeshing->apply();
return 0;
}