Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue147 degree elevation #172

Closed
wants to merge 229 commits into from
Closed

Issue147 degree elevation #172

wants to merge 229 commits into from

Conversation

cm314
Copy link
Collaborator

@cm314 cm314 commented Jul 1, 2019

cm314 added 30 commits December 3, 2018 13:09
cm314 added 7 commits June 25, 2019 10:03
# Conflicts:
#	src/io/io_converter.cc
#	src/io/io_converter.h
#	src/io/vtk_writer.h
#	src/spl/parameter_space.h
#	src/spl/spline.h
#	src/spl/weighted_physical_space.h
@cm314 cm314 requested a review from KBiber94 July 1, 2019 15:55
Copy link
Collaborator

@KBiber94 KBiber94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change stuff in the IGA part? Shouldn't be necessary for extending the core functionality of the SplineLib 🤔

Apart from this, numerous but only minor remarks made and (style) changes requested :)

example/iga/src/mapping_handler.h Outdated Show resolved Hide resolved
example/iga/src/mapping_handler.h Outdated Show resolved Hide resolved
example/iga/src/element_generator.h Outdated Show resolved Hide resolved
example/iga/src/mapping_handler.h Outdated Show resolved Hide resolved
example/iga/src/solution_spline.h Outdated Show resolved Hide resolved
test/spl/degree_elevation_test.cc Outdated Show resolved Hide resolved
test/spl/degree_elevation_test.cc Outdated Show resolved Hide resolved
test/spl/degree_elevation_test.cc Outdated Show resolved Hide resolved
test/spl/degree_elevation_test.cc Outdated Show resolved Hide resolved
test/spl/degree_elevation_test.cc Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 2, 2019

Codecov Report

Merging #172 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #172    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          97     98     +1     
  Lines        7479   7773   +294     
======================================
+ Hits         7479   7773   +294
Impacted Files Coverage Δ
src/baf/knot_vector.h 100% <ø> (ø) ⬆️
test/spl/degree_elevation_test.cc 100% <100%> (ø)
src/spl/weighted_physical_space.h 100% <100%> (ø) ⬆️
src/baf/knot_vector.cc 100% <100%> (ø) ⬆️
src/spl/random_spline_utils.h 100% <100%> (ø) ⬆️
src/spl/parameter_space.h 100% <100%> (ø) ⬆️
src/spl/b_spline.h 100% <100%> (ø) ⬆️
src/spl/spline.h 100% <100%> (ø) ⬆️
src/spl/nurbs.h 100% <100%> (ø) ⬆️
src/io/iges_reader.cc 100% <0%> (ø) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 713be86...016ef76. Read the comment docs.

@cm314 cm314 requested a review from KBiber94 September 23, 2019 07:55
param_coords[i] = ParamCoord{((elm.GetUpperBound() - elm.GetLowerBound()).get() * itg_pnts[i]
+ (elm.GetUpperBound() + elm.GetLowerBound()).get()) / 2.0};
param_coords[i] = ParamCoord{((elm.GetUpperBound() - elm.GetLowerBound()).get() * itg_pnts[i] +
(elm.GetUpperBound() + elm.GetLowerBound()).get()) / 2.0};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix alignment of operands (bold): ... {((...).get() ... + (...).get()) / 2.0};

(spline_->GetKnotVector(i)->GetKnot(knot_span[i] + 1).get()
- spline_->GetKnotVector(i)->GetKnot(knot_span[i]).get()) / 2;
(spline_->GetKnotVector(i)->GetKnot(knot_span[i] + 1).get() -
spline_->GetKnotVector(i)->GetKnot(knot_span[i]).get()) / 2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix alignment as described above.

@@ -1,4 +1,4 @@
Checks: '*,-android-*,-llvm-include-order,-fuchsia-overloaded-operator,-fuchsia-default-arguments,-cppcoreguidelines-pro-bounds-constant-array-index'
Checks: '*,-hicpp-braces-around-statements,-readability-braces-around-statements,-android-*,-llvm-include-order,-fuchsia-overloaded-operator,-fuchsia-default-arguments,-cppcoreguidelines-pro-bounds-constant-array-index'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other effects that we might not want to have?

@@ -112,6 +112,14 @@ size_t baf::KnotVector::GetNumberOfKnots() const {
return knots_.size();
}

int baf::KnotVector::GetNumberOfDifferentKnots() const {
int number = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, you add 1 here, as you do not initialize with 0. I would consider to replace int number = 1 by int number_non_zero_knot_spans = 0 and add 1 when returning.

int baf::KnotVector::GetNumberOfDifferentKnots() const {
int number = 1;
for (size_t i = 1; i < knots_.size(); ++i) {
if (knots_[i].get() > knots_[i - 1].get()) ++number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++number_non_zero_knot_spans

for (size_t i = 1; i < knots_.size(); ++i) {
if (knots_[i].get() > knots_[i - 1].get()) ++number;
}
return number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return (number_non_zero_knot_spans + 1);

src/baf/knot_vector.h Outdated Show resolved Hide resolved
@@ -223,6 +202,23 @@ class ParameterSpace {
}
}

void RecreateBasisFunctions() {
for (int current_dim = 0; current_dim < DIM; ++current_dim) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename current_dim to current_dimension. Same for following variables.

basis_functions_current_dim.reserve(knot_vector_current_dim->GetNumberOfKnots() - degree_current_dim.get() - 1);
for (int current_basis_function = 0;
current_basis_function <
(static_cast<int>(knot_vector_current_dim->GetNumberOfKnots()) - degree_current_dim.get() - 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the static cast? Could you do the line break after the minus operator?

@@ -77,7 +77,7 @@ class RandomSplineUtils {
std::vector<double> weights;
util::MultiIndexHandler<DIM> point_handler(number_of_points);
for (int i = 0; i < point_handler.Get1DLength(); ++i, ++point_handler) {
weights.emplace_back(util::Random::GetBinomialRandom<double>(0.1, 5, 0.1));
weights.emplace_back(util::Random::GetBinomialRandom<double>(0.1, 2, 0.1));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to create a task for this :)

for (int i = static_cast<int>(GetKnotVector(dimension)->GetNumberOfDifferentKnots() - 2); i >= 0; --i) {
new_bez_points[i] = DegreeElevateBezierSegment(GetBezierSegment(dimension, i), alpha, dimension);
new_bez_points(static_cast<uint64_t>(this->GetKnotVector(dimension)->GetNumberOfDifferentKnots() - 1));
for (int current_new_bezier_point = GetKnotVector(dimension)->GetNumberOfDifferentKnots() - 2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we emphasize that current_new_bezier_point is not a point but just an index by renaming the variable?

}
return alpha;
}

std::vector<int> ProduceBezierSegments(int dimension) {
size_t position = GetKnotVector(dimension)->GetNumberOfKnots() - GetDegree(dimension).get() - 2;
auto current_knot = GetDegree(dimension).get() + 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index again?

src/spl/spline.h Outdated
for (int k = 0; k < point_handler.Get1DLength(); ++k, ++point_handler) {
auto index = point_handler[0];
auto pos = point_handler.Get1DIndex();
double new_weight = point_length == GetPointDim() ? 1.0 :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a first glance it seems to me as if there are common operations for B-splines & NURBS during degree elevation. Thus, this functionality should be gathered in the base class spline. However, calls to functions with different implementations for different spline types are always possible. In this case, a virtual method like ComputeWeightForDegreeElevation might be appropriate?

Copy link
Collaborator

@KBiber94 KBiber94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your changes so far!

}

void SetNewPoint(baf::ControlPoint new_point, double new_weight, std::array<int, DIM> indices) override {
physical_space_->SetWeightedControlPoint(indices, new_point, new_weight);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If WeightedPhysicalSpace<DIM>::SetWeightedControlPoint and PhysicalSpace<DIM>::SetControlPoint really implement the same functionality only for physical spaces appropriate for NURBS and B-Splines, respectively, then they should be implementations of the same virtual function! So our problem right now would only be the consequence of a flawed design of these more fundamental classes.

example/\ Show resolved Hide resolved
@cm314
Copy link
Collaborator Author

cm314 commented Nov 7, 2019

I'm closing this pull request now as I've connected all open conversations to issues and this branch is outdated.

@cm314 cm314 closed this Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

algorithm for degree elevation
3 participants