Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ViennaCore and namespace #107

Merged
merged 13 commits into from
Jun 17, 2024
6 changes: 6 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ jobs:
key: python-${{ matrix.os }}
path: build

- name: 🛠️ Disable IPO (Alpine)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sed -i 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DUSE_IPO=off"/g' pyproject.toml
cat pyproject.toml

- name: 🐍 Build and check Python Module (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
Expand Down
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(
ViennaLS
LANGUAGES CXX
VERSION 3.2.0)
VERSION 4.0.0)

# --------------------------------------------------------------------------------------------------------
# Library options
Expand Down Expand Up @@ -102,10 +102,11 @@ include(cmake/cpm.cmake)
include(cmake/vtk.cmake)

CPMAddPackage(
NAME Core
GIT_TAG main # TODO: Create Tag
NAME ViennaCore
GIT_TAG v1.0.0
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore"
OPTIONS "VIENNA_CORE_FORMAT_EXCLUDE docs/")
OPTIONS "VIENNACORE_FORMAT_EXCLUDE docs/"
EXCLUDE_FROM_ALL ${VIENNALS_BUILD_PYTHON})

CPMAddPackage(
NAME PackageProject
Expand All @@ -120,7 +121,7 @@ CPMFindPackage(
EXCLUDE_FROM_ALL ${VIENNALS_BUILD_PYTHON})

find_package(OpenMP REQUIRED)
target_link_libraries(${PROJECT_NAME} INTERFACE OpenMP::OpenMP_CXX ViennaHRLE)
target_link_libraries(${PROJECT_NAME} INTERFACE OpenMP::OpenMP_CXX ViennaHRLE ViennaCore)

if(VIENNALS_USE_VTK AND VIENNALS_VTK_PYTHON_LIBS)
import_vtk_python()
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consum

* Installation with CPM
```cmake
CPMAddPackage("gh:viennatools/viennals@3.0.0")
CPMAddPackage("gh:viennatools/viennals@4.0.0")
```

* With a local installation
Expand Down Expand Up @@ -180,11 +180,11 @@ cmake --build build --target format

## Authors

Current contributors: Lado Filipovic, Paul Manstetten, Xaver Klemenschits and Josef Weinbub
Current contributors: Tobias Reiter, Noah Karnel

Founder and initial developer: Otmar Ertl

Contact us via: viennats@iue.tuwien.ac.at
Contact us via: viennatools@iue.tuwien.ac.at

ViennaLS was developed under the aegis of the 'Institute for Microelectronics' at the 'TU Wien'.
http://www.iue.tuwien.ac.at/
Expand Down
52 changes: 28 additions & 24 deletions examples/AirGapDeposition/AirGapDeposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
then grown directionally on top. \example AirGapDeposition.cpp
*/

namespace ls = viennals;

using NumericType = float;

// implement own velocity field
class velocityField : public lsVelocityField<NumericType> {
class velocityField : public ls::VelocityField<NumericType> {
public:
NumericType
getScalarVelocity(const std::array<NumericType, 3> & /*coordinate*/,
Expand Down Expand Up @@ -50,51 +52,53 @@ int main() {
NumericType gridDelta = 0.5;

hrleCoordType bounds[2 * D] = {-extent, extent, -extent, extent};
lsDomain<NumericType, D>::BoundaryType boundaryCons[D];
boundaryCons[0] = lsDomain<NumericType, D>::BoundaryType::REFLECTIVE_BOUNDARY;
boundaryCons[1] = lsDomain<NumericType, D>::BoundaryType::INFINITE_BOUNDARY;
ls::Domain<NumericType, D>::BoundaryType boundaryCons[D];
boundaryCons[0] =
ls::Domain<NumericType, D>::BoundaryType::REFLECTIVE_BOUNDARY;
boundaryCons[1] = ls::Domain<NumericType, D>::BoundaryType::INFINITE_BOUNDARY;

auto substrate = lsSmartPointer<lsDomain<NumericType, D>>::New(
auto substrate = ls::SmartPointer<ls::Domain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);

NumericType origin[2] = {0., 0.};
NumericType planeNormal[2] = {0., 1.};

{
auto plane =
lsSmartPointer<lsPlane<NumericType, D>>::New(origin, planeNormal);
lsMakeGeometry<NumericType, D>(substrate, plane).apply();
ls::SmartPointer<ls::Plane<NumericType, D>>::New(origin, planeNormal);
ls::MakeGeometry<NumericType, D>(substrate, plane).apply();
}

{
std::cout << "Extracting..." << std::endl;
auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();
lsToSurfaceMesh<NumericType, D>(substrate, mesh).apply();
lsVTKWriter<NumericType>(mesh, "plane.vtp").apply();
auto mesh = ls::SmartPointer<ls::Mesh<NumericType>>::New();
ls::ToSurfaceMesh<NumericType, D>(substrate, mesh).apply();
ls::VTKWriter<NumericType>(mesh, "plane.vtp").apply();
}

{
// create layer used for booling
std::cout << "Creating box..." << std::endl;
auto trench = lsSmartPointer<lsDomain<NumericType, D>>::New(
auto trench = ls::SmartPointer<ls::Domain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);
NumericType xlimit = extent / 6.;
NumericType minCorner[D] = {-xlimit, -25.};
NumericType maxCorner[D] = {xlimit, 1.};
auto box = lsSmartPointer<lsBox<NumericType, D>>::New(minCorner, maxCorner);
lsMakeGeometry<NumericType, D>(trench, box).apply();
auto box =
ls::SmartPointer<ls::Box<NumericType, D>>::New(minCorner, maxCorner);
ls::MakeGeometry<NumericType, D>(trench, box).apply();

{
std::cout << "Extracting..." << std::endl;
auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();
lsToMesh<NumericType, D>(trench, mesh).apply();
lsVTKWriter<NumericType>(mesh, "box.vtp").apply();
auto mesh = ls::SmartPointer<ls::Mesh<NumericType>>::New();
ls::ToMesh<NumericType, D>(trench, mesh).apply();
ls::VTKWriter<NumericType>(mesh, "box.vtp").apply();
}

// Create trench geometry
std::cout << "Booling trench..." << std::endl;
lsBooleanOperation<NumericType, D>(
substrate, trench, lsBooleanOperationEnum::RELATIVE_COMPLEMENT)
ls::BooleanOperation<NumericType, D>(
substrate, trench, ls::BooleanOperationEnum::RELATIVE_COMPLEMENT)
.apply();
}

Expand All @@ -103,12 +107,12 @@ int main() {
// create new levelset for new material, which will be grown
// since it has to wrap around the substrate, just copy it
std::cout << "Creating new layer..." << std::endl;
auto newLayer = lsSmartPointer<lsDomain<NumericType, D>>::New(substrate);
auto newLayer = ls::SmartPointer<ls::Domain<NumericType, D>>::New(substrate);

auto velocities = lsSmartPointer<velocityField>::New();
auto velocities = ls::SmartPointer<velocityField>::New();

std::cout << "Advecting" << std::endl;
lsAdvect<NumericType, D> advectionKernel;
ls::Advect<NumericType, D> advectionKernel;

// the level set to be advected has to be inserted last
// the other could be taken as a mask layer for advection
Expand All @@ -129,9 +133,9 @@ int main() {

std::cout << "\rAdvection step " + std::to_string(i) + " / "
<< numberOfSteps << std::flush;
auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();
lsToSurfaceMesh<NumericType, D>(newLayer, mesh).apply();
lsVTKWriter<NumericType>(mesh, "trench" + std::to_string(i) + ".vtp")
auto mesh = ls::SmartPointer<ls::Mesh<NumericType>>::New();
ls::ToSurfaceMesh<NumericType, D>(newLayer, mesh).apply();
ls::VTKWriter<NumericType>(mesh, "trench" + std::to_string(i) + ".vtp")
.apply();
}
std::cout << std::endl;
Expand Down
37 changes: 19 additions & 18 deletions examples/AirGapDeposition/AirGapDeposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# then grown directionally on top.


class velocityField(vls.lsVelocityField):
class velocityField(vls.VelocityField):
# coord and normalVec are lists with 3 elements
# in 2D coord[2] and normalVec[2] are zero
# getScalarVelocity must return a scalar
Expand All @@ -24,46 +24,47 @@ def getVectorVelocity(self, coord, material, normal, pointId):
boundaryCons = (0, 1, 0) # 0 = reflective, 1 = infinite, 2 = periodic

# create level set
substrate = vls.lsDomain(bounds, boundaryCons, gridDelta)
substrate = vls.Domain(bounds, boundaryCons, gridDelta)

# create plane
origin = (0, 0, 0)
planeNormal = (0, 1, 0)

vls.lsMakeGeometry(substrate, vls.lsPlane(origin, planeNormal)).apply()
vls.MakeGeometry(substrate, vls.Plane(origin, planeNormal)).apply()

print("Extracting")
mesh = vls.lsMesh()
vls.lsToSurfaceMesh(substrate, mesh).apply()
vls.lsVTKWriter(mesh, "plane.vtk").apply()
mesh = vls.Mesh()
vls.ToSurfaceMesh(substrate, mesh).apply()
vls.VTKWriter(mesh, "plane.vtp").apply()

# create layer used for booling
print("Creating box...")
trench = vls.lsDomain(bounds, boundaryCons, gridDelta)
minCorner = (-extent / 6., -25.)
maxCorner = (extent / 6., 1.)
vls.lsMakeGeometry(trench, vls.lsBox(minCorner, maxCorner)).apply()
trench = vls.Domain(bounds, boundaryCons, gridDelta)
minCorner = (-extent / 6.0, -25.0)
maxCorner = (extent / 6.0, 1.0)
vls.MakeGeometry(trench, vls.Box(minCorner, maxCorner)).apply()

print("Extracting")
vls.lsToMesh(trench, mesh).apply()
vls.lsVTKWriter(mesh, "box.vtk").apply()
vls.ToMesh(trench, mesh).apply()
vls.VTKWriter(mesh, "box.vtp").apply()

# Create trench geometry
print("Booling trench")
vls.lsBooleanOperation(substrate, trench,
vls.lsBooleanOperationEnum.RELATIVE_COMPLEMENT).apply()
vls.BooleanOperation(
substrate, trench, vls.BooleanOperationEnum.RELATIVE_COMPLEMENT
).apply()

# Now grow new material

# create new levelset for new material, which will be grown
# since it has to wrap around the substrate, just copy it
print("Creating new layer...")
newLayer = vls.lsDomain(substrate)
newLayer = vls.Domain(substrate)

velocities = velocityField()

print("Advecting")
advectionKernel = vls.lsAdvect()
advectionKernel = vls.Advect()

# the level set to be advected has to be inserted last
# the other could be taken as a mask layer for advection
Expand All @@ -84,7 +85,7 @@ def getVectorVelocity(self, coord, material, normal, pointId):

print("Advection step {} / {}".format(i, numberOfSteps))

vls.lsToSurfaceMesh(newLayer, mesh).apply()
vls.lsVTKWriter(mesh, "trench{}.vtk".format(i)).apply()
vls.ToSurfaceMesh(newLayer, mesh).apply()
vls.VTKWriter(mesh, "trench{}.vtp".format(i)).apply()

print("Time passed during advection: {}".format(passedTime))
50 changes: 27 additions & 23 deletions examples/Deposition/Deposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
\example Deposition.cpp
*/

namespace ls = viennals;

using NumericType = float;

// implement own velocity field
class velocityField : public lsVelocityField<NumericType> {
class velocityField : public ls::VelocityField<NumericType> {
public:
NumericType
getScalarVelocity(const std::array<NumericType, 3> & /*coordinate*/,
Expand Down Expand Up @@ -51,57 +53,58 @@ int main() {
NumericType gridDelta = 0.5;

double bounds[2 * D] = {-extent, extent, -extent, extent, -extent, extent};
lsDomain<NumericType, D>::BoundaryType boundaryCons[D];
ls::Domain<NumericType, D>::BoundaryType boundaryCons[D];
for (unsigned i = 0; i < D - 1; ++i)
boundaryCons[i] =
lsDomain<NumericType, D>::BoundaryType::REFLECTIVE_BOUNDARY;
boundaryCons[2] = lsDomain<NumericType, D>::BoundaryType::INFINITE_BOUNDARY;
ls::Domain<NumericType, D>::BoundaryType::REFLECTIVE_BOUNDARY;
boundaryCons[2] = ls::Domain<NumericType, D>::BoundaryType::INFINITE_BOUNDARY;

auto substrate = lsSmartPointer<lsDomain<NumericType, D>>::New(
auto substrate = ls::SmartPointer<ls::Domain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);

NumericType origin[3] = {0., 0., 0.};
NumericType planeNormal[3] = {0., 0., 1.};

{
auto plane =
lsSmartPointer<lsPlane<NumericType, D>>::New(origin, planeNormal);
lsMakeGeometry<NumericType, D>(substrate, plane).apply();
ls::SmartPointer<ls::Plane<NumericType, D>>::New(origin, planeNormal);
ls::MakeGeometry<NumericType, D>(substrate, plane).apply();
}

{
auto trench = lsSmartPointer<lsDomain<NumericType, D>>::New(
auto trench = ls::SmartPointer<ls::Domain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);
// make -x and +x greater than domain for numerical stability
NumericType ylimit = extent / 4.;
NumericType minCorner[D] = {-extent - 1, -ylimit, -15.};
NumericType maxCorner[D] = {extent + 1, ylimit, 1.};
auto box = lsSmartPointer<lsBox<NumericType, D>>::New(minCorner, maxCorner);
lsMakeGeometry<NumericType, D>(trench, box).apply();
auto box =
ls::SmartPointer<ls::Box<NumericType, D>>::New(minCorner, maxCorner);
ls::MakeGeometry<NumericType, D>(trench, box).apply();

// Create trench geometry
lsBooleanOperation<NumericType, D>(
substrate, trench, lsBooleanOperationEnum::RELATIVE_COMPLEMENT)
ls::BooleanOperation<NumericType, D>(
substrate, trench, ls::BooleanOperationEnum::RELATIVE_COMPLEMENT)
.apply();
}

{
std::cout << "Extracting..." << std::endl;
auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();
lsToSurfaceMesh<NumericType, D>(substrate, mesh).apply();
lsVTKWriter<NumericType>(mesh, "trench-0.vtp").apply();
auto mesh = ls::SmartPointer<ls::Mesh<NumericType>>::New();
ls::ToSurfaceMesh<NumericType, D>(substrate, mesh).apply();
ls::VTKWriter<NumericType>(mesh, "trench-0.vtp").apply();
}

// Now grow new material isotropically

// create new levelset for new material, which will be grown
// since it has to wrap around the substrate, just copy it
auto newLayer = lsSmartPointer<lsDomain<NumericType, D>>::New(substrate);
auto newLayer = ls::SmartPointer<ls::Domain<NumericType, D>>::New(substrate);

auto velocities = lsSmartPointer<velocityField>::New();
auto velocities = ls::SmartPointer<velocityField>::New();

std::cout << "Advecting" << std::endl;
lsAdvect<NumericType, D> advectionKernel;
ls::Advect<NumericType, D> advectionKernel;

// the level set to be advected has to be inserted last
// the other could be taken as a mask layer for advection
Expand All @@ -115,13 +118,14 @@ int main() {
time += advectionKernel.getAdvectedTime()) {
advectionKernel.apply();

auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();
lsToSurfaceMesh<NumericType, D>(newLayer, mesh).apply();
lsVTKWriter<NumericType>(mesh, "trench-" + std::to_string(counter) + ".vtp")
auto mesh = ls::SmartPointer<ls::Mesh<NumericType>>::New();
ls::ToSurfaceMesh<NumericType, D>(newLayer, mesh).apply();
ls::VTKWriter<NumericType>(mesh,
"trench-" + std::to_string(counter) + ".vtp")
.apply();

lsToMesh<NumericType, D>(newLayer, mesh).apply();
lsVTKWriter<NumericType>(mesh, "LS-" + std::to_string(counter) + ".vtp")
ls::ToMesh<NumericType, D>(newLayer, mesh).apply();
ls::VTKWriter<NumericType>(mesh, "LS-" + std::to_string(counter) + ".vtp")
.apply();

++counter;
Expand Down
Loading
Loading