Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
arcofcircle.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE-FUFEM Project contributors, see file AUTHORS.md
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
3
4#ifndef ARC_OF_CIRCLE_HH
5#define ARC_OF_CIRCLE_HH
6
7
9
11{
12 public:
13
14 ArcOfCircle(const Dune::FieldVector<double,2>& center, double radius,
15 double fromAngle, double toAngle)
16 : center_(center), radius_(radius), fromAngle_(fromAngle), toAngle_(toAngle)
17 {}
18
20
21 double angle = fromAngle_ + local[0]*(toAngle_ - fromAngle_);
22
24 result[0] += radius_ * std::cos(angle);
25 result[1] += radius_ * std::sin(angle);
26
27 return result;
28 }
29
31
32 double radius_;
33
34 double fromAngle_;
35
36 double toAngle_;
37};
38
48template<class ctype>
50{
51 public:
52
53 TubeLowerSegment(const Dune::FieldVector<ctype,3>& center, ctype radius, ctype length,
54 ctype fromAngle, ctype toAngle)
55 : center_(center), radius_(radius), length_(length), fromAngle_(fromAngle), toAngle_(toAngle)
56 {}
57
59
60 ctype angle = fromAngle_ + (local[0] + local[1])*(toAngle_ - fromAngle_);
61
63
64 result[0] += local[1]*length_;
65 result[1] += radius_ * std::cos(angle);
66 result[2] += radius_ * std::sin(angle);
67
68 return result;
69 }
70
72
73 ctype radius_;
74 ctype length_;
75
77 ctype toAngle_;
78};
79
89template<class ctype>
91{
92 public:
93
94 TubeUpperSegment(const Dune::FieldVector<ctype,3>& center, ctype radius, ctype length,
95 ctype fromAngle, ctype toAngle)
96 : center_(center), radius_(radius), length_(length), fromAngle_(fromAngle), toAngle_(toAngle)
97 {}
98
100
101 ctype angle = fromAngle_ + local[0]*(toAngle_ - fromAngle_);
102
104
105 result[0] += local[1]*length_;
106 result[1] += radius_ * std::cos(angle);
107 result[2] += radius_ * std::sin(angle);
108
109 return result;
110 }
111
113
114 ctype radius_;
115 ctype length_;
116
118 ctype toAngle_;
119};
120
130template<class ctype>
132{
133 public:
134
135 TubeLateralSegment(const Dune::FieldVector<ctype,3>& center, ctype radius, ctype thickness,
136 ctype fromAngle, ctype toAngle)
137 : center_(center), radius_(radius), thickness_(thickness), fromAngle_(fromAngle), toAngle_(toAngle)
138 {}
139
141
142 ctype angle = fromAngle_ + local[0]*(toAngle_ - fromAngle_);
143
145
146 result[1] += (radius_ +local[1]*thickness_)* std::cos(angle);
147 result[2] += (radius_ +local[1]*thickness_)* std::sin(angle);
148
149 return result;
150 }
151
153
154 ctype radius_;
156
158 ctype toAngle_;
159};
160
161#endif
LocalIndex & local()
Definition arcofcircle.hh:11
Dune::FieldVector< double, 2 > center_
Definition arcofcircle.hh:30
double fromAngle_
Definition arcofcircle.hh:34
Dune::FieldVector< double, 2 > operator()(const Dune::FieldVector< double, 1 > &local) const
Definition arcofcircle.hh:19
double radius_
Definition arcofcircle.hh:32
double toAngle_
Definition arcofcircle.hh:36
ArcOfCircle(const Dune::FieldVector< double, 2 > &center, double radius, double fromAngle, double toAngle)
Definition arcofcircle.hh:14
Boundary segments for a 3D-tube/tube-segment prism grid that is aligned with the x-axis.
Definition arcofcircle.hh:50
ctype length_
Definition arcofcircle.hh:74
ctype radius_
Definition arcofcircle.hh:73
ctype fromAngle_
Definition arcofcircle.hh:76
Dune::FieldVector< ctype, 3 > center_
Definition arcofcircle.hh:71
Dune::FieldVector< ctype, 3 > operator()(const Dune::FieldVector< ctype, 2 > &local) const
Definition arcofcircle.hh:58
ctype toAngle_
Definition arcofcircle.hh:77
TubeLowerSegment(const Dune::FieldVector< ctype, 3 > &center, ctype radius, ctype length, ctype fromAngle, ctype toAngle)
Definition arcofcircle.hh:53
Boundary segments for a 3D-tube/tube-segment prism grid that is aligned with the x-axis.
Definition arcofcircle.hh:91
Dune::FieldVector< ctype, 3 > operator()(const Dune::FieldVector< ctype, 2 > &local) const
Definition arcofcircle.hh:99
ctype length_
Definition arcofcircle.hh:115
ctype fromAngle_
Definition arcofcircle.hh:117
ctype radius_
Definition arcofcircle.hh:114
Dune::FieldVector< ctype, 3 > center_
Definition arcofcircle.hh:112
TubeUpperSegment(const Dune::FieldVector< ctype, 3 > &center, ctype radius, ctype length, ctype fromAngle, ctype toAngle)
Definition arcofcircle.hh:94
ctype toAngle_
Definition arcofcircle.hh:118
Lateral boundary segments for a 3D-tube/tube-segment prism grid that is aligned with the x-axis.
Definition arcofcircle.hh:132
ctype thickness_
Definition arcofcircle.hh:155
ctype radius_
Definition arcofcircle.hh:154
TubeLateralSegment(const Dune::FieldVector< ctype, 3 > &center, ctype radius, ctype thickness, ctype fromAngle, ctype toAngle)
Definition arcofcircle.hh:135
ctype toAngle_
Definition arcofcircle.hh:158
Dune::FieldVector< ctype, 3 > center_
Definition arcofcircle.hh:152
ctype fromAngle_
Definition arcofcircle.hh:157
Dune::FieldVector< ctype, 3 > operator()(const Dune::FieldVector< ctype, 2 > &local) const
Definition arcofcircle.hh:140
T cos(T... args)
T sin(T... args)