Skip to content

Commit babec87

Browse files
Merge pull request #135 from Geode-solutions/fix/inspector-implicit-model
fix(binaries): Added geode-inspector for implicit models.
2 parents 85369c4 + 6d983a3 commit babec87

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed

src/bin/CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,38 @@ add_geode_binary(
6262
${PROJECT_NAME}::inspector
6363
)
6464

65+
add_geode_binary(
66+
SOURCE "geode-inspector-implicit-cross-section.cpp"
67+
DEPENDENCIES
68+
Async++
69+
absl::flags
70+
absl::flags_parse
71+
absl::flags_usage
72+
OpenGeode::basic
73+
OpenGeode::geometry
74+
OpenGeode::mesh
75+
OpenGeode::model
76+
OpenGeode-Geosciences::implicit
77+
OpenGeode-GeosciencesIO::model
78+
${PROJECT_NAME}::inspector
79+
)
80+
81+
add_geode_binary(
82+
SOURCE "geode-inspector-implicit-structural-model.cpp"
83+
DEPENDENCIES
84+
Async++
85+
absl::flags
86+
absl::flags_parse
87+
absl::flags_usage
88+
OpenGeode::basic
89+
OpenGeode::geometry
90+
OpenGeode::mesh
91+
OpenGeode::model
92+
OpenGeode-Geosciences::implicit
93+
OpenGeode-GeosciencesIO::model
94+
${PROJECT_NAME}::inspector
95+
)
96+
6597
add_geode_binary(
6698
SOURCE "geode-inspector-pointset.cpp"
6799
DEPENDENCIES
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
#include <absl/flags/flag.h>
25+
#include <absl/flags/parse.h>
26+
#include <absl/flags/usage.h>
27+
28+
#include <async++.h>
29+
30+
#include <geode/basic/assert.hpp>
31+
#include <geode/basic/filename.hpp>
32+
#include <geode/basic/logger.hpp>
33+
34+
#include <geode/geosciences/implicit/representation/core/implicit_cross_section.hpp>
35+
#include <geode/geosciences/implicit/representation/io/implicit_cross_section_input.hpp>
36+
37+
#include <geode/geosciences_io/model/common.hpp>
38+
39+
#include <geode/inspector/section_inspector.hpp>
40+
41+
ABSL_FLAG( std::string, input, "/path/my/model.og_ixsctn", "Input model" );
42+
43+
void inspect_implicit_cross_section(
44+
const geode::ImplicitCrossSection& cross_section )
45+
{
46+
const geode::SectionInspector cross_section_inspector{ cross_section };
47+
auto result = cross_section_inspector.inspect_section();
48+
49+
geode::Logger::info( result.string() );
50+
}
51+
52+
int main( int argc, char* argv[] )
53+
{
54+
try
55+
{
56+
absl::SetProgramUsageMessage( absl::StrCat(
57+
"ImplicitCrossSection inspector from Geode-solutions.\n",
58+
"Sample usage:\n", argv[0], " --input my_cross_section.og_ixsctn\n",
59+
"Default behavior tests all available criteria, to disable one "
60+
"use --noXXX, e.g. --nocomponent_linking" ) );
61+
absl::ParseCommandLine( argc, argv );
62+
63+
geode::GeosciencesIOModelLibrary::initialize();
64+
const auto filename = absl::GetFlag( FLAGS_input );
65+
66+
inspect_implicit_cross_section(
67+
geode::load_implicit_cross_section( filename ) );
68+
69+
return 0;
70+
}
71+
catch( ... )
72+
{
73+
return geode::geode_lippincott();
74+
}
75+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
#include <absl/flags/flag.h>
25+
#include <absl/flags/parse.h>
26+
#include <absl/flags/usage.h>
27+
28+
#include <async++.h>
29+
30+
#include <geode/basic/assert.hpp>
31+
#include <geode/basic/filename.hpp>
32+
#include <geode/basic/logger.hpp>
33+
34+
#include <geode/geosciences/implicit/representation/core/implicit_structural_model.hpp>
35+
#include <geode/geosciences/implicit/representation/io/implicit_structural_model_input.hpp>
36+
37+
#include <geode/geosciences_io/model/common.hpp>
38+
39+
#include <geode/inspector/brep_inspector.hpp>
40+
41+
ABSL_FLAG( std::string, input, "/path/my/model.og_istrm", "Input model" );
42+
43+
void inspect_implicit_structural_model(
44+
const geode::ImplicitStructuralModel& model )
45+
{
46+
const geode::BRepInspector model_inspector{ model };
47+
auto result = model_inspector.inspect_brep();
48+
geode::Logger::info( result.string() );
49+
}
50+
51+
int main( int argc, char* argv[] )
52+
{
53+
try
54+
{
55+
absl::SetProgramUsageMessage( absl::StrCat(
56+
"ImplicitStructuralModel inspector from Geode-solutions.\n",
57+
"Sample usage:\n", argv[0],
58+
" --input my_implicit_structural_model.og_istrm\n",
59+
"Default behavior tests all available criteria, to disable one "
60+
"use --noXXX, e.g. --nocomponent_linking" ) );
61+
absl::ParseCommandLine( argc, argv );
62+
63+
geode::GeosciencesIOModelLibrary::initialize();
64+
const auto filename = absl::GetFlag( FLAGS_input );
65+
66+
inspect_implicit_structural_model(
67+
geode::load_implicit_structural_model( filename ) );
68+
69+
return 0;
70+
}
71+
catch( ... )
72+
{
73+
return geode::geode_lippincott();
74+
}
75+
}

0 commit comments

Comments
 (0)