These are deprecated and in several cases we have better choices anyway.
{
auto &min = boundary_points.first;
auto &max = boundary_points.second;
- std::fill(min.begin_raw(),
- min.end_raw(),
- std::numeric_limits<Number>::infinity());
- std::fill(max.begin_raw(),
- max.end_raw(),
- -std::numeric_limits<Number>::infinity());
+ for (unsigned int d = 0; d < spacedim; ++d)
+ {
+ min[d] = std::numeric_limits<Number>::infinity();
+ max[d] = -std::numeric_limits<Number>::infinity();
+ }
for (const Point<spacedim, Number> &point : points)
for (unsigned int d = 0; d < spacedim; ++d)
unsigned int
QGaussOneOverR<2>::quad_size(const Point<2> &singularity, const unsigned int n)
{
- const double eps = 1e-8;
- const bool on_edge =
- std::any_of(singularity.begin_raw(),
- singularity.end_raw(),
- [eps](double coord) {
- return std::abs(coord) < eps || std::abs(coord - 1.) < eps;
- });
+ const double eps = 1e-8;
+ bool on_edge = false;
+ for (unsigned int d = 0; d < 2; ++d)
+ on_edge = on_edge || (std::abs(singularity[d]) < eps ||
+ std::abs(singularity[d] - 1.0) < eps);
const bool on_vertex =
on_edge &&
std::abs((singularity - Point<2>(.5, .5)).norm_square() - .5) < eps;
const double volume = (dim == 2 ? 1.0 / 2.0 : 1.0 / 6.0);
this->weights.emplace_back(volume * b_weights[permutation_n]);
Point<dim> c_point;
- std::copy(b_point.begin(),
- b_point.begin() + dim,
- c_point.begin_raw());
+ for (int d = 0; d < dim; ++d)
+ c_point[d] = b_point[d];
this->quadrature_points.emplace_back(c_point);
}
}
//
// ---------------------------------------------------------------------
+#include <deal.II/base/array_view.h>
#include <deal.II/base/tensor.h>
#include <deal.II/lac/exceptions.h>
const types::blas_int lwork = 5 * dim;
std::array<Number, lwork> work;
types::blas_int info;
+ constexpr std::size_t size =
+ Tensor<2, dim, Number>::n_independent_components;
+ std::array<Number, size> A_array;
+ A_in_VT_out.unroll(A_array.begin(), A_array.end());
+ std::array<Number, size> U_array;
+ U.unroll(U_array.begin(), U_array.end());
gesvd(&LAPACKSupport::O, // replace VT in place
&LAPACKSupport::A,
&N,
&N,
- A_in_VT_out.begin_raw(),
+ A_array.data(),
&N,
S.data(),
- A_in_VT_out.begin_raw(),
+ A_array.data(),
&N,
- U.begin_raw(),
+ U_array.data(),
&N,
work.data(),
&lwork,
&info);
Assert(info == 0, LAPACKSupport::ExcErrorCode("gesvd", info));
Assert(S.back() / S.front() > 1.e-10, LACExceptions::ExcSingular());
+
+ A_in_VT_out =
+ Tensor<2, dim, Number>(make_array_view(A_array.begin(), A_array.end()));
+ U = Tensor<2, dim, Number>(make_array_view(U_array.begin(), U_array.end()));
}
} // namespace
// centroid and only the centroid
if (degree == 0)
{
- Point<dim> centroid;
- std::fill(centroid.begin_raw(),
- centroid.end_raw(),
- 1.0 / double(dim + 1));
- unit_points.emplace_back(centroid);
+ unit_points.emplace_back(
+ ReferenceCells::get_simplex<dim>().template barycenter<dim>());
return unit_points;
}
FE_SimplexP<dim> fe_p(degree);
std::vector<Point<dim>> points = fe_p.get_unit_support_points();
- Point<dim> centroid;
- std::fill(centroid.begin_raw(), centroid.end_raw(), 1.0 / double(dim + 1));
+ const Point<dim> centroid =
+ fe_p.reference_cell().template barycenter<dim>();
switch (dim)
{
BarycentricPolynomials<dim>
get_basis(const unsigned int degree)
{
- Point<dim> centroid;
- std::fill(centroid.begin_raw(), centroid.end_raw(), 1.0 / double(dim + 1));
+ const Point<dim> centroid =
+ ReferenceCells::get_simplex<dim>().template barycenter<dim>();
auto M = [](const unsigned int d) {
return BarycentricPolynomial<dim, double>::monomial(d);
pack_values(std::vector<double> &values) const final
{
AssertDimension(values.size(), number_of_values());
- std::copy(pt.begin_raw(), pt.end_raw(), values.begin());
+ for (unsigned int d = 0; d < 2; ++d)
+ values[d] = pt[d];
}
virtual void
unpack_values(const std::vector<double> &values) final
{
AssertDimension(values.size(), number_of_values());
- std::copy(values.cbegin(), values.cend(), pt.begin_raw());
+ for (unsigned int d = 0; d < 2; ++d)
+ pt[d] = values[d];
}
};
using Tensor_t = Tensor<rank, dim, double>;
Tensor_t t_a, t_b;
- for (auto it = t_a.begin_raw(); it != t_a.end_raw(); ++it)
- *it = 1.0;
- for (auto it = t_b.begin_raw(); it != t_b.end_raw(); ++it)
- *it = 2.0;
+ for (unsigned int i = 0; i < Tensor_t::n_independent_components; ++i)
+ {
+ const auto index = t_a.unrolled_to_component_index(i);
+ t_a[index] = 1.0;
+ t_b[index] = 2.0;
+ }
const Tensor_SD_number_t symb_t_a =
SD::make_tensor_of_symbols<rank, dim>("a");
using Tensor_t = SymmetricTensor<rank, dim, double>;
Tensor_t t_a, t_b;
- for (auto it = t_a.begin_raw(); it != t_a.end_raw(); ++it)
- *it = 1.0;
- for (auto it = t_b.begin_raw(); it != t_b.end_raw(); ++it)
- *it = 2.0;
+ for (unsigned int i = 0; i < Tensor_t::n_independent_components; ++i)
+ {
+ const auto index = t_a.unrolled_to_component_index(i);
+ t_a[index] = 1.0;
+ t_b[index] = 2.0;
+ }
+
const Tensor_SD_number_t symb_t_a =
SD::make_symmetric_tensor_of_symbols<rank, dim>("a");