MCPcopy Create free account
hub / github.com/bgrimstad/splinter / reduceSupport

Method reduceSupport

src/bspline.cpp:231–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231void BSpline::reduceSupport(std::vector<double> lb, std::vector<double> ub, bool doRegularizeKnotVectors)
232{
233 if (lb.size() != numVariables || ub.size() != numVariables)
234 throw Exception("BSpline::reduceSupport: Inconsistent vector sizes!");
235
236 std::vector<double> sl = basis.getSupportLowerBound();
237 std::vector<double> su = basis.getSupportUpperBound();
238
239 for (unsigned int dim = 0; dim < numVariables; dim++)
240 {
241 // Check if new domain is empty
242 if (ub.at(dim) <= lb.at(dim) || lb.at(dim) >= su.at(dim) || ub.at(dim) <= sl.at(dim))
243 throw Exception("BSpline::reduceSupport: Cannot reduce B-spline domain to empty set!");
244
245 // Check if new domain is a strict subset
246 if (su.at(dim) < ub.at(dim) || sl.at(dim) > lb.at(dim))
247 throw Exception("BSpline::reduceSupport: Cannot expand B-spline domain!");
248
249 // Tightest possible
250 sl.at(dim) = lb.at(dim);
251 su.at(dim) = ub.at(dim);
252 }
253
254 if (doRegularizeKnotVectors)
255 {
256 regularizeKnotVectors(sl, su);
257 }
258
259 // Remove knots and control points that are unsupported with the new bounds
260 if (!removeUnsupportedBasisFunctions(sl, su))
261 {
262 throw Exception("BSpline::reduceSupport: Failed to remove unsupported basis functions!");
263 }
264}
265
266void BSpline::globalKnotRefinement()
267{

Callers 2

domainReductionTestFunction · 0.45

Calls 3

ExceptionClass · 0.85
getSupportLowerBoundMethod · 0.80
getSupportUpperBoundMethod · 0.80

Tested by 1

domainReductionTestFunction · 0.36