QUGaR
0.0.9
Loading...
Searching...
No Matches
tpms_lib.hpp
Go to the documentation of this file.
1
// --------------------------------------------------------------------------
2
//
3
// Copyright (C) 2025-present by Pablo Antolin
4
//
5
// This file is part of the QUGaR library.
6
//
7
// SPDX-License-Identifier: MIT
8
//
9
// --------------------------------------------------------------------------
10
11
#ifndef QUGAR_IMPL_TPMS_LIB_HPP
12
#define QUGAR_IMPL_TPMS_LIB_HPP
13
20
21
#include <
qugar/domain_function.hpp
>
22
#include <
qugar/vector.hpp
>
23
24
#include <
qugar/numbers.hpp
>
25
#include <
qugar/point.hpp
>
26
#include <
qugar/types.hpp
>
27
30
namespace
qugar::impl::tpms
{
31
32
template
<
int
dim>
class
TPMSBase
:
public
qugar::impl::ImplicitFunc
<dim>
33
{
34
protected
:
38
template
<
int
dim_aux = dim>
39
requires
(dim == dim_aux && dim_aux == 2)
40
TPMSBase
(
const
Vector<real, 2>
&mnq,
real
z) :
z_
(z)
41
{
42
mnq_
(0) = mnq(0);
43
mnq_
(1) = mnq(1);
44
}
45
48
template
<
int
dim_aux = dim>
49
requires
(dim == dim_aux && dim_aux == 3)
50
explicit
TPMSBase
(
const
Vector<real, 3>
&mnq) :
mnq_
(mnq)
51
{}
52
53
TPMSBase
() =
default
;
54
56
Vector<real, 3>
mnq_
{
numbers::one
};
57
59
real
z_
{
numbers::zero
};
60
};
61
62
// NOLINTNEXTLINE (cppcoreguidelines-macro-usage)
63
#define declare_tpms(TPMS_NAME) \
64
template<int dim> class TPMS_NAME : public TPMSBase<dim> \
65
{ \
66
using Parent = TPMSBase<dim>; \
67
template<typename T> using Gradient = qugar::impl::ImplicitFunc<dim>::template Gradient<T>; \
68
template<typename T> using Hessian = qugar::impl::ImplicitFunc<dim>::template Hessian<T>; \
69
\
70
public: \
71
TPMS_NAME() = default; \
72
\
73
template<int dim_aux = dim> \
74
requires(dim == dim_aux && dim_aux == 2) \
75
explicit TPMS_NAME(const Vector<real, dim> &mnq, real z) : Parent(mnq, z) \
76
{} \
77
\
78
template<int dim_aux = dim> \
79
requires(dim == dim_aux && dim_aux == 3) \
80
explicit TPMS_NAME(const Vector<real, dim> &mnq) : Parent(mnq) \
81
{} \
82
\
83
[[nodiscard]] virtual real operator()(const Point<dim> &point) const final; \
84
\
85
[[nodiscard]] virtual ::algoim::Interval<dim> operator()( \
86
const Point<dim, ::algoim::Interval<dim>> &point) const final; \
87
\
88
[[nodiscard]] virtual Gradient<real> grad(const Point<dim> &point) const final; \
89
\
90
[[nodiscard]] virtual Gradient<::algoim::Interval<dim>> grad( \
91
const Point<dim, ::algoim::Interval<dim>> &point) const final; \
92
\
93
[[nodiscard]] virtual Hessian<real> hessian(const Point<dim> &point) const final; \
94
\
95
private: \
96
template<typename T> [[nodiscard]] T eval_(const Point<3, T> &point) const; \
97
\
98
template<typename T> [[nodiscard]] Gradient<T> grad_(const Point<3, T> &point) const; \
99
\
100
template<typename T> [[nodiscard]] Hessian<T> hessian_(const Point<3, T> &point) const; \
101
};
102
109
declare_tpms
(Schoen);
110
118
declare_tpms
(SchoenIWP);
119
127
declare_tpms
(SchoenFRD);
128
137
declare_tpms
(FischerKochS);
138
146
declare_tpms
(SchwarzDiamond);
147
154
declare_tpms
(SchwarzPrimitive);
155
156
}
// namespace qugar::impl::tpms
157
158
159
#endif
// QUGAR_IMPL_TPMS_LIB_HPP
qugar::impl::DomainFunc
Domain functions.
Definition
domain_function.hpp:41
qugar::impl::tpms::TPMSBase
Definition
tpms_lib.hpp:33
qugar::impl::tpms::TPMSBase::mnq_
Vector< real, 3 > mnq_
Function periods.
Definition
tpms_lib.hpp:56
qugar::impl::tpms::TPMSBase::TPMSBase
TPMSBase(const Vector< real, 2 > &mnq, real z)
Definition
tpms_lib.hpp:40
qugar::impl::tpms::TPMSBase::TPMSBase
TPMSBase()=default
qugar::impl::tpms::TPMSBase::TPMSBase
TPMSBase(const Vector< real, 3 > &mnq)
Definition
tpms_lib.hpp:50
qugar::impl::tpms::TPMSBase::z_
real z_
Constant z coordinate for 2D functions.
Definition
tpms_lib.hpp:59
domain_function.hpp
Declaration of a few implicit functions template class ready to be consumed by Algoim.
qugar::impl::tpms
Definition
tpms_lib.hpp:30
qugar::numbers::zero
constexpr real zero
Real zero value.
Definition
numbers.hpp:20
qugar::numbers::one
constexpr real one
Real one value.
Definition
numbers.hpp:22
qugar::real
double real
Definition
types.hpp:18
qugar::Vector
::algoim::uvector< T, dim > Vector
Class representing a vector.
Definition
vector.hpp:31
numbers.hpp
Declaration of constant values.
point.hpp
Definition and implementation of Point class.
declare_tpms
#define declare_tpms(TPMS_NAME)
Definition
tpms_lib.hpp:63
types.hpp
Declaration of types.
vector.hpp
cpp
include
qugar
tpms_lib.hpp
Generated by
1.12.0