suanPan
BSpline.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2024 Theodore Chang
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
30#ifndef BSPLINE_H
31#define BSPLINE_H
32
33#include <suanPan.h>
34
35struct IGA {
36 static void convert_to_weighted(mat&);
37 static void convert_to_weighted(field<vec>&);
38 [[nodiscard]] static uword compute_order(const vec&);
39 [[nodiscard]] static uword compute_number_of_elements(const vec&);
40 [[nodiscard]] static uword compute_number_of_control_points(const vec&);
41 [[nodiscard]] static uvec compute_all_element_span(const vec&);
42};
43
44class BSpline {
45protected:
46 const uword dimension;
47
48 const vec knot;
49
50 field<vec> net;
51
53
54public:
55 BSpline(vec, uword, field<vec>&& = {});
56 BSpline(const BSpline&) = default;
57 BSpline(BSpline&&) = default;
58 BSpline& operator=(const BSpline&) = delete;
60 virtual ~BSpline() = default;
61
62 void set_control_polygon(field<vec>&&);
63 void set_control_polygon(const field<vec>&);
64
65 [[nodiscard]] const vec& get_knot() const;
66 [[nodiscard]] uword get_order() const;
67 [[nodiscard]] uword get_number_of_control_points() const;
68 [[nodiscard]] uvec get_all_element_span() const;
69
70 [[nodiscard]] uword evaluate_span(double) const;
71
72 [[nodiscard]] vec evaluate_basis(double, sword = -1) const;
73 [[nodiscard]] mat evaluate_basis_derivative(double, sword = -1, sword = -1) const;
74
75 [[nodiscard]] vec evaluate_point(double) const;
76 [[nodiscard]] field<vec> evaluate_point_derivative(double, sword = -1) const;
77
78 [[nodiscard]] vec evaluate_shape_function(double) const;
79 [[nodiscard]] field<vec> evaluate_shape_function_derivative(double, sword = -1) const;
80
81 [[nodiscard]] virtual vec evaluate_point(double, const field<vec>&) const;
82 [[nodiscard]] virtual field<vec> evaluate_point_derivative(double, const field<vec>&, sword = -1) const;
83
84 [[nodiscard]] virtual vec evaluate_shape_function(double, const field<vec>&) const;
85 [[nodiscard]] virtual field<vec> evaluate_shape_function_derivative(double, const field<vec>&, sword = -1) const;
86};
87
88class BSplineCurve2D final : public BSpline {
89public:
90 explicit BSplineCurve2D(vec, field<vec>&& = {});
91};
92
93class BSplineCurve3D final : public BSpline {
94public:
95 explicit BSplineCurve3D(vec, field<vec>&& = {});
96};
97
98class BSplineCurve4D final : public BSpline {
99public:
100 explicit BSplineCurve4D(vec, field<vec>&& = {});
101};
102
103#endif
104
Definition: BSpline.h:88
BSplineCurve2D(vec, field< vec > &&={})
Definition: BSpline.cpp:261
Definition: BSpline.h:93
BSplineCurve3D(vec, field< vec > &&={})
Definition: BSpline.cpp:264
Definition: BSpline.h:98
BSplineCurve4D(vec, field< vec > &&={})
Definition: BSpline.cpp:267
Definition: BSpline.h:44
uword get_order() const
Definition: BSpline.cpp:55
BSpline(const BSpline &)=default
vec evaluate_shape_function(double) const
Definition: BSpline.cpp:185
vec evaluate_basis(double, sword=-1) const
Algorithm A2.2.
Definition: BSpline.cpp:96
field< vec > evaluate_shape_function_derivative(double, sword=-1) const
Definition: BSpline.cpp:187
uword evaluate_span(double) const
Algorithm A2.1.
Definition: BSpline.cpp:72
BSpline & operator=(const BSpline &)=delete
vec evaluate_point(double) const
Definition: BSpline.cpp:181
const uword dimension
Definition: BSpline.h:46
BSpline(BSpline &&)=default
void set_control_polygon(field< vec > &&)
Definition: BSpline.cpp:59
mat evaluate_basis_derivative(double, sword=-1, sword=-1) const
Algorithm A2.3.
Definition: BSpline.cpp:127
field< vec > evaluate_point_derivative(double, sword=-1) const
Definition: BSpline.cpp:183
BSpline(vec, uword, field< vec > &&={})
Definition: BSpline.cpp:50
const vec & get_knot() const
Definition: BSpline.cpp:63
virtual ~BSpline()=default
uvec get_all_element_span() const
Definition: BSpline.cpp:65
const uword order
Definition: BSpline.h:52
field< vec > net
Definition: BSpline.h:50
const vec knot
Definition: BSpline.h:48
BSpline & operator=(BSpline &&)=delete
uword get_number_of_control_points() const
Definition: BSpline.cpp:57
Definition: BSpline.h:35
static uvec compute_all_element_span(const vec &)
Definition: BSpline.cpp:41
static void convert_to_weighted(mat &)
Definition: BSpline.cpp:20
static uword compute_order(const vec &)
Definition: BSpline.cpp:29
static uword compute_number_of_control_points(const vec &)
Definition: BSpline.cpp:39
static uword compute_number_of_elements(const vec &)
Definition: BSpline.cpp:37