Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions examples/DRAMWiggling/DRAMWiggling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ int main(int argc, char **argv) {
using NumericType = double;
constexpr int D = 3;

Logger::setLogLevel(LogLevel::INFO);
omp_set_num_threads(12);

// Parse the parameters
util::Parameters params;
if (argc > 1) {
Expand Down Expand Up @@ -59,25 +62,30 @@ int main(int argc, char **argv) {
RayTracingParameters rayParams;
rayParams.raysPerPoint = params.get<int>("raysPerPoint");

const std::string fluxEngineStr = params.get<std::string>("fluxEngine");
const auto fluxEngine = util::convertFluxEngineType(fluxEngineStr);

CoverageParameters coverageParams;
coverageParams.maxIterations = 10;
coverageParams.tolerance = 1e-5;

// Process setup
Process<NumericType, D> process(geometry, model, params.get("processTime"));
process.setParameters(advectionParams);
process.setParameters(rayParams);
process.setParameters(coverageParams);

process.setFluxEngineType(fluxEngine);
// print initial surface
geometry->saveSurfaceMesh("DRAM_Initial.vtp");
geometry->saveSurfaceMesh("DRAM_Initial_" + fluxEngineStr + ".vtp");

const int numSteps = params.get("numSteps");
for (int i = 0; i < numSteps; ++i) {
process.apply();
geometry->saveSurfaceMesh("DRAM_Etched_" + std::to_string(i + 1) + ".vtp");
geometry->saveSurfaceMesh("DRAM_Etched_" + fluxEngineStr + "_" +
std::to_string(i + 1) + ".vtp");
}

geometry->saveHullMesh("DRAM_Final");
geometry->saveHullMesh("DRAM_Final_" + fluxEngineStr);

return 0;
}
20 changes: 14 additions & 6 deletions examples/DRAMWiggling/DRAMWiggling.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
# Add plane
ps.MakePlane(geometry, 0.0, ps.Material.Si, True).apply()

# print intermediate output surfaces during the process
ps.Logger.setLogLevel(ps.LogLevel.INFO)

ps.Length.setUnit(params["lengthUnit"])
ps.Time.setUnit(params["timeUnit"])

Expand All @@ -46,33 +49,38 @@
modelParams.Ions.sigmaEnergy = params["sigmaEnergy"]
modelParams.Ions.exponent = params["ionExponent"]
modelParams.Ions.n_l = 200
modelParams.Substrate.B_sp = 0.75
model = ps.HBrO2Etching(modelParams)

coverageParameters = ps.CoverageParameters()
coverageParameters.maxIterations = 10
coverageParameters.tolerance = 1e-5

rayTracingParams = ps.RayTracingParameters()
rayTracingParams.raysPerPoint = int(params["raysPerPoint"])

advectionParams = ps.AdvectionParameters()
advectionParams.spatialScheme = ps.util.convertSpatialScheme(params["spatialScheme"])
advectionParams.spatialScheme = ps.util.convertSpatialScheme(
params["spatialScheme"]
)

fluxEngineStr = params["fluxEngine"]
fluxEngine = ps.util.convertFluxEngineType(fluxEngineStr)

# process setup
process = ps.Process(geometry, model)
process.setProcessDuration(params["processTime"]) # seconds
process.setParameters(coverageParameters)
process.setParameters(rayTracingParams)
process.setParameters(advectionParams)
process.setFluxEngineType(fluxEngine)

# print initial surface
geometry.saveSurfaceMesh(filename="DRAM_Initial.vtp")
geometry.saveSurfaceMesh(filename=f"DRAM_Initial_{fluxEngineStr}.vtp")

numSteps = int(params["numSteps"])
for i in range(numSteps):
# run the process
process.apply()
geometry.saveSurfaceMesh(filename=f"DRAM_Etched_{i + 1}.vtp")
geometry.saveSurfaceMesh(filename=f"DRAM_Etched_{fluxEngineStr}_{i + 1}.vtp")

# print final volume
geometry.saveHullMesh("DRAM_Final")
geometry.saveHullMesh(f"DRAM_Final_{fluxEngineStr}")
2 changes: 2 additions & 0 deletions examples/DRAMWiggling/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ spatialScheme=LF_2

numSteps=20
raysPerPoint=1000
fluxEngine=CD

gdsFile=wiggle_full.gds
30 changes: 0 additions & 30 deletions include/viennaps/process/psFluxEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,6 @@

namespace viennaps {

enum class FluxEngineType {
// Platform, Surface representation
AUTO, // Automatic selection
CPU_DISK, // CPU, Disk-based
CPU_TRIANGLE, // CPU, Triangle-based
GPU_DISK, // GPU, Disk-based
GPU_TRIANGLE, // GPU, Triangle-based
GPU_LINE, // GPU, Line-based
// GPU_LEVEL_SET // Future implementations
};

inline std::string to_string(const FluxEngineType type) {
switch (type) {
case FluxEngineType::AUTO:
return "AUTO";
case FluxEngineType::CPU_DISK:
return "CPU_DISK";
case FluxEngineType::CPU_TRIANGLE:
return "CPU_TRIANGLE";
case FluxEngineType::GPU_TRIANGLE:
return "GPU_TRIANGLE";
case FluxEngineType::GPU_DISK:
return "GPU_DISK";
case FluxEngineType::GPU_LINE:
return "GPU_LINE";
default:
return "UNKNOWN";
}
}

template <typename NumericType, int D> class FluxEngine {
protected:
viennacore::Timer<> timer_;
Expand Down
56 changes: 56 additions & 0 deletions include/viennaps/psUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@

#include "psMaterials.hpp"

namespace viennaps {
enum class FluxEngineType {
AUTO, // Automatic selection
CPU_DISK, // CPU, Disk-based
CPU_TRIANGLE, // CPU, Triangle-based
GPU_DISK, // GPU, Disk-based
GPU_TRIANGLE, // GPU, Triangle-based
GPU_LINE // GPU, Line-based
};
}

// Use viennacore here to avoid conflicts with other namespaces
namespace viennacore::util {
[[nodiscard]] inline viennals::SpatialSchemeEnum
Expand Down Expand Up @@ -63,6 +74,23 @@ convertIntegrationScheme(const std::string &s) {
return convertSpatialScheme(s);
}

[[nodiscard]] inline viennaps::FluxEngineType
convertFluxEngineType(const std::string &s) {
if (s == "AUTO")
return viennaps::FluxEngineType::AUTO;
if (s == "CPU_DISK" || s == "CD")
return viennaps::FluxEngineType::CPU_DISK;
if (s == "CPU_TRIANGLE" || s == "CT")
return viennaps::FluxEngineType::CPU_TRIANGLE;
if (s == "GPU_DISK" || s == "GD")
return viennaps::FluxEngineType::GPU_DISK;
if (s == "GPU_TRIANGLE" || s == "GT")
return viennaps::FluxEngineType::GPU_TRIANGLE;
if (s == "GPU_LINE" || s == "GL")
return viennaps::FluxEngineType::GPU_LINE;
throw std::invalid_argument("Unknown FluxEngineType: " + s);
}

[[nodiscard]] inline viennals::TemporalSchemeEnum
convertTemporalScheme(const std::string &s) {
if (s == "FORWARD_EULER" || s == "FE")
Expand Down Expand Up @@ -106,6 +134,26 @@ convertSpatialSchemeToString(viennals::SpatialSchemeEnum scheme) {
}
}

[[nodiscard]] inline std::string
convertFluxEngineTypeToString(viennaps::FluxEngineType type) {
switch (type) {
case viennaps::FluxEngineType::AUTO:
return "AUTO";
case viennaps::FluxEngineType::CPU_DISK:
return "CPU_DISK";
case viennaps::FluxEngineType::CPU_TRIANGLE:
return "CPU_TRIANGLE";
case viennaps::FluxEngineType::GPU_DISK:
return "GPU_DISK";
case viennaps::FluxEngineType::GPU_TRIANGLE:
return "GPU_TRIANGLE";
case viennaps::FluxEngineType::GPU_LINE:
return "GPU_LINE";
default:
return "UNKNOWN";
}
}

[[nodiscard]] inline std::string
convertTemporalSchemeToString(viennals::TemporalSchemeEnum scheme) {
switch (scheme) {
Expand Down Expand Up @@ -151,6 +199,8 @@ template <typename T> [[nodiscard]] std::string toString(const T &value) {
else if constexpr (std::is_same_v<T, viennaps::Material>) {
std::string mat = viennaps::to_string_view(value);
return mat;
} else if constexpr (std::is_same_v<T, viennaps::FluxEngineType>) {
return convertFluxEngineTypeToString(value);
} else if constexpr (std::is_same_v<T, std::string>)
return value;
else
Expand Down Expand Up @@ -178,3 +228,9 @@ hexToRGBArray(const uint32_t hexColor) {
return rgb;
}
}; // namespace viennacore::util

namespace viennaps {
[[nodiscard]] inline std::string to_string(FluxEngineType type) {
return viennacore::util::convertFluxEngineTypeToString(type);
}
} // namespace viennaps
2 changes: 2 additions & 0 deletions python/pyWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ PYBIND11_MODULE(VIENNAPS_MODULE_NAME, module) {
"Convert a string to an discretization scheme.");
// convertIntegrationScheme is deprecated
m_util.attr("convertIntegrationScheme") = m_util.attr("convertSpatialScheme");
m_util.def("convertFluxEngineType", &util::convertFluxEngineType,
"Convert a string to a flux engine type.");
m_util.def("convertTemporalScheme", &util::convertTemporalScheme,
"Convert a string to a time integration scheme.");

Expand Down
Loading