-
Notifications
You must be signed in to change notification settings - Fork 27
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
Addresses some odds and ends #1253
Conversation
I didn't add it to the clang-tidy file to avoid it changing sidre auto-generated files.
I couldn't reproduce #1248, but this will likely resolve the issue.
@@ -730,22 +730,22 @@ class Array : public ArrayBase<T, DIM, Array<T, DIM, SPACE>> | |||
"Cannot call Array<T>::resize() when T is non-trivially-" | |||
"constructible. Use Array<T>::reserve() and emplace_back()" | |||
"instead."); | |||
const StackArray<IndexType, DIM> dims {static_cast<IndexType>(args)...}; | |||
const StackArray<IndexType, DIM> dims {{static_cast<IndexType>(args)...}}; |
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 and throughout
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.
Is there a reason we don't apply the args with the integral type that is given?
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 assume this allows users to supply signed/unsigned integral input and convert it to the represented axom::IndexType
(and avoid warnings/compilation errors due to the templated types)
@publixsubfan might have some additional context.
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.
Looks good. I just have a variety of minor questions.
@@ -730,22 +730,22 @@ class Array : public ArrayBase<T, DIM, Array<T, DIM, SPACE>> | |||
"Cannot call Array<T>::resize() when T is non-trivially-" | |||
"constructible. Use Array<T>::reserve() and emplace_back()" | |||
"instead."); | |||
const StackArray<IndexType, DIM> dims {static_cast<IndexType>(args)...}; | |||
const StackArray<IndexType, DIM> dims {{static_cast<IndexType>(args)...}}; |
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.
Is there a reason we don't apply the args with the integral type that is given?
@@ -499,7 +499,7 @@ class FiniteElement | |||
/// \name Reference Element Attributes | |||
/// @{ | |||
|
|||
typedef void (*ShapeFunctionPtr)(const double* lc, double* phi); | |||
using ShapeFunctionPtr = void (*)(const double* lc, double* phi); |
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 and throughout
@@ -657,9 +657,13 @@ double winding_number(const Point<T, 3>& query, | |||
// Find the direction of a ray perpendicular to that | |||
Vector<T, 3> v1; | |||
if(axom::utilities::isNearlyEqual(v0[0], v0[1], EPS)) | |||
{ |
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.
Much better. this is a clang-tidy change, correct?
typedef double CoordType; | ||
typedef primal::Point<CoordType, DIM> QPoint; | ||
typedef primal::Octahedron<CoordType, DIM> QOct; | ||
using CoordType = double; |
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.
is it possible to have a chang-tidy rule to catch this sort of thing?
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.
These typedef
-> using
changes were from the modernize-use-using
rule
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.
That was actually the impetus for revisiting clang-tidy in this PR -- I had been manually updating the typedef
s when I updated old primal
test files (e.g. in #1251) and thought clang-tidy would have a modernize-*
rule to automate it.
static const std::string C2C_CIRCLE_FILENAME = "test_circle.contour"; | ||
static const std::string C2C_SQUARE_FILENAME = "test_square.contour"; | ||
static const std::string C2C_SPLINE_FILENAME = "test_spline.contour"; | ||
const std::string C2C_LINE_FILENAME = "test_line.contour"; |
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.
constexpr
for these?
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 tried that too and got an error about constexpr
and strings.
Looks like we'll have to wait for std::string_view
in C++17 -- https://stackoverflow.com/questions/27123306/is-it-possible-to-use-stdstring-in-a-constant-expression
@@ -25,11 +25,11 @@ enum DType | |||
_UnknownType_ | |||
}; | |||
|
|||
typedef struct | |||
using AA_extent = struct |
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.
can clang-tidy catch these?
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.
yes! (see comment above)
static const SetElement upperIndex = static_cast<SetElement>(.7 * MAX_SIZE); | ||
static const SetElement range = upperIndex - lowerIndex; | ||
constexpr SetPosition MAX_SIZE = 20; | ||
constexpr SetElement lowerIndex = static_cast<SetElement>(.3 * MAX_SIZE); |
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.
constexpr SetElement lowerIndex = static_cast<SetElement>(.3 * MAX_SIZE); | |
constexpr SetElement lowerIndex(.3 * MAX_SIZE); |
Does this do the same thing? If so, it is less verbose.
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 think it probably makes sense to keep the static_cast
here do explicitly highlight the cast from double
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.
Let there be "using"!
Summary