// Copyright (c) 2010-2023, Lawrence Livermore National Security, LLC. Produced // at the Lawrence Livermore National Laboratory. All Rights reserved. See files // LICENSE and NOTICE for details. LLNL-CODE-806117. // // This file is part of the MFEM library. For more information and source code // availability visit https://mfem.org. // // MFEM is free software; you can redistribute it and/or modify it under the // terms of the BSD-3 license. We welcome feedback and contributions, see file // CONTRIBUTING.md for details. #ifndef MFEM_OPTPARSER #define MFEM_OPTPARSER #include "../config/config.hpp" #include "array.hpp" namespace mfem { class Vector; /** Class for parsing command-line options. The class is initialized with argc and argv, and new options are added with the AddOption method. Currently options of type bool, int, double, char*, mfem::Array, and mfem::Vector are supported. See the MFEM examples for sample use. */ class OptionsParser { public: enum OptionType { INT, DOUBLE, STRING, STD_STRING, ENABLE, DISABLE, ARRAY, VECTOR }; private: struct Option { OptionType type; void *var_ptr; const char *short_name; const char *long_name; const char *description; bool required; Option() = default; Option(OptionType type_, void *var_ptr_, const char *short_name_, const char *long_name_, const char *description_, bool req) : type(type_), var_ptr(var_ptr_), short_name(short_name_), long_name(long_name_), description(description_), required(req) { } }; int argc; char **argv; Array