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,
248 const bool add_p_level = dof_map.
should_p_refine(dof_map.var_group_from_var_number(i));
255 element_fe->add_p_level_in_reinit(add_p_level);
257 side_fe->add_p_level_in_reinit(add_p_level);
263 edge_fe->add_p_level_in_reinit(add_p_level);
283 build_var_fe(
dim, v);
286 build_var_fe(
dim, v);
312 template<
typename OutputType,
318 const unsigned int n_dofs = cast_int<unsigned int>
323 libmesh_assert_equal_to(coef.size(), n_dofs);
330 const std::vector<std::vector
332 libmesh_assert_equal_to(phi.size(), n_dofs);
337 for (
unsigned int l=0; l != n_dofs; l++)
339 libmesh_assert_less(qp, phi[l].size());
340 u += phi[l][qp] * coef(l);
346 template<
typename OutputType,
352 const unsigned int n_dofs = cast_int<unsigned int>
363 const std::vector<std::vector
370 for (
unsigned int l=0; l != n_dofs; l++)
371 du.add_scaled(dphi[l][qp], coef(l));
378 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 379 template<
typename OutputType,
385 const unsigned int n_dofs = cast_int<unsigned int>
396 const std::vector<std::vector
403 for (
unsigned int l=0; l != n_dofs; l++)
404 d2u.add_scaled(d2phi[l][qp], coef(l));
421 template<
typename OutputType>
423 OutputType & u)
const 426 &FEMContext::get_element_fe<typename TensorTools::MakeReal<OutputType>::type>,
431 template<
typename OutputType>
434 std::vector<OutputType> & u_vals)
const 439 const unsigned int n_dofs = cast_int<unsigned int>
447 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
450 const std::vector<std::vector<OutputShape>> & phi = fe->
get_phi();
455 OutputType & u = u_vals[qp];
460 for (
unsigned int l=0; l != n_dofs; l++)
461 u += phi[l][qp] * coef(l);
468 unsigned int qp)
const 479 template<
typename OutputType>
482 OutputType & du)
const 487 <OutputType>::type>::type>,
493 template<
typename OutputType>
496 std::vector<OutputType> & du_vals)
const 503 const unsigned int n_dofs = cast_int<unsigned int>
511 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
514 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe->
get_dphi();
519 OutputType & du = du_vals[qp];
524 for (
unsigned int l=0; l != n_dofs; l++)
525 du.add_scaled(dphi[l][qp], coef(l));
531 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 541 template<
typename OutputType>
543 OutputType & d2u)
const 550 <OutputType>::type>::type>::type>,
555 template<
typename OutputType>
558 std::vector<OutputType> & d2u_vals)
const 565 const unsigned int n_dofs = cast_int<unsigned int>
573 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
576 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe->
get_d2phi();
581 OutputType & d2u = d2u_vals[qp];
586 for (
unsigned int l=0; l != n_dofs; l++)
587 d2u.add_scaled(d2phi[l][qp], coef(l));
594 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 597 template<
typename OutputType>
599 OutputType & curl_u)
const 604 const unsigned int n_dofs = cast_int<unsigned int>
613 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
616 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe->
get_curl_phi();
621 for (
unsigned int l=0; l != n_dofs; l++)
622 curl_u.add_scaled(curl_phi[l][qp], coef(l));
628 template<
typename OutputType>
630 OutputType & div_u)
const 637 const unsigned int n_dofs = cast_int<unsigned int>
646 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
649 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputDivergence>> & div_phi = fe->
get_div_phi();
654 for (
unsigned int l=0; l != n_dofs; l++)
655 div_u += div_phi[l][qp] * coef(l);
662 unsigned int qp)
const 672 template<
typename OutputType>
675 OutputType & u)
const 678 &FEMContext::get_side_fe<typename TensorTools::MakeReal<OutputType>::type>,
683 template<
typename OutputType>
686 std::vector<OutputType> & u_vals)
const 691 const unsigned int n_dofs = cast_int<unsigned int>
699 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
702 const std::vector<std::vector<OutputShape>> & phi = the_side_fe->
get_phi();
707 OutputType & u = u_vals[qp];
712 for (
unsigned int l=0; l != n_dofs; l++)
713 u += phi[l][qp] * coef(l);
729 template<
typename OutputType>
731 OutputType & du)
const 738 const unsigned int n_dofs = cast_int<unsigned int>
747 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
750 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->
get_dphi();
755 for (
unsigned int l=0; l != n_dofs; l++)
756 du.add_scaled(dphi[l][qp], coef(l));
763 template<
typename OutputType>
766 std::vector<OutputType> & du_vals)
const 773 const unsigned int n_dofs = cast_int<unsigned int>
781 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
784 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->
get_dphi();
789 OutputType & du = du_vals[qp];
794 for (
unsigned int l=0; l != n_dofs; l++)
795 du.add_scaled(dphi[l][qp], coef(l));
801 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 803 unsigned int qp)
const 814 template<
typename OutputType>
817 OutputType & d2u)
const 824 <OutputType>::type>::type>::type>,
830 template<
typename OutputType>
833 std::vector<OutputType> & d2u_vals)
const 840 const unsigned int n_dofs = cast_int<unsigned int>
848 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
851 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = the_side_fe->
get_d2phi();
856 OutputType & d2u = d2u_vals[qp];
861 for (
unsigned int l=0; l != n_dofs; l++)
862 d2u.add_scaled(d2phi[l][qp], coef(l));
870 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 883 template<
typename OutputType>
887 const Real tolerance)
const 892 const unsigned int n_dofs = cast_int<unsigned int>
901 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
908 const std::vector<std::vector<OutputShape>> & phi = fe_new->get_phi();
912 for (
unsigned int l=0; l != n_dofs; l++)
913 u += phi[l][0] * coef(l);
931 template<
typename OutputType>
935 const Real tolerance)
const 942 const unsigned int n_dofs = cast_int<unsigned int>
951 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
958 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->get_dphi();
962 for (
unsigned int l=0; l != n_dofs; l++)
963 grad_u.add_scaled(dphi[l][0], coef(l));
970 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 982 template<
typename OutputType>
986 const Real tolerance)
const 993 const unsigned int n_dofs = cast_int<unsigned int>
1002 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1009 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->get_d2phi();
1013 for (
unsigned int l=0; l != n_dofs; l++)
1014 hess_u.add_scaled(d2phi[l][0], coef(l));
1019 #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES 1022 template<
typename OutputType>
1025 OutputType & curl_u,
1026 const Real tolerance)
const 1031 const unsigned int n_dofs = cast_int<unsigned int>
1040 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1047 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe_new->get_curl_phi();
1051 for (
unsigned int l=0; l != n_dofs; l++)
1052 curl_u.add_scaled(curl_phi[l][0], coef(l));
1070 template<
typename OutputType>
1072 OutputType & u)
const 1092 template<
typename OutputType>
1094 OutputType & du)
const 1101 <OutputType>::type>::type>,
1108 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1119 template<
typename OutputType>
1121 OutputType & d2u)
const 1128 <OutputType>::type>::type>::type>,
1131 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1145 template<
typename OutputType>
1147 OutputType & u)
const 1169 template<
typename OutputType>
1171 OutputType & du)
const 1177 <OutputType>::type>::type>,
1183 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1193 template<
typename OutputType>
1195 OutputType & d2u)
const 1202 <OutputType>::type>::type>::type>,
1205 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1218 template<
typename OutputType>
1222 const Real tolerance)
const 1227 const unsigned int n_dofs = cast_int<unsigned int>
1236 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1243 const std::vector<std::vector<OutputShape>> & phi = fe_new->get_phi();
1247 for (
unsigned int l=0; l != n_dofs; l++)
1248 u += phi[l][0] * coef(l);
1266 template<
typename OutputType>
1269 OutputType & grad_u,
1270 const Real tolerance)
const 1277 const unsigned int n_dofs = cast_int<unsigned int>
1286 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1293 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->get_dphi();
1297 for (
unsigned int l=0; l != n_dofs; l++)
1298 grad_u.add_scaled(dphi[l][0], coef(l));
1304 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1317 template<
typename OutputType>
1320 OutputType & hess_u,
1321 const Real tolerance)
const 1328 const unsigned int n_dofs = cast_int<unsigned int>
1337 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1344 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->get_d2phi();
1348 for (
unsigned int l=0; l != n_dofs; l++)
1349 hess_u.add_scaled(d2phi[l][0], coef(l));
1354 #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES 1358 template<
typename OutputType>
1360 OutputType & u)
const 1368 template<
typename OutputType>
1370 OutputType & dudot)
const 1375 <OutputType>::type>::type>,
1379 template<
typename OutputType>
1381 OutputType & u)
const 1389 template<
typename OutputType>
1391 OutputType & u)
const 1401 template<
typename OutputType>
1403 OutputType & u)
const 1490 pr.second->reinit(&(this->
get_elem()), pts);
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.
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
Fills the vector di with the global degree of freedom indices for the element.
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.
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.
void should_p_refine(unsigned int g, bool p_refine)
Describe whether the given variable group should be p-refined.
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