Commit 399ba4b9 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

MeshConverter: allow single point interpolations to fail optionally

(cherry picked from commit 0eb4f4bc)
parent 1884f06a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -293,6 +293,7 @@ int main(int argc, char** argv) {
        const auto max_radius = config.get<double>("max_radius", std::max(initial_radius, 50.));
        LOG(INFO) << "Using initial neighbor search radius of " << initial_radius << " and maximum search radius of "
                  << max_radius;
        const auto allow_failed_interpolation = config.get<bool>("allow_failure", false);

        if(rot.at(0) != "x" || rot.at(1) != "y" || rot.at(2) != "z") {
            LOG(STATUS) << "TCAD mesh (x,y,z) coords. transformation into: (" << rot.at(0) << "," << rot.at(1) << ","
@@ -408,9 +409,15 @@ int main(int argc, char** argv) {
                }

                if(!valid) {
                    if(!allow_failed_interpolation) {
                        throw std::runtime_error(
                            "Could not find valid volume element. Consider to increase max_radius to include "
                        "more mesh points in the search");
                            "more mesh points in the search or to allow failed interpolation with allow_failure "
                            "to set the element to zero.");
                    }

                    LOG(DEBUG) << "Failed to interpolate, setting element to zero";
                    e = {};
                }

                new_mesh.push_back(e);
+1 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ It should be noted that the Mesh Converter depends on the core utilities of the
* `initial_radius`: Initial node neighbors search radius in micro meters. Defaults to the minimal cell dimension of the final interpolated mesh.
* `radius_step`: Radius step if no neighbor is found (defaults to `0.5um`).
* `max_radius`: Maximum search radius (default is `50um`).
* `allow_failure`: Allow the interpolation of a single mesh point to fail, i.e. when no neighbors could be found. If set to `true`, the respective mesh element will be set to zero and the interpolation will continue, if `false` the interpolation will be aborted. Defaults to `false`.
* `volume_cut`: Minimum volume for tetrahedron for non-coplanar vertices (defaults to minimum double value).
* `divisions`: Number of divisions of the new regular mesh for each dimension, 2D or 3D vector depending on the `dimension` setting. Defaults to 100 bins in each dimension.
* `xyz`: Array to replace the system coordinates of the mesh. A detailed description of how to use this parameter is given below.