-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DiskMesh example. Improved Serialize example.
- Loading branch information
1 parent
f32a9ee
commit 1e9953f
Showing
3 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
|
||
project("DiskMesh") | ||
|
||
find_package(ViennaHRLE REQUIRED) | ||
find_package(ViennaLS REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) | ||
target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNALS_INCLUDE_DIRS}) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNALS_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include <chrono> | ||
#include <iostream> | ||
|
||
#include <lsBooleanOperation.hpp> | ||
#include <lsDomain.hpp> | ||
#include <lsExpand.hpp> | ||
#include <lsFromSurfaceMesh.hpp> | ||
#include <lsMakeGeometry.hpp> | ||
#include <lsToSurfaceMesh.hpp> | ||
#include <lsToDiskMesh.hpp> | ||
#include <lsVTKWriter.hpp> | ||
|
||
/** | ||
Minimal example showing how to write different | ||
meshes created by the algorithms lsToVoxelMesh and lsToSurfaceMesh. | ||
\example Make3DSphere.cpp | ||
*/ | ||
|
||
int main() { | ||
|
||
constexpr int D = 3; | ||
|
||
omp_set_num_threads(1); | ||
|
||
double gridDelta = 0.4; | ||
|
||
auto sphere1 = | ||
lsSmartPointer<lsDomain<double, D>>::New(gridDelta); //, boundaryCons); | ||
|
||
auto sphere2 = | ||
lsSmartPointer<lsDomain<double, D>>::New(gridDelta); //, boundaryCons); | ||
double origin[3] = {5., 0., 0.}; | ||
double radius = 7.3; | ||
|
||
lsMakeGeometry<double, D>( | ||
sphere1, lsSmartPointer<lsSphere<double, D>>::New(origin, radius)) | ||
.apply(); | ||
origin[0] = -5.; | ||
lsMakeGeometry<double, D>( | ||
sphere2, lsSmartPointer<lsSphere<double, D>>::New(origin, radius)) | ||
.apply(); | ||
|
||
std::cout << "Number of points: " << sphere1->getDomain().getNumberOfPoints() | ||
<< std::endl; | ||
auto mesh = lsSmartPointer<lsMesh>::New(); | ||
|
||
std::cout << "Expanding..." << std::endl; | ||
lsExpand<double, D>(sphere1, 2).apply(); | ||
lsExpand<double, D>(sphere2, 2).apply(); | ||
|
||
std::cout << "Booling..." << std::endl; | ||
lsBooleanOperation<double, D>(sphere1, sphere2, lsBooleanOperationEnum::UNION) | ||
.apply(); | ||
|
||
std::cout << "Extracting..." << std::endl; | ||
lsToDiskMesh<double, D>(sphere1, mesh).apply(); | ||
std::cout << "Disk mesh:" << std::endl; | ||
mesh->print(); | ||
lsVTKWriter(mesh, "disks-" + std::to_string(radius) + ".vtk").apply(); | ||
|
||
lsToSurfaceMesh<double, D>(sphere1, mesh).apply(); | ||
std::cout << "Surface mesh:" << std::endl; | ||
mesh->print(); | ||
lsVTKWriter(mesh, "surface-" + std::to_string(radius) + ".vtk").apply(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters