Skip to content
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
28 changes: 13 additions & 15 deletions .github/workflows/build-and-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,8 @@ jobs:

name: ${{ inputs.platform }}-${{ inputs.build_type }}

# The default compiler on macos is clang, switch to gcc. Specifying the version is necessary.
# It seems like gcc and g++ are symbolic links to the default clang and clang++ compilers, respectively.
# CMAKE_CXX_COMPILER_ID will evaluate to AppleClang rather than GNU on macos.
env:
CC: gcc-12
CXX: g++-12

# Build steps
steps:
# Step: Install GCC (macOS only)
- name: Install GCC
if: startsWith(runner.os, 'macOS')
run: |
brew install gcc@12
echo "CC=$(brew --prefix)/bin/gcc-12" >> $GITHUB_ENV
echo "CXX=$(brew --prefix)/bin/g++-12" >> $GITHUB_ENV

# Step: Checkout
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -58,6 +43,16 @@ jobs:
elif [ "${{ runner.os }}" == "Linux" ]; then
sudo apt-get install libboost-all-dev doxygen
fi

# Step: Install OpenMP
- name: Install OpenMP
run: brew install libomp

# Step: Set OpenMP environment variables
- name: Set OpenMP environment variables
run: |
echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV

# Step: Restore cached user-provided dependencies
- name: Restore cached user-provided dependencies
Expand Down Expand Up @@ -107,6 +102,9 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }}
-DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c
-DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }}
-DCMAKE_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include"
-DCMAKE_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include"
-DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp"

# Step: CMake build
- name: Build
Expand Down
8 changes: 4 additions & 4 deletions cmake/compiler_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Add compiler-specific options and definitions per supported platform
if (UNIX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options("-fvisibility=hidden;-Werror;-Wall;-Wextra;-pedantic;-Wno-unused-function")

if(APPLE AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64"))
Expand All @@ -23,9 +23,9 @@ if (UNIX)
endif()
add_compile_options("$<$<CONFIG:RELEASE>:-O2>")
add_compile_options("$<$<CONFIG:DEBUG>:-g>")
else()
message(FATAL_ERROR "Unsupported compiler. Only GNU is supported under Linux. Found ${CMAKE_CXX_COMPILER_ID}.")
endif()
# else()
# message(FATAL_ERROR "Unsupported compiler. Only GNU is supported under Linux. Found ${CMAKE_CXX_COMPILER_ID}.")
# endif()
elseif(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options("/EHsc;/MP;/W3;/WX")
Expand Down
16 changes: 8 additions & 8 deletions extern/triangle/src/TriangleFacade.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "triangle.h"

/**
* Calls the triangulate() C-routine
* Calls the triangulate() C-routine
*
* Note: all output arrays should be preallocated by the caller!
*
Expand Down Expand Up @@ -62,7 +62,7 @@ void Triangulation(int jatri,
double trisize)
{

struct triangulateio in, mid, out, vorout;
struct triangulateio in, mid, vorout;

int number, i, j, itri, maxnumtri;
int *trinumedge;
Expand All @@ -81,7 +81,7 @@ void Triangulation(int jatri,

in.numberofpointattributes = 0;
number = in.numberofpoints * in.numberofpointattributes * sizeof(REAL);
in.pointattributelist = (REAL *)NULL;
in.pointattributelist = (REAL *)NULL;
in.pointmarkerlist = (int *)NULL;

if (jatri == 1 || jatri == 3) {
Expand Down Expand Up @@ -130,14 +130,14 @@ void Triangulation(int jatri,
/* produce an edge list (e), a Voronoi diagram (v), and a triangle */
/* neighbor list (n). */

if (jatri == 1)
if (jatri == 1)
{
/* triangulate("pcAevnQP", &in, &mid, &vorout); */

triangulate("-Qpc", &in, &mid, &vorout);

}
else if (jatri == 3)
else if (jatri == 3)
{
/* Also produce edge-to-node mapping and tri-to-edge mapping
(uses quite a bit more memory!) */
Expand Down Expand Up @@ -165,7 +165,7 @@ void Triangulation(int jatri,
}
free(trinumedge);
}
else
else
{
i = sprintf(opties, "-Q-Y-q30.0-D-a%f", trisize);

Expand Down Expand Up @@ -193,7 +193,7 @@ void Triangulation(int jatri,


*numtri = mid.numberoftriangles;
if (*numtri > maxnumtri)
if (*numtri > maxnumtri)
{
printf("Triangulation: unsufficient mem for triangle nodes in index (%d > %d)\n", *numtri, maxnumtri);
*numtri = -*numtri; // serves as error indicator
Expand Down Expand Up @@ -231,4 +231,4 @@ void Triangulation(int jatri,
free(vorout.normlist);

return;
}
}
21 changes: 15 additions & 6 deletions extern/triangle/src/triangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,8 @@ REAL area; /* The area of the triangle. */
REAL oalen, dalen, odlen;
REAL maxlen;

(void)(area);

dxoa = triorg[0] - triapex[0];
dyoa = triorg[1] - triapex[1];
dxda = tridest[0] - triapex[0];
Expand Down Expand Up @@ -3264,7 +3266,7 @@ void info()
/* */
/*****************************************************************************/

void internalerror()
void internalerror(void)
{
printf(" Please report this bug to [email protected]\n");
printf(" Include the message above, your input data set, and the exact\n");
Expand Down Expand Up @@ -3769,6 +3771,8 @@ struct osub *s;
struct otri printtri;
vertex printvertex;

(void)(b);

printf("subsegment x%llx with orientation %d and mark %d:\n",
(unsigned long long) s->ss, s->ssorient, mark(*s));
sdecode(s->ss[0], printsh);
Expand Down Expand Up @@ -3946,7 +3950,7 @@ int alignment;
/* - The parameter `alignment'. */
/* - sizeof(VOID *), so the stack of dead items can be maintained */
/* without unaligned accesses. */
if (alignment > sizeof(VOID *)) {
if (alignment > (int)sizeof(VOID *)) {
pool->alignbytes = alignment;
} else {
pool->alignbytes = sizeof(VOID *);
Expand Down Expand Up @@ -4346,8 +4350,8 @@ struct behavior *b;
/* integer index can occupy the same space as the subsegment pointers */
/* or attributes or area constraint or extra nodes. */
if ((b->voronoi || b->neighbors) &&
(trisize < 6 * sizeof(triangle) + sizeof(int))) {
trisize = 6 * sizeof(triangle) + sizeof(int);
(trisize < 6 * (int)sizeof(triangle) + (int)sizeof(int))) {
trisize = 6 * (int)sizeof(triangle) + (int)sizeof(int);
}

/* Having determined the memory size of a triangle, initialize the pool. */
Expand Down Expand Up @@ -4883,7 +4887,7 @@ struct osub *newsubseg;
/* */
/*****************************************************************************/

void exactinit()
void exactinit(void)
{
REAL half;
REAL check, lastcheck;
Expand Down Expand Up @@ -11774,6 +11778,7 @@ vertex endpoint2;
/* Inserting the vertex may have caused edge flips. We wish to rediscover */
/* the edge connecting endpoint1 to the new intersection vertex. */
collinear = finddirection(m, b, splittri, endpoint1);
(void)(collinear);
dest(*splittri, rightvertex);
apex(*splittri, leftvertex);
if ((leftvertex[0] == endpoint1[0]) && (leftvertex[1] == endpoint1[1])) {
Expand Down Expand Up @@ -13189,6 +13194,7 @@ struct behavior *b;
while (subsegloop.ss != (subseg *) NULL) {
/* If the segment is encroached, add it to the list. */
dummy = checkseg4encroach(m, b, &subsegloop);
(void)(dummy);
subsegloop.ss = subsegtraverse(m);
}
}
Expand All @@ -13203,7 +13209,7 @@ struct behavior *b;

#ifndef CDT_ONLY

void precisionerror()
void precisionerror(void)
{
printf("Try increasing the area criterion and/or reducing the minimum\n");
printf(" allowable angle so that tiny triangles are not created.\n");
Expand Down Expand Up @@ -13426,6 +13432,7 @@ int triflaws;
dummy = checkseg4encroach(m, b, &currentenc);
snextself(currentenc);
dummy = checkseg4encroach(m, b, &currentenc);
(void)(dummy);
}

badsubsegdealloc(m, encloop);
Expand Down Expand Up @@ -14580,6 +14587,7 @@ char **argv;
tlist[vertexindex++] = vertexmark(p1);
tlist[vertexindex++] = vertexmark(p2);
tlist[vertexindex++] = vertexmark(p3);
(void)(elementnumber);
#else /* not TRILIBRARY */
/* Triangle number, indices for three vertices. */
fprintf(outfile, "%4ld %4d %4d %4d", elementnumber,
Expand Down Expand Up @@ -15112,6 +15120,7 @@ char **argv;
normlist[coordindex++] = tdest[1] - torg[1];
elist[coordindex] = -1;
normlist[coordindex++] = torg[0] - tdest[0];
(void)(vedgenumber);
#else /* not TRILIBRARY */
/* Write an infinite ray. Edge number, index of one endpoint, -1, */
/* and x and y coordinates of a vector representing the */
Expand Down
5 changes: 3 additions & 2 deletions libs/MeshKernel/include/MeshKernel/Constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
#include <limits>
#include <math.h>

#if defined(__linux__) || defined(__APPLE__)
#if defined(__GNUC__) && !defined(__clang__)
// GCC only: suppress -Wmaybe-uninitialized (not recognized by Clang / AppleClang)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

#include <Eigen/Core>

#if defined(__linux__) || defined(__APPLE__)
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

Expand Down
3 changes: 0 additions & 3 deletions libs/MeshKernel/include/MeshKernel/LandBoundaries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ namespace meshkernel
WholeMesh = 4
};

/// @brief Default constructor
LandBoundaries() = default;

/// @brief Constructor
/// @param[in] landBoundary A vector of points defining the land boundary.
/// @param[in] mesh The current 2d mesh.
Expand Down
2 changes: 0 additions & 2 deletions libs/MeshKernel/include/MeshKernel/Mesh2DToCurvilinear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ namespace meshkernel
{1, 0},
{0, 1}}}; ///< increments for the new nodes depending on the node direction

const int n_maxNumRowsColumns = 1000000; ///< The maximum number of allowed rows or columns

MatrixWithNegativeIndices m_mapping; ///< Unstructured node indices in the curvilinear grid
};

Expand Down
5 changes: 3 additions & 2 deletions libs/MeshKernel/include/MeshKernel/ProjectionConversions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

#include <string>

#if defined(__linux__) || defined(__APPLE__)
#if defined(__GNUC__) && !defined(__clang__)
// GCC only: suppress -Wmaybe-uninitialized (Clang/AppleClang doesn't support it)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
Expand All @@ -39,7 +40,7 @@
#include <boost/geometry/srs/epsg.hpp>
#undef BOOST_ALLOW_DEPRECATED_HEADERS

#if defined(__linux__) || defined(__APPLE__)
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#include "MeshKernel/Definitions.hpp"
#include "MeshKernel/Exceptions.hpp"

#ifdef __linux__
#if defined(__linux__) && !(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#ifdef __linux__
#if defined(__linux__) && !(__clang__)
#pragma GCC diagnostic pop
#endif

Expand Down
3 changes: 1 addition & 2 deletions tools/test_utils/src/MakeCurvilinearGrids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ size_t CurvilinearGridCountValidNodes(meshkernelapi::CurvilinearGrid const& curv
size_t CurvilinearGridCountValidNodes(meshkernel::CurvilinearGrid const& curvilinearGrid)
{
size_t validNodes = 0;
size_t index = 0;

for (meshkernel::UInt n = 0; n < curvilinearGrid.NumN(); ++n)
{
for (meshkernel::UInt m = 0; m < curvilinearGrid.NumM(); ++m)
Expand All @@ -34,7 +34,6 @@ size_t CurvilinearGridCountValidNodes(meshkernel::CurvilinearGrid const& curvili
{
validNodes++;
}
index++;
}
}
return validNodes;
Expand Down
Loading