PLaSK library

Loading...
Searching...
No Matches
spatial_index.hpp
Go to the documentation of this file.
1/*
2 * This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3 * Copyright (c) 2022 Lodz University of Technology
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef PLASK__GEOMETRY_SPATIAL_INDEX_H
15#define PLASK__GEOMETRY_SPATIAL_INDEX_H
16
17#include "transform.hpp"
18
19 namespace plask {
20
26 template <int DIMS>
27 struct SpatialIndexNode {
28
29 virtual shared_ptr<Material> getMaterial(const Vec<DIMS>& p) const = 0;
30
31 virtual bool contains(const Vec<DIMS>& p) const = 0;
32
33 virtual GeometryObject::Subtree getPathsAt(shared_ptr<const GeometryObject> caller, const Vec<DIMS> &point, bool all) const = 0;
34
35 virtual ~SpatialIndexNode() {}
36};
37
38
46 template <int DIMS>
47std::unique_ptr<SpatialIndexNode<DIMS>> buildSpatialIndex(const std::vector< shared_ptr<Translation<DIMS>> >& children);
48
49 PLASK_API_EXTERN_TEMPLATE_STRUCT(SpatialIndexNode<2>)
50 PLASK_API_EXTERN_TEMPLATE_STRUCT(SpatialIndexNode<3>)
51
52 extern template PLASK_API std::unique_ptr<SpatialIndexNode<2>> buildSpatialIndex(const std::vector< shared_ptr<Translation<2>> >& children);
53 extern template PLASK_API std::unique_ptr<SpatialIndexNode<3>> buildSpatialIndex(const std::vector< shared_ptr<Translation<3>> >& children);
54
55} // plask
56
57#endif // PLASK__GEOMETRY_SPATIAL_INDEX_H