Skip to content

Commit 2b422a8

Browse files
committed
feat(criterion): Add inspector criterion on colocation of points for meshes
1 parent d603131 commit 2b422a8

26 files changed

+1541
-217
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
#pragma once
25+
26+
#include <geode/basic/pimpl.h>
27+
28+
#include <geode/inspector/common.h>
29+
30+
namespace geode
31+
{
32+
FORWARD_DECLARATION_DIMENSION_CLASS( EdgedCurve );
33+
} // namespace geode
34+
35+
namespace geode
36+
{
37+
/*!
38+
* Class for inspecting the colocation of points in an EdgedCurve
39+
*/
40+
template < index_t dimension >
41+
class opengeode_inspector_inspector_api EdgedCurveColocation
42+
{
43+
OPENGEODE_DISABLE_COPY( EdgedCurveColocation );
44+
45+
public:
46+
EdgedCurveColocation( const EdgedCurve< dimension >& mesh );
47+
~EdgedCurveColocation();
48+
49+
bool mesh_has_colocated_points() const;
50+
51+
index_t nb_colocated_points() const;
52+
53+
std::vector< std::vector< index_t > > colocated_points_groups() const;
54+
55+
private:
56+
IMPLEMENTATION_MEMBER( impl_ );
57+
};
58+
ALIAS_2D_AND_3D( EdgedCurveColocation );
59+
} // namespace geode
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
#pragma once
25+
26+
#include <geode/basic/pimpl.h>
27+
28+
#include <geode/inspector/common.h>
29+
30+
namespace geode
31+
{
32+
FORWARD_DECLARATION_DIMENSION_CLASS( PointSet );
33+
} // namespace geode
34+
35+
namespace geode
36+
{
37+
/*!
38+
* Class for inspecting the colocation of points in a PointSet
39+
*/
40+
template < index_t dimension >
41+
class opengeode_inspector_inspector_api PointSetColocation
42+
{
43+
OPENGEODE_DISABLE_COPY( PointSetColocation );
44+
45+
public:
46+
PointSetColocation( const PointSet< dimension >& mesh );
47+
~PointSetColocation();
48+
49+
bool mesh_has_colocated_points() const;
50+
51+
index_t nb_colocated_points() const;
52+
53+
std::vector< std::vector< index_t > > colocated_points_groups() const;
54+
55+
private:
56+
IMPLEMENTATION_MEMBER( impl_ );
57+
};
58+
ALIAS_2D_AND_3D( PointSetColocation );
59+
} // namespace geode

include/geode/inspector/criterion/colocalization/solid_colocalization.h renamed to include/geode/inspector/criterion/colocation/solid_colocation.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,25 @@ namespace geode
3535
namespace geode
3636
{
3737
/*!
38-
* Class for inspecting the colocalization of points in a mesh
38+
* Class for inspecting the colocation of points in a SolidMesh
3939
*/
4040
template < index_t dimension >
41-
class opengeode_inspector_inspector_api SolidMeshColocalization
41+
class opengeode_inspector_inspector_api SolidMeshColocation
4242
{
43+
OPENGEODE_DISABLE_COPY( SolidMeshColocation );
44+
4345
public:
44-
SolidMeshColocalization( const SolidMesh< dimension >& mesh );
45-
~SolidMeshColocalization();
46+
SolidMeshColocation( const SolidMesh< dimension >& mesh );
47+
~SolidMeshColocation();
4648

47-
bool mesh_has_colocalized_points() const;
49+
bool mesh_has_colocated_points() const;
4850

49-
index_t nb_colocalized_points() const;
51+
index_t nb_colocated_points() const;
5052

51-
const std::vector< std::vector< index_t > >
52-
colocalized_points_groups() const;
53+
std::vector< std::vector< index_t > > colocated_points_groups() const;
5354

5455
private:
5556
IMPLEMENTATION_MEMBER( impl_ );
5657
};
57-
ALIAS_2D_AND_3D( SolidMeshColocalization );
58+
ALIAS_2D_AND_3D( SolidMeshColocation );
5859
} // namespace geode

include/geode/inspector/criterion/colocalization/surface_colocalization.h renamed to include/geode/inspector/criterion/colocation/surface_colocation.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,25 @@ namespace geode
3535
namespace geode
3636
{
3737
/*!
38-
* Class for inspecting the colocalization of points in a mesh
38+
* Class for inspecting the colocation of points in a SurfaceMesh
3939
*/
4040
template < index_t dimension >
41-
class opengeode_inspector_inspector_api SurfaceMeshColocalization
41+
class opengeode_inspector_inspector_api SurfaceMeshColocation
4242
{
43+
OPENGEODE_DISABLE_COPY( SurfaceMeshColocation );
44+
4345
public:
44-
SurfaceMeshColocalization( const SurfaceMesh< dimension >& mesh );
45-
~SurfaceMeshColocalization();
46+
SurfaceMeshColocation( const SurfaceMesh< dimension >& mesh );
47+
~SurfaceMeshColocation();
4648

47-
bool mesh_has_colocalized_points() const;
49+
bool mesh_has_colocated_points() const;
4850

49-
index_t nb_colocalized_points() const;
51+
index_t nb_colocated_points() const;
5052

51-
const std::vector< std::vector< index_t > >
52-
colocalized_points_groups() const;
53+
std::vector< std::vector< index_t > > colocated_points_groups() const;
5354

5455
private:
5556
IMPLEMENTATION_MEMBER( impl_ );
5657
};
57-
ALIAS_2D_AND_3D( SurfaceMeshColocalization );
58+
ALIAS_2D_AND_3D( SurfaceMeshColocation );
5859
} // namespace geode
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
#pragma once
25+
26+
#include <geode/basic/pimpl.h>
27+
28+
#include <geode/inspector/common.h>
29+
30+
namespace geode
31+
{
32+
FORWARD_DECLARATION_DIMENSION_CLASS( EdgedCurve );
33+
} // namespace geode
34+
35+
namespace geode
36+
{
37+
/*!
38+
* Class for inspecting the degeneration of an EdgedCurve
39+
*/
40+
template < index_t dimension >
41+
class opengeode_inspector_inspector_api EdgedCurveDegeneration
42+
{
43+
OPENGEODE_DISABLE_COPY( EdgedCurveDegeneration );
44+
45+
public:
46+
EdgedCurveDegeneration( const EdgedCurve< dimension >& mesh );
47+
~EdgedCurveDegeneration();
48+
49+
bool is_mesh_degenerated() const;
50+
51+
index_t nb_degenerated_edges() const;
52+
53+
std::vector< index_t > degenerated_edges() const;
54+
55+
private:
56+
IMPLEMENTATION_MEMBER( impl_ );
57+
};
58+
ALIAS_2D_AND_3D( EdgedCurveDegeneration );
59+
} // namespace geode

include/geode/inspector/criterion/degeneration/solid_degeneration.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
namespace geode
3131
{
3232
FORWARD_DECLARATION_DIMENSION_CLASS( SolidMesh );
33-
ALIAS_3D( SolidMesh );
3433
} // namespace geode
3534

3635
namespace geode
3736
{
3837
/*!
3938
* Class for inspecting the degeneration of a SolidMesh
4039
*/
40+
template < index_t dimension >
4141
class opengeode_inspector_inspector_api SolidMeshDegeneration
4242
{
4343
OPENGEODE_DISABLE_COPY( SolidMeshDegeneration );
4444

4545
public:
46-
SolidMeshDegeneration( const SolidMesh3D& mesh );
46+
SolidMeshDegeneration( const SolidMesh< dimension >& mesh );
4747
~SolidMeshDegeneration();
4848

4949
bool is_mesh_degenerated() const;
@@ -55,4 +55,5 @@ namespace geode
5555
private:
5656
IMPLEMENTATION_MEMBER( impl_ );
5757
};
58-
} // namespace geode
58+
ALIAS_2D_AND_3D( SolidMeshDegeneration );
59+
} // namespace geode

include/geode/inspector/criterion/private/colocalization_impl.h renamed to include/geode/inspector/criterion/private/colocation_impl.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,31 @@
2525

2626
#include <geode/inspector/common.h>
2727

28+
#include <geode/geometry/nn_search.h>
29+
2830
namespace geode
2931
{
3032
namespace detail
3133
{
3234
/*!
33-
* Implementation of the inspection of the colocalization of a Mesh
35+
* Implementation of the inspection of the colocation of a Mesh
3436
*/
35-
template < class MeshType >
36-
class opengeode_inspector_inspector_api ColocalizationImpl
37+
template < index_t dimension, class MeshType >
38+
class ColocationImpl
3739
{
38-
OPENGEODE_DISABLE_COPY( ColocalizationImpl );
39-
4040
public:
41-
ColocalizationImpl( const MeshType& mesh );
42-
~ColocalizationImpl();
41+
ColocationImpl( const MeshType& mesh );
4342

44-
bool mesh_has_colocalized_points() const;
43+
bool mesh_has_colocated_points() const;
4544

46-
index_t nb_colocalized_points() const;
45+
index_t nb_colocated_points() const;
4746

4847
std::vector< std::vector< index_t > >
49-
colocalized_points_groups() const;
48+
colocated_points_groups() const;
5049

5150
private:
52-
bool points_are_colocalized(
53-
index_t pt_index_1, index_t pt_index_2 ) const;
54-
55-
const MeshType& mesh_;
51+
const typename NNSearch< dimension >::ColocatedInfo
52+
mesh_colocation_info_;
5653
};
5754
} // namespace detail
5855
} // namespace geode

include/geode/inspector/criterion/private/degeneration_impl.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ namespace geode
3333
* Implementation of the inspection of the degeneration of a Mesh
3434
*/
3535
template < class MeshType >
36-
class opengeode_inspector_inspector_api DegenerationImpl
36+
class DegenerationImpl
3737
{
38-
OPENGEODE_DISABLE_COPY( DegenerationImpl );
39-
4038
public:
4139
DegenerationImpl( const MeshType& mesh );
4240

src/geode/inspector/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,27 @@ add_geode_library(
2323
FOLDER "geode/inspector"
2424
SOURCES
2525
"common.cpp"
26+
"criterion/degeneration/edgedcurve_degeneration.cpp"
2627
"criterion/degeneration/surface_degeneration.cpp"
2728
"criterion/degeneration/solid_degeneration.cpp"
2829
"criterion/private/degeneration_impl.cpp"
30+
"criterion/colocation/pointset_colocation.cpp"
31+
"criterion/colocation/edgedcurve_colocation.cpp"
32+
"criterion/colocation/surface_colocation.cpp"
33+
"criterion/colocation/solid_colocation.cpp"
34+
"criterion/private/colocation_impl.cpp"
2935
PUBLIC_HEADERS
3036
"common.h"
37+
"criterion/degeneration/edgedcurve_degeneration.h"
3138
"criterion/degeneration/surface_degeneration.h"
3239
"criterion/degeneration/solid_degeneration.h"
40+
"criterion/colocation/pointset_colocation.h"
41+
"criterion/colocation/edgedcurve_colocation.h"
42+
"criterion/colocation/surface_colocation.h"
43+
"criterion/colocation/solid_colocation.h"
3344
PRIVATE_HEADERS
3445
"criterion/private/degeneration_impl.h"
46+
"criterion/private/colocation_impl.h"
3547
PUBLIC_DEPENDENCIES
3648
OpenGeode::basic
3749
PRIVATE_DEPENDENCIES

0 commit comments

Comments
 (0)