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
18 changes: 12 additions & 6 deletions include/viennaps/psDomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ template <class NumericType, int D> class Domain {
// [min, max][x, y, z]
auto getBoundingBox() const {
std::array<Vec3D<NumericType>, 2> boundingBox;
if (levelSets_.empty()) {
Logger::getInstance()
.addWarning("No Level-Sets in domain. Returning empty bounding box.")
.print();
return boundingBox;
}
auto mesh = viennals::Mesh<NumericType>::New();
viennals::ToDiskMesh<NumericType, D>(levelSets_.back(), mesh).apply();
boundingBox[0] = mesh->minimumExtent;
Expand All @@ -398,8 +404,8 @@ template <class NumericType, int D> class Domain {
}

void print(std::ostream &out = std::cout, bool hrle = false) const {
out << "Process Simulation Domain:\n";
out << "******************************\n";
constexpr char *separator = "*****************************************\n";
out << "Process Simulation Domain:\n" << separator;
out << "Number of Level-Sets: " << levelSets_.size() << "\n";
if (materialMap_) {
out << "Materials:\n";
Expand All @@ -413,13 +419,13 @@ template <class NumericType, int D> class Domain {
}
auto bb = getBoundingBox();
out << "Bounding Box: [" << bb[0][0] << ", " << bb[0][1] << ", " << bb[0][2]
<< "] - [" << bb[1][0] << ", " << bb[1][1] << ", " << bb[1][2] << "]\n";
out << "******************************\n";
<< "] - [" << bb[1][0] << ", " << bb[1][1] << ", " << bb[1][2] << "]\n"
<< separator;
if (hrle) {
for (auto &ls : levelSets_) {
ls->print();
}
out << "******************************\n";
out << separator;
}
if (!metaData_.empty()) {
out << "Meta Data:\n";
Expand All @@ -430,8 +436,8 @@ template <class NumericType, int D> class Domain {
}
out << "\n";
}
out << separator;
}
out << "******************************" << std::endl;
}

// Save the level set as a VTK file.
Expand Down
10 changes: 8 additions & 2 deletions python/pyWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,10 @@ PYBIND11_MODULE(VIENNAPS_MODULE_NAME, module) {
"Get the boundary conditions of the domain.")
.def("getMetaData", &Domain<T, D>::getMetaData,
"Get meta data (e.g. process data) stored in the domain")
.def("print", &Domain<T, D>::print)
.def(
"print",
[](Domain<T, D> &self, bool hrle) { self.print(std::cout, hrle); },
"Print the domain information.", pybind11::arg("hrleInfo") = false)
.def("saveLevelSetMesh", &Domain<T, D>::saveLevelSetMesh,
pybind11::arg("filename"), pybind11::arg("width") = 1,
"Save the level set grids of layers in the domain.")
Expand Down Expand Up @@ -2112,7 +2115,10 @@ PYBIND11_MODULE(VIENNAPS_MODULE_NAME, module) {
"Get the bounding box of the domain.")
.def("getBoundaryConditions", &Domain<T, 3>::getBoundaryConditions,
"Get the boundary conditions of the domain.")
.def("print", &Domain<T, 3>::print)
.def(
"print",
[](Domain<T, 3> &self, bool hrle) { self.print(std::cout, hrle); },
"Print the domain information.", pybind11::arg("hrleInfo") = false)
.def("saveLevelSetMesh", &Domain<T, 3>::saveLevelSetMesh,
pybind11::arg("filename"), pybind11::arg("width") = 1,
"Save the level set grids of layers in the domain.")
Expand Down
Loading