1 |
424 |
jeremybenn |
// 2007-02-04 Edward Smith-Rowland <3dw4rd@verizon.net>
|
2 |
|
|
//
|
3 |
|
|
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
4 |
|
|
//
|
5 |
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
6 |
|
|
// software; you can redistribute it and/or modify it under the
|
7 |
|
|
// terms of the GNU General Public License as published by the
|
8 |
|
|
// Free Software Foundation; either version 3, or (at your option)
|
9 |
|
|
// any later version.
|
10 |
|
|
//
|
11 |
|
|
// This library is distributed in the hope that it will be useful,
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
// GNU General Public License for more details.
|
15 |
|
|
//
|
16 |
|
|
// You should have received a copy of the GNU General Public License along
|
17 |
|
|
// with this library; see the file COPYING3. If not see
|
18 |
|
|
// <http://www.gnu.org/licenses/>.
|
19 |
|
|
|
20 |
|
|
// cyl_neumann
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
// Compare against values generated by the GNU Scientific Library.
|
24 |
|
|
// The GSL can be found on the web: http://www.gnu.org/software/gsl/
|
25 |
|
|
|
26 |
|
|
#include <tr1/cmath>
|
27 |
|
|
#if defined(__TEST_DEBUG)
|
28 |
|
|
#include <iostream>
|
29 |
|
|
#define VERIFY(A) \
|
30 |
|
|
if (!(A)) \
|
31 |
|
|
{ \
|
32 |
|
|
std::cout << "line " << __LINE__ \
|
33 |
|
|
<< " max_abs_frac = " << max_abs_frac \
|
34 |
|
|
<< std::endl; \
|
35 |
|
|
}
|
36 |
|
|
#else
|
37 |
|
|
#include <testsuite_hooks.h>
|
38 |
|
|
#endif
|
39 |
|
|
#include "../testcase.h"
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
// Test data for nu=0.0000000000000000.
|
43 |
|
|
testcase_cyl_neumann<double> data001[] = {
|
44 |
|
|
{ -0.30851762524903376, 0.0000000000000000, 5.0000000000000000 },
|
45 |
|
|
{ 0.055671167283599395, 0.0000000000000000, 10.000000000000000 },
|
46 |
|
|
{ 0.20546429603891825, 0.0000000000000000, 15.000000000000000 },
|
47 |
|
|
{ 0.062640596809383955, 0.0000000000000000, 20.000000000000000 },
|
48 |
|
|
{ -0.12724943226800620, 0.0000000000000000, 25.000000000000000 },
|
49 |
|
|
{ -0.11729573168666411, 0.0000000000000000, 30.000000000000000 },
|
50 |
|
|
{ 0.045797987195155640, 0.0000000000000000, 35.000000000000000 },
|
51 |
|
|
{ 0.12593641705826095, 0.0000000000000000, 40.000000000000000 },
|
52 |
|
|
{ 0.027060469763313322, 0.0000000000000000, 45.000000000000000 },
|
53 |
|
|
{ -0.098064995470077104, 0.0000000000000000, 50.000000000000000 },
|
54 |
|
|
{ -0.077569178730412622, 0.0000000000000000, 55.000000000000000 },
|
55 |
|
|
{ 0.047358952209449412, 0.0000000000000000, 60.000000000000000 },
|
56 |
|
|
{ 0.097183557740181933, 0.0000000000000000, 65.000000000000000 },
|
57 |
|
|
{ 0.0093096664589410131, 0.0000000000000000, 70.000000000000000 },
|
58 |
|
|
{ -0.085369047647775642, 0.0000000000000000, 75.000000000000000 },
|
59 |
|
|
{ -0.055620339089769981, 0.0000000000000000, 80.000000000000000 },
|
60 |
|
|
{ 0.049567884951494258, 0.0000000000000000, 85.000000000000000 },
|
61 |
|
|
{ 0.079776475854877765, 0.0000000000000000, 90.000000000000000 },
|
62 |
|
|
{ -0.0028230995861232323, 0.0000000000000000, 95.000000000000000 },
|
63 |
|
|
{ -0.077244313365083112, 0.0000000000000000, 100.00000000000000 },
|
64 |
|
|
};
|
65 |
|
|
|
66 |
|
|
// Test function for nu=0.0000000000000000.
|
67 |
|
|
template <typename Tp>
|
68 |
|
|
void test001()
|
69 |
|
|
{
|
70 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
71 |
|
|
Tp max_abs_diff = -Tp(1);
|
72 |
|
|
Tp max_abs_frac = -Tp(1);
|
73 |
|
|
unsigned int num_datum = sizeof(data001)
|
74 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
75 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
76 |
|
|
{
|
77 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data001[i].nu), Tp(data001[i].x));
|
78 |
|
|
const Tp f0 = data001[i].f0;
|
79 |
|
|
const Tp diff = f - f0;
|
80 |
|
|
if (std::abs(diff) > max_abs_diff)
|
81 |
|
|
max_abs_diff = std::abs(diff);
|
82 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
83 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
84 |
|
|
{
|
85 |
|
|
const Tp frac = diff / f0;
|
86 |
|
|
if (std::abs(frac) > max_abs_frac)
|
87 |
|
|
max_abs_frac = std::abs(frac);
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
VERIFY(max_abs_frac < Tp(1.0000000000000006e-10));
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
// Test data for nu=0.33333333333333331.
|
94 |
|
|
testcase_cyl_neumann<double> data002[] = {
|
95 |
|
|
{ -0.18192321129343830, 0.33333333333333331, 5.0000000000000000 },
|
96 |
|
|
{ 0.17020111788268769, 0.33333333333333331, 10.000000000000000 },
|
97 |
|
|
{ 0.18540507541540799, 0.33333333333333331, 15.000000000000000 },
|
98 |
|
|
{ -0.028777707635715091, 0.33333333333333331, 20.000000000000000 },
|
99 |
|
|
{ -0.15829741864944166, 0.33333333333333331, 25.000000000000000 },
|
100 |
|
|
{ -0.058645772316705216, 0.33333333333333331, 30.000000000000000 },
|
101 |
|
|
{ 0.10294930308870620, 0.33333333333333331, 35.000000000000000 },
|
102 |
|
|
{ 0.10547870367098920, 0.33333333333333331, 40.000000000000000 },
|
103 |
|
|
{ -0.034334228816010864, 0.33333333333333331, 45.000000000000000 },
|
104 |
|
|
{ -0.11283489933031278, 0.33333333333333331, 50.000000000000000 },
|
105 |
|
|
{ -0.030007358986895123, 0.33333333333333331, 55.000000000000000 },
|
106 |
|
|
{ 0.086699173295718093, 0.33333333333333331, 60.000000000000000 },
|
107 |
|
|
{ 0.074875579668878672, 0.33333333333333331, 65.000000000000000 },
|
108 |
|
|
{ -0.039323246374552645, 0.33333333333333331, 70.000000000000000 },
|
109 |
|
|
{ -0.091263539574475222, 0.33333333333333331, 75.000000000000000 },
|
110 |
|
|
{ -0.013358849535984282, 0.33333333333333331, 80.000000000000000 },
|
111 |
|
|
{ 0.078373575537830184, 0.33333333333333331, 85.000000000000000 },
|
112 |
|
|
{ 0.055812482883955974, 0.33333333333333331, 90.000000000000000 },
|
113 |
|
|
{ -0.043310380106990579, 0.33333333333333331, 95.000000000000000 },
|
114 |
|
|
{ -0.076900504962136587, 0.33333333333333331, 100.00000000000000 },
|
115 |
|
|
};
|
116 |
|
|
|
117 |
|
|
// Test function for nu=0.33333333333333331.
|
118 |
|
|
template <typename Tp>
|
119 |
|
|
void test002()
|
120 |
|
|
{
|
121 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
122 |
|
|
Tp max_abs_diff = -Tp(1);
|
123 |
|
|
Tp max_abs_frac = -Tp(1);
|
124 |
|
|
unsigned int num_datum = sizeof(data002)
|
125 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
126 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
127 |
|
|
{
|
128 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data002[i].nu), Tp(data002[i].x));
|
129 |
|
|
const Tp f0 = data002[i].f0;
|
130 |
|
|
const Tp diff = f - f0;
|
131 |
|
|
if (std::abs(diff) > max_abs_diff)
|
132 |
|
|
max_abs_diff = std::abs(diff);
|
133 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
134 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
135 |
|
|
{
|
136 |
|
|
const Tp frac = diff / f0;
|
137 |
|
|
if (std::abs(frac) > max_abs_frac)
|
138 |
|
|
max_abs_frac = std::abs(frac);
|
139 |
|
|
}
|
140 |
|
|
}
|
141 |
|
|
VERIFY(max_abs_frac < Tp(2.5000000000000014e-11));
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
// Test data for nu=0.50000000000000000.
|
145 |
|
|
testcase_cyl_neumann<double> data003[] = {
|
146 |
|
|
{ -0.10121770918510843, 0.50000000000000000, 5.0000000000000000 },
|
147 |
|
|
{ 0.21170886633139813, 0.50000000000000000, 10.000000000000000 },
|
148 |
|
|
{ 0.15650551590730860, 0.50000000000000000, 15.000000000000000 },
|
149 |
|
|
{ -0.072806904785061841, 0.50000000000000000, 20.000000000000000 },
|
150 |
|
|
{ -0.15817308404205055, 0.50000000000000000, 25.000000000000000 },
|
151 |
|
|
{ -0.022470290598831121, 0.50000000000000000, 30.000000000000000 },
|
152 |
|
|
{ 0.12187835265849536, 0.50000000000000000, 35.000000000000000 },
|
153 |
|
|
{ 0.084138655676395432, 0.50000000000000000, 40.000000000000000 },
|
154 |
|
|
{ -0.062482641933003132, 0.50000000000000000, 45.000000000000000 },
|
155 |
|
|
{ -0.10888475635053953, 0.50000000000000000, 50.000000000000000 },
|
156 |
|
|
{ -0.0023805454010948804, 0.50000000000000000, 55.000000000000000 },
|
157 |
|
|
{ 0.098104683735037904, 0.50000000000000000, 60.000000000000000 },
|
158 |
|
|
{ 0.055663470218594434, 0.50000000000000000, 65.000000000000000 },
|
159 |
|
|
{ -0.060396767883824809, 0.50000000000000000, 70.000000000000000 },
|
160 |
|
|
{ -0.084922578922046868, 0.50000000000000000, 75.000000000000000 },
|
161 |
|
|
{ 0.0098472271924441215, 0.50000000000000000, 80.000000000000000 },
|
162 |
|
|
{ 0.085190643574343639, 0.50000000000000000, 85.000000000000000 },
|
163 |
|
|
{ 0.037684970437156261, 0.50000000000000000, 90.000000000000000 },
|
164 |
|
|
{ -0.059772904856097479, 0.50000000000000000, 95.000000000000000 },
|
165 |
|
|
{ -0.068803091468728053, 0.50000000000000000, 100.00000000000000 },
|
166 |
|
|
};
|
167 |
|
|
|
168 |
|
|
// Test function for nu=0.50000000000000000.
|
169 |
|
|
template <typename Tp>
|
170 |
|
|
void test003()
|
171 |
|
|
{
|
172 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
173 |
|
|
Tp max_abs_diff = -Tp(1);
|
174 |
|
|
Tp max_abs_frac = -Tp(1);
|
175 |
|
|
unsigned int num_datum = sizeof(data003)
|
176 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
177 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
178 |
|
|
{
|
179 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data003[i].nu), Tp(data003[i].x));
|
180 |
|
|
const Tp f0 = data003[i].f0;
|
181 |
|
|
const Tp diff = f - f0;
|
182 |
|
|
if (std::abs(diff) > max_abs_diff)
|
183 |
|
|
max_abs_diff = std::abs(diff);
|
184 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
185 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
186 |
|
|
{
|
187 |
|
|
const Tp frac = diff / f0;
|
188 |
|
|
if (std::abs(frac) > max_abs_frac)
|
189 |
|
|
max_abs_frac = std::abs(frac);
|
190 |
|
|
}
|
191 |
|
|
}
|
192 |
|
|
VERIFY(max_abs_frac < Tp(5.0000000000000028e-11));
|
193 |
|
|
}
|
194 |
|
|
|
195 |
|
|
// Test data for nu=0.66666666666666663.
|
196 |
|
|
testcase_cyl_neumann<double> data004[] = {
|
197 |
|
|
{ -0.016050662643389616, 0.66666666666666663, 5.0000000000000000 },
|
198 |
|
|
{ 0.23937232657540730, 0.66666666666666663, 10.000000000000000 },
|
199 |
|
|
{ 0.11762106604241242, 0.66666666666666663, 15.000000000000000 },
|
200 |
|
|
{ -0.11182254014899563, 0.66666666666666663, 20.000000000000000 },
|
201 |
|
|
{ -0.14756582982938804, 0.66666666666666663, 25.000000000000000 },
|
202 |
|
|
{ 0.015078692908077665, 0.66666666666666663, 30.000000000000000 },
|
203 |
|
|
{ 0.13260911815705798, 0.66666666666666663, 35.000000000000000 },
|
204 |
|
|
{ 0.057217565989652795, 0.66666666666666663, 40.000000000000000 },
|
205 |
|
|
{ -0.086373755152382048, 0.66666666666666663, 45.000000000000000 },
|
206 |
|
|
{ -0.097624139208051630, 0.66666666666666663, 50.000000000000000 },
|
207 |
|
|
{ 0.025354902147023434, 0.66666666666666663, 55.000000000000000 },
|
208 |
|
|
{ 0.10288136476351209, 0.66666666666666663, 60.000000000000000 },
|
209 |
|
|
{ 0.032728379560128203, 0.66666666666666663, 65.000000000000000 },
|
210 |
|
|
{ -0.077363672735747777, 0.66666666666666663, 70.000000000000000 },
|
211 |
|
|
{ -0.072855870458293975, 0.66666666666666663, 75.000000000000000 },
|
212 |
|
|
{ 0.032358106046953494, 0.66666666666666663, 80.000000000000000 },
|
213 |
|
|
{ 0.086240651537394228, 0.66666666666666663, 85.000000000000000 },
|
214 |
|
|
{ 0.017029601697285159, 0.66666666666666663, 90.000000000000000 },
|
215 |
|
|
{ -0.072173520560584709, 0.66666666666666663, 95.000000000000000 },
|
216 |
|
|
{ -0.056057339204073985, 0.66666666666666663, 100.00000000000000 },
|
217 |
|
|
};
|
218 |
|
|
|
219 |
|
|
// Test function for nu=0.66666666666666663.
|
220 |
|
|
template <typename Tp>
|
221 |
|
|
void test004()
|
222 |
|
|
{
|
223 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
224 |
|
|
Tp max_abs_diff = -Tp(1);
|
225 |
|
|
Tp max_abs_frac = -Tp(1);
|
226 |
|
|
unsigned int num_datum = sizeof(data004)
|
227 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
228 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
229 |
|
|
{
|
230 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data004[i].nu), Tp(data004[i].x));
|
231 |
|
|
const Tp f0 = data004[i].f0;
|
232 |
|
|
const Tp diff = f - f0;
|
233 |
|
|
if (std::abs(diff) > max_abs_diff)
|
234 |
|
|
max_abs_diff = std::abs(diff);
|
235 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
236 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
237 |
|
|
{
|
238 |
|
|
const Tp frac = diff / f0;
|
239 |
|
|
if (std::abs(frac) > max_abs_frac)
|
240 |
|
|
max_abs_frac = std::abs(frac);
|
241 |
|
|
}
|
242 |
|
|
}
|
243 |
|
|
VERIFY(max_abs_frac < Tp(2.5000000000000014e-11));
|
244 |
|
|
}
|
245 |
|
|
|
246 |
|
|
// Test data for nu=1.0000000000000000.
|
247 |
|
|
testcase_cyl_neumann<double> data005[] = {
|
248 |
|
|
{ 0.14786314339122689, 1.0000000000000000, 5.0000000000000000 },
|
249 |
|
|
{ 0.24901542420695388, 1.0000000000000000, 10.000000000000000 },
|
250 |
|
|
{ 0.021073628036873546, 1.0000000000000000, 15.000000000000000 },
|
251 |
|
|
{ -0.16551161436252118, 1.0000000000000000, 20.000000000000000 },
|
252 |
|
|
{ -0.098829964783237384, 1.0000000000000000, 25.000000000000000 },
|
253 |
|
|
{ 0.084425570661747149, 1.0000000000000000, 30.000000000000000 },
|
254 |
|
|
{ 0.12751273354559012, 1.0000000000000000, 35.000000000000000 },
|
255 |
|
|
{ -0.0057935058215496330, 1.0000000000000000, 40.000000000000000 },
|
256 |
|
|
{ -0.11552517964639945, 1.0000000000000000, 45.000000000000000 },
|
257 |
|
|
{ -0.056795668562014713, 1.0000000000000000, 50.000000000000000 },
|
258 |
|
|
{ 0.073846265432577940, 1.0000000000000000, 55.000000000000000 },
|
259 |
|
|
{ 0.091869609369866906, 1.0000000000000000, 60.000000000000000 },
|
260 |
|
|
{ -0.017940374275377303, 1.0000000000000000, 65.000000000000000 },
|
261 |
|
|
{ -0.094844652625716244, 1.0000000000000000, 70.000000000000000 },
|
262 |
|
|
{ -0.035213785160580456, 1.0000000000000000, 75.000000000000000 },
|
263 |
|
|
{ 0.069395913784588051, 1.0000000000000000, 80.000000000000000 },
|
264 |
|
|
{ 0.071233187582749782, 1.0000000000000000, 85.000000000000000 },
|
265 |
|
|
{ -0.026187238607768282, 1.0000000000000000, 90.000000000000000 },
|
266 |
|
|
{ -0.081827958724501229, 1.0000000000000000, 95.000000000000000 },
|
267 |
|
|
{ -0.020372312002759942, 1.0000000000000000, 100.00000000000000 },
|
268 |
|
|
};
|
269 |
|
|
|
270 |
|
|
// Test function for nu=1.0000000000000000.
|
271 |
|
|
template <typename Tp>
|
272 |
|
|
void test005()
|
273 |
|
|
{
|
274 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
275 |
|
|
Tp max_abs_diff = -Tp(1);
|
276 |
|
|
Tp max_abs_frac = -Tp(1);
|
277 |
|
|
unsigned int num_datum = sizeof(data005)
|
278 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
279 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
280 |
|
|
{
|
281 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data005[i].nu), Tp(data005[i].x));
|
282 |
|
|
const Tp f0 = data005[i].f0;
|
283 |
|
|
const Tp diff = f - f0;
|
284 |
|
|
if (std::abs(diff) > max_abs_diff)
|
285 |
|
|
max_abs_diff = std::abs(diff);
|
286 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
287 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
288 |
|
|
{
|
289 |
|
|
const Tp frac = diff / f0;
|
290 |
|
|
if (std::abs(frac) > max_abs_frac)
|
291 |
|
|
max_abs_frac = std::abs(frac);
|
292 |
|
|
}
|
293 |
|
|
}
|
294 |
|
|
VERIFY(max_abs_frac < Tp(2.5000000000000014e-11));
|
295 |
|
|
}
|
296 |
|
|
|
297 |
|
|
// Test data for nu=2.0000000000000000.
|
298 |
|
|
testcase_cyl_neumann<double> data006[] = {
|
299 |
|
|
{ 0.36766288260552449, 2.0000000000000000, 5.0000000000000000 },
|
300 |
|
|
{ -0.0058680824422086154, 2.0000000000000000, 10.000000000000000 },
|
301 |
|
|
{ -0.20265447896733510, 2.0000000000000000, 15.000000000000000 },
|
302 |
|
|
{ -0.079191758245636068, 2.0000000000000000, 20.000000000000000 },
|
303 |
|
|
{ 0.11934303508534720, 2.0000000000000000, 25.000000000000000 },
|
304 |
|
|
{ 0.12292410306411393, 2.0000000000000000, 30.000000000000000 },
|
305 |
|
|
{ -0.038511545278264774, 2.0000000000000000, 35.000000000000000 },
|
306 |
|
|
{ -0.12622609234933843, 2.0000000000000000, 40.000000000000000 },
|
307 |
|
|
{ -0.032194922192042189, 2.0000000000000000, 45.000000000000000 },
|
308 |
|
|
{ 0.095793168727596509, 2.0000000000000000, 50.000000000000000 },
|
309 |
|
|
{ 0.080254497473415454, 2.0000000000000000, 55.000000000000000 },
|
310 |
|
|
{ -0.044296631897120513, 2.0000000000000000, 60.000000000000000 },
|
311 |
|
|
{ -0.097735569256347382, 2.0000000000000000, 65.000000000000000 },
|
312 |
|
|
{ -0.012019513676818619, 2.0000000000000000, 70.000000000000000 },
|
313 |
|
|
{ 0.084430013376826832, 2.0000000000000000, 75.000000000000000 },
|
314 |
|
|
{ 0.057355236934384685, 2.0000000000000000, 80.000000000000000 },
|
315 |
|
|
{ -0.047891809949547205, 2.0000000000000000, 85.000000000000000 },
|
316 |
|
|
{ -0.080358414490605948, 2.0000000000000000, 90.000000000000000 },
|
317 |
|
|
{ 0.0011004057182389959, 2.0000000000000000, 95.000000000000000 },
|
318 |
|
|
{ 0.076836867125027908, 2.0000000000000000, 100.00000000000000 },
|
319 |
|
|
};
|
320 |
|
|
|
321 |
|
|
// Test function for nu=2.0000000000000000.
|
322 |
|
|
template <typename Tp>
|
323 |
|
|
void test006()
|
324 |
|
|
{
|
325 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
326 |
|
|
Tp max_abs_diff = -Tp(1);
|
327 |
|
|
Tp max_abs_frac = -Tp(1);
|
328 |
|
|
unsigned int num_datum = sizeof(data006)
|
329 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
330 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
331 |
|
|
{
|
332 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data006[i].nu), Tp(data006[i].x));
|
333 |
|
|
const Tp f0 = data006[i].f0;
|
334 |
|
|
const Tp diff = f - f0;
|
335 |
|
|
if (std::abs(diff) > max_abs_diff)
|
336 |
|
|
max_abs_diff = std::abs(diff);
|
337 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
338 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
339 |
|
|
{
|
340 |
|
|
const Tp frac = diff / f0;
|
341 |
|
|
if (std::abs(frac) > max_abs_frac)
|
342 |
|
|
max_abs_frac = std::abs(frac);
|
343 |
|
|
}
|
344 |
|
|
}
|
345 |
|
|
VERIFY(max_abs_frac < Tp(2.5000000000000017e-10));
|
346 |
|
|
}
|
347 |
|
|
|
348 |
|
|
// Test data for nu=5.0000000000000000.
|
349 |
|
|
testcase_cyl_neumann<double> data007[] = {
|
350 |
|
|
{ -0.45369482249110188, 5.0000000000000000, 5.0000000000000000 },
|
351 |
|
|
{ 0.13540304768936232, 5.0000000000000000, 10.000000000000000 },
|
352 |
|
|
{ 0.16717271575940021, 5.0000000000000000, 15.000000000000000 },
|
353 |
|
|
{ -0.10003576788953225, 5.0000000000000000, 20.000000000000000 },
|
354 |
|
|
{ -0.14705799311372267, 5.0000000000000000, 25.000000000000000 },
|
355 |
|
|
{ 0.031627359289264322, 5.0000000000000000, 30.000000000000000 },
|
356 |
|
|
{ 0.13554781474770031, 5.0000000000000000, 35.000000000000000 },
|
357 |
|
|
{ 0.031869448780850372, 5.0000000000000000, 40.000000000000000 },
|
358 |
|
|
{ -0.10426932700176872, 5.0000000000000000, 45.000000000000000 },
|
359 |
|
|
{ -0.078548413913081608, 5.0000000000000000, 50.000000000000000 },
|
360 |
|
|
{ 0.055257033062858382, 5.0000000000000000, 55.000000000000000 },
|
361 |
|
|
{ 0.099464632840450901, 5.0000000000000000, 60.000000000000000 },
|
362 |
|
|
{ 0.00023860469499600970, 5.0000000000000000, 65.000000000000000 },
|
363 |
|
|
{ -0.091861802216406066, 5.0000000000000000, 70.000000000000000 },
|
364 |
|
|
{ -0.048383671296970077, 5.0000000000000000, 75.000000000000000 },
|
365 |
|
|
{ 0.060293667104896330, 5.0000000000000000, 80.000000000000000 },
|
366 |
|
|
{ 0.077506166682734010, 5.0000000000000000, 85.000000000000000 },
|
367 |
|
|
{ -0.015338764062239803, 5.0000000000000000, 90.000000000000000 },
|
368 |
|
|
{ -0.081531504045514375, 5.0000000000000000, 95.000000000000000 },
|
369 |
|
|
{ -0.029480196281662041, 5.0000000000000000, 100.00000000000000 },
|
370 |
|
|
};
|
371 |
|
|
|
372 |
|
|
// Test function for nu=5.0000000000000000.
|
373 |
|
|
template <typename Tp>
|
374 |
|
|
void test007()
|
375 |
|
|
{
|
376 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
377 |
|
|
Tp max_abs_diff = -Tp(1);
|
378 |
|
|
Tp max_abs_frac = -Tp(1);
|
379 |
|
|
unsigned int num_datum = sizeof(data007)
|
380 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
381 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
382 |
|
|
{
|
383 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data007[i].nu), Tp(data007[i].x));
|
384 |
|
|
const Tp f0 = data007[i].f0;
|
385 |
|
|
const Tp diff = f - f0;
|
386 |
|
|
if (std::abs(diff) > max_abs_diff)
|
387 |
|
|
max_abs_diff = std::abs(diff);
|
388 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
389 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
390 |
|
|
{
|
391 |
|
|
const Tp frac = diff / f0;
|
392 |
|
|
if (std::abs(frac) > max_abs_frac)
|
393 |
|
|
max_abs_frac = std::abs(frac);
|
394 |
|
|
}
|
395 |
|
|
}
|
396 |
|
|
VERIFY(max_abs_frac < Tp(2.5000000000000013e-09));
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
// Test data for nu=10.000000000000000.
|
400 |
|
|
testcase_cyl_neumann<double> data008[] = {
|
401 |
|
|
{ -25.129110095610098, 10.000000000000000, 5.0000000000000000 },
|
402 |
|
|
{ -0.35981415218340279, 10.000000000000000, 10.000000000000000 },
|
403 |
|
|
{ 0.21997141360195582, 10.000000000000000, 15.000000000000000 },
|
404 |
|
|
{ -0.043894653515658202, 10.000000000000000, 20.000000000000000 },
|
405 |
|
|
{ -0.14871839049980651, 10.000000000000000, 25.000000000000000 },
|
406 |
|
|
{ 0.075056702122397012, 10.000000000000000, 30.000000000000000 },
|
407 |
|
|
{ 0.12222473135000553, 10.000000000000000, 35.000000000000000 },
|
408 |
|
|
{ -0.046723877232677867, 10.000000000000000, 40.000000000000000 },
|
409 |
|
|
{ -0.11739339009322178, 10.000000000000000, 45.000000000000000 },
|
410 |
|
|
{ 0.0057238971820535740, 10.000000000000000, 50.000000000000000 },
|
411 |
|
|
{ 0.10733910125831635, 10.000000000000000, 55.000000000000000 },
|
412 |
|
|
{ 0.036290350559545506, 10.000000000000000, 60.000000000000000 },
|
413 |
|
|
{ -0.083239127691715639, 10.000000000000000, 65.000000000000000 },
|
414 |
|
|
{ -0.069639384138314872, 10.000000000000000, 70.000000000000000 },
|
415 |
|
|
{ 0.045798335061325038, 10.000000000000000, 75.000000000000000 },
|
416 |
|
|
{ 0.086269195064844428, 10.000000000000000, 80.000000000000000 },
|
417 |
|
|
{ -0.0018234674126248629, 10.000000000000000, 85.000000000000000 },
|
418 |
|
|
{ -0.082067762371231298, 10.000000000000000, 90.000000000000000 },
|
419 |
|
|
{ -0.038798074754578075, 10.000000000000000, 95.000000000000000 },
|
420 |
|
|
{ 0.058331574236414815, 10.000000000000000, 100.00000000000000 },
|
421 |
|
|
};
|
422 |
|
|
|
423 |
|
|
// Test function for nu=10.000000000000000.
|
424 |
|
|
template <typename Tp>
|
425 |
|
|
void test008()
|
426 |
|
|
{
|
427 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
428 |
|
|
Tp max_abs_diff = -Tp(1);
|
429 |
|
|
Tp max_abs_frac = -Tp(1);
|
430 |
|
|
unsigned int num_datum = sizeof(data008)
|
431 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
432 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
433 |
|
|
{
|
434 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data008[i].nu), Tp(data008[i].x));
|
435 |
|
|
const Tp f0 = data008[i].f0;
|
436 |
|
|
const Tp diff = f - f0;
|
437 |
|
|
if (std::abs(diff) > max_abs_diff)
|
438 |
|
|
max_abs_diff = std::abs(diff);
|
439 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
440 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
441 |
|
|
{
|
442 |
|
|
const Tp frac = diff / f0;
|
443 |
|
|
if (std::abs(frac) > max_abs_frac)
|
444 |
|
|
max_abs_frac = std::abs(frac);
|
445 |
|
|
}
|
446 |
|
|
}
|
447 |
|
|
VERIFY(max_abs_frac < Tp(2.5000000000000017e-10));
|
448 |
|
|
}
|
449 |
|
|
|
450 |
|
|
// Test data for nu=20.000000000000000.
|
451 |
|
|
testcase_cyl_neumann<double> data009[] = {
|
452 |
|
|
{ -593396529.69143212, 20.000000000000000, 5.0000000000000000 },
|
453 |
|
|
{ -1597.4838482696264, 20.000000000000000, 10.000000000000000 },
|
454 |
|
|
{ -3.3087330924737630, 20.000000000000000, 15.000000000000000 },
|
455 |
|
|
{ -0.28548945860020319, 20.000000000000000, 20.000000000000000 },
|
456 |
|
|
{ 0.19804074776289243, 20.000000000000000, 25.000000000000000 },
|
457 |
|
|
{ -0.16848153948742675, 20.000000000000000, 30.000000000000000 },
|
458 |
|
|
{ 0.10102784152594022, 20.000000000000000, 35.000000000000000 },
|
459 |
|
|
{ 0.045161820565805928, 20.000000000000000, 40.000000000000000 },
|
460 |
|
|
{ -0.12556489308015448, 20.000000000000000, 45.000000000000000 },
|
461 |
|
|
{ 0.016442633948115841, 20.000000000000000, 50.000000000000000 },
|
462 |
|
|
{ 0.10853448778255187, 20.000000000000000, 55.000000000000000 },
|
463 |
|
|
{ -0.026721408520664677, 20.000000000000000, 60.000000000000000 },
|
464 |
|
|
{ -0.098780425256324203, 20.000000000000000, 65.000000000000000 },
|
465 |
|
|
{ 0.016201957786018205, 20.000000000000000, 70.000000000000000 },
|
466 |
|
|
{ 0.093591198265063735, 20.000000000000000, 75.000000000000000 },
|
467 |
|
|
{ 0.0040484400737295740, 20.000000000000000, 80.000000000000000 },
|
468 |
|
|
{ -0.086314929459920503, 20.000000000000000, 85.000000000000000 },
|
469 |
|
|
{ -0.028274110097231495, 20.000000000000000, 90.000000000000000 },
|
470 |
|
|
{ 0.072349520791638755, 20.000000000000000, 95.000000000000000 },
|
471 |
|
|
{ 0.051247973076188565, 20.000000000000000, 100.00000000000000 },
|
472 |
|
|
};
|
473 |
|
|
|
474 |
|
|
// Test function for nu=20.000000000000000.
|
475 |
|
|
template <typename Tp>
|
476 |
|
|
void test009()
|
477 |
|
|
{
|
478 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
479 |
|
|
Tp max_abs_diff = -Tp(1);
|
480 |
|
|
Tp max_abs_frac = -Tp(1);
|
481 |
|
|
unsigned int num_datum = sizeof(data009)
|
482 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
483 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
484 |
|
|
{
|
485 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data009[i].nu), Tp(data009[i].x));
|
486 |
|
|
const Tp f0 = data009[i].f0;
|
487 |
|
|
const Tp diff = f - f0;
|
488 |
|
|
if (std::abs(diff) > max_abs_diff)
|
489 |
|
|
max_abs_diff = std::abs(diff);
|
490 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
491 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
492 |
|
|
{
|
493 |
|
|
const Tp frac = diff / f0;
|
494 |
|
|
if (std::abs(frac) > max_abs_frac)
|
495 |
|
|
max_abs_frac = std::abs(frac);
|
496 |
|
|
}
|
497 |
|
|
}
|
498 |
|
|
VERIFY(max_abs_frac < Tp(1.0000000000000006e-10));
|
499 |
|
|
}
|
500 |
|
|
|
501 |
|
|
// Test data for nu=50.000000000000000.
|
502 |
|
|
testcase_cyl_neumann<double> data010[] = {
|
503 |
|
|
{ -2.7888370175838943e+42, 50.000000000000000, 5.0000000000000000 },
|
504 |
|
|
{ -3.6410665018007421e+27, 50.000000000000000, 10.000000000000000 },
|
505 |
|
|
{ -1.0929732912175405e+19, 50.000000000000000, 15.000000000000000 },
|
506 |
|
|
{ -15606426801663.732, 50.000000000000000, 20.000000000000000 },
|
507 |
|
|
{ -753573251.44662631, 50.000000000000000, 25.000000000000000 },
|
508 |
|
|
{ -386759.32602734747, 50.000000000000000, 30.000000000000000 },
|
509 |
|
|
{ -1172.8690492895341, 50.000000000000000, 35.000000000000000 },
|
510 |
|
|
{ -15.615608873419953, 50.000000000000000, 40.000000000000000 },
|
511 |
|
|
{ -0.87058346204176951, 50.000000000000000, 45.000000000000000 },
|
512 |
|
|
{ -0.21031655464397736, 50.000000000000000, 50.000000000000000 },
|
513 |
|
|
{ 0.093048240412999375, 50.000000000000000, 55.000000000000000 },
|
514 |
|
|
{ 0.0086417699626745066, 50.000000000000000, 60.000000000000000 },
|
515 |
|
|
{ -0.025019788459221974, 50.000000000000000, 65.000000000000000 },
|
516 |
|
|
{ -0.0014815155191908913, 50.000000000000000, 70.000000000000000 },
|
517 |
|
|
{ 0.050335774732164155, 50.000000000000000, 75.000000000000000 },
|
518 |
|
|
{ -0.092924250967987204, 50.000000000000000, 80.000000000000000 },
|
519 |
|
|
{ 0.087332463030205670, 50.000000000000000, 85.000000000000000 },
|
520 |
|
|
{ -0.016164237701651891, 50.000000000000000, 90.000000000000000 },
|
521 |
|
|
{ -0.068897613820457920, 50.000000000000000, 95.000000000000000 },
|
522 |
|
|
{ 0.076505263944802962, 50.000000000000000, 100.00000000000000 },
|
523 |
|
|
};
|
524 |
|
|
|
525 |
|
|
// Test function for nu=50.000000000000000.
|
526 |
|
|
template <typename Tp>
|
527 |
|
|
void test010()
|
528 |
|
|
{
|
529 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
530 |
|
|
Tp max_abs_diff = -Tp(1);
|
531 |
|
|
Tp max_abs_frac = -Tp(1);
|
532 |
|
|
unsigned int num_datum = sizeof(data010)
|
533 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
534 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
535 |
|
|
{
|
536 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data010[i].nu), Tp(data010[i].x));
|
537 |
|
|
const Tp f0 = data010[i].f0;
|
538 |
|
|
const Tp diff = f - f0;
|
539 |
|
|
if (std::abs(diff) > max_abs_diff)
|
540 |
|
|
max_abs_diff = std::abs(diff);
|
541 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
542 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
543 |
|
|
{
|
544 |
|
|
const Tp frac = diff / f0;
|
545 |
|
|
if (std::abs(frac) > max_abs_frac)
|
546 |
|
|
max_abs_frac = std::abs(frac);
|
547 |
|
|
}
|
548 |
|
|
}
|
549 |
|
|
VERIFY(max_abs_frac < Tp(2.5000000000000017e-10));
|
550 |
|
|
}
|
551 |
|
|
|
552 |
|
|
// Test data for nu=100.00000000000000.
|
553 |
|
|
testcase_cyl_neumann<double> data011[] = {
|
554 |
|
|
{ -5.0848639160196196e+115, 100.00000000000000, 5.0000000000000000 },
|
555 |
|
|
{ -4.8491482711800245e+85, 100.00000000000000, 10.000000000000000 },
|
556 |
|
|
{ -1.6375955323195320e+68, 100.00000000000000, 15.000000000000000 },
|
557 |
|
|
{ -8.2002648144679137e+55, 100.00000000000000, 20.000000000000000 },
|
558 |
|
|
{ -2.9712216432562373e+46, 100.00000000000000, 25.000000000000000 },
|
559 |
|
|
{ -7.2875284708240766e+38, 100.00000000000000, 30.000000000000000 },
|
560 |
|
|
{ -3.4251079902108953e+32, 100.00000000000000, 35.000000000000000 },
|
561 |
|
|
{ -1.4552439438101799e+27, 100.00000000000000, 40.000000000000000 },
|
562 |
|
|
{ -3.4506612476220073e+22, 100.00000000000000, 45.000000000000000 },
|
563 |
|
|
{ -3.2938001882025948e+18, 100.00000000000000, 50.000000000000000 },
|
564 |
|
|
{ -1005686182055527.4, 100.00000000000000, 55.000000000000000 },
|
565 |
|
|
{ -831892881402.11377, 100.00000000000000, 60.000000000000000 },
|
566 |
|
|
{ -1650863778.0598330, 100.00000000000000, 65.000000000000000 },
|
567 |
|
|
{ -7192614.1976097804, 100.00000000000000, 70.000000000000000 },
|
568 |
|
|
{ -64639.072261231602, 100.00000000000000, 75.000000000000000 },
|
569 |
|
|
{ -1152.5905185698464, 100.00000000000000, 80.000000000000000 },
|
570 |
|
|
{ -40.250761402102000, 100.00000000000000, 85.000000000000000 },
|
571 |
|
|
{ -2.8307771387185459, 100.00000000000000, 90.000000000000000 },
|
572 |
|
|
{ -0.45762200495904559, 100.00000000000000, 95.000000000000000 },
|
573 |
|
|
{ -0.16692141141757649, 100.00000000000000, 100.00000000000000 },
|
574 |
|
|
};
|
575 |
|
|
|
576 |
|
|
// Test function for nu=100.00000000000000.
|
577 |
|
|
template <typename Tp>
|
578 |
|
|
void test011()
|
579 |
|
|
{
|
580 |
|
|
const Tp eps = std::numeric_limits<Tp>::epsilon();
|
581 |
|
|
Tp max_abs_diff = -Tp(1);
|
582 |
|
|
Tp max_abs_frac = -Tp(1);
|
583 |
|
|
unsigned int num_datum = sizeof(data011)
|
584 |
|
|
/ sizeof(testcase_cyl_neumann<double>);
|
585 |
|
|
for (unsigned int i = 0; i < num_datum; ++i)
|
586 |
|
|
{
|
587 |
|
|
const Tp f = std::tr1::cyl_neumann(Tp(data011[i].nu), Tp(data011[i].x));
|
588 |
|
|
const Tp f0 = data011[i].f0;
|
589 |
|
|
const Tp diff = f - f0;
|
590 |
|
|
if (std::abs(diff) > max_abs_diff)
|
591 |
|
|
max_abs_diff = std::abs(diff);
|
592 |
|
|
if (std::abs(f0) > Tp(10) * eps
|
593 |
|
|
&& std::abs(f) > Tp(10) * eps)
|
594 |
|
|
{
|
595 |
|
|
const Tp frac = diff / f0;
|
596 |
|
|
if (std::abs(frac) > max_abs_frac)
|
597 |
|
|
max_abs_frac = std::abs(frac);
|
598 |
|
|
}
|
599 |
|
|
}
|
600 |
|
|
VERIFY(max_abs_frac < Tp(1.0000000000000006e-11));
|
601 |
|
|
}
|
602 |
|
|
|
603 |
|
|
int main(int, char**)
|
604 |
|
|
{
|
605 |
|
|
test001<double>();
|
606 |
|
|
test002<double>();
|
607 |
|
|
test003<double>();
|
608 |
|
|
test004<double>();
|
609 |
|
|
test005<double>();
|
610 |
|
|
test006<double>();
|
611 |
|
|
test007<double>();
|
612 |
|
|
test008<double>();
|
613 |
|
|
test009<double>();
|
614 |
|
|
test010<double>();
|
615 |
|
|
test011<double>();
|
616 |
|
|
return 0;
|
617 |
|
|
}
|