Skip to content

Commit ab413c8

Browse files
Merge pull request #1 from Geode-solutions/dev
feat(criterion): Add inspector criterion for degeneration on SurfaceMesh and SolidMesh
2 parents 47193e1 + 307928c commit ab413c8

File tree

18 files changed

+721
-71
lines changed

18 files changed

+721
-71
lines changed

.github/workflows/CD.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ jobs:
3030
cd build
3131
version="${GITHUB_REF##*/*/}"
3232
echo ::set-output name=version::$version
33-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DMYMODULE_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=${{ matrix.config.system }} ..
33+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DOPENGEODE_INSPECTOR_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=${{ matrix.config.system }} ..
3434
cmake --build . -- -j2
3535
cmake --build . --target package
3636
- name: Upload
3737
uses: softprops/action-gh-release@v1
3838
with:
39-
files: "build/MyModule-${{ steps.package.outputs.version }}-${{ matrix.config.system }}.tar.gz"
39+
files: "build/OpenGeode-Inspector-${{ steps.package.outputs.version }}-${{ matrix.config.system }}.tar.gz"
4040
env:
4141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4242
- name: Doc
@@ -63,13 +63,13 @@ jobs:
6363
cd build
6464
version="${GITHUB_REF##*/*/}"
6565
echo ::set-output name=version::$version
66-
cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DMYMODULE_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=darwin ..
66+
cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DOPENGEODE_INSPECTOR_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=darwin ..
6767
cmake --build . --config Release
6868
cmake --build . --target package --config Release
6969
- name: Upload
7070
uses: softprops/action-gh-release@v1
7171
with:
72-
files: "build/MyModule-${{ steps.package.outputs.version }}-darwin.tar.gz"
72+
files: "build/OpenGeode-Inspector-${{ steps.package.outputs.version }}-darwin.tar.gz"
7373
env:
7474
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7575

@@ -91,13 +91,13 @@ jobs:
9191
cd build
9292
version="${GITHUB_REF##*/*/}"
9393
echo ::set-output name=version::$version
94-
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DMYMODULE_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=win64 ..
94+
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DOPENGEODE_INSPECTOR_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=win64 ..
9595
cmake --build . --config Release
9696
cmake --build . --target PACKAGE --config Release
9797
shell: bash
9898
- name: Upload
9999
uses: softprops/action-gh-release@v1
100100
with:
101-
files: "build/MyModule-${{ steps.package.outputs.version }}-win64.zip"
101+
files: "build/OpenGeode-Inspector-${{ steps.package.outputs.version }}-win64.zip"
102102
env:
103103
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CMakeLists.txt

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,23 @@
2121
cmake_minimum_required(VERSION 3.11)
2222

2323
# Define the project
24-
project(MyModule CXX)
24+
project(OpenGeode-Inspector CXX)
2525

26-
option(MYMODULE_WITH_TESTS "Compile test projects" ON)
26+
option(OPENGEODE_INSPECTOR_WITH_TESTS "Compile test projects" ON)
2727

28-
# Get MyModule dependencies
28+
# Get OpenGeode-inspector dependencies
2929
find_package(OpenGeode REQUIRED)
3030

3131
#------------------------------------------------------------------------------------------------
32-
# Configure the MyModule libraries
33-
add_geode_library(
34-
NAME mylib
35-
FOLDER "mylib"
36-
SOURCES
37-
"common.cpp"
38-
"hello_world.cpp"
39-
PUBLIC_HEADERS
40-
"hello_world.h"
41-
PRIVATE_DEPENDENCIES
42-
OpenGeode::basic
43-
)
32+
# Configure the OpenGeode-inspector libraries
33+
add_subdirectory(src/geode)
4434

4535
#------------------------------------------------------------------------------------------------
4636
# Optional modules configuration
47-
if(MYMODULE_WITH_TESTS)
37+
if(OPENGEODE_INSPECTOR_WITH_TESTS)
4838
# Enable testing with CTest
4939
enable_testing()
50-
message(STATUS "Configuring MyModule with tests")
40+
message(STATUS "Configuring OpenGeode-inspector with tests")
5141
add_subdirectory(tests)
5242
endif()
5343

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<h1 align="center">OpenGeode-ModuleTemplate<sup><i>by Geode-solutions</i></sup></h1>
2-
<h3 align="center">Template for creating your own OpenGeode modules</h3>
1+
<h1 align="center">OpenGeode-Inspector<sup><i>by Geode-solutions</i></sup></h1>
2+
<h3 align="center">OpenGeode module for inspecting meshes and models</h3>
33

44

55
<p align="center">
@@ -31,18 +31,22 @@
3131

3232
## Introduction
3333

34-
OpenGeode-ModuleTemplate provides a template for creating an [OpenGeode] module.
34+
OpenGeode-Inspector is a module of [OpenGeode] providing ways of inspecting your meshes and models and verifying their validity.
3535

3636
[OpenGeode]: https://github.com/Geode-solutions/OpenGeode
3737

3838
## Documentation
3939

40-
To know how to use this template, please have a look at this page: https://help.github.com/en/articles/creating-a-repository-from-a-template
40+
Go check out the online documentation at [docs.geode-solutions.com].
4141

42-
Have also a look at this [OpenGeode] documentation: https://docs.geode-solutions.com/opengeode then click on "How to create your own OpenGeode module"
42+
[docs.geode-solutions.com] https://docs.geode-solutions.com
43+
44+
Installing OpenGeode-Inspector is done:
45+
46+
* by compiling the C++ source.
4347

4448
## Questions
45-
For questions and support please use the official [slack](https://slackin-opengeode.herokuapp.com) and go to the channel #module_template. The issue list of this repo is exclusively for bug reports and feature requests.
49+
For questions and support please use the official [slack](https://slackin-opengeode.herokuapp.com) and go to the channel #inspector. The issue list of this repo is exclusively for bug reports and feature requests.
4650

4751

4852
## License

cmake/MyModuleConfig.cmake.in renamed to cmake/OpenGeode-InspectorConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ include(CMakeFindDependencyMacro)
2424
find_dependency(OpenGeode)
2525

2626
# Load information for each target
27-
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_mylib_target.cmake)
27+
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_inspector_target.cmake)

include/mylib/hello_world.h renamed to include/geode/inspector/common.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
#pragma once
2525

26-
#include <mylib/mymodule_mylib_export.h>
26+
#include <geode/basic/common.h>
2727

28-
namespace mymodule
29-
{
30-
bool mymodule_mylib_api hello_world();
31-
} // namespace mymodule
28+
#include <geode/inspector/opengeode_inspector_inspector_export.h>

tests/mylib/test-hello-world.cpp renamed to include/geode/inspector/criterion/degeneration/solid_degeneration.h

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,38 @@
2121
*
2222
*/
2323

24-
#include <geode/basic/assert.h>
25-
#include <geode/basic/logger.h>
24+
#pragma once
2625

27-
#include <mylib/hello_world.h>
26+
#include <geode/basic/pimpl.h>
2827

29-
int main()
28+
#include <geode/inspector/common.h>
29+
30+
namespace geode
3031
{
31-
try
32-
{
33-
OPENGEODE_EXCEPTION(
34-
mymodule::hello_world(), "[Test] Hello World is not correct" );
32+
FORWARD_DECLARATION_DIMENSION_CLASS( SolidMesh );
33+
ALIAS_3D( SolidMesh );
34+
} // namespace geode
3535

36-
geode::Logger::info( "TEST SUCCESS" );
37-
return 0;
38-
}
39-
catch( ... )
36+
namespace geode
37+
{
38+
/*!
39+
* Class for inspecting the degeneration of a SolidMesh
40+
*/
41+
class opengeode_inspector_inspector_api SolidMeshDegeneration
4042
{
41-
return geode::geode_lippincott();
42-
}
43-
}
43+
OPENGEODE_DISABLE_COPY( SolidMeshDegeneration );
44+
45+
public:
46+
SolidMeshDegeneration( const SolidMesh3D& mesh );
47+
~SolidMeshDegeneration();
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+
} // 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 degeneration of a SurfaceMesh
39+
*/
40+
template < index_t dimension >
41+
class opengeode_inspector_inspector_api SurfaceMeshDegeneration
42+
{
43+
OPENGEODE_DISABLE_COPY( SurfaceMeshDegeneration );
44+
45+
public:
46+
SurfaceMeshDegeneration( const SurfaceMesh< dimension >& mesh );
47+
~SurfaceMeshDegeneration();
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( SurfaceMeshDegeneration );
59+
} // namespace geode

src/mylib/hello_world.cpp renamed to include/geode/inspector/criterion/private/degeneration_impl.h

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,36 @@
2121
*
2222
*/
2323

24-
#include <mylib/hello_world.h>
24+
#pragma once
2525

26-
#include <geode/basic/logger.h>
26+
#include <geode/inspector/common.h>
2727

28-
namespace mymodule
28+
namespace geode
2929
{
30-
bool hello_world()
30+
namespace detail
3131
{
32-
geode::Logger::info( "Hello Geode World!" );
33-
return true;
34-
}
35-
} // namespace mymodule
32+
/*!
33+
* Implementation of the inspection of the degeneration of a Mesh
34+
*/
35+
template < class MeshType >
36+
class opengeode_inspector_inspector_api DegenerationImpl
37+
{
38+
OPENGEODE_DISABLE_COPY( DegenerationImpl );
39+
40+
public:
41+
DegenerationImpl( const MeshType& mesh );
42+
43+
bool is_mesh_degenerated() const;
44+
45+
index_t nb_degenerated_edges() const;
46+
47+
std::vector< index_t > degenerated_edges() const;
48+
49+
private:
50+
bool edge_is_degenerated( index_t edge_index ) const;
51+
52+
private:
53+
const MeshType& mesh_;
54+
};
55+
} // namespace detail
56+
} // namespace geode

tests/mylib/CMakeLists.txt renamed to src/geode/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,4 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020

21-
add_geode_test(
22-
SOURCE "test-hello-world.cpp"
23-
DEPENDENCIES
24-
OpenGeode::basic
25-
${PROJECT_NAME}::mylib
26-
)
21+
add_subdirectory(inspector)

src/geode/inspector/CMakeLists.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2019 - 2021 Geode-solutions
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in
11+
# all copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
add_geode_library(
22+
NAME inspector
23+
FOLDER "geode/inspector"
24+
SOURCES
25+
"common.cpp"
26+
"criterion/degeneration/surface_degeneration.cpp"
27+
"criterion/degeneration/solid_degeneration.cpp"
28+
"criterion/private/degeneration_impl.cpp"
29+
PUBLIC_HEADERS
30+
"common.h"
31+
"criterion/degeneration/surface_degeneration.h"
32+
"criterion/degeneration/solid_degeneration.h"
33+
PRIVATE_HEADERS
34+
"criterion/private/degeneration_impl.h"
35+
PUBLIC_DEPENDENCIES
36+
OpenGeode::basic
37+
PRIVATE_DEPENDENCIES
38+
OpenGeode::geometry
39+
OpenGeode::mesh
40+
)
41+

0 commit comments

Comments
 (0)