From: Daniel Arndt Date: Sat, 1 Jul 2023 18:54:50 +0000 (-0400) Subject: Replace std_cxx17 X-Git-Tag: relicensing~797^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51c04b17365fea2828fc61333486a37d44ae2766;p=dealii.git Replace std_cxx17 --- diff --git a/examples/step-85/step-85.cc b/examples/step-85/step-85.cc index 981677edbb..abcee95b07 100644 --- a/examples/step-85/step-85.cc +++ b/examples/step-85/step-85.cc @@ -395,7 +395,7 @@ namespace Step85 // produces anything useful. It can happen that the algorithm produces 0 // quadrature points. When this happens, the returned optional will not // contain a value, even if the cell is formally intersected. - const std_cxx17::optional> &inside_fe_values = + const std::optional> &inside_fe_values = non_matching_fe_values.get_inside_fe_values(); if (inside_fe_values) @@ -433,7 +433,7 @@ namespace Step85 // An additional benefit of std::optional is that we do not need any // other check for whether we are on intersected cells: In case we are // on an inside cell, we get an empty object here. - const std_cxx17::optional> + const std::optional> &surface_fe_values = non_matching_fe_values.get_surface_fe_values(); if (surface_fe_values) @@ -634,7 +634,7 @@ namespace Step85 { non_matching_fe_values.reinit(cell); - const std_cxx17::optional> &fe_values = + const std::optional> &fe_values = non_matching_fe_values.get_inside_fe_values(); if (fe_values) diff --git a/include/deal.II/base/mutable_bind.h b/include/deal.II/base/mutable_bind.h index 7f153af4ca..79a5c0c64b 100644 --- a/include/deal.II/base/mutable_bind.h +++ b/include/deal.II/base/mutable_bind.h @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -253,7 +252,7 @@ namespace Utilities ReturnType MutableBind::operator()() const { - return std_cxx17::apply(function, arguments); + return std::apply(function, arguments); } diff --git a/include/deal.II/base/quadrature_point_data.h b/include/deal.II/base/quadrature_point_data.h index f40eb4e915..6e51a874a9 100644 --- a/include/deal.II/base/quadrature_point_data.h +++ b/include/deal.II/base/quadrature_point_data.h @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -33,6 +32,7 @@ #include #include +#include #include #include @@ -170,9 +170,9 @@ public: get_data(const CellIteratorType &cell) const; /** - * Returns a std_cxx17::optional indicating whether @p cell contains an + * Returns a std::optional indicating whether @p cell contains an * associated data or not. If data is available, dereferencing the - * std_cxx17::optional reveals a vector of pointers to the underlying data + * std::optional reveals a vector of pointers to the underlying data * at the quadrature points. * A possible additional typename @p T is the class to which the base class * DataType could be cast. Since @p DataType is stored as shared pointers, @@ -186,13 +186,13 @@ public: * initialize() the cell data. */ template - std_cxx17::optional>> + std::optional>> try_get_data(const CellIteratorType &cell); /** - * Returns a std_cxx17::optional indicating whether @p cell contains an + * Returns a std::optional indicating whether @p cell contains an * associated data or not. If data is available, dereferencing the - * std_cxx17::optional reveals a vector of constant pointers to the + * std::optional reveals a vector of constant pointers to the * underlying data at the quadrature points. * A possible additional typename @p T is the class to which the base class * DataType could be cast. Since @p DataType is stored as shared pointers, @@ -206,7 +206,7 @@ public: * initialize() the cell data. */ template - std_cxx17::optional>> + std::optional>> try_get_data(const CellIteratorType &cell) const; private: @@ -746,7 +746,7 @@ CellDataStorage::get_data( template template -inline std_cxx17::optional>> +inline std::optional>> CellDataStorage::try_get_data( const CellIteratorType &cell) { @@ -777,7 +777,7 @@ CellDataStorage::try_get_data( template template -inline std_cxx17::optional>> +inline std::optional>> CellDataStorage::try_get_data( const CellIteratorType &cell) const { diff --git a/include/deal.II/base/std_cxx17/algorithm.h b/include/deal.II/base/std_cxx17/algorithm.h index d8404b88a6..3231bfe295 100644 --- a/include/deal.II/base/std_cxx17/algorithm.h +++ b/include/deal.II/base/std_cxx17/algorithm.h @@ -17,6 +17,9 @@ #include +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header .") + #include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/std_cxx17/optional.h b/include/deal.II/base/std_cxx17/optional.h index 4d6cc23f2d..510857a6d2 100644 --- a/include/deal.II/base/std_cxx17/optional.h +++ b/include/deal.II/base/std_cxx17/optional.h @@ -17,6 +17,9 @@ #include +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header .") + #include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/std_cxx17/tuple.h b/include/deal.II/base/std_cxx17/tuple.h index 03757d9bf6..e81cce318b 100644 --- a/include/deal.II/base/std_cxx17/tuple.h +++ b/include/deal.II/base/std_cxx17/tuple.h @@ -17,6 +17,9 @@ #include +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header .") + #include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/std_cxx17/variant.h b/include/deal.II/base/std_cxx17/variant.h index 84cc794db4..a7d42b74b9 100644 --- a/include/deal.II/base/std_cxx17/variant.h +++ b/include/deal.II/base/std_cxx17/variant.h @@ -17,6 +17,9 @@ #include +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header .") + #include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/table_handler.h b/include/deal.II/base/table_handler.h index 951568c871..a55bc25941 100644 --- a/include/deal.II/base/table_handler.h +++ b/include/deal.II/base/table_handler.h @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include @@ -149,7 +149,7 @@ namespace internal * Abbreviation for the data type stored by this object. */ using value_type = - std_cxx17::variant; + std::variant; /** * Stored value. @@ -818,13 +818,13 @@ namespace internal { // we don't quite know the data type in 'value', but // it must be one of the ones in the type list of the - // std_cxx17::variant. so if T is not in the list, or if + // std::variant. so if T is not in the list, or if // the data stored in the TableEntry is not of type // T, then we will get an exception that we can // catch and produce an error message try { - return std_cxx17::get(value); + return std::get(value); } catch (...) { @@ -844,33 +844,33 @@ namespace internal // write first an identifier for the kind // of data stored and then the actual // data, in its correct data type - if (std_cxx17::holds_alternative(value)) + if (std::holds_alternative(value)) { - const int p = std_cxx17::get(value); + const int p = std::get(value); char c = 'i'; ar &c &p; } - else if (std_cxx17::holds_alternative(value)) + else if (std::holds_alternative(value)) { - const unsigned int p = std_cxx17::get(value); + const unsigned int p = std::get(value); char c = 'u'; ar &c &p; } - else if (std_cxx17::holds_alternative(value)) + else if (std::holds_alternative(value)) { - const double p = std_cxx17::get(value); + const double p = std::get(value); char c = 'd'; ar &c &p; } - else if (std_cxx17::holds_alternative(value)) + else if (std::holds_alternative(value)) { - const std::string p = std_cxx17::get(value); + const std::string p = std::get(value); char c = 's'; ar &c &p; } - else if (std_cxx17::holds_alternative(value)) + else if (std::holds_alternative(value)) { - const std::uint64_t p = std_cxx17::get(value); + const std::uint64_t p = std::get(value); char c = 'l'; ar &c &p; } diff --git a/include/deal.II/base/thread_management.h b/include/deal.II/base/thread_management.h index b41dc02096..b071d1dedf 100644 --- a/include/deal.II/base/thread_management.h +++ b/include/deal.II/base/thread_management.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include #include @@ -839,7 +839,7 @@ namespace Threads DEAL_II_DISABLE_EXTRA_DIAGNOSTICS auto dummy = std::make_tuple(internal::maybe_make_ref::act(args)...); return new_thread( - [dummy, fun_ptr]() -> RT { return std_cxx17::apply(fun_ptr, dummy); }); + [dummy, fun_ptr]() -> RT { return std::apply(fun_ptr, dummy); }); DEAL_II_ENABLE_EXTRA_DIAGNOSTICS } @@ -1633,7 +1633,7 @@ namespace Threads { auto dummy = std::make_tuple(internal::maybe_make_ref::act(args)...); return new_task( - [dummy, fun_ptr]() -> RT { return std_cxx17::apply(fun_ptr, dummy); }); + [dummy, fun_ptr]() -> RT { return std::apply(fun_ptr, dummy); }); } diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index dcf52d9ccf..7d1e427302 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -22,7 +22,6 @@ #include #include #include -#include #include @@ -52,6 +51,8 @@ #include #include +#include + #ifdef DEAL_II_WITH_ZLIB # include # include @@ -3398,12 +3399,12 @@ namespace GridTools * every ghost cell as it was given by @p pack on the owning processor. * Whether you do or do not receive information to @p unpack on a given * ghost cell depends on whether the @p pack function decided that - * something needs to be sent. It does so using the std_cxx17::optional - * mechanism: if the std_cxx17::optional return object of the @p pack + * something needs to be sent. It does so using the std::optional + * mechanism: if the std::optional return object of the @p pack * function is empty, then this implies that no data has to be sent for * the locally owned cell it was called on. In that case, @p unpack will * also not be called on the ghost cell that corresponds to it on the - * receiving side. On the other hand, if the std_cxx17::optional object is + * receiving side. On the other hand, if the std::optional object is * not empty, then the data stored within it will be sent to the received * and the @p unpack function called with it. * @@ -3421,11 +3422,11 @@ namespace GridTools * that is a ghost cell somewhere else. As mentioned above, the function * may return a regular data object of type @p DataType to indicate * that data should be sent, or an empty - * std_cxx17::optional@ to indicate that nothing has + * std::optional@ to indicate that nothing has * to be sent for this cell. * @param unpack The function that will be called for each ghost cell * for which data was sent, i.e., for which the @p pack function - * on the sending side returned a non-empty std_cxx17::optional object. + * on the sending side returned a non-empty std::optional object. * The @p unpack function is then called with the data sent by the * processor that owns that cell. * @param cell_filter Only cells are communicated where this filter function returns @@ -3462,7 +3463,7 @@ namespace GridTools * @endcode * * You will notice that the @p pack lambda function returns an `unsigned int`, - * not a `std_cxx17::optional`. The former converts + * not a `std::optional`. The former converts * automatically to the latter, implying that data will always be transported * to the other processor. * @@ -3480,7 +3481,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler) void exchange_cell_data_to_ghosts( const MeshType & mesh, - const std::function( + const std::function( const typename MeshType::active_cell_iterator &)> &pack, const std::function & unpack, @@ -3504,7 +3505,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler) void exchange_cell_data_to_level_ghosts( const MeshType & mesh, - const std::function( + const std::function( const typename MeshType::level_cell_iterator &)> &pack, const std::function & unpack, @@ -4613,8 +4614,8 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler) inline void exchange_cell_data( const MeshType &mesh, - const std::function< - std_cxx17::optional(const MeshCellIteratorType &)> &pack, + const std::function(const MeshCellIteratorType &)> + &pack, const std::function & unpack, const std::function & cell_filter, @@ -4760,7 +4761,7 @@ namespace GridTools cell->index(), &mesh); - const std_cxx17::optional data = pack(mesh_it); + const std::optional data = pack(mesh_it); if (data) { data_to_send.emplace_back(*data); @@ -4903,7 +4904,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler) inline void exchange_cell_data_to_ghosts( const MeshType & mesh, - const std::function( + const std::function( const typename MeshType::active_cell_iterator &)> &pack, const std::function & unpack, @@ -4939,7 +4940,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler) inline void exchange_cell_data_to_level_ghosts( const MeshType & mesh, - const std::function( + const std::function( const typename MeshType::level_cell_iterator &)> &pack, const std::function & unpack, diff --git a/include/deal.II/non_matching/fe_values.h b/include/deal.II/non_matching/fe_values.h index 6d42e31ade..e3d7fdf1db 100644 --- a/include/deal.II/non_matching/fe_values.h +++ b/include/deal.II/non_matching/fe_values.h @@ -18,7 +18,6 @@ #include #include -#include #include @@ -37,6 +36,7 @@ #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -107,7 +107,7 @@ namespace NonMatching * can, for example, happen if the relative size of the cut is similar to the * floating-point accuracy. Since the FEValues-like objects are not allowed to * contain 0 points, the object that get_inside/outside/surface_fe_values() - * returns is wrapped in a std_cxx17::optional. This requires us to check if + * returns is wrapped in a std::optional. This requires us to check if * the returned FEValues-like object contains a value before we use it: * @code * NonMatching::FEValues fe_values(...); @@ -116,7 +116,7 @@ namespace NonMatching * { * fe_values.reinit(cell); * - * const std_cxx17::optional> &fe_values_inside = + * const std::optional> &fe_values_inside = * fe_values.get_inside_fe_values(); * * if (fe_values_inside) @@ -234,7 +234,7 @@ namespace NonMatching * cell is completely located in the outside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional> & + const std::optional> & get_inside_fe_values() const; /** @@ -245,7 +245,7 @@ namespace NonMatching * cell is completely located in the inside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional> & + const std::optional> & get_outside_fe_values() const; /** @@ -255,7 +255,7 @@ namespace NonMatching * @note If the quadrature rule over the region is empty, e.g. because the * cell is not intersected, the returned optional will not contain a value. */ - const std_cxx17::optional> & + const std::optional> & get_surface_fe_values() const; private: @@ -316,7 +316,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the `FEValues` * class that does not have a copy-constructor. */ - std::deque>> + std::deque>> fe_values_inside_full_quadrature; /** @@ -332,7 +332,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the `FEValues` * class that does not have a copy-constructor. */ - std::deque>> + std::deque>> fe_values_outside_full_quadrature; /** @@ -342,7 +342,7 @@ namespace NonMatching * or if 0 quadrature points were generated, this optional will not contain * a value. */ - std_cxx17::optional> fe_values_inside; + std::optional> fe_values_inside; /** * FEValues object created with a quadrature rule integrating over the @@ -351,7 +351,7 @@ namespace NonMatching * or if 0 quadrature points were generated, this optional will not contain * a value. */ - std_cxx17::optional> fe_values_outside; + std::optional> fe_values_outside; /** * FEImmersedSurfaceValues object created with a quadrature rule integrating @@ -360,8 +360,7 @@ namespace NonMatching * intersected or if 0 quadrature points were generated, this optional will * not contain a value. */ - std_cxx17::optional> - fe_values_surface; + std::optional> fe_values_surface; /** * Object that generates the immersed quadrature rules. @@ -394,7 +393,7 @@ namespace NonMatching * or get_outside_fe_values(). For the same reason as described in * NonMatching::FEValues, the returned the FEInterfaceValues objects that * get_inside/outside_fe_values() returns is wrapped in a - * std_cxx17::optional. Assembling using this class would then typically be + * std::optional. Assembling using this class would then typically be * done in the following way: * * @code @@ -414,7 +413,7 @@ namespace NonMatching * cell->neighbor_of_neighbor(face_index), * neighbor_subface_index); * - * const std_cxx17::optional> + * const std::optional> * &inside_fe_values = fe_interface_values.get_inside_fe_values(); * * // Check if the returned optional contains a value @@ -550,7 +549,7 @@ namespace NonMatching * cell is completely located in the outside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional> & + const std::optional> & get_inside_fe_values() const; /** @@ -562,7 +561,7 @@ namespace NonMatching * cell is completely located in the inside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional> & + const std::optional> & get_outside_fe_values() const; private: @@ -638,7 +637,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the * `FEInterfaceValues` class that does not have a copy-constructor. */ - std::deque>> + std::deque>> fe_values_inside_full_quadrature; /** @@ -655,7 +654,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the * `FEInterfaceValues` class that does not have a copy-constructor. */ - std::deque>> + std::deque>> fe_values_outside_full_quadrature; /** @@ -665,7 +664,7 @@ namespace NonMatching * intersected or if 0 quadrature points were generated, this optional will * not contain a value. */ - std_cxx17::optional> fe_values_inside; + std::optional> fe_values_inside; /** * FEInterfaceValues object created with a quadrature rule integrating over @@ -674,7 +673,7 @@ namespace NonMatching * intersected or if 0 quadrature points were generated, this optional will * not contain a value. */ - std_cxx17::optional> fe_values_outside; + std::optional> fe_values_outside; /** * Object that generates the immersed quadrature rules. diff --git a/include/deal.II/non_matching/quadrature_generator.h b/include/deal.II/non_matching/quadrature_generator.h index 7b7b7947cf..626b258a6e 100644 --- a/include/deal.II/non_matching/quadrature_generator.h +++ b/include/deal.II/non_matching/quadrature_generator.h @@ -22,7 +22,6 @@ #include #include #include -#include #include @@ -33,6 +32,7 @@ #include #include +#include DEAL_II_NAMESPACE_OPEN namespace NonMatching @@ -1149,10 +1149,10 @@ namespace NonMatching void split_box_and_recurse( const std::vector>> - & level_sets, - const BoundingBox & box, - const std_cxx17::optional &direction_data, - const unsigned int n_box_splits); + & level_sets, + const BoundingBox & box, + const std::optional &direction_data, + const unsigned int n_box_splits); /** * Uses the midpoint-method to create a quadrature over the box. @@ -1367,7 +1367,7 @@ namespace NonMatching * std::optional is non-set. */ template - std_cxx17::optional + std::optional find_best_height_direction( const std::vector> &all_function_bounds); diff --git a/include/deal.II/numerics/fe_field_function.h b/include/deal.II/numerics/fe_field_function.h index 94430d1fcc..2b0922cdaa 100644 --- a/include/deal.II/numerics/fe_field_function.h +++ b/include/deal.II/numerics/fe_field_function.h @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -33,6 +32,8 @@ #include +#include + DEAL_II_NAMESPACE_OPEN @@ -479,9 +480,9 @@ namespace Functions /** * Given a cell, return the reference coordinates of the given point * within this cell if it indeed lies within the cell. Otherwise return an - * uninitialized std_cxx17::optional object. + * uninitialized std::optional object. */ - std_cxx17::optional> + std::optional> get_reference_coordinates( const typename DoFHandler::active_cell_iterator &cell, const Point &point) const; diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index 7393281f21..edee5b5eda 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -81,7 +81,7 @@ namespace Functions if (cell == dh->end()) cell = dh->begin_active(); - std_cxx17::optional> qp = get_reference_coordinates(cell, p); + std::optional> qp = get_reference_coordinates(cell, p); if (!qp) { const std::pair< @@ -143,7 +143,7 @@ namespace Functions if (cell == dh->end()) cell = dh->begin_active(); - std_cxx17::optional> qp = get_reference_coordinates(cell, p); + std::optional> qp = get_reference_coordinates(cell, p); if (!qp) { const std::pair< @@ -219,7 +219,7 @@ namespace Functions if (cell == dh->end()) cell = dh->begin_active(); - std_cxx17::optional> qp = get_reference_coordinates(cell, p); + std::optional> qp = get_reference_coordinates(cell, p); if (!qp) { const std::pair< @@ -548,7 +548,7 @@ namespace Functions template - std_cxx17::optional> + std::optional> FEFieldFunction::get_reference_coordinates( const typename DoFHandler::active_cell_iterator &cell, const Point & point) const @@ -559,14 +559,14 @@ namespace Functions if (GeometryInfo::is_inside_unit_cell(qp)) return qp; else - return std_cxx17::optional>(); + return std::optional>(); } catch (const typename Mapping::ExcTransformationFailed &) { // transformation failed, so // assume the point is // outside - return std_cxx17::optional>(); + return std::optional>(); } } diff --git a/include/deal.II/optimization/line_minimization.h b/include/deal.II/optimization/line_minimization.h index 4d792ab4b4..2f95f6362d 100644 --- a/include/deal.II/optimization/line_minimization.h +++ b/include/deal.II/optimization/line_minimization.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -49,7 +48,7 @@ namespace LineMinimization * not have a solution for given parameters. */ template - std_cxx17::optional + std::optional quadratic_fit(const NumberType x_low, const NumberType f_low, const NumberType g_low, @@ -66,7 +65,7 @@ namespace LineMinimization * The return type is optional as the real-valued solution might not exist. */ template - std_cxx17::optional + std::optional cubic_fit(const NumberType x_low, const NumberType f_low, const NumberType g_low, @@ -82,7 +81,7 @@ namespace LineMinimization * The return type is optional as the real-valued solution might not exist. */ template - std_cxx17::optional + std::optional cubic_fit_three_points(const NumberType x_low, const NumberType f_low, const NumberType g_low, @@ -352,7 +351,7 @@ namespace LineMinimization template - std_cxx17::optional + std::optional quadratic_fit(const NumberType x1, const NumberType f1, const NumberType g1, @@ -370,7 +369,7 @@ namespace LineMinimization template - std_cxx17::optional + std::optional cubic_fit(const NumberType x1, const NumberType f1, const NumberType g1, @@ -397,7 +396,7 @@ namespace LineMinimization template - std_cxx17::optional + std::optional cubic_fit_three_points(const NumberType x1, const NumberType f1, const NumberType g1, @@ -462,7 +461,7 @@ namespace LineMinimization // https://github.com/scipy/scipy/blob/v1.0.0/scipy/optimize/linesearch.py#L555-L563 // First try cubic interpolation - std_cxx17::optional res = cubic_fit(x1, f1, g1, x2, f2, g2); + std::optional res = cubic_fit(x1, f1, g1, x2, f2, g2); if (res && *res >= bounds.first && *res <= bounds.second) return *res; @@ -498,10 +497,10 @@ namespace LineMinimization // https://github.com/scipy/scipy/blob/v1.0.0/scipy/optimize/linesearch.py#L555-L563 // First try cubic interpolation after first iteration - std_cxx17::optional res = + std::optional res = x_rec.size() > 0 ? cubic_fit_three_points(x1, f1, g1, x2, f2, x_rec[0], f_rec[0]) : - std_cxx17::optional{}; + std::optional{}; if (res && *res >= bounds.first && *res <= bounds.second) return *res; diff --git a/source/base/table_handler.cc b/source/base/table_handler.cc index 61f2b529dd..f14dc7749b 100644 --- a/source/base/table_handler.cc +++ b/source/base/table_handler.cc @@ -36,13 +36,13 @@ namespace internal { // we don't quite know the data type in 'value', but // it must be one of the ones in the type list of the - // std_cxx17::variant. Go through this list and return + // std::variant. Go through this list and return // the value if this happens to be a number // // first try with int try { - return std_cxx17::get(value); + return std::get(value); } catch (...) {} @@ -51,7 +51,7 @@ namespace internal // ... then with unsigned int... try { - return std_cxx17::get(value); + return std::get(value); } catch (...) {} @@ -59,7 +59,7 @@ namespace internal // ... then with std::uint64_t... try { - return std_cxx17::get(value); + return std::get(value); } catch (...) {} @@ -67,7 +67,7 @@ namespace internal // ...and finally with double precision: try { - return std_cxx17::get(value); + return std::get(value); } catch (...) { diff --git a/source/cgal/intersections.cc b/source/cgal/intersections.cc index 3fe147fa02..f292db9c9c 100644 --- a/source/cgal/intersections.cc +++ b/source/cgal/intersections.cc @@ -22,8 +22,6 @@ #ifdef DEAL_II_WITH_CGAL # include -# include -# include # include # include @@ -55,7 +53,9 @@ # include # include +# include # include +# include DEAL_II_NAMESPACE_OPEN @@ -130,7 +130,7 @@ namespace CGALWrappers * what we want to use because we like to use std data types. */ template - std_cxx17::optional> + std::optional> convert_boost_to_std(const boost::optional> &x) { if (x) @@ -214,17 +214,17 @@ namespace CGALWrappers // Collection of utilities that compute intersection between simplices // identified by array of points. The return type is the one of - // CGAL::intersection(), i.e. a std_cxx17::optional>. + // CGAL::intersection(), i.e. a std::optional>. // Intersection between 2d and 3d objects and 1d/3d objects are available // only with CGAL versions greater or equal than 5.5, hence the // corresponding functions are guarded by #ifdef directives. All the // signatures follow the convection that the first entity has an intrinsic // dimension higher than the second one. - std_cxx17::optional>> + std::optional>> compute_intersection_triangle_triangle( const ArrayView> &triangle0, const ArrayView> &triangle1) @@ -251,7 +251,7 @@ namespace CGALWrappers } - std_cxx17::optional> + std::optional> compute_intersection_triangle_segment( const ArrayView> &triangle, const ArrayView> &segment) @@ -312,7 +312,7 @@ namespace CGALWrappers - std_cxx17::optional> + std::optional> compute_intersection_tetra_segment( const ArrayView> &tetrahedron, const ArrayView> &segment) @@ -352,10 +352,10 @@ namespace CGALWrappers // tetra, triangle - std_cxx17::optional>> + std::optional>> compute_intersection_tetra_triangle( const ArrayView> &tetrahedron, const ArrayView> &triangle) diff --git a/source/grid/reference_cell.cc b/source/grid/reference_cell.cc index fa2f699230..5130f123a5 100644 --- a/source/grid/reference_cell.cc +++ b/source/grid/reference_cell.cc @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -31,6 +30,7 @@ #include #include +#include #include #include @@ -1075,45 +1075,43 @@ ReferenceCell::closest_point(const Point &p) const case ReferenceCells::Quadrilateral: case ReferenceCells::Hexahedron: for (unsigned int d = 0; d < dim; ++d) - result[d] = std_cxx17::clamp(result[d], 0.0, 1.0); + result[d] = std::clamp(result[d], 0.0, 1.0); // simplices can use the standard definition of a simplex: break; case ReferenceCells::Triangle: - result[x_index] = std_cxx17::clamp(result[x_index], 0.0, 1.0); + result[x_index] = std::clamp(result[x_index], 0.0, 1.0); result[y_index] = - std_cxx17::clamp(result[y_index], 0.0, 1.0 - result[x_index]); + std::clamp(result[y_index], 0.0, 1.0 - result[x_index]); break; case ReferenceCells::Tetrahedron: - result[x_index] = std_cxx17::clamp(result[x_index], 0.0, 1.0); + result[x_index] = std::clamp(result[x_index], 0.0, 1.0); result[y_index] = - std_cxx17::clamp(result[y_index], 0.0, 1.0 - result[x_index]); + std::clamp(result[y_index], 0.0, 1.0 - result[x_index]); result[z_index] = - std_cxx17::clamp(result[z_index], - 0.0, - 1.0 - result[x_index] - result[y_index]); + std::clamp(result[z_index], + 0.0, + 1.0 - result[x_index] - result[y_index]); break; // wedges and pyramids are more ad-hoc: case ReferenceCells::Wedge: - result[x_index] = std_cxx17::clamp(result[x_index], 0.0, 1.0); + result[x_index] = std::clamp(result[x_index], 0.0, 1.0); result[y_index] = - std_cxx17::clamp(result[y_index], 0.0, 1.0 - result[x_index]); - result[z_index] = std_cxx17::clamp(result[z_index], 0.0, 1.0); + std::clamp(result[y_index], 0.0, 1.0 - result[x_index]); + result[z_index] = std::clamp(result[z_index], 0.0, 1.0); break; case ReferenceCells::Pyramid: { - result[x_index] = std_cxx17::clamp(result[x_index], -1.0, 1.0); - result[y_index] = std_cxx17::clamp(result[y_index], -1.0, 1.0); + result[x_index] = std::clamp(result[x_index], -1.0, 1.0); + result[y_index] = std::clamp(result[y_index], -1.0, 1.0); // It suffices to transform everything to the first quadrant to // adjust z: const auto x_abs = std::abs(result[x_index]); const auto y_abs = std::abs(result[y_index]); if (y_abs <= x_abs) - result[z_index] = - std_cxx17::clamp(result[z_index], 0.0, 1.0 - x_abs); + result[z_index] = std::clamp(result[z_index], 0.0, 1.0 - x_abs); else - result[z_index] = - std_cxx17::clamp(result[z_index], 0.0, 1.0 - y_abs); + result[z_index] = std::clamp(result[z_index], 0.0, 1.0 - y_abs); } break; default: diff --git a/source/non_matching/fe_values.cc b/source/non_matching/fe_values.cc index 4c17985207..e964884bd5 100644 --- a/source/non_matching/fe_values.cc +++ b/source/non_matching/fe_values.cc @@ -237,7 +237,7 @@ namespace NonMatching template - const std_cxx17::optional> & + const std::optional> & FEValues::get_inside_fe_values() const { if (current_cell_location == LocationToLevelSet::inside) @@ -249,7 +249,7 @@ namespace NonMatching template - const std_cxx17::optional> & + const std::optional> & FEValues::get_outside_fe_values() const { if (current_cell_location == LocationToLevelSet::outside) @@ -261,7 +261,7 @@ namespace NonMatching template - const std_cxx17::optional> & + const std::optional> & FEValues::get_surface_fe_values() const { return fe_values_surface; @@ -457,7 +457,7 @@ namespace NonMatching template - const std_cxx17::optional> & + const std::optional> & FEInterfaceValues::get_inside_fe_values() const { if (current_face_location == LocationToLevelSet::inside) @@ -469,7 +469,7 @@ namespace NonMatching template - const std_cxx17::optional> & + const std::optional> & FEInterfaceValues::get_outside_fe_values() const { if (current_face_location == LocationToLevelSet::outside) diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index 18ed8736a5..2a2afcac7e 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -271,13 +271,13 @@ namespace NonMatching template - std_cxx17::optional + std::optional find_best_height_direction( const std::vector> &all_function_bounds) { // Minimum (taken over the indefinite functions) on the lower bound on // each component of the gradient. - std_cxx17::optional> min_lower_abs_grad; + std::optional> min_lower_abs_grad; for (const FunctionBounds &bounds : all_function_bounds) { @@ -320,7 +320,7 @@ namespace NonMatching return data; } - return std_cxx17::optional(); + return std::optional(); } @@ -920,7 +920,7 @@ namespace NonMatching } else { - const std_cxx17::optional data = + const std::optional data = find_best_height_direction(all_function_bounds); // Check larger than a constant to avoid that min_abs_dfdx is only @@ -955,7 +955,7 @@ namespace NonMatching * will be non-set. */ template - std_cxx17::optional + std::optional direction_of_largest_extent(const BoundingBox &box) { // Get the side lengths for each direction and sort them. @@ -972,7 +972,7 @@ namespace NonMatching // function isn't called in 1d, so the (dim - 2)-element exists. if (boost::math::epsilon_difference(side_lengths[dim - 1].first, side_lengths[dim - 2].first) < 100) - return std_cxx17::optional(); + return std::optional(); return side_lengths.back().second; } @@ -993,10 +993,10 @@ namespace NonMatching template unsigned int compute_split_direction( - const BoundingBox & box, - const std_cxx17::optional &height_direction_data) + const BoundingBox & box, + const std::optional &height_direction_data) { - const std_cxx17::optional direction = + const std::optional direction = direction_of_largest_extent(box); if (direction) @@ -1055,10 +1055,10 @@ namespace NonMatching void QGenerator::split_box_and_recurse( const std::vector>> - & level_sets, - const BoundingBox & box, - const std_cxx17::optional &direction_data, - const unsigned int n_box_splits) + & level_sets, + const BoundingBox & box, + const std::optional &direction_data, + const unsigned int n_box_splits) { if (this->additional_data.split_in_half) { diff --git a/source/non_matching/quadrature_generator.inst.in b/source/non_matching/quadrature_generator.inst.in index ab20f0a73e..e2f2e551ab 100644 --- a/source/non_matching/quadrature_generator.inst.in +++ b/source/non_matching/quadrature_generator.inst.in @@ -53,7 +53,7 @@ for (deal_II_dimension : DIMENSIONS) // gcc is wrong. We don't need the function when dim = 1, so we avoid // instantiating it. #if 1 < deal_II_dimension - template std_cxx17::optional + template std::optional find_best_height_direction( const std::vector> &); #endif diff --git a/tests/base/cell_data_storage_01.cc b/tests/base/cell_data_storage_01.cc index b5f171480f..015cef56d1 100644 --- a/tests/base/cell_data_storage_01.cc +++ b/tests/base/cell_data_storage_01.cc @@ -102,9 +102,9 @@ check_qph(Triangulation &tr, const std::vector> qpd = manager.get_data(cell); const std::vector> qpd_const = manager_const.get_data(cell); - const std_cxx17::optional>> - qpd_optional = manager.try_get_data(cell); - const std_cxx17::optional>> + const std::optional>> qpd_optional = + manager.try_get_data(cell); + const std::optional>> qpd_const_optional = manager_const.try_get_data(cell); AssertThrow(qpd_optional, ExcInternalError()); AssertThrow(qpd_const_optional, ExcInternalError()); @@ -177,7 +177,7 @@ test() next_cell++; if (next_cell != tr.end()) { - const std_cxx17::optional>> + const std::optional>> nonexisting_data = data_storage.try_get_data(next_cell); AssertThrow(!nonexisting_data, ExcInternalError()); } diff --git a/tests/base/mutable_bind_01.cc b/tests/base/mutable_bind_01.cc index 1c532a2803..fa1cc92ad1 100644 --- a/tests/base/mutable_bind_01.cc +++ b/tests/base/mutable_bind_01.cc @@ -18,7 +18,8 @@ #include #include -#include + +#include #include "../tests.h" diff --git a/tests/base/mutable_bind_02.cc b/tests/base/mutable_bind_02.cc index d80e08cfc8..763fd87886 100644 --- a/tests/base/mutable_bind_02.cc +++ b/tests/base/mutable_bind_02.cc @@ -18,7 +18,8 @@ #include #include -#include + +#include #include "../tests.h" diff --git a/tests/base/mutable_bind_03.cc b/tests/base/mutable_bind_03.cc index c5edf315db..8f583fd543 100644 --- a/tests/base/mutable_bind_03.cc +++ b/tests/base/mutable_bind_03.cc @@ -19,7 +19,8 @@ #include #include -#include + +#include #include "../tests.h" diff --git a/tests/base/mutable_bind_04.cc b/tests/base/mutable_bind_04.cc index a659b023a4..2dd02facff 100644 --- a/tests/base/mutable_bind_04.cc +++ b/tests/base/mutable_bind_04.cc @@ -19,7 +19,8 @@ #include #include -#include + +#include #include "../tests.h" diff --git a/tests/base/stdcxx17_apply.cc b/tests/base/stdcxx17_apply.cc deleted file mode 100644 index 151c4dfe46..0000000000 --- a/tests/base/stdcxx17_apply.cc +++ /dev/null @@ -1,39 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2017 - 2019 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE.md at -// the top level directory of deal.II. -// -// --------------------------------------------------------------------- - - -// test the implementation of the std_cxx17::apply function - - -#include -#include - -#include "../tests.h" - - -void -example_function(const Point<2> &p, const double &d, const unsigned int i = 3) -{ - deallog << "P: " << p << ", d: " << d << ", i: " << i << std::endl; -} - - -int -main() -{ - initlog(); - auto tup = std::make_tuple(Point<2>(.5, .5), 2.0, 3u); - std_cxx17::apply(example_function, tup); -} diff --git a/tests/base/stdcxx17_apply.output b/tests/base/stdcxx17_apply.output deleted file mode 100644 index 8f2ac511fb..0000000000 --- a/tests/base/stdcxx17_apply.output +++ /dev/null @@ -1,2 +0,0 @@ - -DEAL::P: 0.500000 0.500000, d: 2.00000, i: 3 diff --git a/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc b/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc index 646911bb69..49459cd1ba 100644 --- a/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc +++ b/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc @@ -17,7 +17,7 @@ // test GridTools::exchange_cell_data_to_ghosts // // this test works just like the _01 test, but it skips those cells -// where we have an odd 'counter' value via the std_cxx17::optional +// where we have an odd 'counter' value via the std::optional // framework #include @@ -80,7 +80,7 @@ test() GridTools:: exchange_cell_data_to_ghosts>( tria, - [&](const cell_iterator &cell) -> std_cxx17::optional
{ + [&](const cell_iterator &cell) -> std::optional
{ const auto counter = map[cell->id()]; std::ostringstream oss; if (counter % 2 == 0) @@ -95,7 +95,7 @@ test() { oss << "skipping " << cell->id() << ' ' << counter; input[cell->id()] = oss.str(); - return std_cxx17::optional
(); + return std::optional
(); } }, [&](const cell_iterator &cell, const DT &data) { diff --git a/tests/non_matching/fe_interface_values.cc b/tests/non_matching/fe_interface_values.cc index 91425c1b85..c8947adb97 100644 --- a/tests/non_matching/fe_interface_values.cc +++ b/tests/non_matching/fe_interface_values.cc @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -27,6 +26,8 @@ #include +#include + #include "../tests.h" using namespace dealii; diff --git a/tests/non_matching/fe_interface_values_non_standard_meshes.cc b/tests/non_matching/fe_interface_values_non_standard_meshes.cc index 113520c761..6c10913f50 100644 --- a/tests/non_matching/fe_interface_values_non_standard_meshes.cc +++ b/tests/non_matching/fe_interface_values_non_standard_meshes.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include @@ -38,6 +37,7 @@ #include #include +#include #include "../tests.h" diff --git a/tests/non_matching/fe_values.cc b/tests/non_matching/fe_values.cc index 06a1c15b44..b63ffeacab 100644 --- a/tests/non_matching/fe_values.cc +++ b/tests/non_matching/fe_values.cc @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -28,6 +27,8 @@ #include +#include + #include "../tests.h" using namespace dealii; @@ -48,7 +49,7 @@ assert_cells_are_the_same( // Assert that the incoming optional does not have a value. template void -assert_doesnt_have_value(const std_cxx17::optional &fe_values) +assert_doesnt_have_value(const std::optional &fe_values) { AssertThrow(!fe_values, ExcInternalError()); deallog << "OK" << std::endl; @@ -67,7 +68,7 @@ assert_doesnt_have_value(const std_cxx17::optional &fe_values) // Test the following: // 1. That we can construct a NonMatching::FEValues object. // 2. That when we call reinit on each cell in the triangulation, -// the std_cxx17::optionals that we get from +// the std::optionals that we get from // get_inside/outside/surface_fe_values are set up correctly. That is, the // optionals that should contain a value do and the ones that should not contain // a value do not. diff --git a/tests/non_matching/find_best_height_direction.cc b/tests/non_matching/find_best_height_direction.cc index 1edccd1fec..7a9e7f3319 100644 --- a/tests/non_matching/find_best_height_direction.cc +++ b/tests/non_matching/find_best_height_direction.cc @@ -51,7 +51,7 @@ test_ignores_definite_functions() bounds[0].value = pair_with_equal_entries(-1); bounds[1].value = pair_with_equal_entries(1); - const std_cxx17::optional data = + const std::optional data = find_best_height_direction(bounds); if (!data) @@ -87,7 +87,7 @@ test_find_best_height_direction() bounds[0].gradient[1] = pair_with_equal_entries(6); bounds[1].gradient[1] = pair_with_equal_entries(5); - const std_cxx17::optional data = + const std::optional data = find_best_height_direction(bounds); deallog << "height direction = " << data->direction << std::endl;