-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEM2D.cpp
109 lines (89 loc) · 3.47 KB
/
DEM2D.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <chrono>
#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(1);
constexpr int D = 2;
typedef double NumericType;
double gridDelta = 0.05; // 0.125;
double extent = 4;
double bounds[2 * D] = {-extent, extent, -extent, extent};
if constexpr (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 = 0.6;
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.3;
NumericType etchRate = -0.98;
BoschProcess<NumericType, D> processKernel(levelSet, mask);
processKernel.setNumCycles(50);
processKernel.setIsotropicRate(etchRate * 0.6);
processKernel.setCycleEtchDepth(etchRate);
processKernel.setStartWidth(2 * maskRadius);
processKernel.setBottomWidth(2 * maskRadius * bottomFraction);
processKernel.setStartOfTapering(0);
processKernel.setSidewallTapering(false);
processKernel.setTapering(false);
processKernel.setLateralEtchRatio(0.75);
auto start = std::chrono::high_resolution_clock::now();
processKernel.apply();
auto stop = std::chrono::high_resolution_clock::now();
std::cout << "Geometric advect took: "
<< std::chrono::duration_cast<std::chrono::milliseconds>(stop -
start)
.count()
<< " ms" << std::endl;
std::cout << "Final structure has " << levelSet->getNumberOfPoints()
<< " LS points" << std::endl;
// 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();
// TODO REMOVE
// return 0;
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;
}