Skip to content

Commit 5443ecb

Browse files
name refactoring
1 parent c0e33e1 commit 5443ecb

23 files changed

Lines changed: 2154 additions & 374 deletions

include/geode/stochastic/configuration/configuration.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
// #include <geode/stochastic/configuration/neighbors_object_ids.hpp>
3434
namespace geode
3535
{
36-
struct GroupDescriptor
36+
struct SubSetDescriptor
3737
{
3838
geode::uuid unique_id;
39-
bool operator==( GroupDescriptor const& other ) const noexcept
39+
bool operator==( SubSetDescriptor const& other ) const noexcept
4040
{
4141
{
4242
return unique_id == other.unique_id;
@@ -46,32 +46,32 @@ namespace geode
4646

4747
struct ObjectId
4848
{
49-
index_t object;
50-
uuid group;
49+
index_t index;
50+
uuid subset;
5151
bool operator==( const ObjectId& other ) const noexcept
5252
{
53-
return object == other.object && group == other.group;
53+
return index == other.index && subset == other.subset;
5454
}
5555
};
5656
} // namespace geode
5757

5858
namespace geode
5959
{
60-
template < typename Object >
61-
class Configuration
60+
template < typename Type >
61+
class ObjectSet
6262
{
6363
public:
64-
const std::vector< Object >& get_group( const uuid& group_id ) const;
65-
const Object& get_object( const ObjectId& object_id ) const;
64+
const std::vector< Type >& get_subset( const uuid& subset_id ) const;
65+
const Type& get_object( const ObjectId& object_id ) const;
6666
std::vector< ObjectId > get_all_object() const;
6767

68-
index_t nb_groups() const;
69-
index_t nb_objects_in_group( const uuid& group_id ) const;
68+
index_t nb_subsets() const;
69+
index_t nb_objects_in_subset( const uuid& subset_id ) const;
7070
index_t nb_objects() const;
7171

72-
void add_group( const uuid& group_id );
73-
ObjectId add_object( Object&& object, const uuid& group_id );
74-
void update_object( const ObjectId& object_id, Object&& object );
72+
void add_subset( const uuid& subset_id );
73+
ObjectId add_object( Type&& object, const uuid& subset_id );
74+
void update_object( const ObjectId& object_id, Type&& object );
7575
void remove_object( const ObjectId& object_id );
7676

7777
// Object neighbor search by ObjectId (always excludes self)
@@ -80,13 +80,13 @@ namespace geode
8080
// Object neighbor search by arbitrary object (return self if in the
8181
// configuration)
8282
std::vector< ObjectId > neighbors(
83-
const Object& object, double searching_distance ) const;
83+
const Type& object, double searching_distance ) const;
8484

8585
private:
86-
std::vector< Object >& get_group( const uuid& group_id );
86+
std::vector< Type >& get_subset( const uuid& subset_id );
8787

8888
private:
89-
std::unordered_map< uuid, std::vector< Object > > groups_;
89+
std::unordered_map< uuid, std::vector< Type > > groups_;
9090
// ObjectIndexRTree< 2 > tree_;
9191
};
9292
} // namespace geode
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2019 - 2025 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#pragma once
25+
#include <geode/stochastic/configuration/r_tree.hpp>
26+
27+
namespace geode
28+
{
29+
FORWARD_DECLARATION_DIMENSION_CLASS( BoundingBox );
30+
}
31+
32+
namespace geode
33+
{
34+
35+
template < index_t dimension >
36+
class ObjectIndexRTree
37+
{
38+
OPENGEODE_DISABLE_COPY_AND_MOVE( ObjectIndexRTree );
39+
40+
public:
41+
ObjectIndexRTree();
42+
~ObjectIndexRTree() = default;
43+
44+
void add( const BoundingBox< dimension >& box, ObjectId id );
45+
46+
void remove( const BoundingBox< dimension >& box, ObjectId id );
47+
48+
void remove_all();
49+
50+
std::vector< ObjectId > get(
51+
const BoundingBox< dimension >& box ) const;
52+
53+
int count()
54+
{
55+
return tree_.Count();
56+
}
57+
58+
private:
59+
RTree< ObjectId, double, dimension > tree_;
60+
};
61+
62+
} // namespace geode

0 commit comments

Comments
 (0)