16 #include <deal.II/base/function_lib.h>
17 #include <deal.II/base/point.h>
18 #include <deal.II/base/tensor.h>
20 #include <deal.II/lac/vector.h>
24 DEAL_II_NAMESPACE_OPEN
33 const unsigned int n_components,
34 const unsigned int select,
35 const bool integrate_to_one,
36 const double unitary_integral_value)
41 , integrate_to_one(integrate_to_one)
42 , unitary_integral_value(unitary_integral_value)
43 , rescaling(integrate_to_one ? 1. / (unitary_integral_value *
95 1. / (unitary_integral_value * Utilities::fixed_power<dim>(radius));
115 return integrate_to_one;
125 const unsigned int select,
126 const bool integrate_to_one)
142 for (
unsigned int i = 0; i < dim; ++i)
143 base[i]->set_center(
Point<1>(p[i]));
154 for (
unsigned int i = 0; i < dim; ++i)
155 base[i]->set_radius(r);
164 const unsigned int component)
const
168 for (
unsigned int i = 0; i < dim; ++i)
169 ret *= base[i]->value(
Point<1>(p[i]), component);
178 const unsigned int component)
const
182 for (
unsigned int i = 0; i < dim; ++i)
183 ret[i] = base[i]->gradient(
Point<1>(p[i]), component)[0];
194 const double integral_Linfty[] = {2.0,
195 3.14159265358979323846264338328,
196 4.18879020478639098461685784437};
200 const double integral_W1[] = {1.0,
201 1.04719755119659774615421446109,
202 1.04719755119659774615421446109};
206 const double integral_Cinfty[] = {1.20690032243787617533623799633,
207 1.26811216112759608094632335664,
208 1.1990039070192139033798473858};
212 const double integral_C1[] = {1.0,
213 0.93417655442731527615578663815,
214 0.821155557658032806157358815206};
222 const unsigned int n_components,
223 const unsigned int select,
224 const bool integrate_to_one)
230 integral_Linfty[dim - 1])
237 const unsigned int component)
const
240 component == this->selected)
241 return ((this->center.
distance(p) < this->radius) ? this->rescaling : 0.);
249 std::vector<double> & values,
250 const unsigned int component)
const
252 Assert(values.size() == points.size(),
254 Assert(component < this->n_components,
259 component == this->selected)
260 for (
unsigned int k = 0; k < values.size(); ++k)
261 values[k] = (this->center.
distance(points[k]) < this->radius) ?
265 std::fill(values.begin(), values.end(), 0.);
275 Assert(values.size() == points.size(),
278 for (
unsigned int k = 0; k < values.size(); ++k)
280 const double val = (this->center.
distance(points[k]) < this->radius) ?
288 values[k](this->selected) = val;
296 const unsigned int n_components,
297 const unsigned int select,
298 const bool integrate_to_one)
304 integral_W1[dim - 1])
311 const unsigned int component)
const
314 component == this->selected)
316 const double d = this->center.
distance(p);
317 return ((d < this->radius) ?
318 (this->radius - d) / this->radius * this->rescaling :
328 std::vector<double> & values,
329 const unsigned int component)
const
331 Assert(values.size() == points.size(),
335 component == this->selected)
336 for (
unsigned int i = 0; i < values.size(); ++i)
338 const double d = this->center.
distance(points[i]);
339 values[i] = ((d < this->radius) ?
340 (this->radius - d) / this->radius * this->rescaling :
344 std::fill(values.begin(), values.end(), 0.);
355 Assert(values.size() == points.size(),
358 for (
unsigned int k = 0; k < values.size(); ++k)
360 const double d = this->center.
distance(points[k]);
363 (this->radius - d) / this->radius * this->rescaling :
370 values[k](this->selected) = val;
380 const unsigned int n_components,
381 const unsigned int select,
382 bool integrate_to_one)
388 integral_Cinfty[dim - 1])
395 const unsigned int component)
const
398 component == this->selected)
400 const double d = this->center.
distance(p);
401 const double r = this->radius;
404 const double e = -r * r / (r * r - d * d);
405 return ((e < -50) ? 0. :
numbers::E * std::exp(e) * this->rescaling);
414 std::vector<double> & values,
415 const unsigned int component)
const
417 Assert(values.size() == points.size(),
420 const double r = this->radius;
423 component == this->selected)
424 for (
unsigned int i = 0; i < values.size(); ++i)
426 const double d = this->center.
distance(points[i]);
433 const double e = -r * r / (r * r - d * d);
435 (e < -50) ? 0. :
numbers::E * std::exp(e) * this->rescaling;
439 std::fill(values.begin(), values.end(), 0.);
449 Assert(values.size() == points.size(),
452 for (
unsigned int k = 0; k < values.size(); ++k)
454 const double d = this->center.
distance(points[k]);
455 const double r = this->radius;
457 if (d < this->radius)
459 const double e = -r * r / (r * r - d * d);
461 val =
numbers::E * std::exp(e) * this->rescaling;
469 values[k](this->selected) = val;
479 const unsigned int)
const
481 const double d = this->center.
distance(p);
482 const double r = this->radius;
485 const double e = -d * d / (r - d) / (r + d);
487 (p - this->center) / d *
488 (-2.0 * r * r / std::pow(-r * r + d * d, 2.0) * d *
498 const unsigned int n_components,
499 const unsigned int select,
500 bool integrate_to_one)
506 integral_C1[dim - 1])
513 const unsigned int component)
const
516 component == this->selected)
518 const double d = this->center.
distance(p);
519 const double r = this->radius;
522 return .5 * (std::cos(
numbers::PI * d / r) + 1) * this->rescaling;
531 std::vector<double> & values,
532 const unsigned int component)
const
534 Assert(values.size() == points.size(),
537 const double r = this->radius;
540 component == this->selected)
541 for (
unsigned int i = 0; i < values.size(); ++i)
543 const double d = this->center.
distance(points[i]);
551 .5 * (std::cos(
numbers::PI * d / r) + 1) * this->rescaling;
555 std::fill(values.begin(), values.end(), 0.);
565 Assert(values.size() == points.size(),
568 for (
unsigned int k = 0; k < values.size(); ++k)
570 const double d = this->center.
distance(points[k]);
571 const double r = this->radius;
573 if (d < this->radius)
575 val = .5 * (std::cos(
numbers::PI * d / r) + 1) * this->rescaling;
583 values[k](this->selected) = val;
594 const double d = this->center.
distance(p);
595 const double r = this->radius;
599 (p - this->center) / d * this->rescaling;
629 DEAL_II_NAMESPACE_CLOSE