From 1fa07e36629ace8c81a56d51457368041ee7a750 Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Fri, 24 May 2024 14:16:42 -0400 Subject: [PATCH] refactor examples --- examples/GDSReader/GDSReader.cpp | 15 ++-- examples/TEOSTrenchDeposition/multiTEOS.cpp | 56 +++++++------- examples/TEOSTrenchDeposition/parameters.hpp | 54 -------------- examples/TEOSTrenchDeposition/singleTEOS.cpp | 46 ++++++------ .../atomicLayerDeposition.cpp | 17 +++-- .../cantileverWetEtching.cpp | 25 ++++--- examples/exampleProcess/exampleProcess.cpp | 25 ++++--- examples/exampleProcess/particles.hpp | 33 +++++---- examples/exampleProcess/surfaceModel.hpp | 19 ++--- examples/exampleProcess/velocityField.hpp | 12 +-- examples/holeEtching/holeEtching.cpp | 56 +++++++------- examples/holeEtching/parameters.hpp | 56 -------------- examples/selectiveEpitaxy/parameters.hpp | 38 ---------- .../selectiveEpitaxy/selectiveEpitaxy.cpp | 55 +++++++------- examples/trenchDeposition/parameters.hpp | 42 ----------- .../trenchDeposition/trenchDeposition.cpp | 39 +++++----- include/viennaps/cellSet/csMeanFreePath.hpp | 39 ++++++---- include/viennaps/cellSet/csPointSource.hpp | 3 +- include/viennaps/cellSet/csTracingKernel.hpp | 13 ++-- .../viennaps/cellSet/csTracingParticle.hpp | 15 ++-- .../viennaps/models/psAnisotropicProcess.hpp | 6 +- .../viennaps/models/psFluorocarbonEtching.hpp | 14 ++-- include/viennaps/models/psIonBeamEtching.hpp | 16 ++-- include/viennaps/models/psPlasmaDamage.hpp | 24 +++--- include/viennaps/models/psSF6O2Etching.hpp | 38 +++++----- .../models/psSingleParticleProcess.hpp | 24 +++--- include/viennaps/models/psTEOSDeposition.hpp | 23 +++--- include/viennaps/psExtrude.hpp | 43 ++++++----- include/viennaps/psMeanFreePath.hpp | 74 ++++++++++--------- include/viennaps/psPlanarize.hpp | 18 +++-- include/viennaps/psProcess.hpp | 8 +- include/viennaps/psTestAssert.hpp | 20 ----- include/viennaps/psToSurfaceMesh.hpp | 25 ------- include/viennaps/psUtils.hpp | 13 ++-- include/viennaps/psWriteVisualizationMesh.hpp | 38 ---------- tests/logger/logger.cpp | 14 ++-- tests/processModel/processModel.cpp | 2 +- 37 files changed, 406 insertions(+), 652 deletions(-) delete mode 100644 examples/TEOSTrenchDeposition/parameters.hpp delete mode 100644 examples/holeEtching/parameters.hpp delete mode 100644 examples/selectiveEpitaxy/parameters.hpp delete mode 100644 examples/trenchDeposition/parameters.hpp delete mode 100644 include/viennaps/psTestAssert.hpp delete mode 100644 include/viennaps/psToSurfaceMesh.hpp delete mode 100644 include/viennaps/psWriteVisualizationMesh.hpp diff --git a/examples/GDSReader/GDSReader.cpp b/examples/GDSReader/GDSReader.cpp index 24f5757b..a3e7247e 100644 --- a/examples/GDSReader/GDSReader.cpp +++ b/examples/GDSReader/GDSReader.cpp @@ -1,8 +1,7 @@ #include #include -#include -#include -#include + +namespace ps = viennaps; int main(int argc, char **argv) { using NumericType = double; @@ -14,21 +13,21 @@ int main(int argc, char **argv) { lsBoundaryConditionEnum::REFLECTIVE_BOUNDARY, lsBoundaryConditionEnum::REFLECTIVE_BOUNDARY, lsBoundaryConditionEnum::INFINITE_BOUNDARY}; - auto mask = psSmartPointer>::New(gridDelta); + auto mask = ps::SmartPointer>::New(gridDelta); mask->setBoundaryConditions(boundaryConds); - psGDSReader(mask, "mask.gds").apply(); + ps::GDSReader(mask, "mask.gds").apply(); // geometry setup auto bounds = mask->getBounds(); - auto geometry = psSmartPointer>::New(); + auto geometry = ps::SmartPointer>::New(); // substrate plane NumericType origin[D] = {0., 0., 0.}; NumericType normal[D] = {0., 0., 1.}; - auto plane = psSmartPointer>::New( + auto plane = lsSmartPointer>::New( bounds, boundaryConds, gridDelta); lsMakeGeometry( - plane, psSmartPointer>::New(origin, normal)) + plane, lsSmartPointer>::New(origin, normal)) .apply(); geometry->insertNextLevelSet(plane); diff --git a/examples/TEOSTrenchDeposition/multiTEOS.cpp b/examples/TEOSTrenchDeposition/multiTEOS.cpp index 4befd71b..e78d76fb 100644 --- a/examples/TEOSTrenchDeposition/multiTEOS.cpp +++ b/examples/TEOSTrenchDeposition/multiTEOS.cpp @@ -3,57 +3,55 @@ #include #include +#include -#include "parameters.hpp" +namespace ps = viennaps; int main(int argc, char **argv) { using NumericType = double; constexpr int D = 2; // Parse the parameters - Parameters params; + ps::utils::Parameters params; if (argc > 1) { - auto config = psUtils::readConfigFile(argv[1]); - if (config.empty()) { - std::cerr << "Empty config provided" << std::endl; - return -1; - } - params.fromMap(config); + params.readConfigFile(argv[1]); + } else { + std::cout << "Usage: " << argv[0] << " " << std::endl; + return 1; } - auto geometry = psSmartPointer>::New(); - psMakeTrench( - geometry, params.gridDelta /* grid delta */, params.xExtent /*x extent*/, - params.yExtent /*y extent*/, params.trenchWidth /*trench width*/, - params.trenchHeight /*trench height*/, - params.taperAngle /* tapering angle */, 0 /*base height*/, + auto geometry = ps::SmartPointer>::New(); + ps::MakeTrench( + geometry, params.get("gridDelta") /* grid delta */, + params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/, + params.get("trenchWidth") /*trench width*/, + params.get("trenchHeight") /*trench height*/, + params.get("taperAngle") /* tapering angle */, 0 /*base height*/, false /*periodic boundary*/, false /*create mask*/, - psMaterial::Si /*material*/) + ps::Material::Si /*material*/) .apply(); // copy top layer to capture deposition - geometry->duplicateTopLevelSet(psMaterial::SiO2); + geometry->duplicateTopLevelSet(ps::Material::SiO2); // process model encompasses surface model and particle types - auto model = psSmartPointer>::New( - params.stickingProbabilityP1 /*particle sticking probability*/, - params.depositionRateP1 /*process deposition rate*/, - params.reactionOrderP1 /*process reaction order*/, - params.stickingProbabilityP2, params.depositionRateP2, - params.reactionOrderP2); - - psProcess process; + auto model = ps::SmartPointer>::New( + params.get("stickingProbabilityP1") /*particle sticking probability*/, + params.get("depositionRateP1") /*process deposition rate*/, + params.get("reactionOrderP1") /*process reaction order*/, + params.get("stickingProbabilityP2"), params.get("depositionRateP2"), + params.get("reactionOrderP2")); + + ps::Process process; process.setDomain(geometry); process.setProcessModel(model); - process.setNumberOfRaysPerPoint(params.numRaysPerPoint); - process.setProcessDuration(params.processTime); + process.setNumberOfRaysPerPoint(params.get("numRaysPerPoint")); + process.setProcessDuration(params.get("processTime")); geometry->saveSurfaceMesh("MulitTEOS_initial.vtp"); process.apply(); geometry->saveSurfaceMesh("MulitTEOS_final.vtp"); - - if constexpr (D == 2) - geometry->saveVolumeMesh("MulitTEOS_final"); + geometry->saveVolumeMesh("MulitTEOS_final"); } diff --git a/examples/TEOSTrenchDeposition/parameters.hpp b/examples/TEOSTrenchDeposition/parameters.hpp deleted file mode 100644 index 4897b634..00000000 --- a/examples/TEOSTrenchDeposition/parameters.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include -#include - -#include - -template struct Parameters { - // Domain - NumericType gridDelta = 5.; // um - NumericType xExtent = 100.; // um - NumericType yExtent = 100.; // um (3D mode only) - - // Geometry - NumericType trenchWidth = 70; // um - NumericType trenchHeight = 70; // um - NumericType taperAngle = 0.; // degrees - - // Process - NumericType processTime = 350.; // min - int numRaysPerPoint = 2000; - - // 1. particle - NumericType depositionRateP1 = 0.1; - NumericType stickingProbabilityP1 = 0.1; - NumericType reactionOrderP1 = 1.; - - // 2. particle - NumericType depositionRateP2 = 0.01; - NumericType stickingProbabilityP2 = 1e-4; - NumericType reactionOrderP2 = 1.; - - Parameters() {} - - void fromMap(std::unordered_map &m) { - psUtils::AssignItems( // - m, // - psUtils::Item{"gridDelta", gridDelta}, // - psUtils::Item{"xExtent", xExtent}, // - psUtils::Item{"yExtent", yExtent}, // - psUtils::Item{"trenchWidth", trenchWidth}, // - psUtils::Item{"trenchHeight", trenchHeight}, // - psUtils::Item{"taperAngle", taperAngle}, // - psUtils::Item{"processTime", processTime}, // - psUtils::Item{"numRaysPerPoint", numRaysPerPoint}, // - psUtils::Item{"depositionRateP1", depositionRateP1}, // - psUtils::Item{"stickingProbabilityP1", stickingProbabilityP1}, // - psUtils::Item{"reactionOrderP1", reactionOrderP1}, // - psUtils::Item{"depositionRateP2", depositionRateP2}, // - psUtils::Item{"stickingProbabilityP2", stickingProbabilityP2}, // - psUtils::Item{"reactionOrderP2", reactionOrderP2} // - ); - } -}; diff --git a/examples/TEOSTrenchDeposition/singleTEOS.cpp b/examples/TEOSTrenchDeposition/singleTEOS.cpp index 47ff0bfd..abf2711b 100644 --- a/examples/TEOSTrenchDeposition/singleTEOS.cpp +++ b/examples/TEOSTrenchDeposition/singleTEOS.cpp @@ -3,48 +3,48 @@ #include #include +#include -#include "parameters.hpp" +namespace ps = viennaps; int main(int argc, char **argv) { using NumericType = double; constexpr int D = 2; // Parse the parameters - Parameters params; + ps::utils::Parameters params; if (argc > 1) { - auto config = psUtils::readConfigFile(argv[1]); - if (config.empty()) { - std::cerr << "Empty config provided" << std::endl; - return -1; - } - params.fromMap(config); + params.readConfigFile(argv[1]); + } else { + std::cout << "Usage: " << argv[0] << " " << std::endl; + return 1; } - auto geometry = psSmartPointer>::New(); - psMakeTrench( - geometry, params.gridDelta /* grid delta */, params.xExtent /*x extent*/, - params.yExtent /*y extent*/, params.trenchWidth /*trench width*/, - params.trenchHeight /*trench height*/, - params.taperAngle /* tapering angle */, 0 /*base height*/, + auto geometry = ps::SmartPointer>::New(); + ps::MakeTrench( + geometry, params.get("gridDelta") /* grid delta */, + params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/, + params.get("trenchWidth") /*trench width*/, + params.get("trenchHeight") /*trench height*/, + params.get("taperAngle") /* tapering angle */, 0 /*base height*/, false /*periodic boundary*/, false /*create mask*/, - psMaterial::Si /*material*/) + ps::Material::Si /*material*/) .apply(); // copy top layer to capture deposition - geometry->duplicateTopLevelSet(psMaterial::SiO2); + geometry->duplicateTopLevelSet(ps::Material::SiO2); // process model encompasses surface model and particle types - auto model = psSmartPointer>::New( - params.stickingProbabilityP1 /*particle sticking probability*/, - params.depositionRateP1 /*process deposition rate*/, - params.reactionOrderP1 /*process reaction order*/); + auto model = ps::SmartPointer>::New( + params.get("stickingProbabilityP1") /*particle sticking probability*/, + params.get("depositionRateP1") /*process deposition rate*/, + params.get("reactionOrderP1") /*process reaction order*/); - psProcess process; + ps::Process process; process.setDomain(geometry); process.setProcessModel(model); - process.setNumberOfRaysPerPoint(params.numRaysPerPoint); - process.setProcessDuration(params.processTime); + process.setNumberOfRaysPerPoint(params.get("numRaysPerPoint")); + process.setProcessDuration(params.get("processTime")); geometry->saveSurfaceMesh("SingleTEOS_initial.vtp"); diff --git a/examples/atomicLayerDeposition/atomicLayerDeposition.cpp b/examples/atomicLayerDeposition/atomicLayerDeposition.cpp index 95c942a1..230a3af7 100644 --- a/examples/atomicLayerDeposition/atomicLayerDeposition.cpp +++ b/examples/atomicLayerDeposition/atomicLayerDeposition.cpp @@ -5,17 +5,20 @@ #include #include +#include #include "geometry.hpp" +namespace viennaps = ps; + int main(int argc, char *argv[]) { constexpr int D = 2; using NumericType = double; - psLogger::setLogLevel(psLogLevel::INTERMEDIATE); + ps::Logger::setLogLevel(ps::LogLevel::INTERMEDIATE); // Parse the parameters - psUtils::Parameters params; + ps::utils::Parameters params; if (argc > 1) { params.readConfigFile(argv[1]); } else { @@ -25,21 +28,21 @@ int main(int argc, char *argv[]) { omp_set_num_threads(params.get("numThreads")); // Create a domain - auto domain = psSmartPointer>::New(); + auto domain = ps::SmartPointer>::New(); if (params.get("trench") > 0) { - psMakeHole( + ps::MakeHole( domain, params.get("gridDelta"), 2 * params.get("verticalWidth") + 2. * params.get("xPad"), 2 * params.get("verticalWidth") + 2. * params.get("xPad"), params.get("verticalWidth"), params.get("verticalDepth"), 0., 0., false, - false, psMaterial::TiN) + false, ps::Material::TiN) .apply(); } else { - makeLShape(domain, params, psMaterial::TiN); + makeLShape(domain, params, ps::Material::TiN); } // Generate the cell set from the domain domain->generateCellSet(params.get("verticalDepth") + params.get("topSpace"), - psMaterial::GAS, true); + ps::Material::GAS, true); auto &cellSet = domain->getCellSet(); // Segment the cells into surface, material, and gas cells csSegmentCells(cellSet).apply(); diff --git a/examples/cantileverWetEtching/cantileverWetEtching.cpp b/examples/cantileverWetEtching/cantileverWetEtching.cpp index 68857153..9cbc23e6 100644 --- a/examples/cantileverWetEtching/cantileverWetEtching.cpp +++ b/examples/cantileverWetEtching/cantileverWetEtching.cpp @@ -5,6 +5,8 @@ #include +namespace ps = viennaps; + int main(int argc, char **argv) { using NumericType = double; constexpr int D = 3; @@ -39,10 +41,12 @@ int main(int argc, char **argv) { REFLECTIVE_BOUNDARY; // boundary conditions in x and y direction boundaryCons[D - 1] = lsDomain::BoundaryType:: INFINITE_BOUNDARY; // open boundary in z direction - auto gds_mask = psSmartPointer>::New(gridDelta); + auto gds_mask = + ps::SmartPointer>::New(gridDelta); gds_mask->setBoundaryConditions(boundaryCons); gds_mask->setBoundaryPadding(x_add, y_add); - psGDSReader(gds_mask, maskFileName).apply(); // read GDS file + ps::GDSReader(gds_mask, maskFileName) + .apply(); // read GDS file auto mask = gds_mask->layerToLevelSet( 1 /*layer in GDS file*/, 0 /*base z position*/, @@ -52,24 +56,25 @@ int main(int argc, char **argv) { NumericType origin[D] = {0., 0., 0.}; // surface origin NumericType normal[D] = {0., 0., 1.}; // surface normal double *bounds = gds_mask->getBounds(); // extent of GDS mask - auto plane = psSmartPointer>::New( + auto plane = lsSmartPointer>::New( bounds, boundaryCons, gridDelta); lsMakeGeometry( - plane, psSmartPointer>::New(origin, normal)) + plane, lsSmartPointer>::New(origin, normal)) .apply(); // Set up domain - auto geometry = psSmartPointer>::New(); - geometry->insertNextLevelSetAsMaterial(mask, psMaterial::Mask); - geometry->insertNextLevelSetAsMaterial(plane, psMaterial::Si); + auto geometry = ps::SmartPointer>::New(); + geometry->insertNextLevelSetAsMaterial(mask, ps::Material::Mask); + geometry->insertNextLevelSetAsMaterial(plane, ps::Material::Si); geometry->saveSurfaceMesh("initialGeometry.vtp"); // Anisotropic wet etching process model - auto model = psSmartPointer>::New( + auto model = ps::SmartPointer>::New( direction100, direction010, r100, r110, r111, r311, - std::vector>{{psMaterial::Si, -1.}}); + std::vector>{ + {ps::Material::Si, -1.}}); - psProcess process; + ps::Process process; process.setDomain(geometry); process.setProcessModel(model); process.setProcessDuration(5. * 60.); // 5 minutes of etching diff --git a/examples/exampleProcess/exampleProcess.cpp b/examples/exampleProcess/exampleProcess.cpp index 4c5fc04b..5f669494 100644 --- a/examples/exampleProcess/exampleProcess.cpp +++ b/examples/exampleProcess/exampleProcess.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include @@ -9,23 +8,25 @@ #include "surfaceModel.hpp" #include "velocityField.hpp" +namespace ps = viennaps; + int main() { using NumericType = double; constexpr int D = 3; - psLogger::setLogLevel(psLogLevel::INFO); + ps::Logger::setLogLevel(ps::LogLevel::INFO); // particles auto particle = std::make_unique>(0.2, 10.); // surface model - auto surfModel = psSmartPointer>::New(); + auto surfModel = ps::SmartPointer>::New(); // velocity field - auto velField = psSmartPointer>::New(); + auto velField = ps::SmartPointer>::New(); /* ------------- Geometry setup (ViennaLS) ------------ */ - auto domain = psSmartPointer>::New(); + auto domain = ps::SmartPointer>::New(); { NumericType extent = 8; NumericType gridDelta = 0.5; @@ -39,7 +40,7 @@ int main() { boundaryCons[D - 1] = lsDomain::BoundaryType::INFINITE_BOUNDARY; - auto mask = psSmartPointer>::New( + auto mask = lsSmartPointer>::New( bounds, boundaryCons, gridDelta); NumericType normal[3] = {0.}; @@ -49,7 +50,7 @@ int main() { mask, lsSmartPointer>::New(origin, normal)) .apply(); - auto maskCut = psSmartPointer>::New( + auto maskCut = lsSmartPointer>::New( bounds, boundaryCons, gridDelta); normal[D - 1] = 1.; origin[D - 1] = 2.; @@ -72,27 +73,27 @@ int main() { mask, maskCut, lsBooleanOperationEnum::RELATIVE_COMPLEMENT) .apply(); - domain->insertNextLevelSetAsMaterial(mask, psMaterial::Mask); + domain->insertNextLevelSetAsMaterial(mask, ps::Material::Mask); - auto substrate = psSmartPointer>::New( + auto substrate = lsSmartPointer>::New( bounds, boundaryCons, gridDelta); lsMakeGeometry( substrate, lsSmartPointer>::New(origin, normal)) .apply(); - domain->insertNextLevelSetAsMaterial(substrate, psMaterial::Si); + domain->insertNextLevelSetAsMaterial(substrate, ps::Material::Si); } domain->saveSurfaceMesh("initial.vtp"); - auto model = psSmartPointer>::New(); + auto model = ps::SmartPointer>::New(); model->insertNextParticleType(particle); model->setSurfaceModel(surfModel); model->setVelocityField(velField); model->setProcessName("ExampleProcess"); - psProcess process; + ps::Process process; process.setDomain(domain); process.setProcessModel(model); process.setProcessDuration(5); diff --git a/examples/exampleProcess/particles.hpp b/examples/exampleProcess/particles.hpp index 7a5f82d3..11bb3dd4 100644 --- a/examples/exampleProcess/particles.hpp +++ b/examples/exampleProcess/particles.hpp @@ -5,31 +5,34 @@ #include template -class Particle : public rayParticle, NumericType> { +class Particle + : public viennaray::Particle, NumericType> { public: Particle(const NumericType pSticking, const NumericType pPower) : stickingProbability(pSticking), sourcePower(pPower) {} void surfaceCollision(NumericType rayWeight, - const rayTriple &rayDir, - const rayTriple &geomNormal, + const viennaray::Triple &rayDir, + const viennaray::Triple &geomNormal, const unsigned int primID, const int materialId, - rayTracingData &localData, - const rayTracingData *globalData, - rayRNG &Rng) override final { + viennaray::TracingData &localData, + const viennaray::TracingData *globalData, + RNG &rngState) override final { // collect data for this hit localData.getVectorData(0)[primID] += rayWeight; } - std::pair> - surfaceReflection(NumericType rayWeight, const rayTriple &rayDir, - const rayTriple &geomNormal, + std::pair> + surfaceReflection(NumericType rayWeight, + const viennaray::Triple &rayDir, + const viennaray::Triple &geomNormal, const unsigned int primId, const int materialId, - const rayTracingData *globalData, - rayRNG &Rng) override final { - auto direction = rayReflectionDiffuse(geomNormal, Rng); - return std::pair>{stickingProbability, - direction}; + const viennaray::TracingData *globalData, + RNG &rngState) override final { + auto direction = + viennaray::ReflectionDiffuse(geomNormal, rngState); + return std::pair>{ + stickingProbability, direction}; } - void initNew(rayRNG &RNG) override final {} + void initNew(RNG &rngState) override final {} NumericType getSourceDistributionPower() const override final { return sourcePower; } diff --git a/examples/exampleProcess/surfaceModel.hpp b/examples/exampleProcess/surfaceModel.hpp index 29637066..d9921772 100644 --- a/examples/exampleProcess/surfaceModel.hpp +++ b/examples/exampleProcess/surfaceModel.hpp @@ -3,33 +3,34 @@ #include template -class SurfaceModel : public psSurfaceModel { +class SurfaceModel : public viennaps::SurfaceModel { public: - using psSurfaceModel::coverages; - using psSurfaceModel::processParams; + using viennaps::SurfaceModel::coverages; + using viennaps::SurfaceModel::processParams; void initializeCoverages(unsigned numGeometryPoints) override { std::vector someCoverages(numGeometryPoints, 0); - coverages = psSmartPointer>::New(); + coverages = viennaps::SmartPointer>::New(); coverages->insertNextScalarData(someCoverages, "coverages"); } void initializeProcessParameters() override { - processParams = psSmartPointer>::New(); + processParams = + viennaps::SmartPointer>::New(); processParams->insertNextScalar(0., "processParameter"); } - psSmartPointer> calculateVelocities( - psSmartPointer> rates, + viennaps::SmartPointer> calculateVelocities( + viennaps::SmartPointer> rates, const std::vector> &coordinates, const std::vector &materialIds) override { // use coverages and rates here to calculate the velocity here - return psSmartPointer>::New( + return viennaps::SmartPointer>::New( *rates->getScalarData("particleRate")); } - void updateCoverages(psSmartPointer> rates, + void updateCoverages(viennaps::SmartPointer> rates, const std::vector &materialIds) override { // update coverages } diff --git a/examples/exampleProcess/velocityField.hpp b/examples/exampleProcess/velocityField.hpp index 973762fb..fd0a0dad 100644 --- a/examples/exampleProcess/velocityField.hpp +++ b/examples/exampleProcess/velocityField.hpp @@ -1,12 +1,10 @@ #pragma once -#include #include -#include #include #include -template class VelocityField : public psVelocityField { +template class VelocityField : public viennaps::VelocityField { public: VelocityField() {} @@ -15,17 +13,19 @@ template class VelocityField : public psVelocityField { unsigned long pointID) override { // implement material specific etching/deposition here T velocity = 0.; - if (psMaterialMap::mapToMaterial(material) != psMaterial::Mask) { + if (viennaps::MaterialMap::mapToMaterial(material) != + viennaps::Material::Mask) { velocity = -velocities->at(pointID); } return velocity; } - void setVelocities(psSmartPointer> passedVelocities) override { + void setVelocities( + viennaps::SmartPointer> passedVelocities) override { // additional alterations can be made to the velocities here velocities = passedVelocities; } private: - psSmartPointer> velocities = nullptr; + viennaps::SmartPointer> velocities = nullptr; }; diff --git a/examples/holeEtching/holeEtching.cpp b/examples/holeEtching/holeEtching.cpp index 60aa3e13..f2bb3555 100644 --- a/examples/holeEtching/holeEtching.cpp +++ b/examples/holeEtching/holeEtching.cpp @@ -2,56 +2,56 @@ #include #include -#include #include -#include -#include "parameters.hpp" +namespace ps = viennaps; int main(int argc, char *argv[]) { using NumericType = double; constexpr int D = 3; - psLogger::setLogLevel(psLogLevel::INTERMEDIATE); + ps::Logger::setLogLevel(ps::LogLevel::INTERMEDIATE); omp_set_num_threads(16); // Parse the parameters - Parameters params; + ps::utils::Parameters params; if (argc > 1) { - auto config = psUtils::readConfigFile(argv[1]); - if (config.empty()) { - std::cerr << "Empty config provided" << std::endl; - return -1; - } - params.fromMap(config); + params.readConfigFile(argv[1]); + } else { + std::cout << "Usage: " << argv[0] << " " << std::endl; + return 1; } // geometry setup - auto geometry = psSmartPointer>::New(); - psMakeHole( - geometry, params.gridDelta /* grid delta */, params.xExtent /*x extent*/, - params.yExtent /*y extent*/, params.holeRadius /*hole radius*/, - params.maskHeight /* mask height*/, - params.taperAngle /* tapering angle in degrees */, 0 /* base height */, - false /* periodic boundary */, true /*create mask*/, psMaterial::Si) + auto geometry = ps::SmartPointer>::New(); + ps::MakeHole( + geometry, params.get("gridDelta") /* grid delta */, + params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/, + params.get("holeRadius") /*hole radius*/, + params.get("maskHeight") /* mask height*/, + params.get("taperAngle") /* tapering angle in degrees */, + 0 /* base height */, false /* periodic boundary */, true /*create mask*/, + ps::Material::Si) .apply(); // use pre-defined model SF6O2 etching model - auto model = psSmartPointer>::New( - params.ionFlux /*ion flux*/, params.etchantFlux /*etchant flux*/, - params.oxygenFlux /*oxygen flux*/, params.meanEnergy /*mean energy*/, - params.sigmaEnergy /*energy sigma*/, - params.ionExponent /*source power cosine distribution exponent*/, - params.A_O /*oxy sputter yield*/, - params.etchStopDepth /*max etch depth*/); + auto model = ps::SmartPointer>::New( + params.get("ionFlux") /*ion flux*/, + params.get("etchantFlux") /*etchant flux*/, + params.get("oxygenFlux") /*oxygen flux*/, + params.get("meanEnergy") /*mean energy*/, + params.get("sigmaEnergy") /*energy sigma*/, + params.get("ionExponent") /*source power cosine distribution exponent*/, + params.get("A_O") /*oxy sputter yield*/, + params.get("etchStopDepth") /*max etch depth*/); // process setup - psProcess process; + ps::Process process; process.setDomain(geometry); process.setProcessModel(model); process.setMaxCoverageInitIterations(10); - process.setNumberOfRaysPerPoint(params.raysPerPoint); - process.setProcessDuration(params.processTime); + process.setNumberOfRaysPerPoint(params.get("raysPerPoint")); + process.setProcessDuration(params.get("processTime")); // print initial surface geometry->saveSurfaceMesh("initial.vtp"); diff --git a/examples/holeEtching/parameters.hpp b/examples/holeEtching/parameters.hpp deleted file mode 100644 index 43c600b5..00000000 --- a/examples/holeEtching/parameters.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include -#include - -#include - -template struct Parameters { - // Domain - T gridDelta = 5.0; // um - T xExtent = 100.; // um - T yExtent = 100.; // um - - // Geometry - T holeRadius = 20.; // um - T maskHeight = 20.; // um - T taperAngle = 0.; // degree - - // Process - T processTime = 10.; - T ionFlux = 12.; - T etchantFlux = 1.8e3; - T oxygenFlux = 1.0e2; - T meanEnergy = 100; // eV - T sigmaEnergy = 10; // eV - T ionExponent = 200; - T A_O = 2.; - - T etchStopDepth = -1000; - - int raysPerPoint = 1000; - - Parameters() {} - - void fromMap(std::unordered_map &m) { - psUtils::AssignItems( // - m, // - psUtils::Item{"gridDelta", gridDelta}, // - psUtils::Item{"xExtent", xExtent}, // - psUtils::Item{"yExtent", yExtent}, // - psUtils::Item{"holeRadius", holeRadius}, // - psUtils::Item{"maskHeight", maskHeight}, // - psUtils::Item{"taperAngle", taperAngle}, // - psUtils::Item{"processTime", processTime}, // - psUtils::Item{"etchantFlux", etchantFlux}, // - psUtils::Item{"oxygenFlux", oxygenFlux}, // - psUtils::Item{"ionFlux", ionFlux}, // - psUtils::Item{"meanEnergy", meanEnergy}, // - psUtils::Item{"sigmaEnergy", sigmaEnergy}, // - psUtils::Item{"ionExponent", ionExponent}, // - psUtils::Item{"A_O", A_O}, // - psUtils::Item{"etchStopDepth", etchStopDepth}, // - psUtils::Item{"raysPerPoint", raysPerPoint} // - ); - } -}; diff --git a/examples/selectiveEpitaxy/parameters.hpp b/examples/selectiveEpitaxy/parameters.hpp deleted file mode 100644 index 715e3931..00000000 --- a/examples/selectiveEpitaxy/parameters.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#include - -#include - -template struct Parameters { - // Domain - T gridDelta = 0.72; - T xExtent = 40.0; - T yExtent = 80.0; - - // Geometry - T finWidth = 10.0; - T finHeight = 20.0; - T finLength = 60.0; - - // Process - T processTime = 30.; - T epitaxyRate = 10.; - - Parameters() {} - - void fromMap(std::unordered_map &m) { - psUtils::AssignItems( // - m, // - psUtils::Item{"gridDelta", gridDelta}, // - psUtils::Item{"xExtent", xExtent}, // - psUtils::Item{"yExtent", yExtent}, // - psUtils::Item{"finWidth", finWidth}, // - psUtils::Item{"finHeight", finHeight}, // - psUtils::Item{"finLength", finLength}, // - psUtils::Item{"processTime", processTime}, // - psUtils::Item{"epitaxyRate", epitaxyRate} // - ); - } -}; diff --git a/examples/selectiveEpitaxy/selectiveEpitaxy.cpp b/examples/selectiveEpitaxy/selectiveEpitaxy.cpp index 6e59d0c3..39e77580 100644 --- a/examples/selectiveEpitaxy/selectiveEpitaxy.cpp +++ b/examples/selectiveEpitaxy/selectiveEpitaxy.cpp @@ -3,59 +3,60 @@ #include #include -#include "parameters.hpp" +namespace ps = viennaps; int main(int argc, char *argv[]) { using NumericType = double; constexpr int D = 3; // Parse the parameters - Parameters params; + ps::utils::Parameters params; if (argc > 1) { - auto config = psUtils::readConfigFile(argv[1]); - if (config.empty()) { - std::cerr << "Empty config provided" << std::endl; - return -1; - } - params.fromMap(config); + params.readConfigFile(argv[1]); + } else { + std::cout << "Usage: " << argv[0] << " " << std::endl; + return 1; } - auto geometry = psSmartPointer>::New(); + auto geometry = ps::SmartPointer>::New(); // substrate - psMakePlane(geometry, params.gridDelta, params.xExtent, - params.yExtent, 0., false, psMaterial::Mask) + ps::MakePlane(geometry, params.get("gridDelta"), + params.get("xExtent"), params.get("yExtent"), + 0., false, ps::Material::Mask) .apply(); // create fin on substrate { auto fin = - psSmartPointer>::New(geometry->getGrid()); - NumericType minPoint[3] = {-params.finWidth / 2., -params.finLength / 2., - -params.gridDelta}; - NumericType maxPoint[3] = {params.finWidth / 2., params.finLength / 2., - params.finHeight}; + lsSmartPointer>::New(geometry->getGrid()); + NumericType minPoint[3] = {-params.get("finWidth") / 2., + -params.get("finLength") / 2., + -params.get("gridDelta")}; + NumericType maxPoint[3] = {params.get("finWidth") / 2., + params.get("finLength") / 2., + params.get("finHeight")}; if constexpr (D == 2) { - minPoint[1] = -params.gridDelta; - maxPoint[1] = params.finHeight; + minPoint[1] = -params.get("gridDelta"); + maxPoint[1] = params.get("finHeight"); } lsMakeGeometry( - fin, psSmartPointer>::New(minPoint, maxPoint)) + fin, lsSmartPointer>::New(minPoint, maxPoint)) .apply(); - geometry->insertNextLevelSetAsMaterial(fin, psMaterial::Si); + geometry->insertNextLevelSetAsMaterial(fin, ps::Material::Si); geometry->saveSurfaceMesh("fin.vtp"); } // copy top layer to capture deposition - geometry->duplicateTopLevelSet(psMaterial::SiGe); + geometry->duplicateTopLevelSet(ps::Material::SiGe); - auto model = psSmartPointer>::New( - std::vector>{ - {psMaterial::Si, params.epitaxyRate}, - {psMaterial::SiGe, params.epitaxyRate}}); + auto model = ps::SmartPointer>::New( + std::vector>{ + {ps::Material::Si, params.get("epitaxyRate")}, + {ps::Material::SiGe, params.get("epitaxyRate")}}); - psProcess process; + ps::Process process; process.setDomain(geometry); process.setProcessModel(model); - process.setProcessDuration(params.processTime); + process.setProcessDuration(params.get("processTime")); process.setIntegrationScheme( lsIntegrationSchemeEnum::STENCIL_LOCAL_LAX_FRIEDRICHS_1ST_ORDER); diff --git a/examples/trenchDeposition/parameters.hpp b/examples/trenchDeposition/parameters.hpp deleted file mode 100644 index 826aa111..00000000 --- a/examples/trenchDeposition/parameters.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include - -#include - -template struct Parameters { - // Domain - T gridDelta = 0.02; - T xExtent = 1.; - T yExtent = 1.; - - // Geometry - T trenchWidth = 0.4; - T trenchHeight = 0.8; - T taperAngle = 0.; - - // Process - T processTime = 5.; - T rate = 1.; - T stickingProbability = 0.1; - T sourcePower = 1.; - - Parameters() {} - - void fromMap(std::unordered_map &m) { - psUtils::AssignItems( // - m, // - psUtils::Item{"gridDelta", gridDelta}, // - psUtils::Item{"xExtent", xExtent}, // - psUtils::Item{"yExtent", yExtent}, // - psUtils::Item{"trenchWidth", trenchWidth}, // - psUtils::Item{"trenchHeight", trenchHeight}, // - psUtils::Item{"taperAngle", taperAngle}, // - psUtils::Item{"processTime", processTime}, // - psUtils::Item{"rate", rate}, // - psUtils::Item{"stickingProbability", stickingProbability}, // - psUtils::Item{"sourcePower", sourcePower} // - ); - } -}; diff --git a/examples/trenchDeposition/trenchDeposition.cpp b/examples/trenchDeposition/trenchDeposition.cpp index fad60933..fd04b4cd 100644 --- a/examples/trenchDeposition/trenchDeposition.cpp +++ b/examples/trenchDeposition/trenchDeposition.cpp @@ -4,44 +4,43 @@ #include #include -#include "parameters.hpp" +namespace ps = viennaps; int main(int argc, char *argv[]) { using NumericType = double; constexpr int D = 2; // Parse the parameters - Parameters params; + ps::utils::Parameters params; if (argc > 1) { - auto config = psUtils::readConfigFile(argv[1]); - if (config.empty()) { - std::cerr << "Empty config provided" << std::endl; - return -1; - } - params.fromMap(config); + params.readConfigFile(argv[1]); + } else { + std::cout << "Usage: " << argv[0] << " " << std::endl; + return 1; } - auto geometry = psSmartPointer>::New(); - psMakeTrench( - geometry, params.gridDelta /* grid delta */, params.xExtent /*x extent*/, - params.yExtent /*y extent*/, params.trenchWidth /*trench width*/, - params.trenchHeight /*trench height*/, - params.taperAngle /* tapering angle */) + auto geometry = ps::SmartPointer>::New(); + ps::MakeTrench( + geometry, params.get("gridDelta") /* grid delta */, + params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/, + params.get("trenchWidth") /*trench width*/, + params.get("trenchHeight") /*trench height*/, + params.get("taperAngle") /* tapering angle */) .apply(); // copy top layer to capture deposition geometry->duplicateTopLevelSet(); - auto model = psSmartPointer>::New( - params.rate /*deposition rate*/, - params.stickingProbability /*particle sticking probability*/, - params.sourcePower /*particle source power*/); + auto model = ps::SmartPointer>::New( + params.get("rate") /*deposition rate*/, + params.get("stickingProbability") /*particle sticking probability*/, + params.get("sourcePower") /*particle source power*/); - psProcess process; + ps::Process process; process.setDomain(geometry); process.setProcessModel(model); process.setNumberOfRaysPerPoint(1000); - process.setProcessDuration(params.processTime); + process.setProcessDuration(params.get("processTime")); geometry->saveSurfaceMesh("initial.vtp"); diff --git a/include/viennaps/cellSet/csMeanFreePath.hpp b/include/viennaps/cellSet/csMeanFreePath.hpp index 486fe97a..7be5b04d 100644 --- a/include/viennaps/cellSet/csMeanFreePath.hpp +++ b/include/viennaps/cellSet/csMeanFreePath.hpp @@ -1,21 +1,25 @@ #pragma once #include "psDomain.hpp" -#include "psLogger.hpp" #include -template class csMeanFreePath { +namespace viennacs { + +using namespace viennacore; + +template class MeanFreePath { public: - csMeanFreePath() : traceDevice(rtcNewDevice("hugepages=1")) { + MeanFreePath() : traceDevice(rtcNewDevice("hugepages=1")) { static_assert(D == 2 && "Mean free path calculation only implemented for 2D"); } - ~csMeanFreePath() { rtcReleaseDevice(traceDevice); } + ~MeanFreePath() { rtcReleaseDevice(traceDevice); } - void setDomain(const psSmartPointer> passedDomain) { + void + setDomain(const SmartPointer> passedDomain) { domain = passedDomain; } @@ -23,7 +27,7 @@ template class csMeanFreePath { bulkLambda = passedBulkLambda; } - void setMaterial(const psMaterial passedMaterial) { + void setMaterial(const viennaps::Material passedMaterial) { material = passedMaterial; } @@ -52,7 +56,7 @@ template class csMeanFreePath { auto data = cellSet->getScalarData("MeanFreePath"); auto materials = cellSet->getScalarData("Material"); - auto traceGeometry = rayGeometry(); + auto traceGeometry = viennaray::Geometry(); { auto mesh = lsSmartPointer>::New(); lsToDiskMesh(domain->getLevelSets()->back(), mesh) @@ -61,7 +65,8 @@ template class csMeanFreePath { auto normals = mesh->getCellData().getVectorData("Normals"); gridDelta = domain->getGrid().getGridDelta(); traceGeometry.initGeometry(traceDevice, points, *normals, - gridDelta * rayInternal::DiskFactor); + gridDelta * + viennaray::rayInternal::DiskFactor); } auto rtcScene = rtcNewScene(traceDevice); @@ -88,7 +93,7 @@ template class csMeanFreePath { #pragma omp for for (int idx = 0; idx < numCells; ++idx) { - if (!psMaterialMap::isMaterial(materials->at(idx), material)) + if (!viennaps::MaterialMap::isMaterial(materials->at(idx), material)) continue; auto cellCenter = cellSet->getCellCenter(idx); @@ -122,7 +127,7 @@ template class csMeanFreePath { ray.time = 0.0f; #endif - ray.tfar = std::numeric_limits::max(); + ray.tfar = std::numeric_limits::max(); rayHit.hit.instID[0] = RTC_INVALID_GEOMETRY_ID; rayHit.hit.geomID = RTC_INVALID_GEOMETRY_ID; @@ -141,11 +146,11 @@ template class csMeanFreePath { /* -------- Geometry hit -------- */ const auto rayDir = - rayTriple{ray.dir_x, ray.dir_y, ray.dir_z}; + Triple{ray.dir_x, ray.dir_y, ray.dir_z}; auto geomNormal = traceGeometry.getPrimNormal(rayHit.hit.primID); /* -------- Hit at disk backside -------- */ - if (rayInternal::DotProduct(rayDir, geomNormal) > 0) { + if (DotProduct(rayDir, geomNormal) > 0) { continue; } @@ -161,8 +166,8 @@ template class csMeanFreePath { rtcReleaseScene(rtcScene); } - std::array getDirection(const unsigned int idx) { - std::array direction; + Triple getDirection(const unsigned int idx) { + Triple direction; NumericType theta = idx * 2. * M_PI / numRaysPerCell; direction[0] = std::cos(theta); direction[1] = std::sin(theta); @@ -171,12 +176,14 @@ template class csMeanFreePath { } private: - psSmartPointer> domain = nullptr; + SmartPointer> domain = nullptr; RTCDevice traceDevice; NumericType gridDelta = 0; NumericType bulkLambda = 0; NumericType maxLambda = 0.; long numRaysPerCell = 100; - psMaterial material = psMaterial::GAS; + viennaps::Material material = viennaps::Material::GAS; }; + +} // namespace viennacs diff --git a/include/viennaps/cellSet/csPointSource.hpp b/include/viennaps/cellSet/csPointSource.hpp index a0877e92..ce09ea51 100644 --- a/include/viennaps/cellSet/csPointSource.hpp +++ b/include/viennaps/cellSet/csPointSource.hpp @@ -20,8 +20,7 @@ class PointSource : public viennaray::Source { mNumPoints(pNumPoints) {} Pair> - getOriginAndDirection(const size_t idx, - viennaray::RNG &RngState) const override { + getOriginAndDirection(const size_t idx, RNG &rngState) const override { return {origin, direction}; } diff --git a/include/viennaps/cellSet/csTracingKernel.hpp b/include/viennaps/cellSet/csTracingKernel.hpp index 3dcaec8f..d38d6379 100644 --- a/include/viennaps/cellSet/csTracingKernel.hpp +++ b/include/viennaps/cellSet/csTracingKernel.hpp @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -85,11 +84,11 @@ template class TracingKernel { for (long long idx = 0; idx < mNumRays; ++idx) { // particle specific RNG seed auto particleSeed = rayInternal::tea<3>(idx, seed); - viennaray::RNG RngState(particleSeed); + RNG rngState(particleSeed); - particle->initNew(RngState); + particle->initNew(rngState); - auto originAndDirection = mSource->getOriginAndDirection(idx, RngState); + auto originAndDirection = mSource->getOriginAndDirection(idx, rngState); rayInternal::fillRay(rayHit.ray, originAndDirection[0], originAndDirection[1]); @@ -165,7 +164,7 @@ template class TracingKernel { // get fill and reflection const auto fillnDirection = - particle->surfaceHit(rayDir, geomNormal, reflect, RngState); + particle->surfaceHit(rayDir, geomNormal, reflect, rngState); if (mGeometry.getMaterialId(rayHit.hit.primID) != excludeMaterial) { // trace in cell set @@ -185,7 +184,7 @@ template class TracingKernel { while (volumeParticle.energy >= 0) { volumeParticle.distance = -1; while (volumeParticle.distance < 0) - volumeParticle.distance = normalDist(RngState); + volumeParticle.distance = normalDist(rngState); auto travelDist = csUtil::multNew(volumeParticle.direction, volumeParticle.distance); csUtil::add(volumeParticle.position, travelDist); @@ -199,7 +198,7 @@ template class TracingKernel { if (newIdx != volumeParticle.cellId) { volumeParticle.cellId = newIdx; - auto fill = particle->collision(volumeParticle, RngState, + auto fill = particle->collision(volumeParticle, rngState, particleStack); path.addGridData(newIdx, fill); } diff --git a/include/viennaps/cellSet/csTracingParticle.hpp b/include/viennaps/cellSet/csTracingParticle.hpp index 73040c11..3a0d0d08 100644 --- a/include/viennaps/cellSet/csTracingParticle.hpp +++ b/include/viennaps/cellSet/csTracingParticle.hpp @@ -2,7 +2,7 @@ #include "csUtil.hpp" -#include +#include #include namespace viennacs { @@ -14,15 +14,14 @@ template class AbstractParticle { virtual ~AbstractParticle() = default; virtual std::unique_ptr clone() const = 0; - virtual void initNew(viennaray::RNG &Rng) = 0; + virtual void initNew(RNG &rngState) = 0; virtual std::pair> surfaceHit(const Triple &rayDir, const Triple &geomNormal, - bool &reflect, - viennaray::RNG &Rng) = 0; + bool &reflect, RNG &rngState) = 0; virtual T getSourceDistributionPower() const = 0; virtual csPair getMeanFreePath() const = 0; - virtual T collision(csVolumeParticle &particle, viennaray::RNG &RNG, + virtual T collision(csVolumeParticle &particle, RNG &rngState, std::vector> &particleStack) = 0; }; @@ -32,18 +31,18 @@ class Particle : public AbstractParticle { std::unique_ptr> clone() const override final { return std::make_unique(static_cast(*this)); } - virtual void initNew(viennaray::RNG &Rng) override {} + virtual void initNew(RNG &rngState) override {} virtual std::pair> surfaceHit(const Triple &rayDir, const Triple &geomNormal, bool &reflect, - viennaray::RNG &Rng) override { + RNG &rngState) override { reflect = false; return std::pair>{1., Triple{0., 0., 0.}}; } virtual T getSourceDistributionPower() const override { return 1.; } virtual csPair getMeanFreePath() const override { return {1., 1.}; } virtual T - collision(csVolumeParticle &particle, viennaray::RNG &RNG, + collision(csVolumeParticle &particle, RNG &rngState, std::vector> &particleStack) override { return 0.; } diff --git a/include/viennaps/models/psAnisotropicProcess.hpp b/include/viennaps/models/psAnisotropicProcess.hpp index 8e76eb90..7b35f54f 100644 --- a/include/viennaps/models/psAnisotropicProcess.hpp +++ b/include/viennaps/models/psAnisotropicProcess.hpp @@ -95,11 +95,11 @@ class AnisotropicVelocityField : public VelocityField { // Model for an anisotropic process, like selective epitaxy or wet etching. template -class psAnisotropicProcess : public ProcessModel { +class AnisotropicProcess : public ProcessModel { public: // The constructor expects the materials where epitaxy is allowed including // the corresponding rates. - psAnisotropicProcess( + AnisotropicProcess( const std::vector> pMaterials) : materials(pMaterials) { if constexpr (D == 2) { @@ -112,7 +112,7 @@ class psAnisotropicProcess : public ProcessModel { initialize(); } - psAnisotropicProcess( + AnisotropicProcess( const Triple passedDir100, const Triple passedDir010, const NumericType passedR100, const NumericType passedR110, const NumericType passedR111, diff --git a/include/viennaps/models/psFluorocarbonEtching.hpp b/include/viennaps/models/psFluorocarbonEtching.hpp index 668dabfa..24ad44d5 100644 --- a/include/viennaps/models/psFluorocarbonEtching.hpp +++ b/include/viennaps/models/psFluorocarbonEtching.hpp @@ -360,7 +360,7 @@ class FluorocarbonIon const unsigned int primID, const int materialId, viennaray::TracingData &localData, const viennaray::TracingData *globalData, - viennaray::RNG &) override final { + RNG &) override final { // collect data for this hit assert(primID < localData.getVectorData(0).size() && "id out of bounds"); assert(E >= 0 && "Negative energy ion"); @@ -434,7 +434,7 @@ class FluorocarbonIon const Triple &geomNormal, const unsigned int primId, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &Rng) override final { // Small incident angles are reflected with the energy fraction centered at // 0 @@ -463,7 +463,7 @@ class FluorocarbonIon 1., Triple{0., 0., 0.}}; } } - void initNew(viennaray::RNG &RNG) override final { + void initNew(RNG &RNG) override final { std::normal_distribution normalDist{p.Ions.meanEnergy, p.Ions.sigmaEnergy}; do { @@ -492,7 +492,7 @@ class FluorocarbonPolymer const int, viennaray::TracingData &localData, const viennaray::TracingData *, - viennaray::RNG &) override final { + RNG &) override final { // collect data for this hit localData.getVectorData(0)[primID] += rayWeight; } @@ -501,7 +501,7 @@ class FluorocarbonPolymer const Triple &geomNormal, const unsigned int primID, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &Rng) override final { auto direction = viennaray::ReflectionDiffuse(geomNormal, Rng); @@ -537,7 +537,7 @@ class FluorocarbonEtchant const int, viennaray::TracingData &localData, const viennaray::TracingData *, - viennaray::RNG &) override final { + RNG &) override final { // collect data for this hit localData.getVectorData(0)[primID] += rayWeight; } @@ -546,7 +546,7 @@ class FluorocarbonEtchant const Triple &geomNormal, const unsigned int primID, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &Rng) override final { auto direction = viennaray::ReflectionDiffuse(geomNormal, Rng); diff --git a/include/viennaps/models/psIonBeamEtching.hpp b/include/viennaps/models/psIonBeamEtching.hpp index 0560d10f..4b260704 100644 --- a/include/viennaps/models/psIonBeamEtching.hpp +++ b/include/viennaps/models/psIonBeamEtching.hpp @@ -84,10 +84,10 @@ class IBEIon : public viennaray::Particle, NumericType> { void surfaceCollision(NumericType rayWeight, const Triple &rayDir, const Triple &geomNormal, - const unsigned int primID, const int materialId, + const unsigned int primID, const int, viennaray::TracingData &localData, - const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + const viennaray::TracingData *, + RNG &) override final { NumericType cosTheta = -DotProduct(rayDir, geomNormal); localData.getVectorData(0)[primID] += @@ -100,7 +100,7 @@ class IBEIon : public viennaray::Particle, NumericType> { const Triple &geomNormal, const unsigned int primID, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &rngState) override final { // Small incident angles are reflected with the energy fraction centered at // 0 @@ -117,13 +117,13 @@ class IBEIon : public viennaray::Particle, NumericType> { std::normal_distribution normalDist(Eref_peak * energy_, 0.1 * energy_); do { - newEnergy = normalDist(Rng); + newEnergy = normalDist(rngState); } while (newEnergy > energy_ || newEnergy < 0.); if (newEnergy > params_.thresholdEnergy) { energy_ = newEnergy; auto direction = viennaray::ReflectionConedCosine( - rayDir, geomNormal, Rng, std::max(incAngle, minAngle_)); + rayDir, geomNormal, rngState, std::max(incAngle, minAngle_)); return std::pair>{0., direction}; } else { return std::pair>{ @@ -131,9 +131,9 @@ class IBEIon : public viennaray::Particle, NumericType> { } } - void initNew(viennaray::RNG &RNG) override final { + void initNew(RNG &rngState) override final { do { - energy_ = normalDist_(RNG); + energy_ = normalDist_(rngState); } while (energy_ < params_.thresholdEnergy); } diff --git a/include/viennaps/models/psPlasmaDamage.hpp b/include/viennaps/models/psPlasmaDamage.hpp index 0ae511b0..c6385470 100644 --- a/include/viennaps/models/psPlasmaDamage.hpp +++ b/include/viennaps/models/psPlasmaDamage.hpp @@ -18,11 +18,11 @@ class PlasmaDamageIon : public viennacs::Particle, T> { const T passedMeanFreePath = 1.) : meanIonEnergy(passedMeanEnergy), meanFreePath(passedMeanFreePath) {} - void initNew(viennaray::RNG &RNG) override final { + void initNew(RNG &rngState) override final { std::uniform_real_distribution uniDist; do { - const auto rand1 = uniDist(RNG); - const auto rand2 = uniDist(RNG); + const auto rand1 = uniDist(rngState); + const auto rand2 = uniDist(rngState); E = std::cos(M_PI * 2 * rand1) * std::sqrt(-2. * std::log(rand2)) * deltaIonEnergy + meanIonEnergy; @@ -31,7 +31,7 @@ class PlasmaDamageIon : public viennacs::Particle, T> { std::pair> surfaceHit(const Triple &rayDir, const Triple &geomNormal, bool &reflect, - viennaray::RNG &Rng) override final { + RNG &rngState) override final { auto cosTheta = -rayInternal::DotProduct(rayDir, geomNormal); const T incAngle = std::acos(std::max(std::min(cosTheta, T(1)), T(0))); std::uniform_real_distribution uniDist; @@ -53,8 +53,8 @@ class PlasmaDamageIon : public viennacs::Particle, T> { T NewEnergy; do { - const auto rand1 = uniDist(Rng); - const auto rand2 = uniDist(Rng); + const auto rand1 = uniDist(rngState); + const auto rand2 = uniDist(rngState); NewEnergy = tempEnergy + (std::min((E - tempEnergy), tempEnergy) + E * 0.05) * (1 - 2. * rand1) * std::sqrt(std::fabs(std::log(rand2))); @@ -65,7 +65,7 @@ class PlasmaDamageIon : public viennacs::Particle, T> { if (NewEnergy > minEnergy) { reflect = true; auto direction = viennaray::ReflectionConedCosine( - rayDir, geomNormal, Rng, std::min(incAngle, minAngle)); + rayDir, geomNormal, rngState, std::min(incAngle, minAngle)); E = NewEnergy; return std::pair>{impactEnergy, direction}; } else { @@ -74,7 +74,7 @@ class PlasmaDamageIon : public viennacs::Particle, T> { } } - T collision(csVolumeParticle &particle, viennaray::RNG &RNG, + T collision(csVolumeParticle &particle, RNG &rngState, std::vector> &particleStack) override final { T fill = 0.; @@ -91,7 +91,7 @@ class PlasmaDamageIon : public viennacs::Particle, T> { if (particle.scattered < maxScatter) { std::uniform_int_distribution<> particleDist(1, maxScatter - particle.scattered); - numParticles = particleDist(RNG); + numParticles = particleDist(rngState); } for (int i = 0; i < numParticles; i++) { @@ -99,9 +99,9 @@ class PlasmaDamageIon : public viennacs::Particle, T> { csTriple direction; do { // random direction - direction[0] = negUniDist(RNG); - direction[1] = negUniDist(RNG); - direction[2] = negUniDist(RNG); + direction[0] = negUniDist(rngState); + direction[1] = negUniDist(rngState); + direction[2] = negUniDist(rngState); // normalize tmp = csUtil::norm(direction); diff --git a/include/viennaps/models/psSF6O2Etching.hpp b/include/viennaps/models/psSF6O2Etching.hpp index 17ca6d43..8e2215f6 100644 --- a/include/viennaps/models/psSF6O2Etching.hpp +++ b/include/viennaps/models/psSF6O2Etching.hpp @@ -196,7 +196,7 @@ class SF6O2Ion const unsigned int primID, const int materialId, viennaray::TracingData &localData, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &) override final { // collect data for this hit assert(primID < localData.getVectorData(0).size() && "id out of bounds"); @@ -255,7 +255,7 @@ class SF6O2Ion const Triple &geomNormal, const unsigned int primId, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &Rng) override final { auto cosTheta = -DotProduct(rayDir, geomNormal); assert(cosTheta >= 0 && "Hit backside of disc"); @@ -293,11 +293,11 @@ class SF6O2Ion 1., Triple{0., 0., 0.}}; } } - void initNew(viennaray::RNG &RNG) override final { + void initNew(RNG &rngState) override final { std::normal_distribution normalDist{params.Ions.meanEnergy, params.Ions.sigmaEnergy}; do { - E = normalDist(RNG); + E = normalDist(rngState); } while (E <= 0.); } NumericType getSourceDistributionPower() const override final { @@ -321,13 +321,12 @@ class SF6O2Etchant public: SF6O2Etchant(const SF6O2Parameters &pParams) : params(pParams) {} - void surfaceCollision(NumericType rayWeight, - const Triple &rayDir, - const Triple &geomNormal, - const unsigned int primID, const int materialId, + void surfaceCollision(NumericType rayWeight, const Triple &, + const Triple &, const unsigned int primID, + const int, viennaray::TracingData &localData, - const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + const viennaray::TracingData *, + RNG &) override final { localData.getVectorData(0)[primID] += rayWeight; } std::pair> @@ -335,7 +334,7 @@ class SF6O2Etchant const Triple &geomNormal, const unsigned int primID, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &rngState) override final { // F surface coverage const auto &phi_F = globalData->getVectorData(0)[primID]; @@ -348,7 +347,7 @@ class SF6O2Etchant NumericType S_eff = beta * std::max(1. - phi_F - phi_O, 0.); auto direction = - viennaray::ReflectionDiffuse(geomNormal, Rng); + viennaray::ReflectionDiffuse(geomNormal, rngState); return std::pair>{S_eff, direction}; } NumericType getSourceDistributionPower() const override final { return 1.; } @@ -365,13 +364,12 @@ class SF6O2Oxygen public: SF6O2Oxygen(const SF6O2Parameters &pParams) : params(pParams) {} - void surfaceCollision(NumericType rayWeight, - const Triple &rayDir, - const Triple &geomNormal, - const unsigned int primID, const int materialId, + void surfaceCollision(NumericType rayWeight, const Triple &, + const Triple &, const unsigned int primID, + const int, viennaray::TracingData &localData, - const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + const viennaray::TracingData *, + RNG &) override final { // Rate is normalized by dividing with the local sticking coefficient localData.getVectorData(0)[primID] += rayWeight; } @@ -380,7 +378,7 @@ class SF6O2Oxygen const Triple &geomNormal, const unsigned int primID, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &rngState) override final { NumericType S_eff; const auto &phi_F = globalData->getVectorData(0)[primID]; @@ -391,7 +389,7 @@ class SF6O2Oxygen S_eff = beta * std::max(1. - phi_O - phi_F, 0.); auto direction = - viennaray::ReflectionDiffuse(geomNormal, Rng); + viennaray::ReflectionDiffuse(geomNormal, rngState); return std::pair>{S_eff, direction}; } NumericType getSourceDistributionPower() const override final { return 1.; } diff --git a/include/viennaps/models/psSingleParticleProcess.hpp b/include/viennaps/models/psSingleParticleProcess.hpp index 69e61fed..41e412a7 100644 --- a/include/viennaps/models/psSingleParticleProcess.hpp +++ b/include/viennaps/models/psSingleParticleProcess.hpp @@ -56,27 +56,25 @@ class SingleParticle SingleParticle(NumericType sticking, NumericType sourcePower) : stickingProbability_(sticking), sourcePower_(sourcePower) {} - void surfaceCollision(NumericType rayWeight, - const Triple &rayDir, - const Triple &geomNormal, - const unsigned int primID, const int materialId, + void surfaceCollision(NumericType rayWeight, const Triple &, + const Triple &, const unsigned int primID, + const int, viennaray::TracingData &localData, - const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + const viennaray::TracingData *, + RNG &) override final { localData.getVectorData(0)[primID] += rayWeight; } std::pair> - surfaceReflection(NumericType rayWeight, const Triple &rayDir, - const Triple &geomNormal, - const unsigned int primID, const int materialId, - const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + surfaceReflection(NumericType, const Triple &, + const Triple &geomNormal, const unsigned int, + const int, const viennaray::TracingData *, + RNG &rngState) override final { auto direction = - viennaray::ReflectionDiffuse(geomNormal, Rng); + viennaray::ReflectionDiffuse(geomNormal, rngState); return std::pair>{stickingProbability_, direction}; } - void initNew(viennaray::RNG &RNG) override final {} + void initNew(RNG &) override final {} NumericType getSourceDistributionPower() const override final { return sourcePower_; } diff --git a/include/viennaps/models/psTEOSDeposition.hpp b/include/viennaps/models/psTEOSDeposition.hpp index c78a5b6d..f5adbea2 100644 --- a/include/viennaps/models/psTEOSDeposition.hpp +++ b/include/viennaps/models/psTEOSDeposition.hpp @@ -109,11 +109,11 @@ class SingleTEOSParticle : stickingProbability(pStickingProbability), reactionOrder(pReactionOrder), dataLabel(pDataLabel) {} std::pair> - surfaceReflection(NumericType rayWeight, const Triple &rayDir, + surfaceReflection(NumericType, const Triple &, const Triple &geomNormal, - const unsigned int primID, const int materialId, + const unsigned int primID, const int, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &rngState) override final { const auto &cov = globalData->getVectorData(0)[primID]; NumericType sticking; if (cov > 0.) { @@ -128,16 +128,15 @@ class SingleTEOSParticle } } auto direction = - viennaray::ReflectionDiffuse(geomNormal, Rng); + viennaray::ReflectionDiffuse(geomNormal, rngState); return std::pair>{sticking, direction}; } - void surfaceCollision(NumericType rayWeight, - const Triple &rayDir, - const Triple &geomNormal, - const unsigned int primID, const int materialId, + void surfaceCollision(NumericType rayWeight, const Triple &, + const Triple &, const unsigned int primID, + const int, viennaray::TracingData &localData, - const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + const viennaray::TracingData *, + RNG &) override final { localData.getVectorData(0)[primID] += rayWeight; } NumericType getSourceDistributionPower() const override final { return 1; } @@ -163,7 +162,7 @@ class MultiTEOSParticle const Triple &geomNormal, const unsigned int primID, const int materialId, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &Rng) override final { auto direction = viennaray::ReflectionDiffuse(geomNormal, Rng); return std::pair>{stickingProbability, @@ -175,7 +174,7 @@ class MultiTEOSParticle const unsigned int primID, const int materialId, viennaray::TracingData &localData, const viennaray::TracingData *globalData, - viennaray::RNG &Rng) override final { + RNG &Rng) override final { localData.getVectorData(0)[primID] += rayWeight; } NumericType getSourceDistributionPower() const override final { return 1; } diff --git a/include/viennaps/psExtrude.hpp b/include/viennaps/psExtrude.hpp index 61a6e611..1971eeac 100644 --- a/include/viennaps/psExtrude.hpp +++ b/include/viennaps/psExtrude.hpp @@ -5,31 +5,34 @@ #include #include -template class psExtrude { - psSmartPointer> inputDomain; - psSmartPointer> outputDomain; +namespace viennaps { + +using namespace viennacore; + +template class Extrude { + SmartPointer> inputDomain; + SmartPointer> outputDomain; std::array extent = {0., 0.}; int extrudeDim = 0; std::array, 3> boundaryConds; public: - psExtrude() {} - psExtrude(psSmartPointer> &passedInputDomain, - psSmartPointer> &passedOutputDomain, - std::array passedExtent, const int passedExtrudeDim, - std::array, 3> passedBoundaryConds) + Extrude() {} + Extrude(SmartPointer> &passedInputDomain, + SmartPointer> &passedOutputDomain, + std::array passedExtent, const int passedExtrudeDim, + std::array, 3> passedBoundaryConds) : inputDomain(passedInputDomain), outputDomain(passedOutputDomain), extent(passedExtent), extrudeDim(passedExtrudeDim), boundaryConds(passedBoundaryConds) {} - void - setInputDomain(lsSmartPointer> passedInputDomain) { + void setInputDomain(SmartPointer> passedInputDomain) { inputDomain = passedInputDomain; } // The 3D output domain will be overwritten by the extruded domain - void setOutputDomain( - lsSmartPointer> &passedOutputDomain) { + void + setOutputDomain(SmartPointer> &passedOutputDomain) { outputDomain = passedOutputDomain; } @@ -56,13 +59,13 @@ template class psExtrude { void apply() { if (inputDomain == nullptr) { - lsMessage::getInstance() - .addWarning("No input domain supplied to psExtrude! Not converting.") + Logger::getInstance() + .addWarning("No input domain supplied to Extrude! Not converting.") .print(); } if (outputDomain == nullptr) { - lsMessage::getInstance() - .addWarning("No output domain supplied to psExtrude! Not converting.") + Logger::getInstance() + .addWarning("No output domain supplied to Extrude! Not converting.") .print(); return; } @@ -71,15 +74,15 @@ template class psExtrude { outputDomain->clear(); for (std::size_t i = 0; i < inputDomain->getLevelSets()->size(); i++) { - auto tmpLS = psSmartPointer>::New(); + auto tmpLS = lsSmartPointer>::New(); lsExtrude(inputDomain->getLevelSets()->at(i), tmpLS, extent, extrudeDim, boundaryConds) .apply(); if (psLogger::getLogLevel() >= 5) { - auto mesh = psSmartPointer>::New(); + auto mesh = lsSmartPointer>::New(); lsToMesh(tmpLS, mesh).apply(); - psVTKWriter(mesh, + lsVTKWriter(mesh, "extrude_layer_" + std::to_string(i) + ".vtp") .apply(); } @@ -93,3 +96,5 @@ template class psExtrude { } } }; + +} // namespace viennaps diff --git a/include/viennaps/psMeanFreePath.hpp b/include/viennaps/psMeanFreePath.hpp index 8c29683c..c79fc222 100644 --- a/include/viennaps/psMeanFreePath.hpp +++ b/include/viennaps/psMeanFreePath.hpp @@ -3,18 +3,23 @@ #include "compact/psKDTree.hpp" #include "psDomain.hpp" -#include "psLogger.hpp" -#include "psUtils.hpp" -#include #include #include -template class psMeanFreePath { +#include +#include +#include + +namespace viennaps { + +using namespace viennacore; + +template class MeanFreePath { public: - psMeanFreePath() {} + MeanFreePath() {} - void setDomain(const psSmartPointer> passedDomain) { + void setDomain(const SmartPointer> passedDomain) { domain = passedDomain; cellSet = domain->getCellSet(); numCells = cellSet->getNumberOfCells(); @@ -26,9 +31,7 @@ template class psMeanFreePath { bulkLambda = passedBulkLambda; } - void setMaterial(const psMaterial passedMaterial) { - material = passedMaterial; - } + void setMaterial(const Material passedMaterial) { material = passedMaterial; } void setNumRaysPerCell(const NumericType passedNumRaysPerCell) { numRaysPerCell = passedNumRaysPerCell; @@ -45,7 +48,7 @@ template class psMeanFreePath { void enableSmoothing() { smoothing = true; } void apply() { - psLogger::getInstance().addInfo("Calculating mean free path ...").print(); + Logger::getInstance().addInfo("Calculating mean free path ...").print(); initGeometry(); runKernel(); } @@ -69,8 +72,8 @@ template class psMeanFreePath { #pragma omp for schedule(dynamic) for (long long idx = 0; idx < numRays; ++idx) { - if (threadNum == 0 && psLogger::getLogLevel() >= 4) { - psUtils::printProgress(idx, numRays); + if (threadNum == 0 && Logger::getLogLevel() >= 4) { + PrintProgress(idx, numRays); #ifdef VIENNAPS_PYTHON_BUILD if (PyErr_CheckSignals() != 0) throw pybind11::error_already_set(); @@ -78,11 +81,11 @@ template class psMeanFreePath { } // particle specific RNG seed - auto particleSeed = rayInternal::tea<3>(idx, seed); - rayRNG RngState(particleSeed); + auto particleSeed = tea<3>(idx, seed); + RNG RngState(particleSeed); auto pointIdx = pointDist(RngState); - auto direction = rayReflectionDiffuse( + auto direction = viennaray::ReflectionDiffuse( surfaceNormals[pointIdx], RngState); auto cellIdx = getStartingCell(surfacePoints[pointIdx]); auto origin = cellSet->getCellCenter(cellIdx); @@ -112,7 +115,7 @@ template class psMeanFreePath { continue; } - if (!psMaterialMap::isMaterial(materialIds->at(n), material)) { + if (!MaterialMap::isMaterial(materialIds->at(n), material)) { hitState = true; // could be a hit continue; } @@ -174,7 +177,7 @@ template class psMeanFreePath { // material reflection auto closestSurfacePoint = kdTree.findNearest(origin); assert(closestSurfacePoint->second < gridDelta); - direction = rayReflectionDiffuse( + direction = viennaray::ReflectionDiffuse( surfaceNormals[closestSurfacePoint->first], RngState); } } @@ -213,7 +216,7 @@ template class psMeanFreePath { materialIds = cellSet->getScalarData("Material"); #pragma omp parallel for for (int i = 0; i < numCells; i++) { - if (!psMaterialMap::isMaterial(materialIds->at(i), material)) + if (!MaterialMap::isMaterial(materialIds->at(i), material)) continue; if (smoothing) { @@ -221,7 +224,7 @@ template class psMeanFreePath { NumericType sum = 0; unsigned count = 0; for (const auto &n : neighbors) { - if (n < 0 || !psMaterialMap::isMaterial(materialIds->at(n), material)) + if (n < 0 || !MaterialMap::isMaterial(materialIds->at(n), material)) continue; sum += result[n]; count++; @@ -233,7 +236,7 @@ template class psMeanFreePath { } } - if (psLogger::getLogLevel() >= 4) { + if (Logger::getLogLevel() >= 4) { std::cout << std::endl; } } @@ -252,20 +255,20 @@ template class psMeanFreePath { numRays = static_cast(numCells * numRaysPerCell); } - int getStartingCell(const rayTriple &origin) const { + int getStartingCell(const Triple &origin) const { int cellIdx = cellSet->getIndex(origin); if (cellIdx < 0) { - psLogger::getInstance() + Logger::getInstance() .addError("No starting cell found for ray " + std::to_string(origin[0]) + " " + std::to_string(origin[1]) + " " + std::to_string(origin[2])) .print(); } - if (!psMaterialMap::isMaterial(materialIds->at(cellIdx), material)) { + if (!MaterialMap::isMaterial(materialIds->at(cellIdx), material)) { const auto &neighbors = cellSet->getNeighbors(cellIdx); for (const auto &n : neighbors) { - if (n >= 0 && psMaterialMap::isMaterial(materialIds->at(n), material)) { + if (n >= 0 && MaterialMap::isMaterial(materialIds->at(n), material)) { cellIdx = n; break; } @@ -275,12 +278,12 @@ template class psMeanFreePath { } // https://gamedev.stackexchange.com/a/18459 - static bool intersectLineBox(const rayTriple &origin, - const rayTriple &direction, - const rayTriple &min, - const rayTriple &max, + static bool intersectLineBox(const Triple &origin, + const Triple &direction, + const Triple &min, + const Triple &max, NumericType &distance) { - rayTriple t1, t2; + Triple t1, t2; for (int i = 0; i < D; ++i) { // direction is inverted t1[i] = (min[i] - origin[i]) * direction[i]; @@ -306,8 +309,7 @@ template class psMeanFreePath { return false; } - static void randomDirection(rayTriple &direction, - rayRNG &rngState) { + static void randomDirection(Triple &direction, RNG &rngState) { std::uniform_real_distribution dist(-1, 1); for (int i = 0; i < D; ++i) { direction[i] = dist(rngState); @@ -316,9 +318,9 @@ template class psMeanFreePath { } private: - psSmartPointer> domain = nullptr; - psSmartPointer> cellSet = nullptr; - psKDTree> kdTree; + SmartPointer> domain = nullptr; + SmartPointer> cellSet = nullptr; + KDTree> kdTree; std::vector *materialIds; std::vector> surfaceNormals; @@ -333,5 +335,7 @@ template class psMeanFreePath { long long numRays = 0; NumericType numRaysPerCell = 1000; bool smoothing = true; - psMaterial material = psMaterial::GAS; + Material material = Material::GAS; }; + +} // namespace viennaps diff --git a/include/viennaps/psPlanarize.hpp b/include/viennaps/psPlanarize.hpp index 82f6925d..14bdf1b2 100644 --- a/include/viennaps/psPlanarize.hpp +++ b/include/viennaps/psPlanarize.hpp @@ -5,17 +5,21 @@ #include #include -template class psPlanarize { - psSmartPointer> pDomain_; +namespace viennaps { + +using namespace viennacore; + +template class Planarize { + SmartPointer> pDomain_; NumericType cutoffPosition_ = 0.; public: - psPlanarize() {} - psPlanarize(psSmartPointer> domain, - const NumericType passedCutoff) + Planarize() {} + Planarize(SmartPointer> domain, + const NumericType passedCutoff) : pDomain_(domain), cutoffPosition_(passedCutoff) {} - void setDomain(psSmartPointer> domain) { + void setDomain(SmartPointer> domain) { pDomain_ = domain; } @@ -37,3 +41,5 @@ template class psPlanarize { plane, lsBooleanOperationEnum::RELATIVE_COMPLEMENT); } }; + +} // namespace viennaps diff --git a/include/viennaps/psProcess.hpp b/include/viennaps/psProcess.hpp index 3bab0e20..24ac1b8c 100644 --- a/include/viennaps/psProcess.hpp +++ b/include/viennaps/psProcess.hpp @@ -133,7 +133,7 @@ template class Process { rayBoundaryCondition[i] = viennaray::BoundaryCondition::IGNORE; } else { for (unsigned i = 0; i < D; ++i) - rayBoundaryCondition[i] = psUtils::convertBoundaryCondition( + rayBoundaryCondition[i] = utils::convertBoundaryCondition( domain->getGrid().getBoundaryConditions(i)); } rayTracer.setSourceDirection(sourceDirection); @@ -150,7 +150,7 @@ template class Process { if (primaryDirection) { Logger::getInstance() .addInfo("Using primary direction: " + - psUtils::arrayToString(primaryDirection.value())) + utils::arrayToString(primaryDirection.value())) .print(); rayTracer.setPrimaryDirection(primaryDirection.value()); } @@ -278,7 +278,7 @@ template class Process { rayBoundaryCondition[i] = viennaray::BoundaryCondition::IGNORE; } else { for (unsigned i = 0; i < D; ++i) - rayBoundaryCondition[i] = psUtils::convertBoundaryCondition( + rayBoundaryCondition[i] = utils::convertBoundaryCondition( domain->getGrid().getBoundaryConditions(i)); } @@ -290,7 +290,7 @@ template class Process { if (primaryDirection) { Logger::getInstance() .addInfo("Using primary direction: " + - psUtils::arrayToString(primaryDirection.value())) + utils::arrayToString(primaryDirection.value())) .print(); rayTracer.setPrimaryDirection(primaryDirection.value()); } diff --git a/include/viennaps/psTestAssert.hpp b/include/viennaps/psTestAssert.hpp deleted file mode 100644 index 00ad0fb3..00000000 --- a/include/viennaps/psTestAssert.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include -#include - -#define PSTEST_ASSERT(condition) assert(condition) - -#define PSRUN_3D_TESTS \ - psRunTest(); \ - psRunTest(); - -#define PSRUN_2D_TESTS \ - psRunTest(); \ - psRunTest(); - -#define PSRUN_ALL_TESTS \ - psRunTest(); \ - psRunTest(); \ - psRunTest(); \ - psRunTest(); diff --git a/include/viennaps/psToSurfaceMesh.hpp b/include/viennaps/psToSurfaceMesh.hpp deleted file mode 100644 index b8644914..00000000 --- a/include/viennaps/psToSurfaceMesh.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "psDomain.hpp" - -#include - -template class psToSurfaceMesh { -private: - lsToSurfaceMesh meshConverter; - -public: - psToSurfaceMesh(const psSmartPointer> passedDomain, - lsSmartPointer> passedMesh, double eps = 1e-12) - : meshConverter(passedDomain->getLevelSets()->back(), passedMesh, eps) {} - - void apply() { meshConverter.apply(); } - - void setDomain(const psSmartPointer> passedDomain) { - meshConverter.setLevelSet(passedDomain->getLevelSets()->back()); - } - - void setMesh(psSmartPointer> passedMesh) { - meshConverter.setMesh(passedMesh); - } -}; diff --git a/include/viennaps/psUtils.hpp b/include/viennaps/psUtils.hpp index 7ee43f78..5f1f1910 100644 --- a/include/viennaps/psUtils.hpp +++ b/include/viennaps/psUtils.hpp @@ -13,7 +13,9 @@ #include #include -namespace psUtils { +namespace viennaps { + +namespace utils { // Checks if a string starts with a - or not [[nodiscard]] inline bool isSigned(const std::string &s) { @@ -115,7 +117,7 @@ parseConfigStream(std::istream &input) { // Opens a file and forwards its stream to the config stream parser. inline std::unordered_map -readConfigFile(const std::string &filename) { +readFile(const std::string &filename) { std::ifstream f(filename); if (!f.is_open()) { std::cout << "Failed to open config file '" << filename << "'\n"; @@ -185,9 +187,7 @@ std::string arrayToString(const std::array arr) { struct Parameters { std::unordered_map m; - void readConfigFile(const std::string &fileName) { - m = psUtils::readConfigFile(fileName); - } + void readConfigFile(const std::string &fileName) { m = readFile(fileName); } template [[nodiscard]] T get(const std::string &key) const { @@ -222,4 +222,5 @@ convertBoundaryCondition(lsBoundaryConditionEnum originalBoundaryCondition) { return viennaray::BoundaryCondition::IGNORE; } -}; // namespace psUtils +}; // namespace utils +} // namespace viennaps diff --git a/include/viennaps/psWriteVisualizationMesh.hpp b/include/viennaps/psWriteVisualizationMesh.hpp deleted file mode 100644 index 0e7f89cb..00000000 --- a/include/viennaps/psWriteVisualizationMesh.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include "psDomain.hpp" - -#include -#include - -template class psWriteVisualizationMesh { -public: - psWriteVisualizationMesh() {} - psWriteVisualizationMesh( - psSmartPointer> passedDomain, - std::string passedFileName) - : domain(passedDomain), fileName(std::move(passedFileName)) {} - - void apply() { - lsWriteVisualizationMesh visMesh; - visMesh.setFileName(fileName); - for (auto ls : *domain->getLevelSets()) { - visMesh.insertNextLevelSet(ls); - } - if (domain->getMaterialMap()) - visMesh.setMaterialMap(domain->getMaterialMap()->getMaterialMap()); - visMesh.apply(); - } - - void setFileName(std::string passedFileName) { - fileName = std::move(passedFileName); - } - - void setDomain(psSmartPointer> passedDomain) { - domain = passedDomain; - } - -private: - psSmartPointer> domain; - std::string fileName; -}; diff --git a/tests/logger/logger.cpp b/tests/logger/logger.cpp index 600a0da3..39d496f4 100644 --- a/tests/logger/logger.cpp +++ b/tests/logger/logger.cpp @@ -1,5 +1,7 @@ -#include #include +#include + +#include using namespace viennacore; @@ -9,33 +11,33 @@ int main() { std::stringstream ss; logger.setLogLevel(LogLevel::TIMING); - PSTEST_ASSERT(logger.getLogLevel() == 3); + VC_TEST_ASSERT(logger.getLogLevel() == 3); logger.setLogLevel(LogLevel::DEBUG); logger.addDebug("Debug message"); logger.print(ss); - PSTEST_ASSERT(ss.str() == " DEBUG: Debug message\n"); + VC_TEST_ASSERT(ss.str() == " DEBUG: Debug message\n"); ss.str(""); logger.setLogLevel(LogLevel::TIMING); logger.addTiming("Timing message", 1.23); logger.print(ss); - PSTEST_ASSERT(ss.str().find(" Timing message: 1.23") == 0); + VC_TEST_ASSERT(ss.str().find(" Timing message: 1.23") == 0); ss.str(""); logger.setLogLevel(LogLevel::INFO); logger.addInfo("Info message"); logger.print(ss); - PSTEST_ASSERT(ss.str() == " Info message\n"); + VC_TEST_ASSERT(ss.str() == " Info message\n"); ss.str(""); logger.setLogLevel(LogLevel::WARNING); logger.addWarning("Warning message"); logger.print(ss); - PSTEST_ASSERT(ss.str() == "\n WARNING: Warning message\n"); + VC_TEST_ASSERT(ss.str() == "\n WARNING: Warning message\n"); ss.str(""); } diff --git a/tests/processModel/processModel.cpp b/tests/processModel/processModel.cpp index e2e5ad7e..8a1fe8bd 100644 --- a/tests/processModel/processModel.cpp +++ b/tests/processModel/processModel.cpp @@ -84,7 +84,7 @@ template void RunTest() { // anisotropic model { - auto model = SmartPointer>::New( + auto model = SmartPointer>::New( std::vector>{}); VC_TEST_ASSERT(model->getSurfaceModel()); VC_TEST_ASSERT(model->getVelocityField());