Documentation 6b54b78464
Loading...
Searching...
No Matches
CTrapezoidalMap.hpp File Reference

Memory-efficient trapezoidal map for 2D lookup table queries, based on the LUT implementation of P. Gomes (https://github.com/pcarruscag/LUT). More...

#include <algorithm>
#include <array>
#include <cmath>
#include <numeric>
#include <tuple>
#include <utility>
#include <vector>
#include "../basic_types/datatype_structure.hpp"
#include "C2DContainer.hpp"

Go to the source code of this file.

Classes

struct  su2_lut::TrapezoidalMap
 
class  CTrapezoidalMap
 Trapezoidal map for finding the triangle containing a query point in a 2D triangulation. More...
 

Namespaces

namespace  su2_lut
 

Typedefs

using su2_lut::IntT = int32_t
 
using su2_lut::RealT = su2double
 
template<size_t N>
using su2_lut::MatrixNi = C2DContainer< unsigned long, IntT, StorageType::RowMajor, 64, DynamicSize, N >
 
using su2_lut::Matrix2i = MatrixNi< 2 >
 
using su2_lut::Matrix3i = MatrixNi< 3 >
 
using su2_lut::VectorInt = std::vector< IntT >
 
using su2_lut::VectorReal = std::vector< RealT >
 

Functions

void su2_lut::ReorderPoints (Matrix3i &triangles, VectorReal &x, VectorReal &y)
 Orders points by ascending x coordinates and updates triangle indices.
 
void su2_lut::ExtractEdges (const Matrix3i &triangles, Matrix2i &edge_pts, Matrix2i &edge_faces)
 Extracts unique edges from triangles. Edges are defined by two point IDs and up to two adjacent triangles (boundary edges have the second triangle ID < 0).
 
auto su2_lut::DetectBands (const VectorReal &x, IntT max_bands=0)
 Detects the x bands of the map. One band per unique x coordinate is used unless that would exceed max_bands, in which case equal-width bands are used to limit memory.
 
void su2_lut::BuildTrapezoidalMap (const Matrix2i &edge_pts, const VectorReal &x, const VectorReal &y, TrapezoidalMap &map)
 Builds the trapezoidal map for a set of edges (points must be ordered by x).
 
auto su2_lut::QueryTrapezoidalMap (const TrapezoidalMap &map, const Matrix2i &edge_pts, const VectorReal &x_coords, const VectorReal &y_coords, const RealT &x, const RealT &y)
 Returns the IDs of the edges directly below and above a query point (either ID can be -1 if the point is at a boundary).
 
auto su2_lut::AdjacentTriangles (const IntT edge_0, const IntT edge_1, const Matrix2i &edge_faces)
 Returns the IDs of the triangles adjacent to two query edges (up to 3 triangles).
 
auto su2_lut::TriangleCoords (const IntT i_tri, const Matrix3i &triangles, const VectorReal &x, const VectorReal &y, const RealT x_q, const RealT y_q)
 Computes the barycentric coordinates of point (x_q, y_q) in a triangle.
 
bool su2_lut::InTriangle (const std::array< RealT, 3 > &coords, const RealT tol=0.0)
 Checks if a point is inside a triangle based on its barycentric coordinates.
 
IntT su2_lut::FindTriangle (const TrapezoidalMap &map, const Matrix3i &triangles, const Matrix2i &edge_pts, const Matrix2i &edge_faces, const VectorReal &x, const VectorReal &y, const RealT x_q, const RealT y_q, std::array< RealT, 3 > &bary_out)
 Finds the triangle containing a point using the trapezoidal map.
 

Detailed Description

Memory-efficient trapezoidal map for 2D lookup table queries, based on the LUT implementation of P. Gomes (https://github.com/pcarruscag/LUT).

Author
T. Kiymaz, P. Gomes
Version
8.5.0 "Harrier"

SU2 Project Website: https://su2code.github.io

The SU2 Project is maintained by the SU2 Foundation (http://su2foundation.org)

Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)

SU2 is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

SU2 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with SU2. If not, see http://www.gnu.org/licenses/.