105 template <
class InputVector,
int spacedim>
109 const unsigned int component);
135 template <
class InputVector,
int spacedim>
140 const unsigned int component)
142 if (fe_values.get_fe().n_components() == 1)
144 std::vector<typename InputVector::value_type> values(1);
145 fe_values.get_function_values(solution, values);
150 std::vector<Vector<typename InputVector::value_type>> values(
153 fe_values.get_fe().n_components()));
154 fe_values.get_function_values(solution, values);
155 return values[0](component);
166 for (
unsigned int i = 0; i < dim; ++i)
216 template <
class InputVector,
int spacedim>
220 const unsigned int component);
250 template <
class InputVector,
int spacedim>
255 const unsigned int component)
257 if (fe_values.get_fe().n_components() == 1)
259 std::vector<Tensor<1, dim, typename InputVector::value_type>> values(
261 fe_values.get_function_gradients(solution, values);
267 std::vector<Tensor<1, dim, typename InputVector::value_type>>>
271 fe_values.get_fe().n_components()));
272 fe_values.get_function_gradients(solution, values);
283 return std::fabs(d[0][0]);
301 ::sqr(d[0][0] - d[1][1]) + 4 *
::sqr(d[0][1]);
424 const double am =
trace(d) / 3.;
428 for (
unsigned int i = 0; i < 3; ++i)
431 const double ss01 = s[0][1] * s[0][1],
ss12 = s[1][2] * s[1][2],
432 ss02 = s[0][2] * s[0][2];
434 const double J2 = (s[0][0] * s[0][0] + s[1][1] * s[1][1] +
438 (Utilities::fixed_power<3>(s[0][0]) +
439 Utilities::fixed_power<3>(s[1][1]) +
440 Utilities::fixed_power<3>(s[2][2]) + 3. * s[0][0] * (
ss01 +
ss02) +
442 6. * s[0][1] * s[0][2] * s[1][2]) /
447 double EE[3] = {0, 0, 0};
454 if (R <= 1e-14 * std::fabs(
am))
460 const double R3 = R * R * R;
461 const double XX = 4. *
J3 /
R3;
462 const double YY = 1. - std::fabs(
XX);
469 const double a = (
XX > 0 ? -1. : 1.) * R / 2;
516 for (
unsigned int i = 0; i < dim; ++i)
517 for (
unsigned int j = i + 1;
j < dim; ++
j)
519 const double s = (d[i][
j] + d[
j][i]) / 2;
520 d[i][
j] = d[
j][i] = s;
555 template <
class InputVector,
int spacedim>
559 const unsigned int component);
589 template <
class InputVector,
int spacedim>
594 const unsigned int component)
596 if (fe_values.get_fe().n_components() == 1)
598 std::vector<Tensor<2, dim, typename InputVector::value_type>> values(
600 fe_values.get_function_hessians(solution, values);
606 std::vector<Tensor<2, dim, typename InputVector::value_type>>>
610 fe_values.get_fe().n_components()));
611 fe_values.get_function_hessians(solution, values);
622 return std::fabs(d[0][0][0]);
646 for (
unsigned int i = 0; i < dim; ++i)
647 for (
unsigned int j = i + 1;
j < dim; ++
j)
648 for (
unsigned int k =
j + 1;
k < dim; ++
k)
650 const double s = (d[i][
j][
k] + d[i][
k][
j] + d[
j][i][
k] +
651 d[
j][
k][i] + d[
k][i][
j] + d[
k][
j][i]) /
653 d[i][
j][
k] = d[i][
k][
j] = d[
j][i][
k] = d[
j][
k][i] = d[
k][i][
j] =
658 for (
unsigned int i = 0; i < dim; ++i)
659 for (
unsigned int j = i + 1;
j < dim; ++
j)
663 const double s = (d[i][i][
j] + d[i][
j][i] + d[
j][i][i]) / 3;
664 d[i][i][
j] = d[i][
j][i] = d[
j][i][i] = s;
668 const double t = (d[i][
j][
j] + d[
j][i][
j] + d[
j][
j][i]) / 3;
669 d[i][
j][
j] = d[
j][i][
j] = d[
j][
j][i] = t;
674 template <
int order,
int dim>
748 const unsigned int component,
750 typename DerivativeDescription::Derivative &derivative)
763 dof_handler.get_fe_collection();
780 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
799 const typename DerivativeDescription::ProjectedDerivative
823 GridTools::get_active_neighbors<DoFHandler<dim, spacedim>>(
841 const typename DerivativeDescription::ProjectedDerivative
843 DerivativeDescription::get_projected_derivative(
858 const double distance =
y.
norm();
872 for (
unsigned int i = 0; i < dim; ++i)
873 for (
unsigned int j = 0;
j < dim; ++
j)
874 Y[i][
j] +=
y[i] *
y[
j];
879 typename DerivativeDescription::ProjectedDerivative
904 DerivativeDescription::symmetrize(derivative);
926 const unsigned int component)
929 if (std::get<0>(*cell)->is_locally_owned() ==
false)
930 *std::get<1>(*cell) = 0;
933 typename DerivativeDescription::Derivative derivative;
946 *std::get<1>(*cell) =
947 DerivativeDescription::derivative_norm(derivative);
970 const unsigned int component,
974 dof_handler.get_triangulation().n_active_cells(),
977 dof_handler.get_triangulation().n_active_cells()));
981 std::tuple<typename DoFHandler<dim, spacedim>::active_cell_iterator,
993 [&mapping, &dof_handler, &solution, component](
998 cell, mapping, dof_handler, solution, component);
1000 std::function<void(const internal::Assembler::CopyData &)>(),
1014 template <
int dim,
class InputVector,
int spacedim>
1020 const unsigned int component)
1022 internal::approximate_derivative<internal::Gradient<dim>, dim>(
1027 template <
int dim,
class InputVector,
int spacedim>
1032 const unsigned int component)
1034 Assert(!dof_handler.get_triangulation().is_mixed_mesh(),
1036 const auto reference_cell =
1037 dof_handler.get_triangulation().get_reference_cells()[0];
1038 internal::approximate_derivative<internal::Gradient<dim>, dim>(
1047 template <
int dim,
class InputVector,
int spacedim>
1053 const unsigned int component)
1055 internal::approximate_derivative<internal::SecondDerivative<dim>, dim>(
1060 template <
int dim,
class InputVector,
int spacedim>
1065 const unsigned int component)
1067 Assert(!dof_handler.get_triangulation().is_mixed_mesh(),
1069 const auto reference_cell =
1070 dof_handler.get_triangulation().get_reference_cells()[0];
1071 internal::approximate_derivative<internal::SecondDerivative<dim>, dim>(
1080 template <
int dim,
int spacedim,
class InputVector,
int order>
1093 const unsigned int component)
1097 mapping, dof, solution, component, cell, derivative);
1102 template <
int dim,
int spacedim,
class InputVector,
int order>
1114 const unsigned int component)
1118 cell->reference_cell()
1129 template <
int dim,
int order>
1141#include "derivative_approximation.inst"
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)
numbers::NumberTraits< Number >::real_type norm() const
#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.
#define DEAL_II_NOT_IMPLEMENTED()
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(const SynchronousIterators< std::tuple< typename DoFHandler< dim, spacedim >::active_cell_iterator, Vector< float >::iterator > > &cell, const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component)
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_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 > &)
inline ::VectorizedArray< Number, width > acos(const ::VectorizedArray< Number, width > &x)
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 > &)