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

GRIDEDIT-1491 Added api function to retrieve node, edge and face-node data only #375

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
111 changes: 4 additions & 107 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ ALLOW_UNICODE_NAMES = NO

OUTPUT_LANGUAGE = English

# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all generated output in the proper direction.
# Possible values are: None, LTR, RTL and Context.
# The default value is: None.

OUTPUT_TEXT_DIRECTION = None

# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this.
Expand Down Expand Up @@ -1118,15 +1110,15 @@ VERBATIM_HEADERS = YES
# generated with the -Duse_libclang=ON option for CMake.
# The default value is: NO.

CLANG_ASSISTED_PARSING = NO
# CLANG_ASSISTED_PARSING = NO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do the changes in this file belong to this PR?


# If clang assisted parsing is enabled you can provide the compiler with command
# line options that you would normally use when invoking the compiler. Note that
# the include paths will already be set by doxygen for the files and directories
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.

CLANG_OPTIONS =
# CLANG_OPTIONS =

# If clang assisted parsing is enabled you can provide the clang parser with the
# path to the directory containing a file called compile_commands.json. This
Expand All @@ -1139,7 +1131,7 @@ CLANG_OPTIONS =
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.

CLANG_DATABASE_PATH =
# CLANG_DATABASE_PATH =

#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
Expand Down Expand Up @@ -1225,7 +1217,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_STYLESHEET =
HTML_STYLESHEET =

# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
Expand Down Expand Up @@ -1280,15 +1272,6 @@ HTML_COLORSTYLE_SAT = 100

HTML_COLORSTYLE_GAMMA = 80

# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to YES can help to show when doxygen was last run and thus if the
# documentation is up to date.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_TIMESTAMP = NO

# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via JavaScript. If disabled, the navigation index will
Expand Down Expand Up @@ -1570,17 +1553,6 @@ EXT_LINKS_IN_WINDOW = NO

FORMULA_FONTSIZE = 10

# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are not
# supported properly for IE 6.0, but are supported on all modern browsers.
#
# Note that when changing this option you need to delete any form_*.png files in
# the HTML output directory before the changes have effect.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.

FORMULA_TRANSPARENT = YES

# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
# to create new LaTeX commands to be used in formulas as building blocks. See
# the section "Including formulas" for details.
Expand Down Expand Up @@ -1881,16 +1853,6 @@ LATEX_BATCHMODE = NO

LATEX_HIDE_INDICES = NO

# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
# code with syntax highlighting in the LaTeX output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.

LATEX_SOURCE_CODE = NO

# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
Expand All @@ -1899,14 +1861,6 @@ LATEX_SOURCE_CODE = NO

LATEX_BIB_STYLE = plain

# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.

LATEX_TIMESTAMP = NO

# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
# path from which the emoji images will be read. If a relative path is entered,
# it will be relative to the LATEX_OUTPUT directory. If left blank the
Expand Down Expand Up @@ -1971,16 +1925,6 @@ RTF_STYLESHEET_FILE =

RTF_EXTENSIONS_FILE =

# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
# with syntax highlighting in the RTF output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.

RTF_SOURCE_CODE = NO

#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
Expand Down Expand Up @@ -2077,15 +2021,6 @@ GENERATE_DOCBOOK = NO

DOCBOOK_OUTPUT = docbook

# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
# program listings (including syntax highlighting and cross-referencing
# information) to the DOCBOOK output. Note that enabling this will significantly
# increase the size of the DOCBOOK output.
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.

DOCBOOK_PROGRAMLISTING = NO

#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
Expand Down Expand Up @@ -2264,15 +2199,6 @@ EXTERNAL_PAGES = YES
# Configuration options related to the dot tool
#---------------------------------------------------------------------------

# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
# disabled, but it is recommended to install and use dot, since it yields more
# powerful graphs.
# The default value is: YES.

CLASS_DIAGRAMS = YES

# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
Expand Down Expand Up @@ -2305,23 +2231,6 @@ HAVE_DOT = NO

DOT_NUM_THREADS = 0

# When you want a differently looking font in the dot files that doxygen
# generates you can specify the font name using DOT_FONTNAME. You need to make
# sure dot is able to find the font, which can be done by putting it in a
# standard location or by setting the DOTFONTPATH environment variable or by
# setting DOT_FONTPATH to the directory containing the font.
# The default value is: Helvetica.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_FONTNAME = Helvetica

# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
# dot graphs.
# Minimum value: 4, maximum value: 24, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_FONTSIZE = 10

# By default doxygen will tell dot to use the default font as specified with
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
# the path where dot can find it using this tag.
Expand Down Expand Up @@ -2534,18 +2443,6 @@ DOT_GRAPH_MAX_NODES = 50

MAX_DOT_GRAPH_DEPTH = 0

# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not seem
# to support this out of the box.
#
# Warning: Depending on the platform used, enabling this option may lead to
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
# read).
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_TRANSPARENT = NO

# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
Expand Down
10 changes: 10 additions & 0 deletions libs/MeshKernelApi/include/MeshKernelApi/MeshKernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,16 @@ namespace meshkernelapi
/// @returns Error code
MKERNEL_API int mkernel_mesh2d_get_data(int meshKernelId, Mesh2D& mesh2d);

/// @brief Gets the reduced Mesh2D data
///
/// This function ought to be called after `mkernel_mesh2d_get_dimensions` has been called
/// and the pointers have been set to correctly sized memory.
/// @param[in] meshKernelId The id of the mesh state
/// @param[in,out] mesh2d The Mesh2D data
/// @returns Error code
/// @note Only node, edge, face-node data will be retrieved (face node data include the number of nodes per face mesh2d.nodes_per_face)
MKERNEL_API int mkernel_mesh2d_get_data_reduced(int meshKernelId, Mesh2D& mesh2d);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have more descriptive names, e.g.
mkernel_mesh2d_get_connectivity (this method) and
mkernel_mesh2d_get_computed_positions (filling the edgeX, edgeY, faceX, faceY arrays).

The .._get_data can then call both (or be made obsolete).


/// @brief Gets an int indicating the orthogonality property type for mesh2d
/// @param[out] type The int indicating the orthogonality property type
/// @returns Error code
Expand Down
48 changes: 48 additions & 0 deletions libs/MeshKernelApi/include/MeshKernelApi/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,54 @@ namespace meshkernelapi
}
}

/// @brief Sets only the node, edge and face-node data for meshkernelapi::Mesh2D
/// @param[in] mesh2d The meshkernel::Mesh2D instance
/// @param[out] mesh2dApi The output meshkernelapi::Mesh2D instance
static void SetMesh2dApiNodeEdgeFaceNodeData(meshkernel::Mesh2D& mesh2d, Mesh2D& mesh2dApi)
{
if (mesh2dApi.num_nodes != static_cast<int>(mesh2d.GetNumNodes()))
{
throw meshkernel::ConstraintError("The number of nodes in the mesh2d api structure does not equal the number of nodes in the grid, {} /= {}",
mesh2dApi.num_nodes, mesh2d.GetNumNodes());
}

if (mesh2dApi.num_edges != static_cast<int>(mesh2d.GetNumEdges()))
{
throw meshkernel::ConstraintError("The number of edges in the mesh2d api structure does not equal the number of edges in the grid, {} /= {}",
mesh2dApi.num_edges, mesh2d.GetNumEdges());
}

if (mesh2dApi.num_faces != static_cast<int>(mesh2d.GetNumFaces()))
{
throw meshkernel::ConstraintError("The number of faces in the mesh2d api structure does not equal the number of faces in the grid, {} /= {}",
mesh2dApi.num_faces, mesh2d.GetNumFaces());
}

for (meshkernel::UInt n = 0; n < mesh2d.GetNumNodes(); ++n)
{
mesh2dApi.node_x[n] = mesh2d.Node(n).x;
mesh2dApi.node_y[n] = mesh2d.Node(n).y;
}

for (meshkernel::UInt edgeIndex = 0; edgeIndex < mesh2d.GetNumEdges(); ++edgeIndex)
{
mesh2dApi.edge_nodes[edgeIndex * 2] = static_cast<int>(mesh2d.GetEdge(edgeIndex).first);
mesh2dApi.edge_nodes[edgeIndex * 2 + 1] = static_cast<int>(mesh2d.GetEdge(edgeIndex).second);
}

int faceIndex = 0;
for (size_t f = 0; f < mesh2d.GetNumFaces(); f++)
{
mesh2dApi.nodes_per_face[f] = static_cast<int>(mesh2d.m_facesNodes[f].size());

for (size_t n = 0; n < mesh2d.m_facesNodes[f].size(); ++n)
{
mesh2dApi.face_nodes[faceIndex] = static_cast<int>(mesh2d.m_facesNodes[f][n]);
faceIndex++;
}
}
}

/// @brief Sets the meshkernelapi::Mesh2D data
/// @param[in] mesh2d The meshkernel::Mesh2D instance
/// @param[out] mesh2dApi The output meshkernelapi::Mesh2D instance
Expand Down
26 changes: 26 additions & 0 deletions libs/MeshKernelApi/src/MeshKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,32 @@ namespace meshkernelapi
return lastExitCode;
}

MKERNEL_API int mkernel_mesh2d_get_data_reduced(int meshKernelId, Mesh2D& mesh2d)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should mkernel_mesh2d_get_data be substituted with mkernel_mesh2d_get_data_reduced? if this is possible we have one api less to maintain in the other layers

{
lastExitCode = meshkernel::ExitCode::Success;
try
{
if (!meshKernelState.contains(meshKernelId))
{
throw meshkernel::MeshKernelError("The selected mesh kernel id does not exist.");
}

if (mesh2d.node_x == nullptr || mesh2d.node_y == nullptr ||
mesh2d.edge_nodes == nullptr ||
mesh2d.nodes_per_face == nullptr || mesh2d.face_nodes == nullptr)
{
throw meshkernel::MeshKernelError("The meshkernel api Mesh2D has not been initialised correctly.");
}

SetMesh2dApiNodeEdgeFaceNodeData(*meshKernelState[meshKernelId].m_mesh2d, mesh2d);
}
catch (...)
{
lastExitCode = HandleException();
}
return lastExitCode;
}

MKERNEL_API int mkernel_mesh2d_get_data(int meshKernelId, Mesh2D& mesh2d)
{
lastExitCode = meshkernel::ExitCode::Success;
Expand Down
Loading
Loading