Skip to content

Commit

Permalink
Added Disk Mesh Export (#10)
Browse files Browse the repository at this point in the history
* Changed lsVTKWriter/Reader to apply() standard.

* Added lsToDiskMesh.
  • Loading branch information
XaverKlemenschits authored Nov 15, 2019
1 parent e0c8bc5 commit e8c318e
Show file tree
Hide file tree
Showing 157 changed files with 2,066 additions and 818 deletions.
1 change: 0 additions & 1 deletion CMakeFiles/cmake.check_cache

This file was deleted.

6 changes: 3 additions & 3 deletions Examples/AirGapDeposition/AirGapDeposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main() {
std::cout << "Extracting..." << std::endl;
lsMesh mesh;
lsToSurfaceMesh<double, D>(substrate, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("plane.vtp");
lsVTKWriter(mesh, "plane.vtk").apply();
}

{
Expand All @@ -76,7 +76,7 @@ int main() {
std::cout << "Extracting..." << std::endl;
lsMesh mesh;
lsToMesh<double, D>(trench, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("box.vtp");
lsVTKWriter(mesh, "box.vtk").apply();
}

// Create trench geometry
Expand Down Expand Up @@ -119,7 +119,7 @@ int main() {
<< numberOfSteps << std::flush;
lsMesh mesh;
lsToSurfaceMesh<double, D>(newLayer, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("trench" + std::to_string(i) + ".vtk");
lsVTKWriter(mesh, "trench" + std::to_string(i) + ".vtk").apply();
}
std::cout << std::endl;
std::cout << "Time passed during advection: " << passedTime << std::endl;
Expand Down
9 changes: 4 additions & 5 deletions Examples/Deposition/Deposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int main() {
std::cout << "Extracting..." << std::endl;
lsMesh mesh;
lsToSurfaceMesh<double, D>(substrate, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("trench-0.vtp");
lsVTKWriter(mesh, "trench-0.vtk").apply();
}

// Now grow new material isotropically
Expand All @@ -103,11 +103,10 @@ int main() {

lsMesh mesh;
lsToSurfaceMesh<double, D>(newLayer, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("trench-" + std::to_string(counter) +
".vtp");
lsVTKWriter(mesh, "trench-" + std::to_string(counter) + ".vtk").apply();

lsToMesh<double, D>(newLayer, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("LS-" + std::to_string(counter) + ".vtp");
lsVTKWriter(mesh, "LS-" + std::to_string(counter) + ".vtk").apply();

++counter;
}
Expand All @@ -121,7 +120,7 @@ int main() {
// lsMesh mesh;
// lsToSurfaceMesh<double, D>(newLayer, mesh).apply();
//
// lsVTKWriter(mesh).writeVTKLegacy("grown.vtp");
// lsVTKWriter(mesh, "grown.vtk").apply();
// }

return 0;
Expand Down
32 changes: 21 additions & 11 deletions Examples/PatternedSubstrate/PatternedSubstrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <lsExpand.hpp>
#include <lsMakeGeometry.hpp>
#include <lsPrune.hpp>
#include <lsToDiskMesh.hpp>
#include <lsToMesh.hpp>
#include <lsToSurfaceMesh.hpp>
#include <lsToVoxelMesh.hpp>
Expand Down Expand Up @@ -196,8 +197,7 @@ int main() {
<< numberOfEtchSteps << std::flush;
lsMesh mesh;
lsToSurfaceMesh<double, D>(substrate, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("substrate-" + std::to_string(i) +
".vtp");
lsVTKWriter(mesh, "substrate-" + std::to_string(i) + ".vtk").apply();

advectionKernel.apply();
passedTime += advectionKernel.getAdvectionTime();
Expand All @@ -206,13 +206,20 @@ int main() {

lsMesh mesh;
lsToSurfaceMesh<double, D>(substrate, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy(
"substrate-" + std::to_string(numberOfEtchSteps) + ".vtp");
lsVTKWriter(mesh, "substrate-" + std::to_string(numberOfEtchSteps) + ".vtk")
.apply();

std::cout << "Time passed during directional etch: " << passedTime
<< std::endl;
}

// make disk mesh and output
{
lsMesh mesh;
lsToDiskMesh<double, 3>(substrate, mesh).apply();
lsVTKWriter(mesh, "diskMesh.vtk").apply();
}

// Deposit new layer ----------------------------------------------
// new level set for new layer
lsDomain<double, D> fillLayer(substrate);
Expand All @@ -232,8 +239,9 @@ int main() {
<< numberOfDepoSteps << std::flush;
lsMesh mesh;
lsToSurfaceMesh<double, D>(fillLayer, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy(
"fillLayer-" + std::to_string(numberOfEtchSteps + 1 + i) + ".vtp");
lsVTKWriter(mesh, "fillLayer-" +
std::to_string(numberOfEtchSteps + 1 + i) + ".vtk")
.apply();

advectionKernel.apply();
passedTime += advectionKernel.getAdvectionTime();
Expand All @@ -242,9 +250,11 @@ int main() {

lsMesh mesh;
lsToSurfaceMesh<double, D>(fillLayer, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy(
"fillLayer-" + std::to_string(numberOfEtchSteps + numberOfDepoSteps) +
".vtp");
lsVTKWriter(mesh,
"fillLayer-" +
std::to_string(numberOfEtchSteps + numberOfDepoSteps) +
".vtk")
.apply();

std::cout << "Time passed during isotropic deposition: " << passedTime
<< std::endl;
Expand All @@ -254,10 +264,10 @@ int main() {
{
lsMesh mesh;
lsToSurfaceMesh<double, D>(substrate, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("final-substrate.vtp");
lsVTKWriter(mesh, "final-substrate.vtk").apply();

lsToSurfaceMesh<double, D>(fillLayer, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("final-fillLayer.vtp");
lsVTKWriter(mesh, "final-fillLayer.vtk").apply();
}

return 0;
Expand Down
4 changes: 2 additions & 2 deletions Examples/PeriodicBoundary/PeriodicBoundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main() {
.apply();
lsMesh mesh;
lsToSurfaceMesh<double, D>(pillar, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("pillar.vtp");
lsVTKWriter(mesh, "pillar.vtk").apply();
lsBooleanOperation<double, D> boolOp(substrate, pillar,
lsBooleanOperationEnum::UNION);
boolOp.apply();
Expand All @@ -96,7 +96,7 @@ int main() {
<< numberOfSteps << std::flush;
lsMesh mesh;
lsToSurfaceMesh<double, D>(substrate, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("pillar-" + std::to_string(i) + ".vtp");
lsVTKWriter(mesh, "pillar-" + std::to_string(i) + ".vtk").apply();

advectionKernel.apply();
passedTime += advectionKernel.getAdvectionTime();
Expand Down
6 changes: 3 additions & 3 deletions Examples/SharedLib/SharedLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ int main() {
lsToSurfaceMesh_float_3(sphere1, mesh1).apply();
lsToSurfaceMesh_float_3(sphere2, mesh2).apply();

lsVTKWriter(mesh1).writeVTKLegacy("sphere1.vtk");
lsVTKWriter(mesh2).writeVTKLegacy("sphere2.vtk");
lsVTKWriter(mesh1, "sphere1.vtk").apply();
lsVTKWriter(mesh2, "sphere2.vtk").apply();
}

// Perform a boolean operation
Expand All @@ -66,7 +66,7 @@ int main() {

mesh.print();

lsVTKWriter(mesh).writeVTKLegacy("after.vtk");
lsVTKWriter(mesh, "after.vtk").apply();

return 0;
}
2 changes: 1 addition & 1 deletion Examples/VoidEtching/VoidEtching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int main() {
<< numberOfSteps << std::flush;
lsMesh mesh;
lsToSurfaceMesh<double, D>(substrate, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("void-" + std::to_string(i) + ".vtp");
lsVTKWriter(mesh, "void-" + std::to_string(i) + ".vtk").apply();

advectionKernel.apply();
passedTime += advectionKernel.getAdvectionTime();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Advection/Advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int main() {
std::cout << "Extracting..." << std::endl;
lsMesh mesh;
lsToSurfaceMesh<double, D>(sphere1, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("before.vtk");
lsVTKWriter(mesh, "before.vtk").apply();
}

// instantiate velocities
Expand Down Expand Up @@ -82,7 +82,7 @@ int main() {
lsMesh mesh;
lsToSurfaceMesh<double, D>(sphere1, mesh).apply();
mesh.print();
lsVTKWriter(mesh).writeVTKLegacy("after.vtk");
lsVTKWriter(mesh, "after.vtk").apply();
}

return 0;
Expand Down
6 changes: 3 additions & 3 deletions Tests/Advection2D/Advection2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ int main() {
{
lsMesh mesh;
lsToMesh<double, D>(sphere1, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("sphere.vtk");
lsVTKWriter(mesh, "sphere.vtk").apply();

lsToSurfaceMesh<double, D>(sphere1, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("before2D.vtk");
lsVTKWriter(mesh, "before2D.vtk").apply();
}

// Advect the sphere
Expand Down Expand Up @@ -96,7 +96,7 @@ int main() {
std::cout << "Extracting..." << std::endl;
lsToSurfaceMesh<double, D>(sphere1, mesh).apply();
mesh.print();
lsVTKWriter(mesh).writeVTKLegacy("after2D.vtk");
lsVTKWriter(mesh, "after2D.vtk").apply();
}

return 0;
Expand Down
6 changes: 3 additions & 3 deletions Tests/AdvectionPlane/AdvectionPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ int main() {
lsToMesh<double, D>(plane, mesh).apply();

mesh.print();
lsVTKWriter(explMesh).writeVTKLegacy("before.vtk");
lsVTKWriter(mesh).writeVTKLegacy("beforeLS.vtk");
lsVTKWriter(explMesh, "before.vtk").apply();
lsVTKWriter(mesh, "beforeLS.vtk").apply();
}

// fill vector with lsDomain pointers
Expand All @@ -90,7 +90,7 @@ int main() {

// mesh.print();

lsVTKWriter(mesh).writeVTKLegacy("after.vtk");
lsVTKWriter(mesh, "after.vtk").apply();

return 0;
}
6 changes: 3 additions & 3 deletions Tests/BooleanOperation/BooleanOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ int main() {
lsToSurfaceMesh<double, D>(sphere1, mesh1).apply();
lsToSurfaceMesh<double, D>(sphere2, mesh2).apply();

lsVTKWriter(mesh1).writeVTKLegacy("sphere1.vtk");
lsVTKWriter(mesh2).writeVTKLegacy("sphere2.vtk");
lsVTKWriter(mesh1, "sphere1.vtk").apply();
lsVTKWriter(mesh2, "sphere2.vtk").apply();
}

// Perform a boolean operation
Expand All @@ -56,7 +56,7 @@ int main() {

mesh.print();

lsVTKWriter(mesh).writeVTKLegacy("after.vtk");
lsVTKWriter(mesh, "after.vtk").apply();

return 0;
}
2 changes: 1 addition & 1 deletion Tests/BoundaryConditions/BoundaryConditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main() {
std::cout << "Extracting..." << std::endl;
lsMesh mesh;
lsToSurfaceMesh<double, D>(levelSet, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("plane.vtk");
lsVTKWriter(mesh, "plane.vtk").apply();
}

return 0;
Expand Down
10 changes: 6 additions & 4 deletions Tests/CalculateNormalVectors/CalculateNormalVectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ int main() {

// normal vectors are only valid as long as the underlying
// level set does not change
lsCalculateNormalVectors<double, 3>(sphere1).apply();
lsCalculateNormalVectors<double, 3>(sphere1, true).apply();
auto &normalVectors = sphere1.getNormalVectors();

std::cout << "Number of Normal vectors: " << normalVectors.size()
<< std::endl;

lsMesh mesh;
lsToMesh<double, 3>(sphere1, mesh, true).apply();
lsToMesh<double, 3>(sphere1, mesh, true, true).apply();

// also output LS values as scalar data
std::vector<double> scalars;
Expand All @@ -76,8 +76,10 @@ int main() {
// set normal vectors as vectordata to mesh
mesh.insertNextVectorData(normalVectors, "Normals");

auto writer = lsVTKWriter(mesh);
writer.writeVTKLegacy("explicit.vtk");
auto writer = lsVTKWriter();
writer.setMesh(mesh);
writer.setFileName("explicit.vtk");
writer.apply();

return 0;
}
4 changes: 2 additions & 2 deletions Tests/ConvexHull/ConvexHull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main() {
hrleVectorType<double, 3>(cloud.points[i][0], cloud.points[i][1], 0.));
pointMesh.vertices.push_back(hrleVectorType<unsigned, 1>(i));
}
lsVTKWriter(pointMesh).writeVTP("points.vtp");
lsVTKWriter(pointMesh, lsFileFormatEnum::VTP, "points.vtp").apply();

lsMakeGeometry<double, D> geom;
lsDomain<double, D> levelSet;
Expand All @@ -70,7 +70,7 @@ int main() {
std::cout << "Extracting..." << std::endl;
lsToSurfaceMesh<double, D>(levelSet, mesh).apply();
mesh.print();
lsVTKWriter(mesh).writeVTKLegacy("LSMesh.vtk");
lsVTKWriter(mesh, "LSMesh.vtk").apply();
}

return 0;
Expand Down
10 changes: 5 additions & 5 deletions Tests/ConvexHull3D/ConvexHull3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ int main() {
pointMesh.vertices.push_back(hrleVectorType<unsigned, 1>(i));
}
std::cout << "Output point cloud" << std::endl;
lsVTKWriter(pointMesh).writeVTP("points.vtp");
lsVTKWriter(pointMesh, lsFileFormatEnum::VTP, "points.vtp").apply();

// std::cout << "Output surface mesh" << std::endl;
// mesh.print();
// lsVTKWriter(mesh).writeVTP("hull.vtp");
// lsVTKWriter(mesh, lsFileFormatEnum::VTP, "hull.vtp").apply();

std::cout << "create level set" << std::endl;
lsDomain<double, D> levelSet(0.18);
Expand All @@ -128,18 +128,18 @@ int main() {
lsMesh LSMesh;
std::cout << "Output level set grid" << std::endl;
lsToMesh<double, D>(levelSet, LSMesh).apply();
lsVTKWriter(LSMesh).writeVTP("LS.vtp");
lsVTKWriter(LSMesh, lsFileFormatEnum::VTP, "LS.vtp").apply();

std::cout << "Output level set surface" << std::endl;
lsToSurfaceMesh<double, D>(levelSet, LSMesh).apply();
lsVTKWriter(LSMesh).writeVTP("LSmesh.vtp");
lsVTKWriter(LSMesh, lsFileFormatEnum::VTP, "LSmesh.vtp").apply();

// {
// lsMesh mesh;
// std::cout << "Extracting..." << std::endl;
// lsToSurfaceMesh<double, D>(sphere1, mesh).apply();
// mesh.print();
// lsVTKWriter(mesh).writeVTKLegacy("after2D.vtk");
// lsVTKWriter(mesh, "after2D.vtk").apply();
// }

return 0;
Expand Down
6 changes: 3 additions & 3 deletions Tests/Expand/Expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ int main() {
{
lsMesh mesh;
lsToMesh<double, D>(sphere1, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("sphere.vtk");
lsVTKWriter(mesh, "sphere.vtk").apply();
}

{
lsMesh mesh;
lsExpand<double, D>(sphere1, 5).apply();
lsToMesh<double, D>(sphere1, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("sphereExpanded.vtk");
lsVTKWriter(mesh, "sphereExpanded.vtk").apply();

lsReduce<double, D>(sphere1, 1).apply();
lsToMesh<double, D>(sphere1, mesh).apply();
lsVTKWriter(mesh).writeVTKLegacy("sphereReduced.vtk");
lsVTKWriter(mesh, "sphereReduced.vtk").apply();
}

return 0;
Expand Down
Loading

0 comments on commit e8c318e

Please sign in to comment.