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);
311 template<
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);
345 template<
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 378 template<
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));
420 template<
typename OutputType>
422 OutputType & u)
const 425 &FEMContext::get_element_fe<typename TensorTools::MakeReal<OutputType>::type>,
430 template<
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 478 template<
typename OutputType>
481 OutputType & du)
const 486 <OutputType>::type>::type>,
492 template<
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 540 template<
typename OutputType>
542 OutputType & d2u)
const 549 <OutputType>::type>::type>::type>,
554 template<
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));
593 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 596 template<
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));
627 template<
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 671 template<
typename OutputType>
674 OutputType & u)
const 677 &FEMContext::get_side_fe<typename TensorTools::MakeReal<OutputType>::type>,
682 template<
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);
728 template<
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));
762 template<
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 813 template<
typename OutputType>
816 OutputType & d2u)
const 823 <OutputType>::type>::type>::type>,
829 template<
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));
869 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 882 template<
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);
930 template<
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 981 template<
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));
1018 #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES 1021 template<
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));
1069 template<
typename OutputType>
1071 OutputType & u)
const 1091 template<
typename OutputType>
1093 OutputType & du)
const 1100 <OutputType>::type>::type>,
1107 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1118 template<
typename OutputType>
1120 OutputType & d2u)
const 1127 <OutputType>::type>::type>::type>,
1130 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1144 template<
typename OutputType>
1146 OutputType & u)
const 1168 template<
typename OutputType>
1170 OutputType & du)
const 1176 <OutputType>::type>::type>,
1182 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1192 template<
typename OutputType>
1194 OutputType & d2u)
const 1201 <OutputType>::type>::type>::type>,
1204 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1217 template<
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);
1265 template<
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 1316 template<
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));
1353 #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES 1357 template<
typename OutputType>
1359 OutputType & u)
const 1367 template<
typename OutputType>
1369 OutputType & dudot)
const 1374 <OutputType>::type>::type>,
1378 template<
typename OutputType>
1380 OutputType & u)
const 1388 template<
typename OutputType>
1390 OutputType & u)
const 1400 template<
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);
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)
1644 const_cast<Elem &>(this->
get_elem()).point(i)(0) =
1648 for (
unsigned int i=0; i !=
n_nodes; ++i)
1649 const_cast<Elem &>(this->
get_elem()).point(i)(1) =
1653 for (
unsigned int i=0; i !=
n_nodes; ++i)
1654 const_cast<Elem &>(this->
get_elem()).point(i)(2) =
1698 #ifdef LIBMESH_ENABLE_AMR 1710 #endif // 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 1787 #endif // 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 2021 template<
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;
2045 #endif // LIBMESH_ENABLE_AMR 2050 cached_fe<OutputShape>(elem_dim, fe_type, get_derivative_level);
2051 #ifdef LIBMESH_ENABLE_AMR 2053 #endif // 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);
2109 template LIBMESH_EXPORT
void FEMContext::interior_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2111 std::vector<Number> &)
const;
2112 template LIBMESH_EXPORT
void FEMContext::interior_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2114 std::vector<Gradient> &)
const;
2116 template LIBMESH_EXPORT
void FEMContext::interior_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2118 std::vector<Gradient> &)
const;
2119 template LIBMESH_EXPORT
void FEMContext::interior_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2121 std::vector<Tensor> &)
const;
2123 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 2124 template LIBMESH_EXPORT
void FEMContext::interior_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2126 std::vector<Tensor> &)
const;
2133 template LIBMESH_EXPORT
void FEMContext::interior_curl<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2135 template LIBMESH_EXPORT
void FEMContext::interior_div<Number>(
unsigned int,
unsigned int,
Number &)
const;
2137 template LIBMESH_EXPORT
void FEMContext::side_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2138 template LIBMESH_EXPORT
void FEMContext::side_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2140 std::vector<Number> &)
const;
2142 std::vector<Gradient> &)
const;
2144 template LIBMESH_EXPORT
void FEMContext::side_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2146 std::vector<Gradient> &)
const;
2147 template LIBMESH_EXPORT
void FEMContext::side_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2149 std::vector<Tensor> &)
const;
2152 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 2153 template LIBMESH_EXPORT
void FEMContext::side_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2155 std::vector<Tensor> &)
const;
2163 template LIBMESH_EXPORT
void FEMContext::point_value<Number>(
unsigned int,
const Point &,
Number &,
const Real)
const;
2164 template LIBMESH_EXPORT
void FEMContext::point_value<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2166 template LIBMESH_EXPORT
void FEMContext::point_gradient<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2167 template LIBMESH_EXPORT
void FEMContext::point_gradient<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2169 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 2170 template LIBMESH_EXPORT
void FEMContext::point_hessian<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2175 template LIBMESH_EXPORT
void FEMContext::point_curl<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2177 template LIBMESH_EXPORT
void FEMContext::fixed_interior_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2178 template LIBMESH_EXPORT
void FEMContext::fixed_interior_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2180 template LIBMESH_EXPORT
void FEMContext::fixed_interior_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2181 template LIBMESH_EXPORT
void FEMContext::fixed_interior_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2183 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 2184 template LIBMESH_EXPORT
void FEMContext::fixed_interior_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2189 template LIBMESH_EXPORT
void FEMContext::fixed_side_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2190 template LIBMESH_EXPORT
void FEMContext::fixed_side_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2192 template LIBMESH_EXPORT
void FEMContext::fixed_side_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2193 template LIBMESH_EXPORT
void FEMContext::fixed_side_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2195 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 2196 template LIBMESH_EXPORT
void FEMContext::fixed_side_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2201 template LIBMESH_EXPORT
void FEMContext::fixed_point_value<Number>(
unsigned int,
const Point &,
Number &,
const Real)
const;
2202 template LIBMESH_EXPORT
void FEMContext::fixed_point_value<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2204 template LIBMESH_EXPORT
void FEMContext::fixed_point_gradient<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2205 template LIBMESH_EXPORT
void FEMContext::fixed_point_gradient<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2207 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 2208 template LIBMESH_EXPORT
void FEMContext::fixed_point_hessian<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2213 template LIBMESH_EXPORT
void FEMContext::interior_rate<Number>(
unsigned int,
unsigned int,
Number &)
const;
2214 template LIBMESH_EXPORT
void FEMContext::interior_rate<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2216 template LIBMESH_EXPORT
void FEMContext::interior_rate_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2217 template LIBMESH_EXPORT
void FEMContext::interior_rate_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2219 template LIBMESH_EXPORT
void FEMContext::side_rate<Number>(
unsigned int,
unsigned int,
Number &)
const;
2220 template LIBMESH_EXPORT
void FEMContext::side_rate<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2222 template LIBMESH_EXPORT
void FEMContext::interior_accel<Number>(
unsigned int,
unsigned int,
Number &)
const;
2223 template LIBMESH_EXPORT
void FEMContext::interior_accel<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2225 template LIBMESH_EXPORT
void FEMContext::side_accel<Number>(
unsigned int,
unsigned int,
Number &)
const;
2226 template LIBMESH_EXPORT
void FEMContext::side_accel<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
void interior_curl(unsigned int var, unsigned int qp, OutputType &curl_u) const
FEFamily family
The type of finite element.
unsigned char get_edge() const
Accessor for current edge of Elem object.
bool p_refinement
Whether or not the finite elements for this type increase their p refinement level on geometric eleme...
virtual void nonlocal_reinit(Real theta) override
Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new ...
FEGenericBase< OutputShape > * cached_fe(const unsigned int elem_dim, const FEType fe_type, const int get_derivative_level) const
virtual_for_inffe const std::vector< std::vector< OutputDivergence > > & get_div_phi() const
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
Number fixed_side_value(unsigned int var, unsigned int qp) const
Number side_value(unsigned int var, unsigned int qp) const
Tensor fixed_point_hessian(unsigned int var, const Point &p) const
Number interior_value(unsigned int var, unsigned int qp) const
void elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
std::vector< DenseSubVector< Number > > _elem_fixed_subsolutions
This class provides all data required for a physics package (e.g.
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...
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
unsigned int get_mesh_x_var() const
Accessor for x-variable of moving mesh System.
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...
const NumericVector< Number > * _custom_solution
Data with which to do algebra reinitialization.
void set_elem(const Elem *e)
Helper function to promote accessor usage.
std::unique_ptr< FEGenericBase< RealGradient > > _real_grad_fe
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
const DenseVector< Number > & get_elem_solution_rate() const
Accessor for element solution rate of change w.r.t.
unsigned char get_elem_dim() const
const Elem & get_elem() const
Accessor for current Elem object.
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)
FEMContext(const System &sys, const std::vector< unsigned int > *active_vars=nullptr, bool allocate_local_matrices=true)
Constructor.
bool _real_grad_fe_is_inf
unsigned int n_qois() const
Number of currently active quantities of interest.
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...
void interior_accel(unsigned int var, unsigned int qp, OutputType &u) const
TensorTools::MakeReal< OutputType >::type value_shape
const DenseSubVector< Number > &(DiffContext::* diff_subsolution_getter)(unsigned int) const
Helper typedef to simplify refactoring.
void resize(const unsigned int n)
Resize the vector.
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...
std::vector< T > & get_values()
virtual void elem_edge_reinit(Real theta) override
Resets the current time in the context.
This is the base class from which all geometric element types are derived.
OrderWrapper order
The approximation order of the element (at 0 p-refinement level).
int _extra_quadrature_order
The extra quadrature order for this context.
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.
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
std::vector< std::vector< DenseSubVector< Number > > > _elem_qoi_subderivatives
virtual bool is_steady() const =0
Is this effectively a steady-state solver?
void elem_position_get()
Uses the geometry of elem to set the coordinate data specified by mesh_*_position configuration...
The libMesh namespace provides an interface to certain functionality in the library.
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...
bool has_side_boundary_id(boundary_id_type id) const
Reports if the boundary id is found on the current side.
void use_default_quadrature_rules(int extra_quadrature_order=0)
Use quadrature rules designed to over-integrate a mass matrix, plus extra_quadrature_order.
virtual ~FEMContext()
Destructor.
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.
unsigned char get_side() const
Accessor for current side of Elem object.
Number 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 elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
const bool _have_local_matrices
Whether we have local matrices allocated/initialized.
std::unique_ptr< FEGenericBase< Real > > _real_fe
Number fixed_interior_value(unsigned int var, unsigned int qp) const
Tnew cast_int(Told oldvar)
void interior_rate_gradient(unsigned int var, unsigned int qp, OutputType &u) const
Defines a dense subvector for use in finite element computations.
FEType get_fe_type() const
This class provides a specific system class.
Tensor fixed_side_hessian(unsigned int var, unsigned int qp) const
std::unique_ptr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
const std::vector< std::vector< OutputGradient > > & get_dphi() const
std::set< unsigned char > _elem_dims
Cached dimensions of elements in the mesh, plus dimension 0 if SCALAR variables are in use...
Gradient interior_gradient(unsigned int var, unsigned int qp) const
void point_curl(unsigned int var, const Point &p, OutputType &curl_u, const Real tolerance=TOLERANCE) const
const dof_id_type n_nodes
virtual unsigned int time_order() const =0
const std::set< unsigned int > & get_second_order_vars() const
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
unsigned char _elem_dim
Cached dimension of this->_elem.
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...
Tensor side_hessian(unsigned int var, unsigned int qp) const
virtual void side_fe_reinit()
Reinitializes side FE objects on the current geometric element.
std::map< FEType, std::unique_ptr< FEAbstract > > _edge_fe
const System & get_system() const
Accessor for associated system.
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...
virtual unsigned int n_nodes() const =0
void init_internal_data(const System &sys)
Helper function used in constructors to set up internal data.
Gradient fixed_point_gradient(unsigned int var, const Point &p) const
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e...
void side_accel(unsigned int var, unsigned int qp, OutputType &u) const
Manages consistently variables, degrees of freedom, and coefficient vectors.
void set_jacobian_tolerance(Real tol)
Calls set_jacobian_tolerance() on all the FE objects controlled by this class.
System * _mesh_sys
System from which to acquire moving mesh information.
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...
void some_value(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_value methods.
void some_hessian(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_hessian methods. ...
FEType find_hardest_fe_type()
Helper function for creating quadrature rules.
void add_p_level_in_reinit(bool value)
Indicate whether to add p-refinement levels in init/reinit methods.
Tensor interior_hessian(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...
Tensor point_hessian(unsigned int var, const Point &p) const
Gradient fixed_interior_gradient(unsigned int var, unsigned int qp) const
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
void use_unweighted_quadrature_rules(int extra_quadrature_order=0)
Use quadrature rules designed to exactly integrate unweighted undistorted basis functions, plus extra_quadrature_order.
This class provides all data required for a physics package (e.g.
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.
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...
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
const BoundaryInfo & _boundary_info
Saved reference to BoundaryInfo on the mesh for this System.
void set_time(Real time_in)
Set the time for which the current nonlinear_solution is defined.
std::vector< std::vector< FEAbstract * > > _element_fe_var
Pointers to the same finite element objects, but indexed by variable number.
const std::vector< std::vector< OutputTensor > > & get_d2phi() const
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< DenseSubVector< Number > > > >::iterator localized_vectors_iterator
Typedef for the localized_vectors iterator.
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...
int _real_grad_fe_derivative_level
virtual void elem_side_reinit(Real theta) override
Resets the current time in the context.
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...
Real get_system_time() const
Accessor for the time variable stored in the system class.
Number fixed_point_value(unsigned int var, const Point &p) const
virtual void edge_fe_reinit()
Reinitializes edge FE objects on the current geometric element.
std::vector< DenseSubVector< Number > > _elem_subsolutions
std::vector< FEAbstract * > _edge_fe_var
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
This is a generic class that defines a solver to handle time integration of DifferentiableSystems.
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 ...
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _side_fe
const FEType & variable_type(const unsigned int i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::unique_ptr< QBase > > _element_qrule
Quadrature rule for element interior.
std::unique_ptr< QBase > unweighted_quadrature_rule(const unsigned int dim, const int extraorder=0) const
unsigned char side
Current side for side_* to examine.
virtual unsigned short dim() const =0
int _real_fe_derivative_level
const DenseVector< Number > & get_elem_solution_accel() const
Accessor for element solution accel of change w.r.t.
static std::unique_ptr< FEAbstract > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
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...
std::unique_ptr< QBase > _edge_qrule
Quadrature rules for element edges.
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Helper nested class for C++03-compatible "template typedef".
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...
static std::unique_ptr< FEGenericBase > build_InfFE(const unsigned int dim, const FEType &type)
Builds a specific infinite element type.
Gradient fixed_side_gradient(unsigned int var, unsigned int qp) const
unsigned int get_mesh_y_var() const
Accessor for y-variable of moving mesh System.
AlgebraicType algebraic_type() 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 interior_div(unsigned int var, unsigned int qp, OutputType &div_u) const
virtual bool infinite() const =0
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 int n_vars() const
Gradient point_gradient(unsigned int var, const Point &p) const
const Elem * _elem
Current element for element_* to examine.
void attach_quadrature_rules()
Helper function for attaching quadrature rules.
void _do_elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
virtual Order default_order() const =0
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
bool has_elem() const
Test for current Elem object.
Gradient side_gradient(unsigned int var, unsigned int qp) const
const DofMap & get_dof_map() const
void interior_rate(unsigned int var, unsigned int qp, OutputType &u) const
A Point defines a location in LIBMESH_DIM dimensional Real space.
const Point & point(const unsigned int i) const
void ErrorVector unsigned int
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
void side_rate(unsigned int var, unsigned int qp, OutputType &u) const
This class forms the foundation from which generic finite elements may be derived.
virtual void elem_reinit(Real theta) override
Resets the current time in the context.
unsigned int get_mesh_z_var() const
Accessor for z-variable of moving mesh System.
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
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), for one variable vn.
virtual_for_inffe const std::vector< std::vector< OutputShape > > & get_curl_phi() const
const std::vector< std::vector< OutputShape > > & get_phi() const
TimeSolver & get_time_solver()
static FEFamily map_fe_type(const Elem &elem)
Tensor fixed_interior_hessian(unsigned int var, unsigned int qp) const