From: Jean-Paul Pelteret Date: Sat, 30 Mar 2019 10:18:46 +0000 (+0100) Subject: Add traits for SD numbers X-Git-Tag: v9.1.0-rc1~218^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=534cfa1c2f777ec0a48f8e1d8a3e7338c85589eb;p=dealii.git Add traits for SD numbers --- diff --git a/include/deal.II/differentiation/sd.h b/include/deal.II/differentiation/sd.h new file mode 100644 index 0000000000..f2707cbfc6 --- /dev/null +++ b/include/deal.II/differentiation/sd.h @@ -0,0 +1,46 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef dealii_differentiation_sd_h +#define dealii_differentiation_sd_h + +#include + +#ifdef DEAL_II_WITH_SYMENGINE + +# include +# include +# include + +DEAL_II_NAMESPACE_OPEN + +namespace Differentiation +{ + /** + * Wrappers for symbolic differentiation libraries. Currently there is support + * for the following libraries: + * - SymEngine + * + * @ingroup auto_symb_diff + */ + namespace SD + {} +} // namespace Differentiation + +DEAL_II_NAMESPACE_CLOSE + +#endif // DEAL_II_WITH_SYMENGINE + +#endif // dealii_differentiation_sd_h diff --git a/include/deal.II/differentiation/sd/symengine_number_traits.h b/include/deal.II/differentiation/sd/symengine_number_traits.h new file mode 100644 index 0000000000..295584a9bb --- /dev/null +++ b/include/deal.II/differentiation/sd/symengine_number_traits.h @@ -0,0 +1,95 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef dealii_differentiation_sd_symengine_number_traits_h +#define dealii_differentiation_sd_symengine_number_traits_h + +#include + +#ifdef DEAL_II_WITH_SYMENGINE + +# include + +# include + + +DEAL_II_NAMESPACE_OPEN + + +namespace Differentiation +{ + namespace SD + { + /** + * A struct to indicate whether a given @p NumberType is a supported + * symbolically differentiable number or not. By default, numbers are not + * considered to have the necessary characteristics to fulfill this + * condition. + * + * @author Jean-Paul Pelteret, 2019 + */ + template + struct is_sd_number : std::false_type + {}; + + + /** + * A struct to indicate whether a given @p NumberType is a supported + * SymEngine number or not. By default, numbers are not + * considered to have the necessary characteristics to fulfill this + * condition. + * + * @author Jean-Paul Pelteret, 2019 + */ + template + struct is_symengine_number : std::false_type + {}; + + + /*--- SymEngine Expression class ---*/ + + + /** + * A struct to indicate whether a given @p NumberType is a supported + * symbolically differentiable number or not. + * This is a specialization for the SymEngine Expression class. + * + * @author Jean-Paul Pelteret, 2019 + */ + template <> + struct is_symengine_number : std::true_type + {}; + + + /** + * A struct to indicate whether a given @p NumberType is a supported + * symbolically differentiable number or not. + * This is a specialization for the SymEngine Expression class. + * + * @author Jean-Paul Pelteret, 2019 + */ + template <> + struct is_sd_number : std::true_type + {}; + + } // namespace SD +} // namespace Differentiation + + +DEAL_II_NAMESPACE_CLOSE + +#endif // DEAL_II_WITH_SYMENGINE + +#endif // dealii_differentiation_sd_symengine_number_traits_h