20#include "libmesh/fem_context.h"
22#include "libmesh/boundary_info.h"
23#include "libmesh/diff_system.h"
24#include "libmesh/dof_map.h"
25#include "libmesh/elem.h"
26#include "libmesh/fe_base.h"
27#include "libmesh/fe_interface.h"
28#include "libmesh/libmesh_logging.h"
29#include "libmesh/mesh_base.h"
30#include "libmesh/numeric_vector.h"
31#include "libmesh/quadrature.h"
32#include "libmesh/system.h"
33#include "libmesh/time_solver.h"
34#include "libmesh/unsteady_solver.h"
40 const std::vector<unsigned int> * active_vars,
41 bool allocate_local_matrices)
42 :
FEMContext(sys, sys.extra_quadrature_order, active_vars,
43 allocate_local_matrices)
49 int extra_quadrature_order,
50 const std::vector<unsigned int> * active_vars,
51 bool allocate_local_matrices)
59 _custom_solution(nullptr),
60 _boundary_info(sys.get_mesh().get_boundary_info()),
62 _dim(cast_int<unsigned char>(sys.get_mesh().mesh_dimension())),
64 _elem_dims(sys.get_mesh().elem_dimensions()),
67 _extra_quadrature_order(extra_quadrature_order)
73 std::make_unique<std::vector<unsigned int>>(*active_vars);
76 std::sort(vars_copy->begin(), vars_copy->end());
93 auto check_var = [&hardest_fe_type, &sys](
unsigned int v)
113 hardest_fe_type = fe_type;
123 return hardest_fe_type;
131 auto attach_rules = [
this, &sys](
unsigned int v)
207 _element_fe = std::vector<std::map<FEType, std::unique_ptr<FEAbstract>>>(4);
208 _side_fe = std::vector<std::map<FEType, std::unique_ptr<FEAbstract>>>(4);
215 unsigned int nv = sys.
n_vars();
218 bool have_scalar =
false;
243 auto build_var_fe = [
this, &sys](
unsigned int dim,
254 element_fe->add_p_level_in_reinit(add_p_level);
256 side_fe->add_p_level_in_reinit(add_p_level);
262 edge_fe->add_p_level_in_reinit(add_p_level);
282 build_var_fe(
dim, v);
285 build_var_fe(
dim, v);
311template<
typename OutputType,
317 const unsigned int n_dofs = cast_int<unsigned int>
322 libmesh_assert_equal_to(coef.
size(), n_dofs);
329 const std::vector<std::vector
331 libmesh_assert_equal_to(phi.size(), n_dofs);
336 for (
unsigned int l=0; l != n_dofs; l++)
338 libmesh_assert_less(qp, phi[l].size());
339 u += phi[l][qp] * coef(l);
345template<
typename OutputType,
351 const unsigned int n_dofs = cast_int<unsigned int>
362 const std::vector<std::vector
369 for (
unsigned int l=0; l != n_dofs; l++)
370 du.add_scaled(dphi[l][qp], coef(l));
377#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
378template<
typename OutputType,
384 const unsigned int n_dofs = cast_int<unsigned int>
395 const std::vector<std::vector
402 for (
unsigned int l=0; l != n_dofs; l++)
403 d2u.add_scaled(d2phi[l][qp], coef(l));
420template<
typename OutputType>
422 OutputType & u)
const
425 &FEMContext::get_element_fe<typename TensorTools::MakeReal<OutputType>::type>,
430template<
typename OutputType>
433 std::vector<OutputType> & u_vals)
const
438 const unsigned int n_dofs = cast_int<unsigned int>
446 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
449 const std::vector<std::vector<OutputShape>> & phi = fe->
get_phi();
454 OutputType & u = u_vals[qp];
459 for (
unsigned int l=0; l != n_dofs; l++)
460 u += phi[l][qp] * coef(l);
467 unsigned int qp)
const
478template<
typename OutputType>
481 OutputType & du)
const
486 <OutputType>::type>::type>,
492template<
typename OutputType>
495 std::vector<OutputType> & du_vals)
const
502 const unsigned int n_dofs = cast_int<unsigned int>
510 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
513 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe->
get_dphi();
518 OutputType & du = du_vals[qp];
523 for (
unsigned int l=0; l != n_dofs; l++)
524 du.add_scaled(dphi[l][qp], coef(l));
530#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
540template<
typename OutputType>
542 OutputType & d2u)
const
549 <OutputType>::type>::type>::type>,
554template<
typename OutputType>
557 std::vector<OutputType> & d2u_vals)
const
564 const unsigned int n_dofs = cast_int<unsigned int>
572 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
575 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe->
get_d2phi();
580 OutputType & d2u = d2u_vals[qp];
585 for (
unsigned int l=0; l != n_dofs; l++)
586 d2u.add_scaled(d2phi[l][qp], coef(l));
596template<
typename OutputType>
598 OutputType & curl_u)
const
603 const unsigned int n_dofs = cast_int<unsigned int>
612 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
615 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe->
get_curl_phi();
620 for (
unsigned int l=0; l != n_dofs; l++)
621 curl_u.add_scaled(curl_phi[l][qp], coef(l));
627template<
typename OutputType>
629 OutputType & div_u)
const
636 const unsigned int n_dofs = cast_int<unsigned int>
645 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
648 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputDivergence>> & div_phi = fe->
get_div_phi();
653 for (
unsigned int l=0; l != n_dofs; l++)
654 div_u += div_phi[l][qp] * coef(l);
661 unsigned int qp)
const
671template<
typename OutputType>
674 OutputType & u)
const
677 &FEMContext::get_side_fe<typename TensorTools::MakeReal<OutputType>::type>,
682template<
typename OutputType>
685 std::vector<OutputType> & u_vals)
const
690 const unsigned int n_dofs = cast_int<unsigned int>
698 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
701 const std::vector<std::vector<OutputShape>> & phi = the_side_fe->
get_phi();
706 OutputType & u = u_vals[qp];
711 for (
unsigned int l=0; l != n_dofs; l++)
712 u += phi[l][qp] * coef(l);
728template<
typename OutputType>
730 OutputType & du)
const
737 const unsigned int n_dofs = cast_int<unsigned int>
746 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
749 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->
get_dphi();
754 for (
unsigned int l=0; l != n_dofs; l++)
755 du.add_scaled(dphi[l][qp], coef(l));
762template<
typename OutputType>
765 std::vector<OutputType> & du_vals)
const
772 const unsigned int n_dofs = cast_int<unsigned int>
780 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
783 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->
get_dphi();
788 OutputType & du = du_vals[qp];
793 for (
unsigned int l=0; l != n_dofs; l++)
794 du.add_scaled(dphi[l][qp], coef(l));
800#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
802 unsigned int qp)
const
813template<
typename OutputType>
816 OutputType & d2u)
const
823 <OutputType>::type>::type>::type>,
829template<
typename OutputType>
832 std::vector<OutputType> & d2u_vals)
const
839 const unsigned int n_dofs = cast_int<unsigned int>
847 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
850 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = the_side_fe->
get_d2phi();
855 OutputType & d2u = d2u_vals[qp];
860 for (
unsigned int l=0; l != n_dofs; l++)
861 d2u.add_scaled(d2phi[l][qp], coef(l));
882template<
typename OutputType>
886 const Real tolerance)
const
891 const unsigned int n_dofs = cast_int<unsigned int>
900 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
907 const std::vector<std::vector<OutputShape>> & phi = fe_new->
get_phi();
911 for (
unsigned int l=0; l != n_dofs; l++)
912 u += phi[l][0] * coef(l);
930template<
typename OutputType>
934 const Real tolerance)
const
941 const unsigned int n_dofs = cast_int<unsigned int>
950 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
957 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->
get_dphi();
961 for (
unsigned int l=0; l != n_dofs; l++)
962 grad_u.add_scaled(dphi[l][0], coef(l));
969#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
981template<
typename OutputType>
985 const Real tolerance)
const
992 const unsigned int n_dofs = cast_int<unsigned int>
1001 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1008 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->
get_d2phi();
1012 for (
unsigned int l=0; l != n_dofs; l++)
1013 hess_u.add_scaled(d2phi[l][0], coef(l));
1021template<
typename OutputType>
1024 OutputType & curl_u,
1025 const Real tolerance)
const
1030 const unsigned int n_dofs = cast_int<unsigned int>
1039 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1046 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe_new->
get_curl_phi();
1050 for (
unsigned int l=0; l != n_dofs; l++)
1051 curl_u.add_scaled(curl_phi[l][0], coef(l));
1069template<
typename OutputType>
1071 OutputType & u)
const
1091template<
typename OutputType>
1093 OutputType & du)
const
1100 <OutputType>::type>::type>,
1107#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1118template<
typename OutputType>
1120 OutputType & d2u)
const
1127 <OutputType>::type>::type>::type>,
1144template<
typename OutputType>
1146 OutputType & u)
const
1168template<
typename OutputType>
1170 OutputType & du)
const
1176 <OutputType>::type>::type>,
1182#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1192template<
typename OutputType>
1194 OutputType & d2u)
const
1201 <OutputType>::type>::type>::type>,
1217template<
typename OutputType>
1221 const Real tolerance)
const
1226 const unsigned int n_dofs = cast_int<unsigned int>
1235 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1242 const std::vector<std::vector<OutputShape>> & phi = fe_new->
get_phi();
1246 for (
unsigned int l=0; l != n_dofs; l++)
1247 u += phi[l][0] * coef(l);
1265template<
typename OutputType>
1268 OutputType & grad_u,
1269 const Real tolerance)
const
1276 const unsigned int n_dofs = cast_int<unsigned int>
1285 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1292 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->
get_dphi();
1296 for (
unsigned int l=0; l != n_dofs; l++)
1297 grad_u.add_scaled(dphi[l][0], coef(l));
1303#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1316template<
typename OutputType>
1319 OutputType & hess_u,
1320 const Real tolerance)
const
1327 const unsigned int n_dofs = cast_int<unsigned int>
1336 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1343 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->
get_d2phi();
1347 for (
unsigned int l=0; l != n_dofs; l++)
1348 hess_u.add_scaled(d2phi[l][0], coef(l));
1357template<
typename OutputType>
1359 OutputType & u)
const
1367template<
typename OutputType>
1369 OutputType & dudot)
const
1374 <OutputType>::type>::type>,
1378template<
typename OutputType>
1380 OutputType & u)
const
1388template<
typename OutputType>
1390 OutputType & u)
const
1400template<
typename OutputType>
1402 OutputType & u)
const
1489 pr.second->reinit(&(this->get_elem()), pts);
1492 else if (pr.first.family ==
SCALAR)
1493 pr.second->reinit(
nullptr);
1509 pr.second->reinit(&(this->get_elem()), this->
get_side());
1521 pr.second->edge_reinit(&(this->get_elem()), this->
get_edge());
1550 == this->get_elem().default_order()));
1555 == this->get_elem().default_order()));
1560 == this->get_elem().default_order()));
1565 for (
unsigned int i=0; i !=
n_nodes; ++i)
1569 for (
unsigned int i=0; i !=
n_nodes; ++i)
1573 for (
unsigned int i=0; i !=
n_nodes; ++i)
1590 pr.second->get_fe_map().set_jacobian_tolerance(tol);
1594 pr.second->get_fe_map().set_jacobian_tolerance(tol);
1597 pr.second->get_fe_map().set_jacobian_tolerance(tol);
1643 for (
unsigned int i=0; i !=
n_nodes; ++i)
1648 for (
unsigned int i=0; i !=
n_nodes; ++i)
1653 for (
unsigned int i=0; i !=
n_nodes; ++i)
1698#ifdef LIBMESH_ENABLE_AMR
1712 const unsigned int n_dofs = cast_int<unsigned int>
1714 const unsigned int n_qoi = sys.
n_qois();
1756 for (std::size_t q=0; q != n_qoi; ++q)
1763 unsigned int sub_dofs = 0;
1776#ifdef LIBMESH_ENABLE_AMR
1793 const unsigned int n_dofs_var = cast_int<unsigned int>
1802 (sub_dofs, n_dofs_var);
1813 (sub_dofs, n_dofs_var);
1820 (sub_dofs, n_dofs_var);
1826 (sub_dofs, n_dofs_var);
1831 (sub_dofs, n_dofs_var);
1833 for (std::size_t q=0; q != n_qoi; ++q)
1835 (sub_dofs, n_dofs_var);
1839 for (
unsigned int j=0; j != i; ++j)
1841 const unsigned int n_dofs_var_j =
1842 cast_int<unsigned int>
1847 n_dofs_var, n_dofs_var_j);
1850 n_dofs_var_j, n_dofs_var);
1853 (sub_dofs, sub_dofs,
1860 sub_dofs += n_dofs_var;
1868 libmesh_assert_equal_to (sub_dofs, n_dofs);
1879 for (; localized_vec_it != localized_vec_end; ++localized_vec_it)
1887 unsigned int sub_dofs = 0;
1888 auto init_localized_var_data = [
this, localized_vec_it, &sub_dofs](
unsigned int i)
1890 const unsigned int n_dofs_var = cast_int<unsigned int>
1896 localized_vec_it->second.second[i].reposition
1897 (sub_dofs, n_dofs_var);
1899 sub_dofs += n_dofs_var;
1904 init_localized_var_data(v);
1907 init_localized_var_data(v);
1909 libmesh_assert_equal_to (sub_dofs, n_dofs);
1920 cast_int<unsigned char>(this->
_elem ? this->
_elem->
dim() : 0);
1940 const int get_derivative_level )
const
1942#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1943 const bool fe_needs_inf =
1949 fe_type !=
_real_fe->get_fe_type() ||
1955#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1962#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1982 const int get_derivative_level )
const
1984#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1985 const bool fe_needs_inf =
1997#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2004#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2021template<
typename OutputShape>
2025 const Real tolerance,
2026 const int get_derivative_level)
const
2035#ifdef LIBMESH_ENABLE_AMR
2041 fe_type.
order -= add_p_level;
2043 fe_type.
order += add_p_level;
2050 cached_fe<OutputShape>(elem_dim, fe_type, get_derivative_level);
2051#ifdef LIBMESH_ENABLE_AMR
2061 std::vector<Point> coor(1, master_point);
2063 switch (get_derivative_level)
2068#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2080#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2084 libmesh_not_implemented();
2099 fe_new->
reinit (
nullptr, &coor);
2109template LIBMESH_EXPORT
void FEMContext::interior_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2110template LIBMESH_EXPORT
void FEMContext::interior_values<Number>(
unsigned int,
const NumericVector<Number> &,
2111 std::vector<Number> &)
const;
2112template LIBMESH_EXPORT
void FEMContext::interior_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2113template LIBMESH_EXPORT
void FEMContext::interior_values<Gradient>(
unsigned int,
const NumericVector<Number> &,
2114 std::vector<Gradient> &)
const;
2116template LIBMESH_EXPORT
void FEMContext::interior_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2117template LIBMESH_EXPORT
void FEMContext::interior_gradients<Gradient>(
unsigned int,
const NumericVector<Number> &,
2118 std::vector<Gradient> &)
const;
2119template LIBMESH_EXPORT
void FEMContext::interior_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2120template LIBMESH_EXPORT
void FEMContext::interior_gradients<Tensor>(
unsigned int,
const NumericVector<Number> &,
2121 std::vector<Tensor> &)
const;
2123#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2124template LIBMESH_EXPORT
void FEMContext::interior_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2125template LIBMESH_EXPORT
void FEMContext::interior_hessians<Tensor>(
unsigned int,
const NumericVector<Number> &,
2126 std::vector<Tensor> &)
const;
2133template LIBMESH_EXPORT
void FEMContext::interior_curl<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2135template LIBMESH_EXPORT
void FEMContext::interior_div<Number>(
unsigned int,
unsigned int,
Number &)
const;
2137template LIBMESH_EXPORT
void FEMContext::side_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2138template LIBMESH_EXPORT
void FEMContext::side_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2139template LIBMESH_EXPORT
void FEMContext::side_values<Number>(
unsigned int,
const NumericVector<Number> &,
2140 std::vector<Number> &)
const;
2141template LIBMESH_EXPORT
void FEMContext::side_values<Gradient>(
unsigned int,
const NumericVector<Number> &,
2142 std::vector<Gradient> &)
const;
2144template LIBMESH_EXPORT
void FEMContext::side_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2145template LIBMESH_EXPORT
void FEMContext::side_gradients<Gradient>(
unsigned int,
const NumericVector<Number> &,
2146 std::vector<Gradient> &)
const;
2147template LIBMESH_EXPORT
void FEMContext::side_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2148template LIBMESH_EXPORT
void FEMContext::side_gradients<Tensor>(
unsigned int,
const NumericVector<Number> &,
2149 std::vector<Tensor> &)
const;
2152#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2153template LIBMESH_EXPORT
void FEMContext::side_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2154template LIBMESH_EXPORT
void FEMContext::side_hessians<Tensor>(
unsigned int,
const NumericVector<Number> &,
2155 std::vector<Tensor> &)
const;
2163template LIBMESH_EXPORT
void FEMContext::point_value<Number>(
unsigned int,
const Point &,
Number &,
const Real)
const;
2164template LIBMESH_EXPORT
void FEMContext::point_value<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2166template LIBMESH_EXPORT
void FEMContext::point_gradient<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2167template LIBMESH_EXPORT
void FEMContext::point_gradient<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2169#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2170template LIBMESH_EXPORT
void FEMContext::point_hessian<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2175template LIBMESH_EXPORT
void FEMContext::point_curl<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2177template LIBMESH_EXPORT
void FEMContext::fixed_interior_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2178template LIBMESH_EXPORT
void FEMContext::fixed_interior_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2180template LIBMESH_EXPORT
void FEMContext::fixed_interior_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2181template LIBMESH_EXPORT
void FEMContext::fixed_interior_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2183#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2184template LIBMESH_EXPORT
void FEMContext::fixed_interior_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2189template LIBMESH_EXPORT
void FEMContext::fixed_side_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2190template LIBMESH_EXPORT
void FEMContext::fixed_side_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2192template LIBMESH_EXPORT
void FEMContext::fixed_side_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2193template LIBMESH_EXPORT
void FEMContext::fixed_side_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2195#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2196template LIBMESH_EXPORT
void FEMContext::fixed_side_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2201template LIBMESH_EXPORT
void FEMContext::fixed_point_value<Number>(
unsigned int,
const Point &,
Number &,
const Real)
const;
2202template LIBMESH_EXPORT
void FEMContext::fixed_point_value<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2204template LIBMESH_EXPORT
void FEMContext::fixed_point_gradient<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2205template LIBMESH_EXPORT
void FEMContext::fixed_point_gradient<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2207#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2208template LIBMESH_EXPORT
void FEMContext::fixed_point_hessian<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2213template LIBMESH_EXPORT
void FEMContext::interior_rate<Number>(
unsigned int,
unsigned int,
Number &)
const;
2214template LIBMESH_EXPORT
void FEMContext::interior_rate<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2216template LIBMESH_EXPORT
void FEMContext::interior_rate_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2217template LIBMESH_EXPORT
void FEMContext::interior_rate_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2219template LIBMESH_EXPORT
void FEMContext::side_rate<Number>(
unsigned int,
unsigned int,
Number &)
const;
2220template LIBMESH_EXPORT
void FEMContext::side_rate<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2222template LIBMESH_EXPORT
void FEMContext::interior_accel<Number>(
unsigned int,
unsigned int,
Number &)
const;
2223template LIBMESH_EXPORT
void FEMContext::interior_accel<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2225template LIBMESH_EXPORT
void FEMContext::side_accel<Number>(
unsigned int,
unsigned int,
Number &)
const;
2226template LIBMESH_EXPORT
void FEMContext::side_accel<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
Defines a dense subvector for use in finite element computations.
virtual unsigned int size() const override final
Defines a dense vector for use in Finite Element-type computations.
void resize(const unsigned int n)
Resize the vector.
std::vector< T > & get_values()
This class provides all data required for a physics package (e.g.
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< DenseSubVector< Number > > > > _localized_vectors
Contains pointers to vectors the user has asked to be localized, keyed with pairs of element localize...
const DenseVector< Number > & get_elem_solution_rate() const
Accessor for element solution rate of change w.r.t.
std::vector< DenseSubVector< Number > > _elem_fixed_subsolutions
std::vector< DenseSubVector< Number > > _elem_subsolutions
std::map< constNumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< DenseSubVector< Number > > > >::iterator localized_vectors_iterator
Typedef for the localized_vectors iterator.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
Real get_system_time() const
Accessor for the time variable stored in the system class.
std::vector< std::vector< DenseSubVector< Number > > > _elem_qoi_subderivatives
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
const DenseVector< Number > & get_elem_solution_accel() const
Accessor for element solution accel of change w.r.t.
void set_time(Real time_in)
Set the time for which the current nonlinear_solution is defined.
DenseSubVector< Number > & get_localized_subvector(const NumericVector< Number > &localized_vector, unsigned int var)
Return a reference to DenseSubVector localization of localized_vector at variable var contained in th...
const System & get_system() const
Accessor for associated system.
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
const bool _have_local_matrices
Whether we have local matrices allocated/initialized.
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
const std::set< unsigned int > & get_second_order_vars() const
This class provides a specific system class.
TimeSolver & get_time_solver()
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
void old_dof_indices(const Elem &elem, unsigned int n, std::vector< dof_id_type > &di, const unsigned int vn) const
Appends to the vector di the old global degree of freedom indices for elem.node_ref(n),...
This is the base class from which all geometric element types are derived.
const Point & point(const unsigned int i) const
virtual unsigned int n_nodes() const =0
virtual unsigned short dim() const =0
virtual bool infinite() const =0
void add_p_level_in_reinit(bool value)
Indicate whether to add p-refinement levels in init/reinit methods.
virtual void reinit(const Elem *elem, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)=0
This is at the core of this class.
static std::unique_ptr< FEAbstract > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
FEType get_fe_type() const
This class forms the foundation from which generic finite elements may be derived.
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
virtual_for_inffe const std::vector< std::vector< OutputDivergence > > & get_div_phi() const
const std::vector< std::vector< OutputShape > > & get_phi() const
const std::vector< std::vector< OutputGradient > > & get_dphi() const
static std::unique_ptr< FEGenericBase > build_InfFE(const unsigned int dim, const FEType &type)
Builds a specific infinite element type.
const std::vector< std::vector< OutputTensor > > & get_d2phi() const
virtual_for_inffe const std::vector< std::vector< OutputShape > > & get_curl_phi() const
This class provides all data required for a physics package (e.g.
const NumericVector< Number > * _custom_solution
Data with which to do algebra reinitialization.
void some_value(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_value methods.
FEType find_hardest_fe_type()
Helper function for creating quadrature rules.
void interior_values(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &interior_values_vector) const
Fills a vector of values of the _system_vector at the all the quadrature points in the current elemen...
void interior_curl(unsigned int var, unsigned int qp, OutputType &curl_u) const
virtual void side_fe_reinit()
Reinitializes side FE objects on the current geometric element.
void get_side_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in th...
void _do_elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
Gradient interior_gradient(unsigned int var, unsigned int qp) const
void interior_rate_gradient(unsigned int var, unsigned int qp, OutputType &u) const
void side_gradients(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &side_gradients_vector) const
Fills a vector with the gradient of the solution variable var at all the quadrature points on the cur...
std::map< FEType, std::unique_ptr< FEAbstract > > _edge_fe
System * _mesh_sys
System from which to acquire moving mesh information.
Number side_value(unsigned int var, unsigned int qp) const
void attach_quadrature_rules()
Helper function for attaching quadrature rules.
void some_hessian(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_hessian methods.
void interior_rate(unsigned int var, unsigned int qp, OutputType &u) const
Tensor side_hessian(unsigned int var, unsigned int qp) const
unsigned int get_mesh_y_var() const
Accessor for y-variable of moving mesh System.
bool _real_grad_fe_is_inf
std::vector< std::vector< FEAbstract * > > _element_fe_var
Pointers to the same finite element objects, but indexed by variable number.
void point_curl(unsigned int var, const Point &p, OutputType &curl_u, const Real tolerance=TOLERANCE) const
virtual void elem_reinit(Real theta) override
Resets the current time in the context.
Gradient fixed_side_gradient(unsigned int var, unsigned int qp) const
Number fixed_point_value(unsigned int var, const Point &p) const
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _element_fe
Finite element objects for each variable's interior, sides and edges.
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
std::vector< std::unique_ptr< QBase > > _side_qrule
Quadrature rules for element sides The FEM context will try to find a quadrature rule that correctly ...
void side_values(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &side_values_vector) const
Fills a vector of values of the _system_vector at the all the quadrature points on the current elemen...
FEGenericBase< OutputShape > * cached_fe(const unsigned int elem_dim, const FEType fe_type, const int get_derivative_level) const
Tensor fixed_side_hessian(unsigned int var, unsigned int qp) const
unsigned char side
Current side for side_* to examine.
void side_boundary_ids(std::vector< boundary_id_type > &vec_to_fill) const
As above, but fills in the std::set provided by the user.
int _real_fe_derivative_level
Gradient side_gradient(unsigned int var, unsigned int qp) const
const DenseSubVector< Number > &(DiffContext::* diff_subsolution_getter)(unsigned int) const
Helper typedef to simplify refactoring.
Number interior_value(unsigned int var, unsigned int qp) const
void some_gradient(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_gradient methods.
std::vector< std::vector< FEAbstract * > > _side_fe_var
unsigned char _elem_dim
Cached dimension of this->_elem.
void side_hessians(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &d2u_vals) const
Fills a vector of hessians of the _system_vector at the all the quadrature points on the current elem...
const Elem & get_elem() const
Accessor for current Elem object.
virtual void elem_side_reinit(Real theta) override
Resets the current time in the context.
void side_accel(unsigned int var, unsigned int qp, OutputType &u) const
void set_jacobian_tolerance(Real tol)
Calls set_jacobian_tolerance() on all the FE objects controlled by this class.
void elem_position_get()
Uses the geometry of elem to set the coordinate data specified by mesh_*_position configuration.
std::unique_ptr< FEGenericBase< RealGradient > > _real_grad_fe
void set_elem(const Elem *e)
Helper function to promote accessor usage.
void side_rate(unsigned int var, unsigned int qp, OutputType &u) const
void interior_hessians(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &d2u_vals) const
Fills a vector of hessians of the _system_vector at the all the quadrature points in the current elem...
virtual void elem_edge_reinit(Real theta) override
Resets the current time in the context.
FEMContext(const System &sys, const std::vector< unsigned int > *active_vars=nullptr, bool allocate_local_matrices=true)
Constructor.
int _real_grad_fe_derivative_level
void use_default_quadrature_rules(int extra_quadrature_order=0)
Use quadrature rules designed to over-integrate a mass matrix, plus extra_quadrature_order.
void elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
void interior_gradients(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &interior_gradients_vector) const
Fills a vector with the gradient of the solution variable var at all the quadrature points in the cur...
bool has_elem() const
Test for current Elem object.
void interior_div(unsigned int var, unsigned int qp, OutputType &div_u) const
FEGenericBase< OutputShape > * build_new_fe(const FEGenericBase< OutputShape > *fe, const Point &p, const Real tolerance=TOLERANCE, const int get_derivative_level=-1) const
Helper function to reduce some code duplication in the *_point_* methods.
void _update_time_from_system(Real theta)
Update the time in the context object for the given value of theta, based on the values of "time" and...
int _extra_quadrature_order
The extra quadrature order for this context.
void interior_accel(unsigned int var, unsigned int qp, OutputType &u) const
const Elem * _elem
Current element for element_* to examine.
unsigned char get_elem_dim() const
std::unique_ptr< const std::vector< unsigned int > > _active_vars
Variables on which to enable calculations, or nullptr if all variables in the System are to be enable...
unsigned int get_mesh_x_var() const
Accessor for x-variable of moving mesh System.
Number fixed_side_value(unsigned int var, unsigned int qp) const
const std::vector< unsigned int > * active_vars() const
Return a pointer to the vector of active variables being computed for, or a null pointer if all varia...
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
std::set< unsigned char > _elem_dims
Cached dimensions of elements in the mesh, plus dimension 0 if SCALAR variables are in use.
unsigned char get_side() const
Accessor for current side of Elem object.
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh.
Number point_value(unsigned int var, const Point &p) const
Tensor point_hessian(unsigned int var, const Point &p) const
std::vector< FEAbstract * > _edge_fe_var
virtual ~FEMContext()
Destructor.
Gradient point_gradient(unsigned int var, const Point &p) const
Tensor fixed_interior_hessian(unsigned int var, unsigned int qp) const
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _side_fe
Tensor fixed_point_hessian(unsigned int var, const Point &p) const
void use_unweighted_quadrature_rules(int extra_quadrature_order=0)
Use quadrature rules designed to exactly integrate unweighted undistorted basis functions,...
bool has_side_boundary_id(boundary_id_type id) const
Reports if the boundary id is found on the current side.
unsigned char get_edge() const
Accessor for current edge of Elem object.
Number fixed_interior_value(unsigned int var, unsigned int qp) const
const BoundaryInfo & _boundary_info
Saved reference to BoundaryInfo on the mesh for this System.
std::unique_ptr< QBase > _edge_qrule
Quadrature rules for element edges.
Gradient fixed_point_gradient(unsigned int var, const Point &p) const
AlgebraicType algebraic_type() const
Gradient fixed_interior_gradient(unsigned int var, unsigned int qp) const
unsigned int get_mesh_z_var() const
Accessor for z-variable of moving mesh System.
virtual void nonlocal_reinit(Real theta) override
Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new ...
std::vector< std::unique_ptr< QBase > > _element_qrule
Quadrature rule for element interior.
virtual void edge_fe_reinit()
Reinitializes edge FE objects on the current geometric element.
std::unique_ptr< FEGenericBase< Real > > _real_fe
void init_internal_data(const System &sys)
Helper function used in constructors to set up internal data.
Tensor interior_hessian(unsigned int var, unsigned int qp) const
static FEFamily map_fe_type(const Elem &elem)
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
std::unique_ptr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
std::unique_ptr< QBase > unweighted_quadrature_rule(const unsigned int dim, const int extraorder=0) const
OrderWrapper order
The approximation order of the element (at 0 p-refinement level).
bool p_refinement
Whether or not the finite elements for this type increase their p refinement level on geometric eleme...
FEFamily family
The type of finite element.
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Manages consistently variables, degrees of freedom, and coefficient vectors.
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e....
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
const FEType & variable_type(const unsigned int i) const
unsigned int n_qois() const
Number of currently active quantities of interest.
unsigned int n_vars() const
const DofMap & get_dof_map() const
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
virtual bool is_steady() const =0
Is this effectively a steady-state solver?
This is a generic class that defines a solver to handle time integration of DifferentiableSystems.
virtual unsigned int time_order() const =0
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Helper nested class for C++03-compatible "template typedef".
TensorTools::MakeReal< OutputType >::type value_shape
const dof_id_type n_nodes