Skip to content

Commit 996929a

Browse files
Feat/colocalization criterion (#4)
* feat(criterion): Added colocation inspector for PointSet, EdgedCurve, SurfaceMesh and SolidMesh * Added 3D template verification for SolidMesh inspection
1 parent 0caddd6 commit 996929a

18 files changed

+1316
-1
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
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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( SolidMesh );
33+
} // namespace geode
34+
35+
namespace geode
36+
{
37+
/*!
38+
* Class for inspecting the colocation of points in a SolidMesh
39+
*/
40+
template < index_t dimension >
41+
class opengeode_inspector_inspector_api SolidMeshColocation
42+
{
43+
OPENGEODE_DISABLE_COPY( SolidMeshColocation );
44+
OPENGEODE_TEMPLATE_ASSERT_3D( dimension );
45+
46+
public:
47+
SolidMeshColocation( const SolidMesh< dimension >& mesh );
48+
~SolidMeshColocation();
49+
50+
bool mesh_has_colocated_points() const;
51+
52+
index_t nb_colocated_points() const;
53+
54+
std::vector< std::vector< index_t > > colocated_points_groups() const;
55+
56+
private:
57+
IMPLEMENTATION_MEMBER( impl_ );
58+
};
59+
ALIAS_2D_AND_3D( SolidMeshColocation );
60+
} // 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( SurfaceMesh );
33+
} // namespace geode
34+
35+
namespace geode
36+
{
37+
/*!
38+
* Class for inspecting the colocation of points in a SurfaceMesh
39+
*/
40+
template < index_t dimension >
41+
class opengeode_inspector_inspector_api SurfaceMeshColocation
42+
{
43+
OPENGEODE_DISABLE_COPY( SurfaceMeshColocation );
44+
45+
public:
46+
SurfaceMeshColocation( const SurfaceMesh< dimension >& mesh );
47+
~SurfaceMeshColocation();
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( SurfaceMeshColocation );
59+
} // namespace geode

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace geode
4141
class opengeode_inspector_inspector_api SolidMeshDegeneration
4242
{
4343
OPENGEODE_DISABLE_COPY( SolidMeshDegeneration );
44+
OPENGEODE_TEMPLATE_ASSERT_3D( dimension );
4445

4546
public:
4647
SolidMeshDegeneration( const SolidMesh< dimension >& mesh );
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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/inspector/common.h>
27+
28+
#include <geode/geometry/nn_search.h>
29+
30+
namespace geode
31+
{
32+
namespace detail
33+
{
34+
/*!
35+
* Implementation of the inspection of the colocation of a Mesh
36+
*/
37+
template < index_t dimension, typename Mesh >
38+
class ColocationImpl
39+
{
40+
protected:
41+
ColocationImpl( const Mesh& mesh );
42+
43+
public:
44+
bool mesh_has_colocated_points() const;
45+
46+
index_t nb_colocated_points() const;
47+
48+
std::vector< std::vector< index_t > >
49+
colocated_points_groups() const;
50+
51+
private:
52+
const typename NNSearch< dimension >::ColocatedInfo
53+
mesh_colocation_info_;
54+
};
55+
} // namespace detail
56+
} // namespace geode

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ namespace geode
3535
template < typename Mesh >
3636
class DegenerationImpl
3737
{
38-
public:
38+
protected:
3939
DegenerationImpl( const Mesh& mesh );
4040

41+
public:
4142
bool is_mesh_degenerated() const;
4243

4344
index_t nb_degenerated_edges() const;

src/geode/inspector/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,23 @@ add_geode_library(
2727
"criterion/degeneration/surface_degeneration.cpp"
2828
"criterion/degeneration/solid_degeneration.cpp"
2929
"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"
3035
PUBLIC_HEADERS
3136
"common.h"
3237
"criterion/degeneration/edgedcurve_degeneration.h"
3338
"criterion/degeneration/surface_degeneration.h"
3439
"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"
3544
PRIVATE_HEADERS
3645
"criterion/private/degeneration_impl.h"
46+
"criterion/private/colocation_impl.h"
3747
PUBLIC_DEPENDENCIES
3848
OpenGeode::basic
3949
PRIVATE_DEPENDENCIES

0 commit comments

Comments
 (0)