// 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<FEValues<dim>> &inside_fe_values =
+ const std::optional<FEValues<dim>> &inside_fe_values =
non_matching_fe_values.get_inside_fe_values();
if (inside_fe_values)
// 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<NonMatching::FEImmersedSurfaceValues<dim>>
+ const std::optional<NonMatching::FEImmersedSurfaceValues<dim>>
&surface_fe_values = non_matching_fe_values.get_surface_fe_values();
if (surface_fe_values)
{
non_matching_fe_values.reinit(cell);
- const std_cxx17::optional<FEValues<dim>> &fe_values =
+ const std::optional<FEValues<dim>> &fe_values =
non_matching_fe_values.get_inside_fe_values();
if (fe_values)
#include <deal.II/base/config.h>
#include <deal.II/base/patterns.h>
-#include <deal.II/base/std_cxx17/tuple.h>
#include <tuple>
#include <utility>
ReturnType
MutableBind<ReturnType, FunctionArgs...>::operator()() const
{
- return std_cxx17::apply(function, arguments);
+ return std::apply(function, arguments);
}
#include <deal.II/base/config.h>
#include <deal.II/base/quadrature.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/distributed/tria.h>
#include <deal.II/lac/vector.h>
#include <map>
+#include <optional>
#include <type_traits>
#include <vector>
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,
* initialize() the cell data.
*/
template <typename T = DataType>
- std_cxx17::optional<std::vector<std::shared_ptr<T>>>
+ std::optional<std::vector<std::shared_ptr<T>>>
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,
* initialize() the cell data.
*/
template <typename T = DataType>
- std_cxx17::optional<std::vector<std::shared_ptr<const T>>>
+ std::optional<std::vector<std::shared_ptr<const T>>>
try_get_data(const CellIteratorType &cell) const;
private:
template <typename CellIteratorType, typename DataType>
template <typename T>
-inline std_cxx17::optional<std::vector<std::shared_ptr<T>>>
+inline std::optional<std::vector<std::shared_ptr<T>>>
CellDataStorage<CellIteratorType, DataType>::try_get_data(
const CellIteratorType &cell)
{
template <typename CellIteratorType, typename DataType>
template <typename T>
-inline std_cxx17::optional<std::vector<std::shared_ptr<const T>>>
+inline std::optional<std::vector<std::shared_ptr<const T>>>
CellDataStorage<CellIteratorType, DataType>::try_get_data(
const CellIteratorType &cell) const
{
#include <deal.II/base/config.h>
+DEAL_II_WARNING(
+ "This file is deprecated. Simply use the corresponding C++14 header <algorithm>.")
+
#include <algorithm>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
+DEAL_II_WARNING(
+ "This file is deprecated. Simply use the corresponding C++14 header <optional>.")
+
#include <optional>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
+DEAL_II_WARNING(
+ "This file is deprecated. Simply use the corresponding C++14 header <tuple>.")
+
#include <tuple>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
+DEAL_II_WARNING(
+ "This file is deprecated. Simply use the corresponding C++14 header <variant>.")
+
#include <variant>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
-#include <deal.II/base/std_cxx17/variant.h>
#include <boost/serialization/map.hpp>
#include <boost/serialization/split_member.hpp>
#include <map>
#include <ostream>
#include <string>
+#include <variant>
#include <vector>
* Abbreviation for the data type stored by this object.
*/
using value_type =
- std_cxx17::variant<int, unsigned int, std::uint64_t, double, std::string>;
+ std::variant<int, unsigned int, std::uint64_t, double, std::string>;
/**
* Stored value.
{
// 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<T>(value);
+ return std::get<T>(value);
}
catch (...)
{
// 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<int>(value))
+ if (std::holds_alternative<int>(value))
{
- const int p = std_cxx17::get<int>(value);
+ const int p = std::get<int>(value);
char c = 'i';
ar &c &p;
}
- else if (std_cxx17::holds_alternative<unsigned int>(value))
+ else if (std::holds_alternative<unsigned int>(value))
{
- const unsigned int p = std_cxx17::get<unsigned int>(value);
+ const unsigned int p = std::get<unsigned int>(value);
char c = 'u';
ar &c &p;
}
- else if (std_cxx17::holds_alternative<double>(value))
+ else if (std::holds_alternative<double>(value))
{
- const double p = std_cxx17::get<double>(value);
+ const double p = std::get<double>(value);
char c = 'd';
ar &c &p;
}
- else if (std_cxx17::holds_alternative<std::string>(value))
+ else if (std::holds_alternative<std::string>(value))
{
- const std::string p = std_cxx17::get<std::string>(value);
+ const std::string p = std::get<std::string>(value);
char c = 's';
ar &c &p;
}
- else if (std_cxx17::holds_alternative<std::uint64_t>(value))
+ else if (std::holds_alternative<std::uint64_t>(value))
{
- const std::uint64_t p = std_cxx17::get<std::uint64_t>(value);
+ const std::uint64_t p = std::get<std::uint64_t>(value);
char c = 'l';
ar &c &p;
}
#include <deal.II/base/exceptions.h>
#include <deal.II/base/multithread_info.h>
#include <deal.II/base/mutex.h>
-#include <deal.II/base/std_cxx17/tuple.h>
#include <deal.II/base/template_constraints.h>
#include <atomic>
#include <list>
#include <memory>
#include <thread>
+#include <tuple>
#include <utility>
#include <vector>
DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
auto dummy = std::make_tuple(internal::maybe_make_ref<Args>::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
}
{
auto dummy = std::make_tuple(internal::maybe_make_ref<Args>::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); });
}
#include <deal.II/base/bounding_box.h>
#include <deal.II/base/geometry_info.h>
#include <deal.II/base/point.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/boost_adaptors/bounding_box.h>
#include <boost/serialization/array.hpp>
#include <boost/serialization/vector.hpp>
+#include <optional>
+
#ifdef DEAL_II_WITH_ZLIB
# include <boost/iostreams/device/back_inserter.hpp>
# include <boost/iostreams/filter/gzip.hpp>
* 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.
*
* 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
- * <code>std_cxx17::optional@<DataType@></code> to indicate that nothing has
+ * <code>std::optional@<DataType@></code> 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
* @endcode
*
* You will notice that the @p pack lambda function returns an `unsigned int`,
- * not a `std_cxx17::optional<unsigned int>`. The former converts
+ * not a `std::optional<unsigned int>`. The former converts
* automatically to the latter, implying that data will always be transported
* to the other processor.
*
DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>)
void exchange_cell_data_to_ghosts(
const MeshType & mesh,
- const std::function<std_cxx17::optional<DataType>(
+ const std::function<std::optional<DataType>(
const typename MeshType::active_cell_iterator &)> &pack,
const std::function<void(const typename MeshType::active_cell_iterator &,
const DataType &)> & unpack,
DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>)
void exchange_cell_data_to_level_ghosts(
const MeshType & mesh,
- const std::function<std_cxx17::optional<DataType>(
+ const std::function<std::optional<DataType>(
const typename MeshType::level_cell_iterator &)> &pack,
const std::function<void(const typename MeshType::level_cell_iterator &,
const DataType &)> & unpack,
DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>)
inline void exchange_cell_data(
const MeshType &mesh,
- const std::function<
- std_cxx17::optional<DataType>(const MeshCellIteratorType &)> &pack,
+ const std::function<std::optional<DataType>(const MeshCellIteratorType &)>
+ &pack,
const std::function<void(const MeshCellIteratorType &, const DataType &)>
& unpack,
const std::function<bool(const MeshCellIteratorType &)> & cell_filter,
cell->index(),
&mesh);
- const std_cxx17::optional<DataType> data = pack(mesh_it);
+ const std::optional<DataType> data = pack(mesh_it);
if (data)
{
data_to_send.emplace_back(*data);
DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>)
inline void exchange_cell_data_to_ghosts(
const MeshType & mesh,
- const std::function<std_cxx17::optional<DataType>(
+ const std::function<std::optional<DataType>(
const typename MeshType::active_cell_iterator &)> &pack,
const std::function<void(const typename MeshType::active_cell_iterator &,
const DataType &)> & unpack,
DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>)
inline void exchange_cell_data_to_level_ghosts(
const MeshType & mesh,
- const std::function<std_cxx17::optional<DataType>(
+ const std::function<std::optional<DataType>(
const typename MeshType::level_cell_iterator &)> &pack,
const std::function<void(const typename MeshType::level_cell_iterator &,
const DataType &)> & unpack,
#include <deal.II/base/bounding_box.h>
#include <deal.II/base/smartpointer.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/non_matching/quadrature_generator.h>
#include <deque>
+#include <optional>
DEAL_II_NAMESPACE_OPEN
* 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<dim> fe_values(...);
* {
* fe_values.reinit(cell);
*
- * const std_cxx17::optional<FEValues<dim>> &fe_values_inside =
+ * const std::optional<FEValues<dim>> &fe_values_inside =
* fe_values.get_inside_fe_values();
*
* if (fe_values_inside)
* cell is completely located in the outside domain, the returned
* optional will not contain a value.
*/
- const std_cxx17::optional<dealii::FEValues<dim>> &
+ const std::optional<dealii::FEValues<dim>> &
get_inside_fe_values() const;
/**
* cell is completely located in the inside domain, the returned
* optional will not contain a value.
*/
- const std_cxx17::optional<dealii::FEValues<dim>> &
+ const std::optional<dealii::FEValues<dim>> &
get_outside_fe_values() const;
/**
* @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<FEImmersedSurfaceValues<dim>> &
+ const std::optional<FEImmersedSurfaceValues<dim>> &
get_surface_fe_values() const;
private:
* This container is a std::deque, which is compatible with the `FEValues`
* class that does not have a copy-constructor.
*/
- std::deque<std_cxx17::optional<dealii::FEValues<dim>>>
+ std::deque<std::optional<dealii::FEValues<dim>>>
fe_values_inside_full_quadrature;
/**
* This container is a std::deque, which is compatible with the `FEValues`
* class that does not have a copy-constructor.
*/
- std::deque<std_cxx17::optional<dealii::FEValues<dim>>>
+ std::deque<std::optional<dealii::FEValues<dim>>>
fe_values_outside_full_quadrature;
/**
* or if 0 quadrature points were generated, this optional will not contain
* a value.
*/
- std_cxx17::optional<dealii::FEValues<dim>> fe_values_inside;
+ std::optional<dealii::FEValues<dim>> fe_values_inside;
/**
* FEValues object created with a quadrature rule integrating over the
* or if 0 quadrature points were generated, this optional will not contain
* a value.
*/
- std_cxx17::optional<dealii::FEValues<dim>> fe_values_outside;
+ std::optional<dealii::FEValues<dim>> fe_values_outside;
/**
* FEImmersedSurfaceValues object created with a quadrature rule integrating
* intersected or if 0 quadrature points were generated, this optional will
* not contain a value.
*/
- std_cxx17::optional<NonMatching::FEImmersedSurfaceValues<dim>>
- fe_values_surface;
+ std::optional<NonMatching::FEImmersedSurfaceValues<dim>> fe_values_surface;
/**
* Object that generates the immersed quadrature rules.
* 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
* cell->neighbor_of_neighbor(face_index),
* neighbor_subface_index);
*
- * const std_cxx17::optional<dealii::FEInterfaceValues<dim>>
+ * const std::optional<dealii::FEInterfaceValues<dim>>
* &inside_fe_values = fe_interface_values.get_inside_fe_values();
*
* // Check if the returned optional contains a value
* cell is completely located in the outside domain, the returned
* optional will not contain a value.
*/
- const std_cxx17::optional<dealii::FEInterfaceValues<dim>> &
+ const std::optional<dealii::FEInterfaceValues<dim>> &
get_inside_fe_values() const;
/**
* cell is completely located in the inside domain, the returned
* optional will not contain a value.
*/
- const std_cxx17::optional<dealii::FEInterfaceValues<dim>> &
+ const std::optional<dealii::FEInterfaceValues<dim>> &
get_outside_fe_values() const;
private:
* This container is a std::deque, which is compatible with the
* `FEInterfaceValues` class that does not have a copy-constructor.
*/
- std::deque<std_cxx17::optional<dealii::FEInterfaceValues<dim>>>
+ std::deque<std::optional<dealii::FEInterfaceValues<dim>>>
fe_values_inside_full_quadrature;
/**
* This container is a std::deque, which is compatible with the
* `FEInterfaceValues` class that does not have a copy-constructor.
*/
- std::deque<std_cxx17::optional<dealii::FEInterfaceValues<dim>>>
+ std::deque<std::optional<dealii::FEInterfaceValues<dim>>>
fe_values_outside_full_quadrature;
/**
* intersected or if 0 quadrature points were generated, this optional will
* not contain a value.
*/
- std_cxx17::optional<dealii::FEInterfaceValues<dim>> fe_values_inside;
+ std::optional<dealii::FEInterfaceValues<dim>> fe_values_inside;
/**
* FEInterfaceValues object created with a quadrature rule integrating over
* intersected or if 0 quadrature points were generated, this optional will
* not contain a value.
*/
- std_cxx17::optional<dealii::FEInterfaceValues<dim>> fe_values_outside;
+ std::optional<dealii::FEInterfaceValues<dim>> fe_values_outside;
/**
* Object that generates the immersed quadrature rules.
#include <deal.II/base/function.h>
#include <deal.II/base/function_restriction.h>
#include <deal.II/base/quadrature.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/non_matching/immersed_surface_quadrature.h>
#include <functional>
+#include <optional>
DEAL_II_NAMESPACE_OPEN
namespace NonMatching
void
split_box_and_recurse(
const std::vector<std::reference_wrapper<const Function<dim>>>
- & level_sets,
- const BoundingBox<dim> & box,
- const std_cxx17::optional<HeightDirectionData> &direction_data,
- const unsigned int n_box_splits);
+ & level_sets,
+ const BoundingBox<dim> & box,
+ const std::optional<HeightDirectionData> &direction_data,
+ const unsigned int n_box_splits);
/**
* Uses the midpoint-method to create a quadrature over the box.
* std::optional is non-set.
*/
template <int dim>
- std_cxx17::optional<HeightDirectionData>
+ std::optional<HeightDirectionData>
find_best_height_direction(
const std::vector<FunctionBounds<dim>> &all_function_bounds);
#include <deal.II/base/function.h>
#include <deal.II/base/point.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/base/tensor.h>
#include <deal.II/base/thread_local_storage.h>
#include <deal.II/lac/vector.h>
+#include <optional>
+
DEAL_II_NAMESPACE_OPEN
/**
* 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<Point<dim>>
+ std::optional<Point<dim>>
get_reference_coordinates(
const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell,
const Point<dim> &point) const;
if (cell == dh->end())
cell = dh->begin_active();
- std_cxx17::optional<Point<dim>> qp = get_reference_coordinates(cell, p);
+ std::optional<Point<dim>> qp = get_reference_coordinates(cell, p);
if (!qp)
{
const std::pair<
if (cell == dh->end())
cell = dh->begin_active();
- std_cxx17::optional<Point<dim>> qp = get_reference_coordinates(cell, p);
+ std::optional<Point<dim>> qp = get_reference_coordinates(cell, p);
if (!qp)
{
const std::pair<
if (cell == dh->end())
cell = dh->begin_active();
- std_cxx17::optional<Point<dim>> qp = get_reference_coordinates(cell, p);
+ std::optional<Point<dim>> qp = get_reference_coordinates(cell, p);
if (!qp)
{
const std::pair<
template <int dim, typename VectorType, int spacedim>
- std_cxx17::optional<Point<dim>>
+ std::optional<Point<dim>>
FEFieldFunction<dim, VectorType, spacedim>::get_reference_coordinates(
const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell,
const Point<dim> & point) const
if (GeometryInfo<dim>::is_inside_unit_cell(qp))
return qp;
else
- return std_cxx17::optional<Point<dim>>();
+ return std::optional<Point<dim>>();
}
catch (const typename Mapping<dim>::ExcTransformationFailed &)
{
// transformation failed, so
// assume the point is
// outside
- return std_cxx17::optional<Point<dim>>();
+ return std::optional<Point<dim>>();
}
}
#include <deal.II/base/exceptions.h>
#include <deal.II/base/logstream.h>
#include <deal.II/base/numbers.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/base/utilities.h>
#include <deal.II/numerics/history.h>
* not have a solution for given parameters.
*/
template <typename NumberType>
- std_cxx17::optional<NumberType>
+ std::optional<NumberType>
quadratic_fit(const NumberType x_low,
const NumberType f_low,
const NumberType g_low,
* The return type is optional as the real-valued solution might not exist.
*/
template <typename NumberType>
- std_cxx17::optional<NumberType>
+ std::optional<NumberType>
cubic_fit(const NumberType x_low,
const NumberType f_low,
const NumberType g_low,
* The return type is optional as the real-valued solution might not exist.
*/
template <typename NumberType>
- std_cxx17::optional<NumberType>
+ std::optional<NumberType>
cubic_fit_three_points(const NumberType x_low,
const NumberType f_low,
const NumberType g_low,
template <typename NumberType>
- std_cxx17::optional<NumberType>
+ std::optional<NumberType>
quadratic_fit(const NumberType x1,
const NumberType f1,
const NumberType g1,
template <typename NumberType>
- std_cxx17::optional<NumberType>
+ std::optional<NumberType>
cubic_fit(const NumberType x1,
const NumberType f1,
const NumberType g1,
template <typename NumberType>
- std_cxx17::optional<NumberType>
+ std::optional<NumberType>
cubic_fit_three_points(const NumberType x1,
const NumberType f1,
const NumberType g1,
// https://github.com/scipy/scipy/blob/v1.0.0/scipy/optimize/linesearch.py#L555-L563
// First try cubic interpolation
- std_cxx17::optional<NumberType> res = cubic_fit(x1, f1, g1, x2, f2, g2);
+ std::optional<NumberType> res = cubic_fit(x1, f1, g1, x2, f2, g2);
if (res && *res >= bounds.first && *res <= bounds.second)
return *res;
// 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<NumberType> res =
+ std::optional<NumberType> res =
x_rec.size() > 0 ?
cubic_fit_three_points(x1, f1, g1, x2, f2, x_rec[0], f_rec[0]) :
- std_cxx17::optional<NumberType>{};
+ std::optional<NumberType>{};
if (res && *res >= bounds.first && *res <= bounds.second)
return *res;
{
// 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<int>(value);
+ return std::get<int>(value);
}
catch (...)
{}
// ... then with unsigned int...
try
{
- return std_cxx17::get<unsigned int>(value);
+ return std::get<unsigned int>(value);
}
catch (...)
{}
// ... then with std::uint64_t...
try
{
- return std_cxx17::get<std::uint64_t>(value);
+ return std::get<std::uint64_t>(value);
}
catch (...)
{}
// ...and finally with double precision:
try
{
- return std_cxx17::get<double>(value);
+ return std::get<double>(value);
}
catch (...)
{
#ifdef DEAL_II_WITH_CGAL
# include <deal.II/base/quadrature_lib.h>
-# include <deal.II/base/std_cxx17/optional.h>
-# include <deal.II/base/std_cxx17/variant.h>
# include <deal.II/base/utilities.h>
# include <deal.II/fe/mapping.h>
# include <deal.II/cgal/utilities.h>
# include <fstream>
+# include <optional>
# include <type_traits>
+# include <variant>
DEAL_II_NAMESPACE_OPEN
* what we want to use because we like to use std data types.
*/
template <typename... Types>
- std_cxx17::optional<std_cxx17::variant<Types...>>
+ std::optional<std::variant<Types...>>
convert_boost_to_std(const boost::optional<boost::variant<Types...>> &x)
{
if (x)
// 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<std_cxx17::variant<>>.
+ // CGAL::intersection(), i.e. a std::optional<std::variant<>>.
// 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_cxx17::variant<CGALPoint2,
- CGALSegment2,
- CGALTriangle2,
- std::vector<CGALPoint2>>>
+ std::optional<std::variant<CGALPoint2,
+ CGALSegment2,
+ CGALTriangle2,
+ std::vector<CGALPoint2>>>
compute_intersection_triangle_triangle(
const ArrayView<const Point<2>> &triangle0,
const ArrayView<const Point<2>> &triangle1)
}
- std_cxx17::optional<std_cxx17::variant<CGALPoint2, CGALSegment2>>
+ std::optional<std::variant<CGALPoint2, CGALSegment2>>
compute_intersection_triangle_segment(
const ArrayView<const Point<2>> &triangle,
const ArrayView<const Point<2>> &segment)
- std_cxx17::optional<std_cxx17::variant<CGALPoint3, CGALSegment3>>
+ std::optional<std::variant<CGALPoint3, CGALSegment3>>
compute_intersection_tetra_segment(
const ArrayView<const Point<3>> &tetrahedron,
const ArrayView<const Point<3>> &segment)
// tetra, triangle
- std_cxx17::optional<std_cxx17::variant<CGALPoint3,
- CGALSegment3,
- CGALTriangle3,
- std::vector<CGALPoint3>>>
+ std::optional<std::variant<CGALPoint3,
+ CGALSegment3,
+ CGALTriangle3,
+ std::vector<CGALPoint3>>>
compute_intersection_tetra_triangle(
const ArrayView<const Point<3>> &tetrahedron,
const ArrayView<const Point<3>> &triangle)
#include <deal.II/base/polynomial.h>
#include <deal.II/base/polynomials_barycentric.h>
#include <deal.II/base/quadrature_lib.h>
-#include <deal.II/base/std_cxx17/algorithm.h>
#include <deal.II/base/tensor_product_polynomials.h>
#include <deal.II/fe/fe_pyramid_p.h>
#include <deal.II/grid/reference_cell.h>
#include <deal.II/grid/tria.h>
+#include <algorithm>
#include <iostream>
#include <memory>
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:
template <int dim>
- const std_cxx17::optional<dealii::FEValues<dim>> &
+ const std::optional<dealii::FEValues<dim>> &
FEValues<dim>::get_inside_fe_values() const
{
if (current_cell_location == LocationToLevelSet::inside)
template <int dim>
- const std_cxx17::optional<dealii::FEValues<dim>> &
+ const std::optional<dealii::FEValues<dim>> &
FEValues<dim>::get_outside_fe_values() const
{
if (current_cell_location == LocationToLevelSet::outside)
template <int dim>
- const std_cxx17::optional<FEImmersedSurfaceValues<dim>> &
+ const std::optional<FEImmersedSurfaceValues<dim>> &
FEValues<dim>::get_surface_fe_values() const
{
return fe_values_surface;
template <int dim>
- const std_cxx17::optional<dealii::FEInterfaceValues<dim>> &
+ const std::optional<dealii::FEInterfaceValues<dim>> &
FEInterfaceValues<dim>::get_inside_fe_values() const
{
if (current_face_location == LocationToLevelSet::inside)
template <int dim>
- const std_cxx17::optional<dealii::FEInterfaceValues<dim>> &
+ const std::optional<dealii::FEInterfaceValues<dim>> &
FEInterfaceValues<dim>::get_outside_fe_values() const
{
if (current_face_location == LocationToLevelSet::outside)
template <int dim>
- std_cxx17::optional<HeightDirectionData>
+ std::optional<HeightDirectionData>
find_best_height_direction(
const std::vector<FunctionBounds<dim>> &all_function_bounds)
{
// Minimum (taken over the indefinite functions) on the lower bound on
// each component of the gradient.
- std_cxx17::optional<std::array<double, dim>> min_lower_abs_grad;
+ std::optional<std::array<double, dim>> min_lower_abs_grad;
for (const FunctionBounds<dim> &bounds : all_function_bounds)
{
return data;
}
- return std_cxx17::optional<HeightDirectionData>();
+ return std::optional<HeightDirectionData>();
}
}
else
{
- const std_cxx17::optional<HeightDirectionData> data =
+ const std::optional<HeightDirectionData> data =
find_best_height_direction(all_function_bounds);
// Check larger than a constant to avoid that min_abs_dfdx is only
* will be non-set.
*/
template <int dim>
- std_cxx17::optional<unsigned int>
+ std::optional<unsigned int>
direction_of_largest_extent(const BoundingBox<dim> &box)
{
// Get the side lengths for each direction and sort them.
// 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<unsigned int>();
+ return std::optional<unsigned int>();
return side_lengths.back().second;
}
template <int dim>
unsigned int
compute_split_direction(
- const BoundingBox<dim> & box,
- const std_cxx17::optional<HeightDirectionData> &height_direction_data)
+ const BoundingBox<dim> & box,
+ const std::optional<HeightDirectionData> &height_direction_data)
{
- const std_cxx17::optional<unsigned int> direction =
+ const std::optional<unsigned int> direction =
direction_of_largest_extent(box);
if (direction)
void
QGenerator<dim, spacedim>::split_box_and_recurse(
const std::vector<std::reference_wrapper<const Function<dim>>>
- & level_sets,
- const BoundingBox<dim> & box,
- const std_cxx17::optional<HeightDirectionData> &direction_data,
- const unsigned int n_box_splits)
+ & level_sets,
+ const BoundingBox<dim> & box,
+ const std::optional<HeightDirectionData> &direction_data,
+ const unsigned int n_box_splits)
{
if (this->additional_data.split_in_half)
{
// 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<HeightDirectionData>
+ template std::optional<HeightDirectionData>
find_best_height_direction(
const std::vector<FunctionBounds<deal_II_dimension>> &);
#endif
const std::vector<std::shared_ptr<DATA>> qpd = manager.get_data(cell);
const std::vector<std::shared_ptr<const DATA>> qpd_const =
manager_const.get_data(cell);
- const std_cxx17::optional<std::vector<std::shared_ptr<DATA>>>
- qpd_optional = manager.try_get_data(cell);
- const std_cxx17::optional<std::vector<std::shared_ptr<const DATA>>>
+ const std::optional<std::vector<std::shared_ptr<DATA>>> qpd_optional =
+ manager.try_get_data(cell);
+ const std::optional<std::vector<std::shared_ptr<const DATA>>>
qpd_const_optional = manager_const.try_get_data(cell);
AssertThrow(qpd_optional, ExcInternalError());
AssertThrow(qpd_const_optional, ExcInternalError());
next_cell++;
if (next_cell != tr.end())
{
- const std_cxx17::optional<std::vector<std::shared_ptr<MyQData>>>
+ const std::optional<std::vector<std::shared_ptr<MyQData>>>
nonexisting_data = data_storage.try_get_data(next_cell);
AssertThrow(!nonexisting_data, ExcInternalError());
}
#include <deal.II/base/mutable_bind.h>
#include <deal.II/base/point.h>
-#include <deal.II/base/std_cxx17/tuple.h>
+
+#include <tuple>
#include "../tests.h"
#include <deal.II/base/mutable_bind.h>
#include <deal.II/base/point.h>
-#include <deal.II/base/std_cxx17/tuple.h>
+
+#include <tuple>
#include "../tests.h"
#include <deal.II/base/mutable_bind.h>
#include <deal.II/base/point.h>
-#include <deal.II/base/std_cxx17/tuple.h>
+
+#include <tuple>
#include "../tests.h"
#include <deal.II/base/mutable_bind.h>
#include <deal.II/base/point.h>
-#include <deal.II/base/std_cxx17/tuple.h>
+
+#include <tuple>
#include "../tests.h"
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// 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 <deal.II/base/point.h>
-#include <deal.II/base/std_cxx17/tuple.h>
-
-#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);
-}
+++ /dev/null
-
-DEAL::P: 0.500000 0.500000, d: 2.00000, i: 3
// 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 <deal.II/base/logstream.h>
GridTools::
exchange_cell_data_to_ghosts<DT, parallel::distributed::Triangulation<dim>>(
tria,
- [&](const cell_iterator &cell) -> std_cxx17::optional<DT> {
+ [&](const cell_iterator &cell) -> std::optional<DT> {
const auto counter = map[cell->id()];
std::ostringstream oss;
if (counter % 2 == 0)
{
oss << "skipping " << cell->id() << ' ' << counter;
input[cell->id()] = oss.str();
- return std_cxx17::optional<DT>();
+ return std::optional<DT>();
}
},
[&](const cell_iterator &cell, const DT &data) {
#include <deal.II/base/exceptions.h>
#include <deal.II/base/function_signed_distance.h>
#include <deal.II/base/quadrature_lib.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/mapping_cartesian.h>
#include <deal.II/numerics/vector_tools.h>
+#include <optional>
+
#include "../tests.h"
using namespace dealii;
#include <deal.II/base/exceptions.h>
#include <deal.II/base/function_signed_distance.h>
#include <deal.II/base/quadrature_lib.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/numerics/vector_tools.h>
#include <bitset>
+#include <optional>
#include "../tests.h"
#include <deal.II/base/exceptions.h>
#include <deal.II/base/function_signed_distance.h>
#include <deal.II/base/quadrature_lib.h>
-#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/numerics/vector_tools.h>
+#include <optional>
+
#include "../tests.h"
using namespace dealii;
// Assert that the incoming optional does not have a value.
template <class FEVALUES>
void
-assert_doesnt_have_value(const std_cxx17::optional<FEVALUES> &fe_values)
+assert_doesnt_have_value(const std::optional<FEVALUES> &fe_values)
{
AssertThrow(!fe_values, ExcInternalError());
deallog << "OK" << std::endl;
// 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.
bounds[0].value = pair_with_equal_entries(-1);
bounds[1].value = pair_with_equal_entries(1);
- const std_cxx17::optional<HeightDirectionData> data =
+ const std::optional<HeightDirectionData> data =
find_best_height_direction(bounds);
if (!data)
bounds[0].gradient[1] = pair_with_equal_entries(6);
bounds[1].gradient[1] = pair_with_equal_entries(5);
- const std_cxx17::optional<HeightDirectionData> data =
+ const std::optional<HeightDirectionData> data =
find_best_height_direction(bounds);
deallog << "height direction = " << data->direction << std::endl;