107 template <
class InputVector,
int spacedim>
111 const unsigned int component);
137 template <
class InputVector,
int spacedim>
142 const unsigned int component)
144 if (fe_values.get_fe().n_components() == 1)
146 std::vector<typename InputVector::value_type> values(1);
147 fe_values.get_function_values(solution, values);
152 std::vector<Vector<typename InputVector::value_type>> values(
155 fe_values.get_fe().n_components()));
156 fe_values.get_function_values(solution, values);
157 return values[0](component);
168 for (
unsigned int i = 0; i < dim; ++i)
218 template <
class InputVector,
int spacedim>
222 const unsigned int component);
252 template <
class InputVector,
int spacedim>
257 const unsigned int component)
259 if (fe_values.get_fe().n_components() == 1)
261 std::vector<Tensor<1, dim, typename InputVector::value_type>> values(
263 fe_values.get_function_gradients(solution, values);
269 std::vector<Tensor<1, dim, typename InputVector::value_type>>>
273 fe_values.get_fe().n_components()));
274 fe_values.get_function_gradients(solution, values);
285 return std::fabs(d[0][0]);
303 ::sqr(d[0][0] - d[1][1]) + 4 *
::sqr(d[0][1]);
426 const double am =
trace(d) / 3.;
430 for (
unsigned int i = 0; i < 3; ++i)
433 const double ss01 = s[0][1] * s[0][1],
ss12 = s[1][2] * s[1][2],
434 ss02 = s[0][2] * s[0][2];
436 const double J2 = (s[0][0] * s[0][0] + s[1][1] * s[1][1] +
440 (Utilities::fixed_power<3>(s[0][0]) +
441 Utilities::fixed_power<3>(s[1][1]) +
442 Utilities::fixed_power<3>(s[2][2]) + 3. * s[0][0] * (
ss01 +
ss02) +
444 6. * s[0][1] * s[0][2] * s[1][2]) /
449 double EE[3] = {0, 0, 0};
456 if (R <= 1e-14 * std::fabs(
am))
462 const double R3 = R * R * R;
463 const double XX = 4. *
J3 /
R3;
464 const double YY = 1. - std::fabs(
XX);
471 const double a = (
XX > 0 ? -1. : 1.) * R / 2;
477 const double theta = std::acos(
XX) / 3.;
518 for (
unsigned int i = 0; i < dim; ++i)
519 for (
unsigned int j = i + 1;
j < dim; ++
j)
521 const double s = (d[i][
j] + d[
j][i]) / 2;
522 d[i][
j] = d[
j][i] = s;
557 template <
class InputVector,
int spacedim>
561 const unsigned int component);
591 template <
class InputVector,
int spacedim>
596 const unsigned int component)
598 if (fe_values.get_fe().n_components() == 1)
600 std::vector<Tensor<2, dim, typename InputVector::value_type>> values(
602 fe_values.get_function_hessians(solution, values);
608 std::vector<Tensor<2, dim, typename InputVector::value_type>>>
612 fe_values.get_fe().n_components()));
613 fe_values.get_function_hessians(solution, values);
624 return std::fabs(d[0][0][0]);
648 for (
unsigned int i = 0; i < dim; ++i)
649 for (
unsigned int j = i + 1;
j < dim; ++
j)
650 for (
unsigned int k =
j + 1;
k < dim; ++
k)
652 const double s = (d[i][
j][
k] + d[i][
k][
j] + d[
j][i][
k] +
653 d[
j][
k][i] + d[
k][i][
j] + d[
k][
j][i]) /
655 d[i][
j][
k] = d[i][
k][
j] = d[
j][i][
k] = d[
j][
k][i] = d[
k][i][
j] =
660 for (
unsigned int i = 0; i < dim; ++i)
661 for (
unsigned int j = i + 1;
j < dim; ++
j)
665 const double s = (d[i][i][
j] + d[i][
j][i] + d[
j][i][i]) / 3;
666 d[i][i][
j] = d[i][
j][i] = d[
j][i][i] = s;
670 const double t = (d[i][
j][
j] + d[
j][i][
j] + d[
j][
j][i]) / 3;
671 d[i][
j][
j] = d[
j][i][
j] = d[
j][
j][i] = t;
676 template <
int order,
int dim>
750 const unsigned int component,
752 typename DerivativeDescription::Derivative &derivative)
765 dof_handler.get_fe_collection();
782 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
801 const typename DerivativeDescription::ProjectedDerivative
825 GridTools::get_active_neighbors<DoFHandler<dim, spacedim>>(
843 const typename DerivativeDescription::ProjectedDerivative
845 DerivativeDescription::get_projected_derivative(
860 const double distance =
y.norm();
874 for (
unsigned int i = 0; i < dim; ++i)
875 for (
unsigned int j = 0;
j < dim; ++
j)
876 Y[i][
j] +=
y[i] *
y[
j];
881 typename DerivativeDescription::ProjectedDerivative
906 DerivativeDescription::symmetrize(derivative);
928 const unsigned int component)
931 if (std::get<0>(*cell)->is_locally_owned() ==
false)
932 *std::get<1>(*cell) = 0;
935 typename DerivativeDescription::Derivative derivative;
948 *std::get<1>(*cell) =
949 DerivativeDescription::derivative_norm(derivative);
972 const unsigned int component,
976 dof_handler.get_triangulation().n_active_cells(),
979 dof_handler.get_triangulation().n_active_cells()));
983 std::tuple<typename DoFHandler<dim, spacedim>::active_cell_iterator,
995 [&mapping, &dof_handler, &solution, component](
1000 cell, mapping, dof_handler, solution, component);
1002 std::function<void(internal::Assembler::CopyData const &)>(),
1016 template <
int dim,
class InputVector,
int spacedim>
1022 const unsigned int component)
1024 internal::approximate_derivative<internal::Gradient<dim>, dim>(
1029 template <
int dim,
class InputVector,
int spacedim>
1034 const unsigned int component)
1036 Assert(!dof_handler.get_triangulation().is_mixed_mesh(),
1038 const auto reference_cell =
1039 dof_handler.get_triangulation().get_reference_cells()[0];
1040 internal::approximate_derivative<internal::Gradient<dim>, dim>(
1049 template <
int dim,
class InputVector,
int spacedim>
1055 const unsigned int component)
1057 internal::approximate_derivative<internal::SecondDerivative<dim>, dim>(
1062 template <
int dim,
class InputVector,
int spacedim>
1067 const unsigned int component)
1069 Assert(!dof_handler.get_triangulation().is_mixed_mesh(),
1071 const auto reference_cell =
1072 dof_handler.get_triangulation().get_reference_cells()[0];
1073 internal::approximate_derivative<internal::SecondDerivative<dim>, dim>(
1082 template <
int dim,
int spacedim,
class InputVector,
int order>
1095 const unsigned int component)
1099 mapping, dof, solution, component, cell, derivative);
1104 template <
int dim,
int spacedim,
class InputVector,
int order>
1116 const unsigned int component)
1120 cell->reference_cell()
1131 template <
int dim,
int order>
1143#include "derivative_approximation.inst"
void reinit(value_type *starting_element, const std::size_t n_elements)
static ProjectedDerivative get_projected_derivative(const FEValues< dim, spacedim > &fe_values, const InputVector &solution, const unsigned int component)
static const UpdateFlags update_flags
static void symmetrize(Derivative &derivative_tensor)
static double derivative_norm(const Derivative &d)
static const UpdateFlags update_flags
static ProjectedDerivative get_projected_derivative(const FEValues< dim, spacedim > &fe_values, const InputVector &solution, const unsigned int component)
static double derivative_norm(const Derivative &d)
static void symmetrize(Derivative &derivative_tensor)
static ProjectedDerivative get_projected_derivative(const FEValues< dim, spacedim > &fe_values, const InputVector &solution, const unsigned int component)
static double derivative_norm(const Derivative &d)
static const UpdateFlags update_flags
static void symmetrize(Derivative &derivative_tensor)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInsufficientDirections()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcVectorLengthVsNActiveCells(int arg1, int arg2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
#define AssertThrow(cond, exc)
typename ActiveSelector::active_cell_iterator active_cell_iterator
@ update_hessians
Second derivatives of shape functions.
@ update_values
Shape function values.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
void approximate_derivative(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component, Vector< float > &derivative_norm)
void approximate_cell(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component, const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, typename DerivativeDescription::Derivative &derivative)
void approximate(SynchronousIterators< std::tuple< typename DoFHandler< dim, spacedim >::active_cell_iterator, Vector< float >::iterator > > const &cell, const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component)
void approximate_gradient(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0)
double derivative_norm(const Tensor< order, dim > &derivative)
void approximate_derivative_tensor(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, Tensor< order, dim > &derivative, const unsigned int component=0)
void approximate_second_derivative(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0)
void run(const std::vector< std::vector< Iterator > > &colored_iterators, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length=2 *MultithreadInfo::n_threads(), const unsigned int chunk_size=8)
static constexpr double PI
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
DEAL_II_HOST constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
std::array< Number, 1 > eigenvalues(const SymmetricTensor< 2, 1, Number > &T)
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > outer_product(const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, Number > &t2)
DEAL_II_HOST constexpr Number trace(const SymmetricTensor< 2, dim2, Number > &)