16 #ifndef _d2k_fe_values_cache_h_ 17 #define _d2k_fe_values_cache_h_ 19 #include <deal2lkit/config.h> 27 template <
int dim,
int spacedim=dim>
40 fe_values (mapping, fe, quadrature, update_flags),
75 cache.template add_ref<FEValuesBase<dim,spacedim> >(
fe_values,
"FEValuesBase");
84 const unsigned int face_no)
97 const unsigned int face_no,
const unsigned int subface_no)
124 ExcMessage(
"You have to initialize the cache using one of the " 125 "reinit function first!"));
127 cache.template get<FEValuesBase<dim,spacedim> >(
"FEValuesBase");
135 template<
typename Number>
136 std::vector<Number> &
140 std::string dofs_name = prefix+
"_independent_local_dofs_"+
type(dummy);
143 ExcMessage(
"You did not call cache_local_solution_vector with the right types!"));
145 return cache.template get<std::vector<Number> >(dofs_name);
152 const std::vector<Point<spacedim> > &
162 const std::vector<double > &
172 template <
class STREAM>
175 cache.print_info(os);
196 template<
typename VEC,
typename Number>
201 std::string name = prefix+
"_independent_local_dofs_"+
type(dummy);
203 if (!
cache.have(name))
204 cache.add_copy(std::vector<Number>(n_dofs), name);
206 std::vector<Number> &independent_local_dofs
207 =
cache.template get<std::vector<Number> >(name);
221 template<
typename Number>
222 const std::vector <std::vector<Number> > &
225 const std::vector<Number> &independent_local_dofs =
231 const unsigned int n_components = fev.
get_fe().n_components();
235 if (!
cache.have(name))
237 cache.add_copy(std::vector <std::vector<Number> >(n_q_points, std::vector<Number>(n_components)), name);
240 std::vector <std::vector<Number> > &ret =
cache.template get<std::vector <std::vector<Number> > >(name);
254 template<
typename Number>
255 const std::vector <Number> &
257 const std::string &additional_prefix,
261 const std::vector<Number> &independent_local_dofs =
268 std::string name = prefix+
"_"+additional_prefix+
"_scalar_values_q"+
272 typedef typename std::vector<Number> RetType;
275 if (!
cache.have(name))
276 cache.add_copy(RetType(n_q_points), name);
278 RetType &ret =
cache.template get<RetType>(name);
292 template<
typename Number>
293 const std::vector <Tensor <1, spacedim, Number> > &
295 const std::string &additional_prefix,
299 const std::vector<Number> &independent_local_dofs =
306 std::string name = prefix+
"_"+additional_prefix+
"_vector_values_q"+
311 typedef typename std::vector<Tensor<1, spacedim, Number> > RetType;
313 if (!
cache.have(name))
314 cache.add_copy(RetType(n_q_points), name);
316 RetType &ret =
cache.template get<RetType>(name);
330 template<
typename Number>
331 const std::vector <Number> &
333 const std::string &additional_prefix,
337 const std::vector<Number> &independent_local_dofs =
344 std::string name = prefix+
"_"+additional_prefix+
"_div_values_q"+
349 typedef typename std::vector<Number> RetType;
351 if (!
cache.have(name))
352 cache.add_copy(RetType(n_q_points), name);
354 RetType &ret =
cache.template get<RetType>(name);
368 template<
typename Number>
369 const std::vector <Tensor<1, spacedim, Number> > &
371 const std::string &additional_prefix,
375 const std::vector<Number> &independent_local_dofs =
382 std::string name = prefix+
"_"+additional_prefix+
"_grad_values_q"+
386 typedef typename std::vector <Tensor<1, spacedim, Number> > RetType;
388 if (!
cache.have(name))
389 cache.add_copy(RetType(n_q_points), name);
391 RetType &ret =
cache.template get<RetType>(name);
405 template<
typename Number>
406 const std::vector <Tensor<2, spacedim, Number> > &
408 const std::string &additional_prefix,
412 const std::vector<Number> &independent_local_dofs =
419 std::string name = prefix+
"_"+additional_prefix+
"_grad2_values_q"+
423 typedef typename std::vector <Tensor<2, spacedim, Number> > RetType;
425 if (!
cache.have(name))
426 cache.add_copy(RetType(n_q_points), name);
428 RetType &ret =
cache.template get<RetType>(name);
440 template<
typename Number>
441 const std::vector <Tensor<1, (spacedim > 2 ? spacedim : 1), Number> > &
443 const std::string &additional_prefix,
447 const std::vector<Number> &independent_local_dofs =
454 std::string name = prefix+
"_"+additional_prefix+
"_curl_values_q"+
458 typedef typename std::vector <Tensor<1, (spacedim > 2 ? spacedim : 1), Number> > RetType;
460 if (!
cache.have(name))
461 cache.add_copy(RetType(n_q_points), name);
463 RetType &ret =
cache.template get<RetType>(name);
475 template<
typename Number>
476 const std::vector <Number> &
478 const std::string &additional_prefix,
482 const std::vector<Number> &independent_local_dofs =
489 std::string name = prefix+
"_"+additional_prefix+
"_laplacian_values_q"+
493 typedef typename std::vector <Number> RetType;
495 if (!
cache.have(name))
496 cache.add_copy(RetType(n_q_points), name);
498 RetType &ret =
cache.template get<RetType>(name);
511 template<
typename Number>
512 const std::vector <Tensor<1,spacedim,Number> > &
514 const std::string &additional_prefix,
518 const std::vector<Number> &independent_local_dofs =
525 std::string name = prefix+
"_"+additional_prefix+
"_laplacian2_values_q"+
529 typedef typename std::vector <Tensor<1,spacedim,Number> > RetType;
531 if (!
cache.have(name))
532 cache.add_copy(RetType(n_q_points), name);
534 RetType &ret =
cache.template get<RetType>(name);
546 template<
typename Number>
547 const std::vector <Tensor<2, spacedim, Number> > &
549 const std::string &additional_prefix,
553 const std::vector<Number> &independent_local_dofs =
560 std::string name = prefix+
"_"+additional_prefix+
"_F_values_q"+
564 typedef typename std::vector <Tensor<2, spacedim, Number> > RetType;
566 if (!
cache.have(name))
567 cache.add_copy(RetType(n_q_points), name);
569 RetType &ret =
cache.template get<RetType>(name);
583 template<
typename Number>
584 const std::vector <Tensor<2, spacedim, Number> > &
586 const std::string &additional_prefix,
590 const std::vector<Number> &independent_local_dofs =
597 std::string name = prefix+
"_"+additional_prefix+
"_sym_grad_values_q"+
601 typedef typename std::vector <Tensor<2, spacedim, Number> > RetType;
603 if (!
cache.have(name))
604 cache.add_copy(RetType(n_q_points), name);
606 RetType &ret =
cache.template get<RetType>(name);
618 template<
typename Number>
619 const std::vector <Tensor<2,spacedim,Number> > &
621 const std::string &additional_prefix,
625 const std::vector<Number> &independent_local_dofs =
632 std::string name = prefix+
"_"+additional_prefix+
"_hessians_values_q"+
636 typedef typename std::vector <Tensor<2,spacedim,Number> > RetType;
638 if (!
cache.have(name))
639 cache.add_copy(RetType(n_q_points), name);
641 RetType &ret =
cache.template get<RetType>(name);
653 template<
typename Number>
654 const std::vector <Tensor<3,spacedim,Number> > &
656 const std::string &additional_prefix,
660 const std::vector<Number> &independent_local_dofs =
667 std::string name = prefix+
"_"+additional_prefix+
"_hessians2_values_q"+
671 typedef typename std::vector <Tensor<3,spacedim,Number> > RetType;
673 if (!
cache.have(name))
674 cache.add_copy(RetType(n_q_points), name);
676 RetType &ret =
cache.template get<RetType>(name);
void reinit(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, const unsigned int face_no)
Initialize the internal FEFaceValues to use the given on the given cell.
const std::vector< Tensor< 2, spacedim, Number > > & get_symmetric_gradients(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &variable, const Number dummy)
Return the symmetric gradient of the named cached solution vector.
void print_info(STREAM &os)
Print the content of the internal cache.
void reinit(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell)
Initialize the internal FEValues to use the given cell.
void cache_local_solution_vector(const std::string &prefix, const VEC &input_vector, const Number dummy)
Store internally the independent local dof values associated with the internally initialized cell...
const std::vector< Tensor< 2, spacedim, Number > > & get_hessians(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Scalar &variable, const Number dummy)
Return the hessian of the named cached solution vector.
const std::vector< Number > & get_laplacians(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Scalar &variable, const Number dummy)
Return the laplacian of the named cached solution vector.
const std::vector< Tensor< 2, spacedim, Number > > & get_gradients(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &variable, const Number dummy)
Return the gradient of the named cached solution vector.
void get_values(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, std::vector< std::vector< Number > > &us)
Extract independent local dofs values in a cell and store them in std::vector <std::vector<Number> > ...
ActiveSelector::active_cell_iterator active_cell_iterator
std::vector< types::global_dof_index > local_dof_indices
std::vector< Number > & get_current_independent_local_dofs(const std::string &prefix, Number dummy)
const std::vector< Tensor< 1, spacedim, Number > > & get_gradients(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Scalar &variable, const Number dummy)
Return the gradient of the named cached solution vector.
const std::vector< Tensor< 2, spacedim, Number > > & get_deformation_gradients(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &variable, const Number dummy)
Return the deformation gradient of the named cached solution vector.
void extract_local_dofs(const VEC &global_vector, const std::vector< types::global_dof_index > &local_dof_indices, std::vector< Number > &independent_local_dofs)
Extract local dofs values and initialize the number of independent variables up to the second order d...
static::ExceptionBase & ExcMessage(std::string arg1)
AnyData & get_cache()
Get the reference to cache.
void get_divergences(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, const FEValuesExtractors::Vector &vector_variable, std::vector< Number > &us)
Extract divergence values of a vector_variable on face of a cell and store them in std::vector <Numbe...
const std::vector< Tensor< 1, spacedim, Number > > & get_laplacians(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &variable, const Number dummy)
Return the laplacian of the named cached solution vector.
std::string type(const T &t)
Return a human readable name of the type passed as argument.
#define Assert(cond, exc)
void get_deformation_gradients(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, const FEValuesExtractors::Vector &vector_variable, std::vector< Tensor< 2, spacedim, Number > > &Fs)
Compute the deformation gradient in each quadrature point of a cell and it is stored in std::vector <...
void get_symmetric_gradients(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, const FEValuesExtractors::Vector &vector_variable, std::vector< Tensor< 2, spacedim, Number > > &grad_us)
Extract symmetric gradient values of a vector_variable on face of a cell and store them in std::vecto...
void get_curls(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, const FEValuesExtractors::Vector &vector_variable, std::vector< Tensor< 1,(spacedim > 2 ? spacedim :1), Number > > &curl_us)
Extract curl values of a vector_variable on face or cell and store them in std::vector <Tensor <1...
void get_hessians(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, const FEValuesExtractors::Scalar &variable, std::vector< Tensor< 2, spacedim, Number > > &us)
Extract hessians local dofs values of a scalar variable in a cell and store them in std::vector <Tens...
FESubfaceValues< dim, spacedim > fe_subface_values
const std::vector< Tensor< 1,(spacedim > 2 ? spacedim :1), Number > > & get_curls(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &variable, const Number dummy)
Return the curl of the named cached solution vector.
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
const unsigned int n_quadrature_points
const std::vector< std::vector< Number > > & get_values(const std::string &prefix, const Number dummy)
Return the values of the named cached solution vector.
void reinit(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no)
Initialize the internal FESubFaceValues to use the given , on , on the given cell.
void get_laplacians(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, const FEValuesExtractors::Scalar &variable, std::vector< Number > &us)
Extract laplacians local dofs values of a scalar variable in a cell and store them in std::vector <Nu...
const std::vector< Number > & get_divergences(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &vector_variable, const Number dummy)
Return the divergence of the named cached solution vector.
const std::vector< Tensor< 3, spacedim, Number > > & get_hessians(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &variable, const Number dummy)
Return the hessian of the named cached solution vector.
const FEValuesBase< dim, spacedim > & get_current_fe_values()
Get the currently initialized FEValues.
const std::vector< Tensor< 1, spacedim, Number > > & get_values(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Vector &vector_variable, const Number dummy)
Return the values of the named cached solution vector.
FEValuesCache(const FEValuesCache< dim, spacedim > &scratch)
Deep copy constructor.
Store any amount of any type of data accessible by an identifier string.
const FiniteElement< dim, spacedim > & get_fe() const
const std::vector< Point< spacedim > > & get_quadrature_points()
Return the quadrature points of the internal FEValues object.
FEFaceValues< dim, spacedim > fe_face_values
void get_gradients(const FEValuesBase< dim, spacedim > &fe_values, const std::vector< Number > &independent_local_dof_values, const FEValuesExtractors::Vector &vector_variable, std::vector< Tensor< 2, spacedim, Number > > &grad_us)
Extract gradient values of a vector_variable on face of a cell and store them in std::vector <Tensor ...
FEValuesCache(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim > &quadrature, const UpdateFlags &update_flags, const Quadrature< dim-1 > &face_quadrature, const UpdateFlags &face_update_flags)
Explicit constructor.
const std::vector< double > & get_JxW_values()
Return the JxW values of the internal FEValues object.
FEValues< dim, spacedim > fe_values
const std::vector< Number > & get_values(const std::string &prefix, const std::string &additional_prefix, const FEValuesExtractors::Scalar &variable, const Number dummy)
Return the values of the named cached solution vector.