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

UGRID-43: Handle SWIGTYPE_P_<T> #33

Open
wants to merge 51 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ad797a4
Move unordered maps to API src
ahmad-el-sayed Nov 5, 2024
a2f7a70
Remove UGridAPI/UGridState.hpp from SWIG config
ahmad-el-sayed Nov 5, 2024
3043930
Apply type maps to signature of API funcs having SWIGTYPE_p_<TYPE>
ahmad-el-sayed Nov 5, 2024
11f0df3
Keep unsafe compilation option commented for now (needed if pinning i…
ahmad-el-sayed Nov 5, 2024
b88f2ff
Remove TopologyType enum getters from API
ahmad-el-sayed Nov 6, 2024
24f6f5f
Remove MeshLocations enum getters from API
ahmad-el-sayed Nov 6, 2024
9ef7927
Provide extensions and helpers for SWIGTYPR_p_T (part of unit tests f…
ahmad-el-sayed Nov 6, 2024
95fa911
Use System.IntPtr instead of SWIGTYPE_p_T
ahmad-el-sayed Nov 7, 2024
2749f02
Start working on abstraction
ahmad-el-sayed Nov 7, 2024
b5d09e9
cont impl
ahmad-el-sayed Nov 13, 2024
a190791
Handle char*
ahmad-el-sayed Nov 21, 2024
ca55acd
Move initial impl to lib
ahmad-el-sayed Nov 21, 2024
6a884d6
Dispose properly and refactor exit code processing
ahmad-el-sayed Nov 21, 2024
9a88215
Have a wrapper base class and derive for extension
ahmad-el-sayed Nov 25, 2024
cc3b760
Clean uo
ahmad-el-sayed Nov 25, 2024
c1bd70b
Split base and derived classes to different src files
ahmad-el-sayed Nov 25, 2024
b26172a
Byte alloc/free in entity extensions
ahmad-el-sayed Nov 25, 2024
d1c7f32
Refactor entity extensions: safety + maintenance
ahmad-el-sayed Nov 25, 2024
566db54
Termpalte IntPtrHelpers.Allocate to improve usability
ahmad-el-sayed Nov 26, 2024
ad9a060
Add doc for IntPtrHelpers
ahmad-el-sayed Nov 26, 2024
92a989b
Add doc for entity extensions
ahmad-el-sayed Nov 26, 2024
cb44edb
Change order of params: topology type then id
ahmad-el-sayed Nov 26, 2024
4f377d0
Support getting double attributes
ahmad-el-sayed Nov 28, 2024
adf5fa9
Provide useful string and byte array extensions
ahmad-el-sayed Nov 28, 2024
073a919
Add ug_attribute_global_char_get API function
ahmad-el-sayed Nov 28, 2024
e4b4312
More string and byte[] extensions
ahmad-el-sayed Nov 28, 2024
a27808b
Get attributes of variable and file attributes
ahmad-el-sayed Nov 28, 2024
ca7b77b
clean up
ahmad-el-sayed Nov 30, 2024
7a85675
Added doc and tetsts for IntPtrExtensions
ahmad-el-sayed Dec 12, 2024
1ad8c3b
Added custom exception with doc and unit tests
ahmad-el-sayed Dec 12, 2024
7264feb
Improve some err msgs, improvements to getting attr values as strings
ahmad-el-sayed Dec 12, 2024
98d94ec
Get IntPtrHelpers.Free to handle dangling pointers accessed by proper…
ahmad-el-sayed Dec 13, 2024
e3c9bb4
Remove commented code
ahmad-el-sayed Dec 13, 2024
8cb8a5d
Add StringExtensions unit tests
ahmad-el-sayed Dec 15, 2024
f504407
Remove unused StringExtensions methods and add doc
ahmad-el-sayed Dec 16, 2024
fcf2b5e
minor formatting
ahmad-el-sayed Dec 16, 2024
a814441
Add doc and tests for ByteArrayExtensions
ahmad-el-sayed Dec 16, 2024
8ea4f44
Added tests for topology extensions
ahmad-el-sayed Dec 16, 2024
d688ebd
Refactor the reader
ahmad-el-sayed Dec 16, 2024
440f516
Split the tests by context
ahmad-el-sayed Dec 16, 2024
62dd4be
Correct alloc size in Mesh1D ext
ahmad-el-sayed Dec 17, 2024
78b77cb
Make PACK_NUPKG_LOCALLY OFF by default
ahmad-el-sayed Dec 17, 2024
52744ec
Remove hardcoded path
ahmad-el-sayed Dec 19, 2024
6467d3c
Force MD compile opt in both release and debug MSVC builds to enable …
ahmad-el-sayed Dec 19, 2024
69b28ca
Suport netcdf-cxx installation under windows and fix various exisitin…
ahmad-el-sayed Dec 19, 2024
267f749
use for instead of while loop
ahmad-el-sayed Dec 19, 2024
a5f268b
fix size of contacts.contact_name_id
ahmad-el-sayed Dec 19, 2024
6103fa0
remove unneccesary code from swig tests
ahmad-el-sayed Dec 19, 2024
544c699
remove unnecessary declarations in ug_fil_<mode>_mode
ahmad-el-sayed Dec 19, 2024
ded5bbd
Rework disposal of manage and unmanaged resources
ahmad-el-sayed Dec 19, 2024
cda5c3d
Fix dstination dir of the deps of the dll of the nupkg
ahmad-el-sayed Dec 21, 2024
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
4 changes: 2 additions & 2 deletions cmake/cached_globals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ set(GLOB_CURRENT_YEAR ${GLOB_CURRENT_YEAR} CACHE STRING "Current year")
if(WIN32 AND BUILD_DOTNET_WRAPPER)
# .NET SDK
set(GLOB_DOTNET_SDK "Microsoft.NET.Sdk" CACHE STRING ".NET SDK")
# .NET target frameworks
# List of .NET target frameworks (semicolon-delimited)
# Note: Even if the list consists of a single element, make sure to terminate with a semicolon
# For ex: set(LIST_OF_DOTNET_TARGET_FRAMEWORKS "net481;" CACHE STRING "Supported .NET target framework")
# Otherwise, Visual Studio will not create subdir net481 under Release (of whichever build config is used) in the CMake binary dir
# <TargetFramework>net481</TargetFramework> works (notice the singular form in xml element "TargetFramework")
# <TargetFrameworks>net481</TargetFrameworks> does not work (notice the plural form in xml element "TargetFrameworks")
# <TargetFrameworks>net481;</TargetFrameworks> works (notice the plural form in xml element "TargetFrameworks" and the semicolon after "net481")
set(GLOB_LIB_DOTNET_TARGET_FRAMEWORKS "netstandard2.0;net481" CACHE STRING "Library .NET target framework")
set(GLOB_LIB_DOTNET_TARGET_FRAMEWORKS "net481;netstandard2.0" CACHE STRING "Library .NET target framework")
set(GLOB_TEST_DOTNET_TARGET_FRAMEWORKS "net481;" CACHE STRING "Test .NET target framework")
# .NET language version
set(GLOB_CSHARP_LANGUAGE_VERSION "7.3" CACHE STRING "C# Compiler Options for language feature rules")
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (UNIX)
endif()
elseif(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/EHsc;/MP;/W3;/WX>")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/EHsc;/MP;/MD;/W3;/WX>")
add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>:/O2>")
add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:/Od;/DEBUG>")
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:_USE_MATH_DEFINES>")
Expand Down
2 changes: 1 addition & 1 deletion cmake/user_config_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ option(
cmake_dependent_option(
PACK_NUPKG_LOCALLY
"Pack the NuGet package locally. Should be used only to verify packages locally."
ON
OFF
"BUILD_DOTNET_WRAPPER"
OFF
)
4 changes: 2 additions & 2 deletions libs/UGrid/src/Contacts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ void Contacts::define(ugridapi::Contacts const& contacts)
// Define topology attribute
define_topological_attribute("cf_role", "mesh_topology_contact");

auto const mesh_from_location_string = from_location_integer_to_location_string(contacts.mesh_from_location);
auto const mesh_to_location_string = from_location_integer_to_location_string(contacts.mesh_to_location);
auto const mesh_from_location_string = from_location_integer_to_location_string(static_cast<int>(contacts.mesh_from_location));
auto const mesh_to_location_string = from_location_integer_to_location_string(static_cast<int>(contacts.mesh_to_location));

// Define topology attribute from to mesh
std::stringstream os;
Expand Down
1 change: 1 addition & 0 deletions libs/UGridAPI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set(
${DOMAIN_INC_DIR}/Contacts.hpp
${DOMAIN_INC_DIR}/Mesh1D.hpp
${DOMAIN_INC_DIR}/Mesh2D.hpp
${DOMAIN_INC_DIR}/MeshLocations.hpp
${DOMAIN_INC_DIR}/Network1D.hpp
${DOMAIN_INC_DIR}/UGrid.hpp
${DOMAIN_INC_DIR}/UGridState.hpp
Expand Down
6 changes: 4 additions & 2 deletions libs/UGridAPI/include/UGridAPI/Contacts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#pragma once

#include <UGridAPI/MeshLocations.hpp>

namespace ugridapi
{
/// @brief A struct used to describe UGrid contact in a C-compatible manner
Expand Down Expand Up @@ -54,10 +56,10 @@ namespace ugridapi
char* mesh_to_name = nullptr;

/// @brief The location type (node, edge or face) at the contact start
int mesh_from_location = 0;
MeshLocations mesh_from_location = MeshLocations::Unknown;

/// @brief The location type (node, edge or face) at the contact end
int mesh_to_location = 0;
MeshLocations mesh_to_location = MeshLocations::Unknown;

/// @brief The number of contact
int num_contacts = 0;
Expand Down
50 changes: 50 additions & 0 deletions libs/UGridAPI/include/UGridAPI/MeshLocations.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//---- GPL ---------------------------------------------------------------------
//
// Copyright (C) Stichting Deltares, 2011-2021.
//
// 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: delft3d.support@deltares.nl
// 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

#ifndef UGRID_API
#ifdef _WIN32
#define UGRID_API __declspec(dllexport)
#else
#define UGRID_API __attribute__((visibility("default")))
#endif
#endif

namespace ugridapi
{

/// @brief MeshLocations locations
enum MeshLocations
{
Unknown = -1, ///< Unknown
Faces = 0, ///< Faces
Nodes = 1, ///< Nodes
Edges = 2, ///< Edges
};

} // namespace ugridapi
Loading
Loading