Loading...
Searching...
No Matches
surface_skd_tree.hpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25# ifndef __BITPIT_SURFACE_SKD_TREE_HPP__
26# define __BITPIT_SURFACE_SKD_TREE_HPP__
27
28#include "patch_skd_tree.hpp"
29#include "surface_kernel.hpp"
30
31namespace bitpit {
32
34
35public:
36 SurfaceSkdTree(const SurfaceKernel *patch, bool interorOnly = false);
37
38 void clear(bool release);
39
40 double evalPointDistance(const std::array<double,3> &point) const;
41 double evalPointDistance(const std::array<double,3> &point, double maxDistance) const;
42 double evalPointDistance(const std::array<double,3> &point, double maxDistance, bool interorOnly) const;
43 void evalPointDistance(int nPoints, const std::array<double, 3> *points, double *distances) const;
44 void evalPointDistance(int nPoints, const std::array<double, 3> *points, double maxDistance, double *distances) const;
45 void evalPointDistance(int nPoints, const std::array<double, 3> *points, const double *maxDistances, double *distances) const;
46 void evalPointDistance(int nPoints, const std::array<double, 3> *points, const double *maxDistances, bool interorOnly, double *distances) const;
47#if BITPIT_ENABLE_MPI
48 void evalPointGlobalDistance(int nPoints, const std::array<double, 3> *points, double *distances) const;
49 void evalPointGlobalDistance(int nPoints, const std::array<double, 3> *points, double maxDistance, double *distances) const;
50 void evalPointGlobalDistance(int nPoints, const std::array<double, 3> *points, const double *maxDistances, double *distances) const;
51#endif
52
53 long findPointClosestCell(const std::array<double,3> &point, long *id, double *distance) const;
54 long findPointClosestCell(const std::array<double, 3> &point, double maxDistance, long *id, double *distance) const;
55 long findPointClosestCell(const std::array<double, 3> &point, double maxDistance, bool interorOnly, long *id, double *distance) const;
56 long findPointClosestCell(int nPoints, const std::array<double, 3> *points, long *ids, double *distances) const;
57 long findPointClosestCell(int nPoints, const std::array<double, 3> *points, double maxDistance, long *ids, double *distances) const;
58 long findPointClosestCell(int nPoints, const std::array<double, 3> *points, const double *maxDistances, long *ids, double *distances) const;
59 long findPointClosestCell(int nPoints, const std::array<double, 3> *points, const double *maxDistances, bool interorOnly, long *ids, double *distances) const;
60 long findPointClosestCells(const std::array<double,3> &point, std::vector<long> &ids, double *distance) const;
61 long findPointClosestCells(const std::array<double, 3> &point, double maxDistance, std::vector<long> &ids, double *distance) const;
62 long findPointClosestCells(const std::array<double, 3> &point, double maxDistance, bool interorOnly, std::vector<long> &ids, double *distance) const;
63
64#if BITPIT_ENABLE_MPI
65 long findPointClosestGlobalCell(int nPoints, const std::array<double, 3> *points, long *ids, int *ranks, double *distances) const;
66 long findPointClosestGlobalCell(int nPoints, const std::array<double, 3> *points, double maxDistance, long *ids, int *ranks, double *distances) const;
67 long findPointClosestGlobalCell(int nPoints, const std::array<double, 3> *points, const double *maxDistances, long *ids, int *ranks, double *distances) const;
68#endif
69
70private:
71 struct ClosestCellCandidates {
72 std::vector<std::size_t> nodeStack;
73 std::vector<std::size_t> ids;
74 std::vector<double> minDistances;
75 double maxDistance;
76
77 void clear()
78 {
79 nodeStack.clear();
80 ids.clear();
81 minDistances.clear();
82 }
83 };
84
85 void findPointClosestCandidates(const std::array<double, 3> &point, double maxDistance, ClosestCellCandidates *candidates) const;
86
87 mutable ClosestCellCandidates m_closestCellCandidates;
88};
89
90}
91
92#endif
PatchSkdTree is the class that implements a spatial kd-tree (skd-tree) a bitpit patch.
The SurfaceKernel class provides an interface for defining surface patches.
The SurfaceSkdTree implements a Bounding Volume Hierarchy tree for surface patches.
long findPointClosestGlobalCell(int nPoints, const std::array< double, 3 > *points, long *ids, int *ranks, double *distances) const
void evalPointGlobalDistance(int nPoints, const std::array< double, 3 > *points, double *distances) const
void clear(bool release)
long findPointClosestCells(const std::array< double, 3 > &point, std::vector< long > &ids, double *distance) const
SurfaceSkdTree(const SurfaceKernel *patch, bool interorOnly=false)
double evalPointDistance(const std::array< double, 3 > &point) const
long findPointClosestCell(const std::array< double, 3 > &point, long *id, double *distance) const
--- layout: doxygen_footer ---