-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feature/gridedit 1548 casulli refinement depths #390
base: master
Are you sure you want to change the base?
Feature/gridedit 1548 casulli refinement depths #390
Conversation
Added api unit functions and unit test, though the test does not yet work correctly
Added missing file and updated cmake file
…y required conditions
…mkernel_mesh2d_set_property. Must also pass a propertyId to indicate which property is being defined
…tree in that interpolator
…e centres for triangulation interpolation
and simple unit test
52fde8f
to
c38c831
Compare
|
||
double searchRadiusSquared = 1.0e5; | ||
|
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.
Where did this number (1e5) come from?
|
||
/// @brief Determine the size of the edge-length vector required | ||
int Size(const MeshKernelState& state, const meshkernel::Location location) const override; |
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.
Update comment, interpolation is not only for edges
// The current property id, initialised with a number larger than the Mesh2D:::Property enum values | ||
static int currentPropertyId = static_cast<int>(meshkernel::Mesh2D::Property::EdgeLength); | ||
|
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.
Update comment, its no longer larger than the enum.
std::map<int, std::unique_ptr<PropertyCalculator>> allocatePropertyCalculators() | ||
{ | ||
std::map<int, std::unique_ptr<PropertyCalculator>> propertyMap; | ||
|
||
int propertyId = static_cast<int>(meshkernel::Mesh2D::Property::Orthogonality); | ||
propertyMap.emplace(propertyId, std::make_unique<OrthogonalityPropertyCalculator>()); | ||
|
||
propertyId = static_cast<int>(meshkernel::Mesh2D::Property::EdgeLength); | ||
propertyMap.emplace(propertyId, std::make_unique<EdgeLengthPropertyCalculator>()); | ||
|
||
return propertyMap; | ||
} | ||
|
||
/// @brief Map of property calculators, from an property identifier to the calculator. | ||
static std::map<int, std::unique_ptr<PropertyCalculator>> propertyCalculators = allocatePropertyCalculators(); |
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.
Could this be implemented as a singlton rather than a static global variable
|
||
/// @brief Set sample data | ||
// template <meshkernel::ValidConstDoubleArray VectorType> | ||
// void SetData(const int propertyId, const VectorType& sampleData) override; | ||
|
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.
Remove commented out code
/// @note saves only triangle and quadrilateral elements. | ||
void PrintVtk(const std::vector<Point>& nodes, const std::vector<std::vector<UInt>>& faces, const std::string& fileName); | ||
|
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.
rename to save vtk
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.
do you want to preserve this method?
{ | ||
refineNode = true; | ||
} |
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.
Could break here inside if
if (node1 == constants::missing::uintValue || node2 == constants::missing::uintValue) | ||
// if (node1 == constants::missing::uintValue && node2 == constants::missing::uintValue) |
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.
Remove commented out code
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.
remove commented code
@@ -32,7 +32,9 @@ | |||
#include <vector> | |||
|
|||
#include "MeshKernel/Mesh2D.hpp" | |||
#include "MeshKernel/Parameters.hpp" | |||
#include "MeshKernel/Polygons.hpp" |
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.
polygons.hpp unused header
@@ -112,4 +113,70 @@ namespace meshkernel | |||
/// @brief Get the string representation of the CurvilinearDirection enumeration values. | |||
const std::string& CurvilinearDirectionToString(CurvilinearDirection direction); | |||
|
|||
/// @brief The concept specifies that the array type must have an access operator returning the array element type or can be converted to one | |||
template <typename ArrayType, typename ResultType> | |||
concept ArrayConstAccessConcept = requires(const ArrayType& array, const size_t i) { |
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.
when do you need these concepts?
|
||
/// @brief A simple bounded array | ||
template <const UInt Dimension> | ||
class BoundedArray |
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.
if the dimension in known at compile time, can we use an std::array ?
bool PointIsInElement(const Point& pnt, const UInt faceId) const; | ||
|
||
/// @brief Print the mesh graph | ||
void Print(std::ostream& out = std::cout) 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.
i suggest removing this function in the final commit
@@ -94,6 +120,25 @@ namespace meshkernel | |||
/// @param [in, out] nodeMask Node mask information | |||
static void InitialiseFaceNodes(const Mesh2D& mesh, std::vector<NodeMask>& nodeMask); | |||
|
|||
/// @brief INitialise the node mask using depth data |
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.
typo
/// @note saves only triangle and quadrilateral elements. | ||
void PrintVtk(const std::vector<Point>& nodes, const std::vector<std::vector<UInt>>& faces, const std::string& fileName); | ||
|
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.
do you want to preserve this method?
if (node1 == constants::missing::uintValue || node2 == constants::missing::uintValue) | ||
// if (node1 == constants::missing::uintValue && node2 == constants::missing::uintValue) |
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.
remove commented code
{ | ||
return faceId; | ||
} | ||
else |
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.
remove else
{ | ||
m_elementCentreRTree->SearchNearestPoint(pnt); | ||
|
||
if (m_elementCentreRTree->HasQueryResults()) |
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.
consider early returning instead
40, 39, 40, 25, 33, | ||
35, 27, 36, 29, 31, | ||
30, 37, 38, 32, 40}; | ||
// std::vector<int> expectedEdgesStart = {9, 25, 9, 12, 13, |
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.
remove commented code
/// @brief The minimum depth considered when computing refinement based on depths | ||
/// | ||
/// Only depths greater than this value will be considered. | ||
double minimum_refinement_depth = 0.0; | ||
|
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.
Pass as parameter and remove from the struct here.
This way the api does not change
No description provided.