-
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
irregular to regular #322
Merged
lucacarniato
merged 11 commits into
master
from
feature/GRIDEDIT-784-irregular-to-regular
Apr 27, 2024
Merged
irregular to regular #322
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1b2ea67
aDD Mesh2DToCurvilinear class
lucacarniato 7b3b47f
Going ahead
lucacarniato fc8f3fb
Going ahead
lucacarniato 54138d7
Add unit test
lucacarniato f9ccaae
Merge remote-tracking branch 'origin/master' into feature/GRIDEDIT-78…
lucacarniato 91dfae4
Add unit tests
lucacarniato 9f435a8
Add Mesh2DToCurvilinear.cpp
lucacarniato 5da9fef
Complete documentation
lucacarniato eb671cc
Fix the build
lucacarniato 6f458ed
Account for comments
lucacarniato 6394384
Add mkernel_mesh2d_convert_to_curvilinear API unit test
lucacarniato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
libs/MeshKernel/include/MeshKernel/Mesh2DToCurvilinear.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
//---- GPL --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) Stichting Deltares, 2011-2023. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation version 3. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
// contact: [email protected] | ||
// Stichting Deltares | ||
// P.O. Box 177 | ||
// 2600 MH Delft, The Netherlands | ||
// | ||
// All indications and logos of, and references to, "Delft3D" and "Deltares" | ||
// are registered trademarks of Stichting Deltares, and remain the property of | ||
// Stichting Deltares. All rights reserved. | ||
// | ||
//------------------------------------------------------------------------------ | ||
|
||
#pragma once | ||
#include <memory> | ||
|
||
#include "MeshKernel/CurvilinearGrid/CurvilinearGrid.hpp" | ||
#include "MeshKernel/Definitions.hpp" | ||
#include "MeshKernel/Mesh2D.hpp" | ||
#include "MeshKernel/Point.hpp" | ||
#include "Utilities/LinearAlgebra.hpp" | ||
|
||
using namespace meshkernel::constants; | ||
|
||
namespace meshkernel | ||
{ | ||
/// @brief Construct a curvilinear grid from an unstructured mesh | ||
class Mesh2DToCurvilinear | ||
{ | ||
public: | ||
/// @brief Constructor | ||
/// @param[in] mesh The input unstructured mesh | ||
explicit Mesh2DToCurvilinear(Mesh2D& mesh); | ||
|
||
/// @brief Computes the curvilinear grid starting from a specific point | ||
/// @param[in] point The point from which start growing the curvilinear mesh. The point must be inside a quadrangular face | ||
/// @returns The curvilinear grid | ||
std::unique_ptr<CurvilinearGrid> Compute(const Point& point); | ||
lucacarniato marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private: | ||
/// @brief Computes the local mapping of the nodes composing the face | ||
[[nodiscard]] Eigen::Matrix<UInt, 2, 2> ComputeLocalNodeMapping(UInt face) const; | ||
|
||
/// @brief Computes the node indices of the neighbouring faces | ||
[[nodiscard]] UInt ComputeNeighbouringFaceNodes(const UInt face, | ||
const Eigen::Matrix<UInt, 2, 2>& localNodeMapping, | ||
const UInt d, | ||
const std::vector<bool>& visitedFace); | ||
|
||
/// @brief Computes the final curvilinear matrix | ||
[[nodiscard]] lin_alg::Matrix<Point> ComputeCurvilinearMatrix(); | ||
|
||
Mesh2D& m_mesh; ///< The mesh to convert | ||
std::vector<int> m_i; ///< The i indices of each node on the curvilinear grid | ||
std::vector<int> m_j; ///< The j indices of each node on the curvilinear grid | ||
|
||
std::array<std::array<int, 2>, 4> m_nodeFrom = {{{0, 0}, | ||
{0, 0}, | ||
{1, 0}, | ||
{1, 1}}}; ///< starting edge node indices for each direction in the local mapping | ||
|
||
std::array<std::array<int, 2>, 4> m_nodeTo = {{{0, 1}, | ||
{1, 0}, | ||
{1, 1}, | ||
{0, 1}}}; ///< ending edge node indices for each direction in the local mapping | ||
|
||
std::array<std::array<int, 2>, 4> m_directionsDeltas = {{{-1, 0}, | ||
{0, -1}, | ||
{1, 0}, | ||
{0, 1}}}; ///< increments for the new nodes depending on the node direction | ||
lucacarniato marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const int n_maxNumRowsColumns = 1000000; ///< The maximum number of allowed rows or columns | ||
}; | ||
|
||
} // namespace meshkernel |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Might be a year out of date