double
LSingularityFunction::value(const Point<2> &p, const unsigned int) const
{
- double x = p(0);
- double y = p(1);
+ const double x = p(0);
+ const double y = p(1);
if ((x >= 0) && (y >= 0))
return 0.;
- double phi = std::atan2(y, -x) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(y, -x) + numbers::PI;
+ const double r_squared = x * x + y * y;
- return std::pow(r2, 1. / 3.) * std::sin(2. / 3. * phi);
+ return std::pow(r_squared, 1. / 3.) * std::sin(2. / 3. * phi);
}
+
void
LSingularityFunction::value_list(const std::vector<Point<2>> &points,
std::vector<double> & values,
for (unsigned int i = 0; i < points.size(); ++i)
{
- double x = points[i](0);
- double y = points[i](1);
+ const double x = points[i](0);
+ const double y = points[i](1);
if ((x >= 0) && (y >= 0))
values[i] = 0.;
else
{
- double phi = std::atan2(y, -x) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(y, -x) + numbers::PI;
+ const double r_squared = x * x + y * y;
- values[i] = std::pow(r2, 1. / 3.) * std::sin(2. / 3. * phi);
+ values[i] = std::pow(r_squared, 1. / 3.) * std::sin(2. / 3. * phi);
}
}
}
+
void
LSingularityFunction::vector_value_list(
const std::vector<Point<2>> &points,
{
Assert(values[i].size() == 1,
ExcDimensionMismatch(values[i].size(), 1));
- double x = points[i](0);
- double y = points[i](1);
+ const double x = points[i](0);
+ const double y = points[i](1);
if ((x >= 0) && (y >= 0))
values[i](0) = 0.;
else
{
- double phi = std::atan2(y, -x) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(y, -x) + numbers::PI;
+ const double r_squared = x * x + y * y;
- values[i](0) = std::pow(r2, 1. / 3.) * std::sin(2. / 3. * phi);
+ values[i](0) =
+ std::pow(r_squared, 1. / 3.) * std::sin(2. / 3. * phi);
}
}
}
+
double
LSingularityFunction::laplacian(const Point<2> &, const unsigned int) const
{
+ // Not a bug but exactly how the function is defined:
return 0.;
}
+
void
LSingularityFunction::laplacian_list(const std::vector<Point<2>> &points,
std::vector<double> & values,
}
+
Tensor<1, 2>
LSingularityFunction::gradient(const Point<2> &p, const unsigned int) const
{
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(y, -x) + numbers::PI;
- double r43 = std::pow(x * x + y * y, 2. / 3.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(y, -x) + numbers::PI;
+ const double r43 = std::pow(x * x + y * y, 2. / 3.);
Tensor<1, 2> result;
result[0] = 2. / 3. *
}
+
void
LSingularityFunction::gradient_list(const std::vector<Point<2>> &points,
std::vector<Tensor<1, 2>> & gradients,
for (unsigned int i = 0; i < points.size(); ++i)
{
const Point<2> &p = points[i];
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(y, -x) + numbers::PI;
- double r43 = std::pow(x * x + y * y, 2. / 3.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(y, -x) + numbers::PI;
+ const double r43 = std::pow(x * x + y * y, 2. / 3.);
gradients[i][0] =
2. / 3. *
}
+
void
LSingularityFunction::vector_gradient_list(
const std::vector<Point<2>> & points,
Assert(gradients[i].size() == 1,
ExcDimensionMismatch(gradients[i].size(), 1));
const Point<2> &p = points[i];
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(y, -x) + numbers::PI;
- double r43 = std::pow(x * x + y * y, 2. / 3.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(y, -x) + numbers::PI;
+ const double r43 = std::pow(x * x + y * y, 2. / 3.);
gradients[i][0][0] =
2. / 3. *
{}
+
double
LSingularityGradFunction::value(const Point<2> &p, const unsigned int d) const
{
SlitSingularityFunction<dim>::value(const Point<dim> &p,
const unsigned int) const
{
- double x = p(0);
- double y = p(1);
+ const double x = p(0);
+ const double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r_squared = x * x + y * y;
- return std::pow(r2, .25) * std::sin(.5 * phi);
+ return std::pow(r_squared, .25) * std::sin(.5 * phi);
}
for (unsigned int i = 0; i < points.size(); ++i)
{
- double x = points[i](0);
- double y = points[i](1);
+ const double x = points[i](0);
+ const double y = points[i](1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r_squared = x * x + y * y;
- values[i] = std::pow(r2, .25) * std::sin(.5 * phi);
+ values[i] = std::pow(r_squared, .25) * std::sin(.5 * phi);
}
}
Assert(values[i].size() == 1,
ExcDimensionMismatch(values[i].size(), 1));
- double x = points[i](0);
- double y = points[i](1);
+ const double x = points[i](0);
+ const double y = points[i](1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r_squared = x * x + y * y;
- values[i](0) = std::pow(r2, .25) * std::sin(.5 * phi);
+ values[i](0) = std::pow(r_squared, .25) * std::sin(.5 * phi);
}
}
SlitSingularityFunction<dim>::gradient(const Point<dim> &p,
const unsigned int) const
{
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r64 = std::pow(x * x + y * y, 3. / 4.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r64 = std::pow(x * x + y * y, 3. / 4.);
Tensor<1, dim> result;
result[0] = 1. / 2. *
for (unsigned int i = 0; i < points.size(); ++i)
{
const Point<dim> &p = points[i];
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r64 = std::pow(x * x + y * y, 3. / 4.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r64 = std::pow(x * x + y * y, 3. / 4.);
gradients[i][0] =
1. / 2. *
ExcDimensionMismatch(gradients[i].size(), 1));
const Point<dim> &p = points[i];
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r64 = std::pow(x * x + y * y, 3. / 4.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r64 = std::pow(x * x + y * y, 3. / 4.);
gradients[i][0][0] =
1. / 2. *
SlitHyperSingularityFunction::value(const Point<2> &p,
const unsigned int) const
{
- double x = p(0);
- double y = p(1);
+ const double x = p(0);
+ const double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r_squared = x * x + y * y;
- return std::pow(r2, .125) * std::sin(.25 * phi);
+ return std::pow(r_squared, .125) * std::sin(.25 * phi);
}
for (unsigned int i = 0; i < points.size(); ++i)
{
- double x = points[i](0);
- double y = points[i](1);
+ const double x = points[i](0);
+ const double y = points[i](1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r_squared = x * x + y * y;
- values[i] = std::pow(r2, .125) * std::sin(.25 * phi);
+ values[i] = std::pow(r_squared, .125) * std::sin(.25 * phi);
}
}
Assert(values[i].size() == 1,
ExcDimensionMismatch(values[i].size(), 1));
- double x = points[i](0);
- double y = points[i](1);
+ const double x = points[i](0);
+ const double y = points[i](1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r2 = x * x + y * y;
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r_squared = x * x + y * y;
- values[i](0) = std::pow(r2, .125) * std::sin(.25 * phi);
+ values[i](0) = std::pow(r_squared, .125) * std::sin(.25 * phi);
}
}
SlitHyperSingularityFunction::gradient(const Point<2> &p,
const unsigned int) const
{
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r78 = std::pow(x * x + y * y, 7. / 8.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r78 = std::pow(x * x + y * y, 7. / 8.);
Tensor<1, 2> result;
for (unsigned int i = 0; i < points.size(); ++i)
{
const Point<2> &p = points[i];
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r78 = std::pow(x * x + y * y, 7. / 8.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r78 = std::pow(x * x + y * y, 7. / 8.);
gradients[i][0] =
1. / 4. *
ExcDimensionMismatch(gradients[i].size(), 1));
const Point<2> &p = points[i];
- double x = p(0);
- double y = p(1);
- double phi = std::atan2(x, y) + numbers::PI;
- double r78 = std::pow(x * x + y * y, 7. / 8.);
+ const double x = p(0);
+ const double y = p(1);
+ const double phi = std::atan2(x, y) + numbers::PI;
+ const double r78 = std::pow(x * x + y * y, 7. / 8.);
gradients[i][0][0] =
1. / 4. *
double
JumpFunction<dim>::value(const Point<dim> &p, const unsigned int) const
{
- double x = steepness * (-cosine * p(0) + sine * p(1));
+ const double x = steepness * (-cosine * p(0) + sine * p(1));
return -std::atan(x);
}
for (unsigned int i = 0; i < p.size(); ++i)
{
- double x = steepness * (-cosine * p[i](0) + sine * p[i](1));
- values[i] = -std::atan(x);
+ const double x = steepness * (-cosine * p[i](0) + sine * p[i](1));
+ values[i] = -std::atan(x);
}
}
double
JumpFunction<dim>::laplacian(const Point<dim> &p, const unsigned int) const
{
- double x = steepness * (-cosine * p(0) + sine * p(1));
- double r = 1 + x * x;
+ const double x = steepness * (-cosine * p(0) + sine * p(1));
+ const double r = 1 + x * x;
return 2 * steepness * steepness * x / (r * r);
}
for (unsigned int i = 0; i < p.size(); ++i)
{
- double x = steepness * (-cosine * p[i](0) + sine * p[i](1));
- double r = 1 + x * x;
- values[i] = f * x / (r * r);
+ const double x = steepness * (-cosine * p[i](0) + sine * p[i](1));
+ const double r = 1 + x * x;
+ values[i] = f * x / (r * r);
}
}
Tensor<1, dim>
JumpFunction<dim>::gradient(const Point<dim> &p, const unsigned int) const
{
- double x = steepness * (-cosine * p(0) + sine * p(1));
- double r = -steepness * (1 + x * x);
+ const double x = steepness * (-cosine * p(0) + sine * p(1));
+ const double r = -steepness * (1 + x * x);
Tensor<1, dim> erg;
erg[0] = cosine * r;
erg[1] = sine * r;
for (unsigned int i = 0; i < p.size(); ++i)
{
- double x = steepness * (cosine * p[i](0) + sine * p[i](1));
- double r = -steepness * (1 + x * x);
+ const double x = steepness * (cosine * p[i](0) + sine * p[i](1));
+ const double r = -steepness * (1 + x * x);
gradients[i][0] = cosine * r;
gradients[i][1] = sine * r;
}