-
Notifications
You must be signed in to change notification settings - Fork 1
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/correct mappings #13
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bf78031
Use plural for members of mesh2d, mesh1d
lucacarniato 7884ed6
add face_edges and edge_faces when reading and writing a mesh
lucacarniato f223ae1
Add unit test checking edge_faces and face_edges values
lucacarniato 58b665e
Fix grammar
lucacarniato d0fe7fa
Add apis to get the int and double filling values
lucacarniato aa6f62b
Clang formatting
lucacarniato b0badc9
Account for comments
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
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
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
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
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
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 |
---|---|---|
|
@@ -431,6 +431,16 @@ namespace ugridapi | |
/// @returns Error code | ||
UGRID_API int ug_get_faces_location_type(int& type); | ||
|
||
/// @brief Gets the int fill value | ||
/// @param[out] fillValue The int indicating the fill value | ||
/// @returns Error code | ||
UGRID_API int ug_get_int_fill_value(int& fillValue); | ||
|
||
/// @brief Gets the double fill value | ||
/// @param[out] fillValue The double indicating the fill value | ||
/// @returns Error code | ||
UGRID_API int ug_get_double_fill_value(double& fillValue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to pass i by ref. |
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
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
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
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 |
---|---|---|
|
@@ -109,8 +109,7 @@ void Mesh2D::define(ugridapi::Mesh2D const& mesh2d) | |
{{"long_name", "Start and end node of mesh edge"}}); | ||
|
||
// Define edge_nodes coordinates | ||
bool const add_coordinate_variable = mesh2d.edge_x != nullptr && mesh2d.edge_y != nullptr; | ||
if (add_coordinate_variable) | ||
if (mesh2d.edge_x != nullptr && mesh2d.edge_y != nullptr) | ||
{ | ||
define_topology_coordinates(UGridFileDimensions::edge, "characteristic %s of the mesh edge (e.g. midpoint)"); | ||
} | ||
|
@@ -138,7 +137,7 @@ void Mesh2D::define(ugridapi::Mesh2D const& mesh2d) | |
"face_nodes", | ||
netCDF::NcType::nc_INT, | ||
{UGridFileDimensions::face, UGridFileDimensions::max_face_node}, | ||
{{"long_name", "Vertex node of mesh face(counterclockwise)"}}); | ||
{{"long_name", "Vertex node of mesh face(counterclockwise)"}}, true); | ||
|
||
// Define face coordinates | ||
bool const add_coordinate_variable = mesh2d.face_x != nullptr && mesh2d.face_y != nullptr; | ||
|
@@ -151,7 +150,7 @@ void Mesh2D::define(ugridapi::Mesh2D const& mesh2d) | |
// define_topology_coordinates(UGridFileDimensions::face, "%s bounds of mesh face (i.e. corner coordinates)", "%s%s_bnd"); | ||
|
||
// Define optional variables | ||
if (mesh2d.face_edge != nullptr) | ||
if (mesh2d.face_edges != nullptr) | ||
{ | ||
// Define face_edges topology attribute and variable | ||
string_builder.clear(); | ||
|
@@ -161,9 +160,9 @@ void Mesh2D::define(ugridapi::Mesh2D const& mesh2d) | |
"face_edge", | ||
netCDF::NcType::nc_INT, | ||
{UGridFileDimensions::face, UGridFileDimensions::max_face_node}, | ||
{{"long_name", "Side edge of mesh face (counterclockwise)"}}); | ||
{{"long_name", "Side edge of mesh face (counterclockwise)"}}, true); | ||
} | ||
if (mesh2d.face_face != nullptr) | ||
if (mesh2d.face_faces != nullptr) | ||
{ | ||
// Define face_links topology attribute and variable | ||
string_builder.clear(); | ||
|
@@ -175,7 +174,7 @@ void Mesh2D::define(ugridapi::Mesh2D const& mesh2d) | |
{UGridFileDimensions::face, UGridFileDimensions::max_face_node}, | ||
{{"long_name", "Neighboring face of mesh face (counterclockwise)"}}); | ||
} | ||
if (mesh2d.edge_face != nullptr) | ||
if (mesh2d.edge_faces != nullptr) | ||
{ | ||
// Define edge_face topology attribute variable and variable | ||
string_builder.clear(); | ||
|
@@ -214,9 +213,13 @@ void Mesh2D::put(ugridapi::Mesh2D const& mesh2d) | |
} | ||
|
||
// Edges | ||
if (auto const it = m_topology_attribute_variables.find("edge_node_connectivity"); mesh2d.edge_node != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("edge_node_connectivity"); mesh2d.edge_nodes != nullptr && it != m_topology_attribute_variables.end()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A general comments about put:
|
||
{ | ||
it->second.at(0).putVar(mesh2d.edge_nodes); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("edge_face_connectivity"); mesh2d.edge_faces != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).putVar(mesh2d.edge_node); | ||
it->second.at(0).putVar(mesh2d.edge_faces); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("edge_coordinates"); mesh2d.edge_x != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
|
@@ -228,17 +231,17 @@ void Mesh2D::put(ugridapi::Mesh2D const& mesh2d) | |
} | ||
|
||
// Faces | ||
if (auto const it = m_topology_attribute_variables.find("face_node_connectivity"); mesh2d.face_node != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("face_node_connectivity"); mesh2d.face_nodes != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).putVar(mesh2d.face_node); | ||
it->second.at(0).putVar(mesh2d.face_nodes); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("face_edge_connectivity"); mesh2d.face_face != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("face_edge_connectivity"); mesh2d.face_edges != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).putVar(mesh2d.face_face); | ||
it->second.at(0).putVar(mesh2d.face_edges); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("face_face_connectivity"); mesh2d.edge_face != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("face_face_connectivity"); mesh2d.face_faces != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).putVar(mesh2d.edge_face); | ||
it->second.at(0).putVar(mesh2d.face_faces); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("face_coordinates"); mesh2d.face_x != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
|
@@ -290,9 +293,13 @@ void Mesh2D::get(ugridapi::Mesh2D& mesh2d) const | |
} | ||
|
||
// Edges | ||
if (auto const it = m_topology_attribute_variables.find("edge_node_connectivity"); mesh2d.edge_node != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("edge_node_connectivity"); mesh2d.edge_nodes != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).getVar(mesh2d.edge_nodes); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("edge_face_connectivity"); mesh2d.edge_faces != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).getVar(mesh2d.edge_node); | ||
it->second.at(0).getVar(mesh2d.edge_faces); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("edge_coordinates"); mesh2d.edge_x != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
|
@@ -304,17 +311,17 @@ void Mesh2D::get(ugridapi::Mesh2D& mesh2d) const | |
} | ||
|
||
// Faces | ||
if (auto const it = m_topology_attribute_variables.find("face_node_connectivity"); mesh2d.face_node != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("face_node_connectivity"); mesh2d.face_nodes != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).getVar(mesh2d.face_node); | ||
it->second.at(0).getVar(mesh2d.face_nodes); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("face_edge_connectivity"); mesh2d.face_face != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("face_edge_connectivity"); mesh2d.face_edges != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).getVar(mesh2d.face_face); | ||
it->second.at(0).getVar(mesh2d.face_edges); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("face_face_connectivity"); mesh2d.edge_face != nullptr && it != m_topology_attribute_variables.end()) | ||
if (auto const it = m_topology_attribute_variables.find("face_face_connectivity"); mesh2d.face_faces != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
it->second.at(0).getVar(mesh2d.edge_face); | ||
it->second.at(0).getVar(mesh2d.face_faces); | ||
} | ||
if (auto const it = m_topology_attribute_variables.find("face_coordinates"); mesh2d.face_x != nullptr && it != m_topology_attribute_variables.end()) | ||
{ | ||
|
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
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
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.
No need to pass i by ref.