Skip to content

Commit

Permalink
Implemented default cases for parsing BSplines and Nurbs
Browse files Browse the repository at this point in the history
  • Loading branch information
markriegler committed Jun 23, 2023
1 parent 910c0cc commit 77c4491
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions cpp/splinepy/py/py_spline_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <Sources/InputOutput/xml.hpp>
#include <Sources/Splines/b_spline.hpp>
#include <Sources/Utilities/named_type.hpp>
#include <splinepy/utils/print.hpp>

namespace splinepy::py {

Expand Down Expand Up @@ -303,6 +304,12 @@ class SplineReader {
auto bsparser = BSplineParser<1, 4>();
p_splines.append(bsparser.BsplineToDict(bspline));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseBspline() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
case 2:
Expand All @@ -323,6 +330,12 @@ class SplineReader {
auto bsparser = BSplineParser<2, 4>();
p_splines.append(bsparser.BsplineToDict(bspline));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseBspline() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
case 3:
Expand All @@ -343,6 +356,12 @@ class SplineReader {
auto bsparser = BSplineParser<3, 4>();
p_splines.append(bsparser.BsplineToDict(bspline));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseBspline() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
case 4:
Expand All @@ -363,8 +382,20 @@ class SplineReader {
auto bsparser = BSplineParser<4, 4>();
p_splines.append(bsparser.BsplineToDict(bspline));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseBspline() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
default:
splinepy::utils::PrintAndThrowError(
"ParseBspline() does not support parametric dimension of ",
para_dim,
". Only dimensions 1 to 4 are supported.");
break;
}
}

Expand Down Expand Up @@ -396,6 +427,12 @@ class SplineReader {
auto nparser = NurbsParser<1, 4>();
p_splines.append(nparser.NurbsToDict(nurbs));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseNurbs() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
case 2:
Expand All @@ -416,6 +453,12 @@ class SplineReader {
auto nparser = NurbsParser<2, 4>();
p_splines.append(nparser.NurbsToDict(nurbs));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseNurbs() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
case 3:
Expand All @@ -436,6 +479,12 @@ class SplineReader {
auto nparser = NurbsParser<3, 4>();
p_splines.append(nparser.NurbsToDict(nurbs));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseNurbs() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
case 4:
Expand All @@ -456,8 +505,20 @@ class SplineReader {
auto nparser = NurbsParser<4, 4>();
p_splines.append(nparser.NurbsToDict(nurbs));
} break;
default:
splinepy::utils::PrintAndThrowError(
"ParseNurbs() does not support physical dimension of ",
dim,
". Only dimensions 1 to 4 are supported.");
break;
}
break;
default:
splinepy::utils::PrintAndThrowError(
"ParseNurbs() does not support parametric dimension of ",
para_dim,
". Only dimensions 1 to 4 are supported.");
break;
}
}

Expand Down

0 comments on commit 77c4491

Please sign in to comment.