Skip to content
Merged
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
6 changes: 3 additions & 3 deletions src/calc_waves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ void CSimulation::GenerateSyntheticTransects(vector<TransectWaveData> const* pVR
TransectWaveData const& transect = (*pVRealTransects)[i];
if (!transect.VdX.empty())
{
VdTransectExtX[i] = dGridCentroidXToExtCRSX(transect.VdX[0]);
VdTransectExtY[i] = dGridCentroidYToExtCRSY(transect.VdY[0]);
VdTransectExtX[i] = dGridCentroidXToExtCRSX(static_cast<int>(transect.VdX[0]));
VdTransectExtY[i] = dGridCentroidYToExtCRSY(static_cast<int>(transect.VdY[0]));
}
else
{
Expand Down Expand Up @@ -228,7 +228,7 @@ void CSimulation::GenerateSyntheticTransects(vector<TransectWaveData> const* pVR

// Second pass: generate the synthetic transects
// Using OpenMP to parallelize - each thread handles one pair
int nCurrentIndex = 0;
// int nCurrentIndex = 0;

#pragma omp parallel for schedule(dynamic)
for (int nPair = 0; nPair < nNumRealTransects - 1; nPair++)
Expand Down
4 changes: 2 additions & 2 deletions src/coast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,9 @@ CGeomCoastPolygon* CRWCoast::pPolyCreateAndAppendPolygon(int const nCoastID, int
}

//! Returns the number of coast polygons
std::size_t CRWCoast::nGetNumPolygons(void) const
int CRWCoast::nGetNumPolygons(void) const
{
return m_pVCoastPolygon.size();
return static_cast<int>(m_pVCoastPolygon.size());
}

//! Returns a pointer to a coast polygon, specified by down-coast (i.e. along the coast in the direction of increasing coastline point numbers) sequence
Expand Down
2 changes: 1 addition & 1 deletion src/coast.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class CRWCoast
CGeomProfile* pGetProfileWithUpCoastSeq(int const) const;

CGeomCoastPolygon* pPolyCreateAndAppendPolygon(int const, int const, CGeom2DIPoint const*, CGeom2DIPoint const*, int const, int const, vector<CGeom2DPoint> const*, int const, int const, bool const, bool const);
std::size_t nGetNumPolygons(void) const;
int nGetNumPolygons(void) const;
CGeomCoastPolygon* pGetPolygon(int const);

void SetPolygonNode(int const, int const);
Expand Down
4 changes: 2 additions & 2 deletions src/gis_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1565,8 +1565,8 @@ bool CSimulation::bWriteVectorGISFile(int const nDataItem, string const* strPlot
OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());

// Set the feature's geometry (convert from grid CRS to external CRS)
OGRPt.setX(dGridCentroidXToExtCRSX(transect.VdX[nPoint]));
OGRPt.setY(dGridCentroidYToExtCRSY(transect.VdY[nPoint]));
OGRPt.setX(dGridCentroidXToExtCRSX(static_cast<int>(transect.VdX[nPoint])));
OGRPt.setY(dGridCentroidYToExtCRSY(static_cast<int>(transect.VdY[nPoint])));
pOGRFeature->SetGeometry(&OGRPt);

// Calculate wave height and angle from components
Expand Down
2 changes: 1 addition & 1 deletion src/run_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ if [ "$cflag" = "true" ]; then
fi
# CMAKE_COMPILER_ARGS="PKG_CPPFLAGS='-Xclang -fopenmp' PKG_LIBS=-lomp"
# cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$buildtype -DCOMPILER=$compiler -DCSHORE_LIBRARY=$cshorelibrary -DCSHORE_INOUT=$cshoreinout $CMAKE_COMPILER_ARGS .
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$buildtype -DCOMPILER=$compiler -DCSHORE_LIBRARY=$cshorelibrary -DCSHORE_INOUT=$cshoreinout -DCMAKE_VERBOSE_MAKEFILE=ON $CMAKE_COMPILER_ARGS .
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$buildtype -DCOMPILER=$compiler -DCSHORE_LIBRARY=$cshorelibrary -DCSHORE_INOUT=$cshoreinout -DCMAKE_VERBOSE_MAKEFILE=OFF $CMAKE_COMPILER_ARGS .
#cmake -DCMAKE_BUILD_TYPE=$buildtype -DCOMPILER=$compiler -DCSHORE_LIBRARY=$cshorelibrary -DCSHORE_INOUT=$cshoreinout $CMAKE_COMPILER_ARGS . -G"CodeBlocks - Unix Makefiles"
# Or Ninja?
#cmake -G Ninja -DCMAKE_BUILD_TYPE=$buildtype -DCOMPILER=$compiler -DCSHORE_LIBRARY=$cshorelibrary -DCSHORE_INOUT=$cshoreinout $CMAKE_COMPILER_ARGS .
Expand Down
15 changes: 8 additions & 7 deletions src/spatial_interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
//! double result = interp.Interpolate(5.0, 5.0); // Interpolate at (5,5)
//!
//===============================================================================================================================
#include <stdexcept>

#include "spatial_interpolation.h"
#include <stdexcept>
#include "cme.h"

#ifdef _OPENMP
#include <omp.h>
Expand Down Expand Up @@ -117,7 +118,7 @@ double SpatialInterpolator::Interpolate(double x, double y) const
std::vector<unsigned int> indices(k);
std::vector<double> sq_dists(k); // Squared distances (faster than actual distances)

unsigned int num_found = m_kdtree->knnSearch(query_pt, k,
long unsigned int num_found = m_kdtree->knnSearch(query_pt, k,
indices.data(),
sq_dists.data());

Expand All @@ -134,7 +135,7 @@ double SpatialInterpolator::Interpolate(double x, double y) const
double sum_weights = 0.0;
double sum_weighted_values = 0.0;

if (m_power == 2.0)
if (bFPIsEqual(m_power, 2.0, TOLERANCE))
{
// *** OPTIMIZED PATH for power=2.0 ***
// Since weight = 1/dist^2 and we have sq_dist = dist^2,
Expand Down Expand Up @@ -181,7 +182,7 @@ void SpatialInterpolator::Interpolate(std::vector<Point2D> const& query_points,
{
double const query_pt[2] = {query_points[i].x, query_points[i].y};

unsigned int num_found = m_kdtree->knnSearch(query_pt, k,
long unsigned int num_found = m_kdtree->knnSearch(query_pt, k,
indices.data(),
sq_dists.data());

Expand All @@ -202,7 +203,7 @@ void SpatialInterpolator::Interpolate(std::vector<Point2D> const& query_points,
double sum_weights = 0.0;
double sum_weighted_values = 0.0;

if (m_power == 2.0)
if (bFPIsEqual(m_power, 2.0, TOLERANCE))
{
for (size_t j = 0; j < num_found; j++)
{
Expand Down Expand Up @@ -297,7 +298,7 @@ void DualSpatialInterpolator::InterpolatePoint(double x, double y,
double const query_pt[2] = {x, y};
size_t const k = std::min((size_t) m_k_neighbors, m_cloud.pts.size());

unsigned int num_found = m_kdtree->knnSearch(query_pt, k,
long unsigned int num_found = m_kdtree->knnSearch(query_pt, k,
indices.data(),
sq_dists.data());

Expand All @@ -320,7 +321,7 @@ void DualSpatialInterpolator::InterpolatePoint(double x, double y,
double sum_weighted_x = 0.0;
double sum_weighted_y = 0.0;

if (m_power == 2.0)
if (bFPIsEqual(m_power, 2.0, TOLERANCE))
{
for (size_t i = 0; i < num_found; i++)
{
Expand Down