16 #ifndef dealii_meshworker_scratch_data_h 17 #define dealii_meshworker_scratch_data_h 19 #include <deal.II/base/config.h> 21 #include <deal.II/algorithms/general_data_storage.h> 23 #include <deal.II/differentiation/ad.h> 25 #include <deal.II/fe/fe_values.h> 26 #include <deal.II/fe/mapping_q1.h> 28 #include <boost/any.hpp> 34 DEAL_II_NAMESPACE_OPEN
44 template <
int dim,
int spacedim,
typename NumberType,
typename Extractor>
46 template OutputType<NumberType>;
231 template <
int dim,
int spacedim = dim>
361 const unsigned int face_no);
375 const unsigned int face_no,
376 const unsigned int subface_no);
394 const std::vector<Point<spacedim>> &
400 const std::vector<double> &
406 const std::vector<Tensor<1, spacedim>> &
413 const std::vector<types::global_dof_index> &
444 const unsigned int face_no);
459 const unsigned int face_no,
460 const unsigned int subface_no);
479 const std::vector<double> &
485 const std::vector<Tensor<1, spacedim>> &
492 const std::vector<types::global_dof_index> &
539 template <
typename VectorType,
typename Number =
double>
542 const VectorType & input_vector,
543 const Number dummy = Number(0));
553 template <
typename Number =
double>
554 const std::vector<Number> &
556 Number dummy = Number(0))
const;
579 template <
typename Extractor,
typename Number =
double>
581 typename internal::OutputType<dim, spacedim, Number, Extractor>::
583 get_values(
const std::string &global_vector_name,
584 const Extractor & variable,
585 const Number dummy = Number(0));
608 template <
typename Extractor,
typename Number =
double>
610 typename internal::OutputType<dim, spacedim, Number, Extractor>::
613 const Extractor & variable,
614 const Number dummy = Number(0));
638 template <
typename Extractor,
typename Number =
double>
640 typename internal::OutputType<dim, spacedim, Number, Extractor>::
641 symmetric_gradient_type> &
643 const Extractor & variable,
644 const Number dummy = Number(0));
667 template <
typename Extractor,
typename Number =
double>
669 typename internal::OutputType<dim, spacedim, Number, Extractor>::
672 const Extractor & variable,
673 const Number dummy = Number(0));
696 template <
typename Extractor,
typename Number =
double>
697 const std::vector<
typename internal::
698 OutputType<dim, spacedim, Number, Extractor>::curl_type>
700 get_curls(
const std::string &global_vector_name,
701 const Extractor & variable,
702 const Number dummy = Number(0));
725 template <
typename Extractor,
typename Number =
double>
727 typename internal::OutputType<dim, spacedim, Number, Extractor>::
730 const Extractor & variable,
731 const Number dummy = Number(0));
754 template <
typename Extractor,
typename Number =
double>
756 typename internal::OutputType<dim, spacedim, Number, Extractor>::
757 third_derivative_type> &
759 const Extractor & variable,
760 const Number dummy = Number(0));
775 template <
typename Extractor,
typename Number =
double>
778 const Extractor & variable,
779 const std::string &object_type,
780 const unsigned int size,
781 const Number & exemplar_number)
const;
786 template <
typename Number =
double>
789 const unsigned int size,
790 const Number & exemplar_number)
const;
902 template <
int dim,
int spacedim>
903 template <
typename Extractor,
typename Number>
906 const std::string &global_vector_name,
907 const Extractor & variable,
908 const std::string &object_type,
909 const unsigned int size,
910 const Number & exemplar_number)
const 912 return global_vector_name +
"_" + variable.get_name() +
"_" + object_type +
919 template <
int dim,
int spacedim>
920 template <
typename Number>
923 const std::string &global_vector_name,
924 const unsigned int size,
925 const Number & exemplar_number)
const 927 return global_vector_name +
"_independent_local_dofs_" +
934 template <
int dim,
int spacedim>
935 template <
typename VectorType,
typename Number>
938 const std::string &global_vector_name,
939 const VectorType & input_vector,
942 const unsigned int n_dofs = get_current_fe_values().get_fe().dofs_per_cell;
944 const std::string name =
945 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
947 auto &independent_local_dofs =
948 internal_data_storage
949 .template get_or_add_object_with_name<std::vector<Number>>(name,
955 for (
unsigned int i = 0; i < n_dofs; ++i)
957 input_vector(local_dof_indices[i]),
960 independent_local_dofs[i]);
962 for (
unsigned int i = 0; i < n_dofs; ++i)
963 independent_local_dofs[i] = input_vector(local_dof_indices[i]);
968 template <
int dim,
int spacedim>
969 template <
typename Number>
970 const std::vector<Number> &
972 const std::string &global_vector_name,
975 const unsigned int n_dofs = get_current_fe_values().get_fe().dofs_per_cell;
977 const std::string dofs_name =
978 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
981 internal_data_storage.stores_object_with_name(dofs_name),
983 "You did not call yet extract_local_dof_values with the right types!"));
985 return internal_data_storage
986 .template get_object_with_name<std::vector<Number>>(dofs_name);
991 template <
int dim,
int spacedim>
992 template <
typename Extractor,
typename Number>
994 typename internal::OutputType<dim, spacedim, Number, Extractor>::value_type>
997 const std::string &global_vector_name,
998 const Extractor & variable,
1001 const std::vector<Number> &independent_local_dofs =
1002 get_local_dof_values(global_vector_name, dummy);
1008 const std::string name = get_unique_name(
1009 global_vector_name, variable,
"_values_q", n_q_points, dummy);
1013 std::vector<
typename internal::
1014 OutputType<dim, spacedim, Number, Extractor>::value_type>;
1017 internal_data_storage.template get_or_add_object_with_name<RetType>(
1022 fev[variable].get_function_values_from_local_dof_values(
1023 independent_local_dofs, ret);
1029 template <
int dim,
int spacedim>
1030 template <
typename Extractor,
typename Number>
1032 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1035 const std::string &global_vector_name,
1036 const Extractor & variable,
1039 const std::vector<Number> &independent_local_dofs =
1040 get_local_dof_values(global_vector_name, dummy);
1046 const std::string name = get_unique_name(
1047 global_vector_name, variable,
"_gradients_q", n_q_points, dummy);
1050 using RetType = std::vector<
1051 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1055 internal_data_storage.template get_or_add_object_with_name<RetType>(
1060 fev[variable].get_function_gradients_from_local_dof_values(
1061 independent_local_dofs, ret);
1067 template <
int dim,
int spacedim>
1068 template <
typename Extractor,
typename Number>
1070 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1073 const std::string &global_vector_name,
1074 const Extractor & variable,
1077 const std::vector<Number> &independent_local_dofs =
1078 get_local_dof_values(global_vector_name, dummy);
1084 const std::string name = get_unique_name(
1085 global_vector_name, variable,
"_hessians_q", n_q_points, dummy);
1089 std::vector<
typename internal::
1090 OutputType<dim, spacedim, Number, Extractor>::hessian_type>;
1093 internal_data_storage.template get_or_add_object_with_name<RetType>(
1099 fev[variable].get_function_hessians_from_local_dof_values(
1100 independent_local_dofs, ret);
1106 template <
int dim,
int spacedim>
1107 template <
typename Extractor,
typename Number>
1109 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1110 third_derivative_type> &
1112 const std::string &global_vector_name,
1113 const Extractor & variable,
1116 const std::vector<Number> &independent_local_dofs =
1117 get_local_dof_values(global_vector_name, dummy);
1123 const std::string name = get_unique_name(
1124 global_vector_name, variable,
"_third_derivatives_q", n_q_points, dummy);
1127 using RetType = std::vector<
1128 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1129 third_derivative_type>;
1132 internal_data_storage.template get_or_add_object_with_name<RetType>(
1138 fev[variable].get_function_third_derivatives_from_local_dof_values(
1139 independent_local_dofs, ret);
1145 template <
int dim,
int spacedim>
1146 template <
typename Extractor,
typename Number>
1148 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1149 symmetric_gradient_type> &
1151 const std::string &global_vector_name,
1152 const Extractor & variable,
1155 const std::vector<Number> &independent_local_dofs =
1156 get_local_dof_values(global_vector_name, dummy);
1162 const std::string name = get_unique_name(
1163 global_vector_name, variable,
"_symmetric_gradient_q", n_q_points, dummy);
1167 using RetType = std::vector<
1168 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1169 symmetric_gradient_type>;
1172 internal_data_storage.template get_or_add_object_with_name<RetType>(
1178 fev[variable].get_function_symmetric_gradients_from_local_dof_values(
1179 independent_local_dofs, ret);
1184 template <
int dim,
int spacedim>
1185 template <
typename Extractor,
typename Number>
1187 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1190 const std::string &global_vector_name,
1191 const Extractor & variable,
1194 const std::vector<Number> &independent_local_dofs =
1195 get_local_dof_values(global_vector_name, dummy);
1201 const std::string name = get_unique_name(
1202 global_vector_name, variable,
"_divergence_q", n_q_points, dummy);
1205 using RetType = std::vector<
1206 typename internal::OutputType<dim, spacedim, Number, Extractor>::
1210 internal_data_storage.template get_or_add_object_with_name<RetType>(
1216 fev[variable].get_function_divergences_from_local_dof_values(
1217 independent_local_dofs, ret);
1223 template <
int dim,
int spacedim>
1224 template <
typename Extractor,
typename Number>
1226 typename internal::OutputType<dim, spacedim, Number, Extractor>::curl_type>
1229 const Extractor & variable,
1232 const std::vector<Number> &independent_local_dofs =
1233 get_local_dof_values(global_vector_name, dummy);
1239 const std::string name = get_unique_name(
1240 global_vector_name, variable,
"_curl_q", n_q_points, dummy);
1244 std::vector<
typename internal::
1245 OutputType<dim, spacedim, Number, Extractor>::curl_type>;
1248 internal_data_storage.template get_or_add_object_with_name<RetType>(
1253 fev[variable].get_function_curls_from_local_dof_values(
1254 independent_local_dofs, ret);
1262 DEAL_II_NAMESPACE_CLOSE
GeneralDataStorage internal_data_storage
SmartPointer< FEValuesBase< dim, spacedim > > current_fe_values
std::string type_to_string(const T &t)
#define AssertDimension(dim1, dim2)
std::unique_ptr< FEFaceValues< dim, spacedim > > fe_face_values
const std::vector< typename internal::OutputType< dim, spacedim, Number, Extractor >::gradient_type > & get_gradients(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
Quadrature< dim > cell_quadrature
SmartPointer< const Mapping< dim, spacedim > > mapping
const Mapping< dim, spacedim > & get_mapping() const
std::string get_unique_dofs_name(const std::string &global_vector_name, const unsigned int size, const Number &exemplar_number) const
std::unique_ptr< FEValues< dim, spacedim > > neighbor_fe_values
UpdateFlags neighbor_face_update_flags
const std::vector< typename internal::OutputType< dim, spacedim, Number, Extractor >::value_type > & get_values(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const std::vector< types::global_dof_index > & get_local_dof_indices() const
const FEValuesBase< dim, spacedim > & get_current_neighbor_fe_values() const
const std::vector< typename internal::OutputType< dim, spacedim, Number, Extractor >::symmetric_gradient_type > & get_symmetric_gradients(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const FEValues< dim, spacedim > & reinit(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell)
UpdateFlags neighbor_cell_update_flags
const std::vector< Tensor< 1, spacedim > > & get_neighbor_normal_vectors()
std::vector< types::global_dof_index > neighbor_dof_indices
ScratchData(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim > &quadrature, const UpdateFlags &update_flags, const Quadrature< dim - 1 > &face_quadrature=Quadrature< dim - 1 >(), const UpdateFlags &face_update_flags=update_default)
GeneralDataStorage & get_general_data_storage()
const std::vector< typename internal::OutputType< dim, spacedim, Number, Extractor >::hessian_type > & get_hessians(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
typename internal::FEValuesViews::ViewType< dim, spacedim, Extractor >::type View
std::unique_ptr< FESubfaceValues< dim, spacedim > > fe_subface_values
std::unique_ptr< FESubfaceValues< dim, spacedim > > neighbor_fe_subface_values
static ::ExceptionBase & ExcMessage(std::string arg1)
const FEValues< dim, spacedim > & reinit_neighbor(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell)
#define Assert(cond, exc)
const std::vector< Tensor< 1, spacedim > > & get_normal_vectors() const
Abstract base class for mapping classes.
const std::vector< Point< spacedim > > & get_quadrature_points() const
SmartPointer< FEValuesBase< dim, spacedim > > current_neighbor_fe_values
std::unique_ptr< FEFaceValues< dim, spacedim > > neighbor_fe_face_values
UpdateFlags face_update_flags
GeneralDataStorage user_data_storage
std::string get_unique_name(const std::string &global_vector_name, const Extractor &variable, const std::string &object_type, const unsigned int size, const Number &exemplar_number) const
const std::vector< typename internal::OutputType< dim, spacedim, Number, Extractor >::third_derivative_type > & get_third_derivatives(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const std::vector< typename internal::OutputType< dim, spacedim, Number, Extractor >::curl_type > & get_curls(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
void extract_local_dof_values(const std::string &global_vector_name, const VectorType &input_vector, const Number dummy=Number(0))
UpdateFlags cell_update_flags
const unsigned int n_quadrature_points
Quadrature< dim - 1 > face_quadrature
std::unique_ptr< FEValues< dim, spacedim > > fe_values
const std::vector< types::global_dof_index > & get_neighbor_dof_indices() const
const std::vector< typename internal::OutputType< dim, spacedim, Number, Extractor >::divergence_type > & get_divergences(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const FEValuesBase< dim, spacedim > & get_current_fe_values() const
const std::vector< double > & get_neighbor_JxW_values() const
const std::vector< double > & get_JxW_values() const
typename ActiveSelector::active_cell_iterator active_cell_iterator
std::vector< types::global_dof_index > local_dof_indices
SmartPointer< const FiniteElement< dim, spacedim > > fe
const std::vector< Number > & get_local_dof_values(const std::string &global_vector_name, Number dummy=Number(0)) const