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

Feature/gridedit 591 64 to 32 bit indexing 2 #198

Merged
merged 43 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a444767
refinement in spherical coordinates (GRIDEDIT-556 | #170)
lucacarniato Jun 13, 2023
6ebc7ec
Added missing ZLIB_ROOT option to CMake config of NetCDF (#171)
ahmad-el-sayed Jun 14, 2023
fffad73
Include wix installer files in repository (#172 | GRIDEDIT-546)
ahmad-el-sayed Jun 19, 2023
8d64a8e
Added workflow for building on macOS (#174 | GRIDEDIT-558, GRIDEDIT-558)
ahmad-el-sayed Jun 19, 2023
0839366
Reduced NetCDF cache size in macOS build (#175 | GRIDEDIT-566)
ahmad-el-sayed Jun 20, 2023
867d952
Make uniform grid on a desired extension (#177 | GRIDEDIT-570)
lucacarniato Jun 23, 2023
658ebad
Add more exceptions (#178 | GRIDEDIT-583)
lucacarniato Jun 27, 2023
a52cb47
Improve refinement based on gridded samples ( #179 | GRIDEDIT-584 )
lucacarniato Jun 28, 2023
4fcf65f
Fix a bug in computing an uniform mesh in spherical coordinate ( #181…
lucacarniato Jun 28, 2023
592087b
Change default values in MakeGridParameters and SplinesToCurvilinearP…
lucacarniato Jun 29, 2023
19ea688
GRIDEDIT-588
BillSenior Jun 28, 2023
c4dc6a6
Vector performance enhancements (#182 | GRIDEDIT-588)
BillSenior Jun 29, 2023
b1c8a9c
GRIDEDIT-591: Started changing size_t to unsigned int (32 bit) in mes…
BillSenior Jun 29, 2023
7b5ab9f
Merge branch 'release/v2.0.0' into feature/GRIDEDIT-591_64_to_32_bit_…
BillSenior Jun 29, 2023
d3bd7a5
GRIDEDIT-591 Minor realignment of the class member comments.
BillSenior Jun 30, 2023
e6b444b
GRIDEDIT-591 Replaced static_cast for literals.
BillSenior Jun 30, 2023
b2298c5
GRIDEDIT-591 Fixes for the VS compiler
BillSenior Jul 3, 2023
32823b0
Merge branch 'feature/GRIDEDIT-591_64_to_32_bit_indexing' of https://…
BillSenior Jul 3, 2023
2a063c4
GRIDEDIT-591 Further replacement of size_t with Index
BillSenior Jul 7, 2023
eee6ca8
GRIDEDIT-591 Further changes of size_t to Index
BillSenior Jul 7, 2023
ece3503
GRIDEDIT-591 Further changes of size_t to Index
BillSenior Jul 7, 2023
fec4445
GRIDEDIT-591 Further changes of size_t to Index
BillSenior Jul 7, 2023
f93d10a
GRIDEDIT-591 Further changes of size_t to Index
BillSenior Jul 7, 2023
31dc321
GRIDEDIT-591 Further changes of size_t to Index
BillSenior Jul 7, 2023
9e418a9
GRIDEDIT-591 Further changes of size_t to Index
BillSenior Jul 7, 2023
23877ff
GRIDEDIT-591 Further changes of size_t to Index
BillSenior Jul 7, 2023
4a01dd9
Fix windows build
lucacarniato Jul 11, 2023
c70eaab
Merge remote-tracking branch 'origin/master' into feature/GRIDEDIT-59…
lucacarniato Jul 11, 2023
57cde27
Fix Clang
lucacarniato Jul 11, 2023
0b6c6b4
Fix clang
lucacarniato Jul 11, 2023
3e5d37a
Fix clang
lucacarniato Jul 11, 2023
be58068
Fix doxygen
lucacarniato Jul 11, 2023
5e51c0c
Remove unused operator
lucacarniato Jul 11, 2023
a80f528
Fix win build
lucacarniato Jul 11, 2023
c115602
Fix win build
lucacarniato Jul 11, 2023
cf5f574
Correct tests
lucacarniato Jul 11, 2023
04fdf1d
Fix win build
lucacarniato Jul 11, 2023
13616ec
Fix win build
lucacarniato Jul 11, 2023
e59ecd2
Change Index to UInt
lucacarniato Jul 12, 2023
870af7f
Change constants::missing::sizetValue to constants::missing::uintValue
lucacarniato Jul 12, 2023
c1a17ca
Add Definitions.hpp
lucacarniato Jul 12, 2023
8781e92
Add Definitions.hpp file
lucacarniato Jul 12, 2023
76e511a
Merge branch 'master' into feature/GRIDEDIT-591_64_to_32_bit_indexing_2
BillSenior Jul 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/MeshKernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ set(
${DOMAIN_INC_DIR}/BilinearInterpolationOnGriddedSamples.hpp
${DOMAIN_INC_DIR}/Constants.hpp
${DOMAIN_INC_DIR}/Contacts.hpp
${DOMAIN_INC_DIR}/Definitions.hpp
${DOMAIN_INC_DIR}/Entities.hpp
${DOMAIN_INC_DIR}/Exceptions.hpp
${DOMAIN_INC_DIR}/FlipEdges.hpp
Expand Down
3 changes: 2 additions & 1 deletion libs/MeshKernel/benchmark/src/perf_orthogonalization.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <MeshKernel/Constants.hpp>
#include <MeshKernel/LandBoundaries.hpp>
#include <MeshKernel/Mesh2D.hpp>
#include <MeshKernel/MeshRefinement.hpp>
Expand Down Expand Up @@ -38,7 +39,7 @@ static void BM_Orthogonalization(benchmark::State& state)
// move nodes to skew the mesh
double const delta_x = dim_x / static_cast<double>(n - 1);
double const delta_y = dim_y / static_cast<double>(m - 1);
for (size_t i = 0; i < mesh->m_nodes.size(); ++i)
for (meshkernel::Index i = 0; i < mesh->m_nodes.size(); ++i)
{
// only move inetrnal nodes
if (!mesh->IsNodeOnBoundary(i))
Expand Down
7 changes: 4 additions & 3 deletions libs/MeshKernel/include/MeshKernel/AveragingInterpolation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "MeshInterpolation.hpp"

#include <MeshKernel/AveragingStrategies/AveragingStrategy.hpp>
#include <MeshKernel/Constants.hpp>
#include <MeshKernel/Mesh2D.hpp>
#include <MeshKernel/RTree.hpp>

Expand Down Expand Up @@ -102,7 +103,7 @@ namespace meshkernel
double relativeSearchRadius,
bool useClosestSampleIfNoneAvailable,
bool subtractSampleValues,
size_t minNumSamples);
UInt minNumSamples);

/// @brief Compute interpolation
void Compute() override;
Expand Down Expand Up @@ -133,7 +134,7 @@ namespace meshkernel
/// @brief Gets the sample value from an r-tree query
/// param[in] index The query index
/// @return The sample value
[[nodiscard]] double GetSampleValueFromRTree(size_t index);
[[nodiscard]] double GetSampleValueFromRTree(UInt index);

/// @brief Compute a search radius from a point and a polygon
/// @param searchPolygon The input polygon
Expand All @@ -149,7 +150,7 @@ namespace meshkernel
double m_relativeSearchRadius; ///< Relative search radius
bool m_useClosestSampleIfNoneAvailable = false; ///< Whether to use the closest sample if there is none available
bool m_transformSamples = false; ///< Wheher to transform samples
size_t m_minNumSamples = 1; ///< The minimum amount of samples for a valid interpolation. Used in some interpolation algorithms.
UInt m_minNumSamples = 1; ///< The minimum amount of samples for a valid interpolation. Used in some interpolation algorithms.

std::vector<bool> m_visitedSamples; ///< The visited samples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ namespace meshkernel
/// @param[in] cellSize The grid cell size
/// @param[in] values The values of the gridded samples
BilinearInterpolationOnGriddedSamples(const Mesh2D& mesh,
size_t numXCoord,
size_t numYCoord,
UInt numXCoord,
UInt numYCoord,
const Point& origin,
double cellSize,
const std::vector<double>& values);
Expand Down Expand Up @@ -81,18 +81,17 @@ namespace meshkernel

/// @brief Gets the sample value at specific row and column
/// @return The sample value
[[nodiscard]] double getGriddedValue(size_t columnIndex, size_t rowIndex) const
[[nodiscard]] double getGriddedValue(UInt columnIndex, UInt rowIndex) const
{
const auto index = rowIndex * m_numXCoord + columnIndex;
return m_values[index];
}

const Mesh2D& m_mesh; ///< Pointer to the mesh

size_t m_numXCoord; ///< The number of x coordinates of the gridded data
size_t m_numYCoord; ///< The number of y coordinates of the gridded data
Point m_origin; ///< The coordinate of the origin
double m_cellSize; ///< The grid cell size
UInt m_numXCoord; ///< The number of x coordinates of the gridded data
UInt m_numYCoord; ///< The number of y coordinates of the gridded data
Point m_origin; ///< The coordinate of the origin
double m_cellSize; ///< The grid cell size

std::vector<double> m_xCoordinates; ///< The x coordinates of the grid
std::vector<double> m_yCoordinates; ///< The y coordinates of the grid
Expand Down
13 changes: 8 additions & 5 deletions libs/MeshKernel/include/MeshKernel/Constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,25 @@

#pragma once

#include "MeshKernel/Definitions.hpp"

#include <cmath>
#include <limits>
#include <math.h>

namespace meshkernel
{

namespace constants
{
// missing values
namespace missing
{
constexpr double innerOuterSeparator = -998.0; ///< Double value used to separate the inner part of a polygon from its outer part
constexpr double doubleValue = -999.0; ///< Double value used as missing value
constexpr int intValue = -999; ///< Integer value used as missing value
constexpr size_t sizetValue = std::numeric_limits<size_t>::max(); ///< std::size_t missing value used for invalid indices
} // namespace missing
constexpr double innerOuterSeparator = -998.0; ///< Double value used to separate the inner part of a polygon from its outer part
constexpr double doubleValue = -999.0; ///< Double value used as missing value
constexpr int intValue = -999; ///< Integer value used as missing value
constexpr UInt uintValue = std::numeric_limits<UInt>::max(); ///< missing value used for invalid indices
} // namespace missing

// often used values
namespace numeric
Expand Down
20 changes: 10 additions & 10 deletions libs/MeshKernel/include/MeshKernel/Contacts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ namespace meshkernel
/// The algorithms works as follows:
/// - For each oned node, find the closest 2d boundary faces within the search radius.
/// - If a boundary face can be connected to multiple oned nodes, choose the closest one.
/// - Generate the 1d-2d contacts.
/// - Generate the 1d-2d contacts.Index m_numM = 0; ///< Number of columns in the curvilinear grid
/// \image html ComputeBoundaryContacts.jpg "1d mesh connecting to 2d mesh using the ComputeBoundaryContacts algorithm. Contacts are shown in red.
/// The mesh 2d boundary faces are connected to the closest 1d nodes."
///
Expand All @@ -133,34 +133,34 @@ namespace meshkernel

/// @brief Gets the 1d mesh indices
/// @return Vector of 1d mesh indices
std::vector<size_t> const& Mesh1dIndices() const { return m_mesh1dIndices; }
std::vector<UInt> const& Mesh1dIndices() const { return m_mesh1dIndices; }

/// @brief Gets the 2d mesh indices
/// @return Vector of 2d mesh indices
std::vector<size_t> const& Mesh2dIndices() const { return m_mesh2dIndices; }
std::vector<UInt> const& Mesh2dIndices() const { return m_mesh2dIndices; }

private:
/// @brief Asserts if a contact is crossing a 1d mesh edge
/// @param[in] node The 1d node index (start of the contact)
/// @param[in] face The 2d face index (end of the contact)
/// @return True if the contact is crossing a 1d mesh edge
[[nodiscard]] bool IsContactIntersectingMesh1d(size_t node, size_t face) const;
[[nodiscard]] bool IsContactIntersectingMesh1d(UInt node, UInt face) const;

/// @brief Asserts if a contact is crossing an existing contact
/// @param[in] node The 1d node index (start of the contact)
/// @param[in] face The 2d face index (end of the contact)
/// @return True if the contact is crossing an existing contact
[[nodiscard]] bool IsContactIntersectingContact(size_t node, size_t face) const;
[[nodiscard]] bool IsContactIntersectingContact(UInt node, UInt face) const;

/// @brief Connect the current 1D line segment with the faces that intersect a semiline originating from the current node and perpendicular to the current 1D edge.
/// @param[in] node The 1d node index (start of the contact)
/// @param[in] projectionFactor The semiline length, as a multiplier of the current ad edge length
void Connect1dNodesWithCrossingFaces(size_t node,
void Connect1dNodesWithCrossingFaces(UInt node,
double projectionFactor);

std::shared_ptr<Mesh1D> m_mesh1d; ///< The 1-d mesh to connect
std::shared_ptr<Mesh2D> m_mesh2d; ///< The 2-d mesh to connect
std::vector<size_t> m_mesh1dIndices; ///< The indices of the connected 1-d nodes
std::vector<size_t> m_mesh2dIndices; ///< The indices of the connected 2-d faces
std::shared_ptr<Mesh1D> m_mesh1d; ///< The 1-d mesh to connect
std::shared_ptr<Mesh2D> m_mesh2d; ///< The 2-d mesh to connect
std::vector<UInt> m_mesh1dIndices; ///< The indices of the connected 1-d nodes
std::vector<UInt> m_mesh2dIndices; ///< The indices of the connected 2-d faces
};
} // namespace meshkernel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <vector>

#include <MeshKernel/Constants.hpp>
#include <MeshKernel/CurvilinearGrid/CurvilinearGridLine.hpp>
#include <MeshKernel/CurvilinearGrid/CurvilinearGridNodeIndices.hpp>
#include <MeshKernel/Entities.hpp>
Expand Down Expand Up @@ -74,7 +75,7 @@ namespace meshkernel
/// @brief Deletes a curvilinear grid inside a polygon
/// @param[in] polygons The polygons
/// @param[in] polygonIndex The index of the polygon to use for deletion
void Delete(std::shared_ptr<Polygons> polygons, size_t polygonIndex);
void Delete(std::shared_ptr<Polygons> polygons, UInt polygonIndex);

/// @brief Lvalue constructor. Creates a new curvilinear grid from a given set of points
/// @param[in] grid The input grid points
Expand Down Expand Up @@ -109,7 +110,7 @@ namespace meshkernel
/// @param[in] m The m coordinate
/// @param[in] n The n coordinate
/// @return True if the face is valid, false otherwise
[[nodiscard]] bool IsValidFace(size_t m, size_t n) const;
[[nodiscard]] bool IsValidFace(UInt m, UInt n) const;

/// @brief Inserts a new face. The new face will be inserted on top of the closest edge.
/// @param[in] point The point used for finding the closest edge.
Expand Down Expand Up @@ -177,8 +178,8 @@ namespace meshkernel
/// @param[in] toPoint The coordinates of the new position
void MoveNode(Point const& fromPoint, Point const& toPoint);

size_t m_numM = 0; ///< The number of m coordinates (vertical lines)
size_t m_numN = 0; ///< The number of n coordinates (horizontal lines)
UInt m_numM = 0; ///< The number of m coordinates (vertical lines)
UInt m_numN = 0; ///< The number of n coordinates (horizontal lines)
std::vector<std::vector<Point>> m_gridNodes; ///< Member variable storing the grid
std::vector<std::vector<bool>> m_gridFacesMask; ///< The mask of the grid faces (true/false)
std::vector<std::vector<NodeType>> m_gridNodesTypes; ///< The grid node types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace meshkernel
const double blockSizeX,
const double blockSizeY,
std::shared_ptr<Polygons> polygons,
size_t polygonIndex) const;
UInt polygonIndex) const;

/// @brief Compute an uniform curvilinear grid in one polygon, given the block size and the extension. The grid angle is 0
/// @param[in] originX The x coordinate of the origin, located at the bottom left corner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ namespace meshkernel

/// @brief Compute curvilinear in a polygon (pol2curvi)
/// @returns The computed curvilinear grid
CurvilinearGrid Compute(size_t firstNode, size_t secondNode, size_t thirdNode, bool useFourthSide) const;
CurvilinearGrid Compute(UInt firstNode, UInt secondNode, UInt thirdNode, bool useFourthSide) const;

/// @brief Compute curvilinear in a triangle (pol2curvi_tri)
/// @returns The computed curvilinear grid
CurvilinearGrid Compute(size_t firstNode, size_t secondNode, size_t thirdNode) const;
CurvilinearGrid Compute(UInt firstNode, UInt secondNode, UInt thirdNode) const;

private:
std::shared_ptr<Polygons> m_polygon; ///< A pointer to Polygons
Expand Down
Loading
Loading