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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ include("cmake/cpm.cmake")

CPMAddPackage(
NAME ViennaCore
VERSION 1.7.1
VERSION 1.7.2
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore"
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}
OPTIONS "VIENNACORE_USE_GPU ${VIENNAPS_USE_GPU}")
Expand Down
17 changes: 6 additions & 11 deletions include/viennaps/compact/psCSVDataSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ class CSVDataSource : public DataSource<NumericType> {
if (v.has_value())
positionalParameters.push_back(v.value());
else {
Logger::getInstance()
.addWarning("Error while converting parameter '" + input +
"' to numeric type.")
.print();
VIENNACORE_LOG_WARNING("Error while converting parameter '" + input +
"' to numeric type.");
}
}

Expand All @@ -59,15 +57,12 @@ class CSVDataSource : public DataSource<NumericType> {
if (v.has_value())
namedParameters.insert({smatch[1], v.value()});
else {
Logger::getInstance()
.addWarning("Error while converting value of parameter '" +
std::string(smatch[1]) + "'")
.print();
VIENNACORE_LOG_WARNING("Error while converting value of parameter '" +
std::string(smatch[1]) + "'.");
}
} else {
Logger::getInstance()
.addWarning("Error while parsing parameter line '" + input + "'")
.print();
VIENNACORE_LOG_WARNING("Error while parsing parameter line '" + input +
"'");
}
}

Expand Down
24 changes: 8 additions & 16 deletions include/viennaps/compact/psCSVReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ template <class NumericType> class CSVReader {
}
}
} else {
Logger::getInstance()
.addWarning("Couldn't open file '" + filename + "'")
.print();
VIENNACORE_LOG_WARNING("Couldn't open file '" + filename + "'");
return {};
}
return {header};
Expand Down Expand Up @@ -92,11 +90,9 @@ template <class NumericType> class CSVReader {
if (valueOpt)
a.push_back(valueOpt.value());
else {
Logger::getInstance()
.addWarning("Error while reading line " +
std::to_string(lineCount - 1) + " in '" + filename +
"'")
.print();
VIENNACORE_LOG_WARNING("Error while reading line " +
std::to_string(lineCount - 1) + " in '" +
filename + "'");
return {};
}
++i;
Expand All @@ -107,21 +103,17 @@ template <class NumericType> class CSVReader {
numCols = i;

if (i != numCols) {
Logger::getInstance()
.addWarning("Invalid number of columns in line " +
std::to_string(lineCount - 1) + " in '" + filename +
"'")
.print();
VIENNACORE_LOG_WARNING("Invalid number of columns in line " +
std::to_string(lineCount - 1) + " in '" +
filename + "'");
return {};
}
data.push_back(a);
}
file.close();
return data;
} else {
Logger::getInstance()
.addWarning("Couldn't open file '" + filename + "'")
.print();
VIENNACORE_LOG_WARNING("Couldn't open file '" + filename + "'");
return {};
}
}
Expand Down
30 changes: 10 additions & 20 deletions include/viennaps/compact/psCSVWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ template <class NumericType> class CSVWriter {

bool initialize() {
if (filename.empty()) {
Logger::getInstance()
.addWarning("CSVWriter: No filename provided!")
.print();
VIENNACORE_LOG_WARNING("CSVWriter: No filename provided!");
return false;
}
if (file.is_open())
Expand All @@ -65,9 +63,8 @@ template <class NumericType> class CSVWriter {
}
}
} else {
Logger::getInstance()
.addWarning("CSVWriter: Error opening file '" + filename + "'")
.print();
VIENNACORE_LOG_WARNING("CSVWriter: Error opening file '" + filename +
"'");
return false;
}
initialized = true;
Expand All @@ -84,16 +81,12 @@ template <class NumericType> class CSVWriter {
numCols = data.size();

if (data.size() != numCols) {
Logger::getInstance()
.addWarning("Unexpected number of items in the provided row!")
.print();
VIENNACORE_LOG_WARNING("Unexpected number of items in the provided row!");
return false;
}

if (!file.is_open()) {
Logger::getInstance()
.addWarning("Couldn't open file `" + filename + "`")
.print();
VIENNACORE_LOG_WARNING("Couldn't open file `" + filename + "`");
return false;
}

Expand All @@ -111,17 +104,14 @@ template <class NumericType> class CSVWriter {
numCols = data.size();

if (data.size() != numCols) {
Logger::getInstance()
.addWarning("Unexpected number of items in the provided row! (" +
std::to_string(data.size()) + " instead of " +
std::to_string(numCols) + ")")
.print();
VIENNACORE_LOG_WARNING(
"Unexpected number of items in the provided row! (" +
std::to_string(data.size()) + " instead of " +
std::to_string(numCols) + ")");
return false;
}
if (!file.is_open()) {
Logger::getInstance()
.addWarning("Couldn't open file `" + filename + "`")
.print();
VIENNACORE_LOG_WARNING("Couldn't open file `" + filename + "`");
return false;
}
file << join(data.begin(), data.end()) << '\n';
Expand Down
10 changes: 4 additions & 6 deletions include/viennaps/compact/psDataSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ template <typename NumericType> class DataSource {
// stored alongside the actual data (e.g. depth at which trench diameters were
// captured)
virtual std::vector<NumericType> getPositionalParameters() {
Logger::getInstance()
.addWarning("This data source does not support positional parameters.")
.print();
VIENNACORE_LOG_WARNING(
"This data source does not support positional parameters.");
return {};
}
void setPositionalParameters(
Expand All @@ -70,9 +69,8 @@ template <typename NumericType> class DataSource {

// These optional parameters can also be named
virtual std::unordered_map<std::string, NumericType> getNamedParameters() {
Logger::getInstance()
.addWarning("This data source does not support named parameters.")
.print();
VIENNACORE_LOG_WARNING(
"This data source does not support named parameters.");
return {};
}

Expand Down
20 changes: 8 additions & 12 deletions include/viennaps/compact/psNearestNeighborsInterpolation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,15 @@ class NearestNeighborsInterpolation

bool initialize() override {
if (!data || (data && data->empty())) {
Logger::getInstance()
.addWarning(
"NearestNeighborsInterpolation: the provided data is empty.")
.print();
VIENNACORE_LOG_WARNING(
"NearestNeighborsInterpolation: the provided data is empty.");
return false;
}

if (data->at(0).size() != inputDim + outputDim) {
Logger::getInstance()
.addWarning("NearestNeighborsInterpolation: the sum of the provided "
"InputDimension and OutputDimension does not match the "
"dimension of the provided data.")
.print();
VIENNACORE_LOG_WARNING("NearestNeighborsInterpolation: the sum of the "
"provided InputDimension and OutputDimension does "
"not match the dimension of the provided data.");
return false;
}

Expand All @@ -106,9 +102,9 @@ class NearestNeighborsInterpolation
std::optional<std::tuple<ItemType, NumericType>>
estimate(const ItemType &input) override {
if (input.size() != inputDim) {
Logger::getInstance()
.addWarning("NearestNeighborsInterpolation: No input data provided.")
.print();
VIENNACORE_LOG_WARNING(
"NearestNeighborsInterpolation: the provided input has a different "
"dimensionality than expected.");
return {};
}

Expand Down
32 changes: 12 additions & 20 deletions include/viennaps/compact/psRectilinearGridInterpolation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ class RectilinearGridInterpolation : public ValueEstimator<NumericType, bool> {
uniqueValues[axis].insert((start + i)->at(axis));

if (rangeSize != i - tmp) {
Logger::getInstance()
.addWarning("Data is not arranged in a rectilinear grid!")
.print();
VIENNACORE_LOG_WARNING(
"Data is not arranged in a rectilinear grid!");
equalSize = false;
return false;
}
Expand All @@ -93,20 +92,15 @@ class RectilinearGridInterpolation : public ValueEstimator<NumericType, bool> {

bool initialize() override {
if (!data || (data && data->empty())) {
Logger::getInstance()
.addWarning(
"RectilinearGridInterpolation: the provided data is empty.")
.print();
VIENNACORE_LOG_WARNING(
"RectilinearGridInterpolation: the provided data is empty.");
return false;
}

if (data->at(0).size() != inputDim + outputDim) {
Logger::getInstance()
.addWarning(
"psNearestNeighborsInterpolation: the sum of the provided "
"InputDimension and OutputDimension does not match the "
"dimension of the provided data.")
.print();
VIENNACORE_LOG_WARNING("RectilinearGridInterpolation: the sum of the "
"provided InputDimension and OutputDimension does "
"not match the dimension of the provided data.");
return false;
}

Expand All @@ -119,18 +113,16 @@ class RectilinearGridInterpolation : public ValueEstimator<NumericType, bool> {
auto equalSize = rearrange(localData.begin(), localData.end(), 0, true);

if (!equalSize) {
Logger::getInstance()
.addWarning("Data is not arranged in a rectilinear grid!")
.print();
VIENNACORE_LOG_WARNING("Data is not arranged in a rectilinear grid!");
return false;
}

for (int i = 0; i < inputDim; ++i)
if (uniqueValues[i].empty()) {
Logger::getInstance()
.addWarning("The grid has no values along dimension " +
std::to_string(i))
.print();
VIENNACORE_LOG_WARNING(
"RectilinearGridInterpolation: The grid has no values along "
"dimension " +
std::to_string(i));
return false;
}

Expand Down
25 changes: 12 additions & 13 deletions include/viennaps/gds/psGDSGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ template <class NumericType, int D> class GDSGeometry {
levelSet, topLS, viennals::BooleanOperationEnum::INTERSECT)
.apply();

if (Logger::getLogLevel() >= 5) {
if (Logger::hasDebug()) {
auto mesh = viennals::Mesh<NumericType>::New();
viennals::ToMesh<NumericType, D>(levelSet, mesh).apply();
viennals::VTKWriter<NumericType>(mesh, "GDS_layer_" +
Expand All @@ -148,7 +148,7 @@ template <class NumericType, int D> class GDSGeometry {

// exposureGrid is the final blurred grid to be used for SDF calculation
// auto exposureGrid = proximity.getExposedGrid();
if (lsInternal::Logger::getLogLevel() >= 5)
if (Logger::hasDebug())
proximity.saveGridToCSV("finalGrid.csv");

PointType pointData;
Expand Down Expand Up @@ -255,11 +255,9 @@ template <class NumericType, int D> class GDSGeometry {
// illumination during Gaussians convolution
gridRefinement = std::ceil(gridRefinement * beamDelta / gridDelta_);

Logger::getInstance()
.addInfo("gridDelta = " + std::to_string(gridDelta_) +
", beamDelta = " + std::to_string(beamDelta) +
", gridRefinement = " + std::to_string(gridRefinement))
.print();
VIENNACORE_LOG_INFO("gridDelta = " + std::to_string(gridDelta_) +
", beamDelta = " + std::to_string(beamDelta) +
", gridRefinement = " + std::to_string(gridRefinement));

// Scale sigmas to represent geometry dimensions
NumericType exposureDelta = beamDelta / gridRefinement;
Expand Down Expand Up @@ -314,12 +312,13 @@ template <class NumericType, int D> class GDSGeometry {
for (auto &str : structures) {
for (auto &sref : str.sRefs) {
auto refStr = getStructure(sref.strName);
if (refStr)
if (refStr) {

refStr->isRef = true;
else
Logger::getInstance()
.addWarning("Missing referenced structure: " + sref.strName)
.print();
} else {
VIENNACORE_LOG_WARNING("Missing referenced structure: " +
sref.strName);
}
}
}
}
Expand Down Expand Up @@ -578,7 +577,7 @@ template <class NumericType, int D> class GDSGeometry {
maskLS->insertPoints(pointData);
maskLS->finalize(2);

if (Logger::getLogLevel() >= 5) {
if (Logger::hasDebug()) {
auto mesh = viennals::Mesh<NumericType>::New();
viennals::ToMesh<NumericType, 2>(maskLS, mesh).apply();
viennals::VTKWriter<NumericType>(
Expand Down
18 changes: 5 additions & 13 deletions include/viennaps/gds/psGDSReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,13 @@ template <typename NumericType, int D> class GDSReader {
void parseHeader() {
short version;
version = readTwoByteSignedInt();
Logger::getInstance()
.addDebug("GDS Version: " + std::to_string(version))
.print();
VIENNACORE_LOG_DEBUG("GDS Version: " + std::to_string(version));
}

void parseLibName() {
char *str;
str = readAsciiString();
Logger::getInstance()
.addDebug("GDS Library name: " + std::string(str))
.print();
VIENNACORE_LOG_DEBUG("GDS Library name: " + std::string(str));
delete[] str;
}

Expand Down Expand Up @@ -296,7 +292,7 @@ template <typename NumericType, int D> class GDSReader {
void parseFile() {
filePtr = fopen(fileName.c_str(), "rb");
if (!filePtr) {
Logger::getInstance().addError("Could not open GDS file.").print();
VIENNACORE_LOG_ERROR("Could not open GDS file.");
return;
}

Expand Down Expand Up @@ -469,9 +465,7 @@ template <typename NumericType, int D> class GDSReader {
case GDS::RecordNumbers::DataType: // unimportant and should be zero
currentDataType = readTwoByteSignedInt();
if (currentDataType != 0)
Logger::getInstance()
.addWarning("Unsupported argument in DATATYPE")
.print();
VIENNACORE_LOG_WARNING("Unsupported argument in DATATYPE");
break;

case GDS::RecordNumbers::Node: // ignore
Expand Down Expand Up @@ -630,9 +624,7 @@ template <typename NumericType, int D> class GDSReader {
break;

default:
Logger::getInstance()
.addWarning("Unknown record type in GDS file.")
.print();
VIENNACORE_LOG_WARNING("Unknown record type in GDS file.");
return;
}
}
Expand Down
Loading
Loading