-
Notifications
You must be signed in to change notification settings - Fork 245
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
[Core][NURBS] nurbs geometry #5361
Conversation
///@name Get and Set functions | ||
///@{ | ||
|
||
bool IsRational() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Doxygen doc (same for everything)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commments, why ints?
return mKnots; | ||
} | ||
|
||
int NumberOfKnots() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why int and not std::size_t?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for the ints: The algorithms in the nurbs book assume that signed-integer operations can be performed. In some cases usigned integers led to wrong results. Since no error occurs, it is very difficult to debug something like this. Adapting the algorithms from the book is also not very easy in these cases.
|
||
std::vector<Interval> KnotSpanIntervals() const | ||
{ | ||
const int first_span = mPolynomialDegree - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wht ints?
#if !defined(KRATOS_NURBS_CURVE_SHAPE_FUNCTIONS_H_INCLUDED ) | ||
#define KRATOS_NURBS_CURVE_SHAPE_FUNCTIONS_H_INCLUDED | ||
|
||
#include "nurbs_utilities.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate properly:
// System includes
// External includes
// Project includes
mDerivativeOrder = DerivativeOrder; | ||
} | ||
|
||
int PolynomialDegree() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why int?, missing doxygen
return mPolynomialDegree; | ||
} | ||
|
||
int NumberOfNonzeroControlPoints() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem in the following
///@name Member Variables | ||
///@{ | ||
|
||
double m_t0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CammelCase
kratos/geometries/nurbs_shape_function_utilities/nurbs_utilities.h
Outdated
Show resolved
Hide resolved
const Vector& rKnots, | ||
const double ParameterT) | ||
{ | ||
auto span = std::lower_bound(std::begin(rKnots) + PolynomialDegree, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const?
///@{ | ||
|
||
static int GetUpperSpan( | ||
const int PolynomialDegree, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why int?
{ | ||
// clang-format off | ||
return | ||
(K > N) ? 0 : // out of range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this is efficient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I thought so, too. However, precalculated values have produced surprisingly poor results. But it would still make sense to take the function from boost.
Thanks @loumalouomega, I tried to change as suggested. |
Thank you for the compliments but maybe there was a misunderstanding. Last friday we decided that you would take care of the container for the shape functions. I should then adjust the geometries in my last pull-request as I discussed with @pooyan-dadvand and @RiccardoRossi in the bistro and use this container. Why is there now a new pull-request containing only the curve geometry (without surfaces and tests) and without the container? |
I tried to ease the review process, further, I only adapted to the Kratos style. |
This is basically a good idea but now we have pull-requests for the branches "nurbs-geometries" and "nurbs_geometries". Instead of creating this new branch (and making changes that lead to errors) it would make more sense to prepare the container as discussed last week. |
@philbucher you requested changes. I adressed your issues, are you ok with it now? |
can you please merge master? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more comments, but nothing significant
other than that for me is ok
result[i] = Interval(t0, t1); | ||
} | ||
|
||
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would using std::move
make sense here?
not sure, asking the others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy elision?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::move would make it more explicit (which is good) but as result is rvalue, the optimizer will use the move.
const Vector& rKnots, | ||
const double ParameterT) | ||
{ | ||
const auto span = std::lower_bound(std::begin(rKnots) + PolynomialDegree, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
kratos/geometries/nurbs_shape_function_utilities/nurbs_utilities.h
Outdated
Show resolved
Hide resolved
KRATOS_CHECK_NEAR(shape_functions(1, 6), -0.132366199073095, TOLERANCE); | ||
KRATOS_CHECK_NEAR(shape_functions(2, 6), 0.161718941270974, TOLERANCE); | ||
KRATOS_CHECK_NEAR(shape_functions(3, 6), -0.295903990157367, TOLERANCE); | ||
KRATOS_CHECK_NEAR(shape_functions(4, 6), 0.227141701884515, TOLERANCE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you could use the new matrix-check macro
KRATOS_CHECK_NEAR(shape_functions(8,14), 6.244572963750500e+00, TOLERANCE); | ||
KRATOS_CHECK_NEAR(shape_functions(9,14), -4.328015755205562e+00, TOLERANCE); | ||
KRATOS_CHECK_NEAR(shape_functions(10,14), -2.987503354121680e+00, TOLERANCE); | ||
KRATOS_CHECK_NEAR(shape_functions(11,14), -1.031093322633297e+00, TOLERANCE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
unrolling those macros apparently takes quite some time
…hape_functions.h Co-Authored-By: Philipp Bucher <philipp.bucher@tum.de>
…hysics/Kratos into core/nurbs_geometry
this is the first one that should go in, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as i can see this is essentially ready for merging.
@philbucher could u make a resume of what is still a TODO here?
please if you do tell what is crucial and what is "wish"
once that is done according to me this can go in
Yes, this is very important |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me looks ready
(although adding the docu as I pointed out would be nice ;) )
@pooyan-dadvand do you still want to take a look?
I tried to adress all your comments. @pooyan-dadvand if you say yes I would merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Hi all,
I am adding here the geometries for pure NURBS entitities and the necessary utiltity functions.
Those are ported from the very good work of @oberbichler with ANurbs and #5344. We adapted it to fully fit to the KRATOS style.