| 
 | 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