Skip to content

Commit 725d0ae

Browse files
committed
Started adding the colocalization criterion
1 parent 055e975 commit 725d0ae

File tree

2 files changed

+157
-1
lines changed

2 files changed

+157
-1
lines changed

include/geode/inspector/criterion/colocalization.h

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,42 @@
2323

2424
#pragma once
2525

26+
#include <geode/basic/pimpl.h>
27+
2628
#include <geode/inspector/common.h>
2729

2830
namespace geode
2931
{
30-
bool opengeode_inspector_inspector_api hello_world();
32+
FORWARD_DECLARATION_DIMENSION_CLASS( VertexSet );
3133
} // namespace geode
34+
35+
namespace geode
36+
{
37+
namespace inspector
38+
{
39+
/*!
40+
* Class for inspecting the colocalization of points in a mesh
41+
*/
42+
template < index_t dimension >
43+
class opengeode_inspector_inspector_api MeshColocalization
44+
{
45+
public:
46+
MeshColocalization();
47+
~MeshColocalization();
48+
49+
bool mesh_has_colocalized_points(
50+
const VertexSet< dimension >& mesh ) const;
51+
52+
index_t nb_colocalized_points(
53+
const VertexSet< dimension >& mesh ) const;
54+
55+
const std::vector< std::vector< index_t > >
56+
colocalized_points_groups(
57+
const VertexSet< dimension >& mesh ) const;
58+
59+
private:
60+
IMPLEMENTATION_MEMBER( impl_ );
61+
};
62+
ALIAS_2D_AND_3D( MeshColocalization );
63+
} // namespace inspector
64+
} // namespace geode
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/*
2+
* Copyright (c) 2019 - 2021 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+
#include <geode/inspector/criterion/colocalization.h>
25+
26+
#include <geode/basic/pimpl_impl.h>
27+
28+
#include <geode/mesh/core/vertex_set.h>
29+
30+
#include <geode/geometry/distance.h>
31+
#include <geode/geometry/point.h>
32+
33+
namespace geode
34+
{
35+
namespace inspector
36+
{
37+
template < index_t dimension >
38+
class MeshColocalization< dimension >::Impl
39+
{
40+
public:
41+
Impl() = default;
42+
43+
bool mesh_has_colocalized_points(
44+
const VertexSet< dimension >& mesh ) const
45+
{
46+
bool has_colocalization = false;
47+
48+
for( auto point_index : Range( mesh.nb_vertices() ) ) {}
49+
// mesh.enable_edges();
50+
// for( auto edge_index : Range( mesh.edges().nb_edges() ) )
51+
// {
52+
// const auto edge_vertices =
53+
// mesh.edges().edge_vertices( edge_index );
54+
// const Point< dimension >&p1 =
55+
// mesh.point( edge_vertices[0]
56+
// ),
57+
// p2 = mesh.point( edge_vertices[1]
58+
// );
59+
// if( geode::point_point_distance( p1, p2 ) <
60+
// global_epsilon )
61+
// {
62+
// is_degenerated = true;
63+
// break;
64+
// }
65+
// }
66+
67+
return has_colocalization;
68+
}
69+
70+
index_t nb_colocalized_points(
71+
const VertexSet< dimension >& mesh ) const
72+
{
73+
index_t nb_colocalizations;
74+
75+
return nb_colocalizations
76+
}
77+
78+
std::vector< std::Vector< index_t > > colocalized_points_groups(
79+
const VertexSet< dimension >& mesh ) const
80+
{
81+
std::vector< std::Vector< index_t > > colocalizations;
82+
return colocalizations;
83+
}
84+
};
85+
86+
template < index_t dimension >
87+
MeshColocalization< dimension >::MeshColocalization()
88+
{
89+
}
90+
91+
template < index_t dimension >
92+
MeshColocalization< dimension >::~MeshColocalization()
93+
{
94+
}
95+
96+
template < index_t dimension >
97+
bool MeshColocalization< dimension >::mesh_has_colocalized_points(
98+
const VertexSet< dimension >& mesh ) const
99+
{
100+
return impl_->mesh_has_colocalized_points( mesh );
101+
}
102+
103+
template < index_t dimension >
104+
index_t MeshColocalization< dimension >::nb_colocalized_points(
105+
const VertexSet< dimension >& mesh ) const
106+
{
107+
return impl_->nb_colocalized_points( mesh );
108+
}
109+
110+
template < index_t dimension >
111+
const std::vector< std::vector< index_t > >
112+
MeshColocalization< dimension >::colocalized_points_groups(
113+
const VertexSet< dimension >& mesh ) const
114+
{
115+
return impl_->colocalized_points_groups( mesh );
116+
}
117+
118+
template class opengeode_inspector_inspector_api
119+
MeshColocalization< 2 >;
120+
template class opengeode_inspector_inspector_api
121+
MeshColocalization< 3 >;
122+
} // namespace inspector
123+
} // namespace geode

0 commit comments

Comments
 (0)