libMesh
Loading...
Searching...
No Matches
fem_context.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
20#ifndef LIBMESH_FEM_CONTEXT_H
21#define LIBMESH_FEM_CONTEXT_H
22
23// Local Includes
24#include "libmesh/diff_context.h"
25#include "libmesh/id_types.h"
26#include "libmesh/enum_quadrature_type.h"
27#include "libmesh/fe_type.h"
28#include "libmesh/fe_base.h"
29#include "libmesh/vector_value.h"
30
31#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
32#include "libmesh/tensor_value.h"
33#endif
34
35// C++ includes
36#include <map>
37#include <set>
38
39namespace libMesh
40{
41
42// Forward Declarations
43class BoundaryInfo;
44class Elem;
45template <typename T> class FEGenericBase;
47class QBase;
48class Point;
49template <typename T> class NumericVector;
50
63class FEMContext : public DiffContext
64{
65public:
66
74 explicit
75 FEMContext (const System & sys,
76 const std::vector<unsigned int> * active_vars = nullptr,
77 bool allocate_local_matrices = true);
78
87 explicit
88 FEMContext (const System & sys,
89 int extra_quadrature_order,
90 const std::vector<unsigned int> * active_vars = nullptr,
91 bool allocate_local_matrices = true);
92
93
97 virtual ~FEMContext ();
98
103 void use_default_quadrature_rules(int extra_quadrature_order=0);
104
109 void use_unweighted_quadrature_rules(int extra_quadrature_order=0);
110
126 void use_quadrature_rules(QuadratureType qt, int extra_quadrature_order=0);
127
132
136 void side_boundary_ids(std::vector<boundary_id_type> & vec_to_fill) const;
137
144 Number interior_value(unsigned int var, unsigned int qp) const;
145
152 Number side_value(unsigned int var, unsigned int qp) const;
153
160 Number point_value(unsigned int var, const Point & p) const;
161
168 Gradient interior_gradient(unsigned int var, unsigned int qp) const;
169
176 Gradient side_gradient(unsigned int var, unsigned int qp) const;
177
184 Gradient point_gradient(unsigned int var, const Point & p) const;
185
186#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
193 Tensor interior_hessian(unsigned int var, unsigned int qp) const;
194
201 Tensor side_hessian(unsigned int var, unsigned int qp) const;
202
209 Tensor point_hessian(unsigned int var, const Point & p) const;
210
211#endif // LIBMESH_ENABLE_SECOND_DERIVATIVES
212
219 Number fixed_interior_value(unsigned int var, unsigned int qp) const;
220
227 Number fixed_side_value(unsigned int var, unsigned int qp) const;
228
235 Number fixed_point_value(unsigned int var, const Point & p) const;
236
243 Gradient fixed_interior_gradient(unsigned int var, unsigned int qp) const;
244
251 Gradient fixed_side_gradient(unsigned int var, unsigned int qp) const;
252
259 Gradient fixed_point_gradient(unsigned int var, const Point & p) const;
260
261#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
268 Tensor fixed_interior_hessian(unsigned int var, unsigned int qp) const;
269
276 Tensor fixed_side_hessian(unsigned int var, unsigned int qp) const;
277
284 Tensor fixed_point_hessian (unsigned int var, const Point & p) const;
285
286#endif // LIBMESH_ENABLE_SECOND_DERIVATIVES
287
294 template<typename OutputShape>
295 void get_element_fe( unsigned int var, FEGenericBase<OutputShape> *& fe ) const
296 { this->get_element_fe<OutputShape>(var,fe,this->get_elem_dim()); }
297
304 FEBase * get_element_fe( unsigned int var ) const
305 { return this->get_element_fe(var,this->get_elem_dim()); }
306
311 template<typename OutputShape>
312 void get_element_fe( unsigned int var, FEGenericBase<OutputShape> *& fe,
313 unsigned short dim ) const;
314
319 void get_element_fe( unsigned int var, FEAbstract *& fe,
320 unsigned short dim ) const;
321
326 FEBase * get_element_fe( unsigned int var, unsigned short dim ) const;
327
334 template<typename OutputShape>
335 void get_side_fe( unsigned int var, FEGenericBase<OutputShape> *& fe ) const
336 { this->get_side_fe<OutputShape>(var,fe,this->get_elem_dim()); }
337
344 FEBase * get_side_fe( unsigned int var ) const
345 { return this->get_side_fe(var,this->get_elem_dim()); }
346
351 template<typename OutputShape>
352 void get_side_fe( unsigned int var, FEGenericBase<OutputShape> *& fe,
353 unsigned short dim ) const;
354
359 void get_side_fe( unsigned int var, FEAbstract *& fe,
360 unsigned short dim ) const;
361
366 FEBase * get_side_fe( unsigned int var, unsigned short dim ) const;
367
371 template<typename OutputShape>
372 void get_edge_fe( unsigned int var, FEGenericBase<OutputShape> *& fe ) const;
373
374 void get_edge_fe( unsigned int var, FEAbstract *& fe ) const;
375
379 FEBase * get_edge_fe( unsigned int var ) const;
380
387 template<typename OutputType>
388 void interior_value(unsigned int var,
389 unsigned int qp,
390 OutputType & u) const;
391
396 template<typename OutputType>
397 void interior_values(unsigned int var,
398 const NumericVector<Number> & _system_vector,
399 std::vector<OutputType> & interior_values_vector) const;
400
407 template<typename OutputType>
408 void side_value(unsigned int var,
409 unsigned int qp,
410 OutputType & u) const;
411
416 template<typename OutputType>
417 void side_values(unsigned int var,
418 const NumericVector<Number> & _system_vector,
419 std::vector<OutputType> & side_values_vector) const;
420
430 template<typename OutputType>
431 void point_value(unsigned int var,
432 const Point & p,
433 OutputType & u,
434 const Real tolerance = TOLERANCE) const;
435
442 template<typename OutputType>
443 void interior_gradient(unsigned int var, unsigned int qp,
444 OutputType & du) const;
445
452 template<typename OutputType>
453 void interior_gradients(unsigned int var,
454 const NumericVector<Number> & _system_vector,
455 std::vector<OutputType> & interior_gradients_vector) const;
456
463 template<typename OutputType>
464 void side_gradient(unsigned int var,
465 unsigned int qp,
466 OutputType & du) const;
467
474 template<typename OutputType>
475 void side_gradients(unsigned int var,
476 const NumericVector<Number> & _system_vector,
477 std::vector<OutputType> & side_gradients_vector) const;
478
488 template<typename OutputType>
489 void point_gradient(unsigned int var,
490 const Point & p,
491 OutputType & grad_u,
492 const Real tolerance = TOLERANCE) const;
493
494#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
501 template<typename OutputType>
502 void interior_hessian(unsigned int var,
503 unsigned int qp,
504 OutputType & d2u) const;
505
511 template<typename OutputType>
512 void interior_hessians(unsigned int var,
513 const NumericVector<Number> & _system_vector,
514 std::vector<OutputType> & d2u_vals) const;
515
522 template<typename OutputType>
523 void side_hessian(unsigned int var,
524 unsigned int qp,
525 OutputType & d2u) const;
526
532 template<typename OutputType>
533 void side_hessians(unsigned int var,
534 const NumericVector<Number> & _system_vector,
535 std::vector<OutputType> & d2u_vals) const;
536
546 template<typename OutputType>
547 void point_hessian(unsigned int var,
548 const Point & p,
549 OutputType & hess_u,
550 const Real tolerance = TOLERANCE) const;
551
552#endif // LIBMESH_ENABLE_SECOND_DERIVATIVES
553
559 template<typename OutputType>
560 void interior_rate(unsigned int var,
561 unsigned int qp,
562 OutputType & u) const;
563
564
570 template<typename OutputType>
571 void interior_rate_gradient(unsigned int var,
572 unsigned int qp,
573 OutputType & u) const;
574
575
580 template<typename OutputType>
581 void side_rate(unsigned int var,
582 unsigned int qp,
583 OutputType & u) const;
584
589 template<typename OutputType>
590 void point_rate(unsigned int var,
591 const Point & p,
592 OutputType & u) const;
593
599 template<typename OutputType>
600 void interior_accel(unsigned int var,
601 unsigned int qp,
602 OutputType & u) const;
603
608 template<typename OutputType>
609 void side_accel(unsigned int var,
610 unsigned int qp,
611 OutputType & u) const;
612
617 template<typename OutputType>
618 void point_accel(unsigned int var,
619 const Point & p,
620 OutputType & u) const;
621
628 template<typename OutputType>
629 void fixed_interior_value(unsigned int var,
630 unsigned int qp,
631 OutputType & u) const;
632
639 template<typename OutputType>
640 void fixed_side_value(unsigned int var,
641 unsigned int qp,
642 OutputType & u) const;
643
653 template<typename OutputType>
654 void fixed_point_value(unsigned int var,
655 const Point & p,
656 OutputType & u,
657 const Real tolerance = TOLERANCE) const;
658
665 template<typename OutputType>
666 void fixed_interior_gradient(unsigned int var,
667 unsigned int qp,
668 OutputType & grad_u) const;
669
676 template<typename OutputType>
677 void fixed_side_gradient(unsigned int var,
678 unsigned int qp,
679 OutputType & grad_u) const;
680
690 template<typename OutputType>
691 void fixed_point_gradient(unsigned int var,
692 const Point & p,
693 OutputType & grad_u,
694 const Real tolerance = TOLERANCE) const;
695
696#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
703 template<typename OutputType>
704 void fixed_interior_hessian(unsigned int var,
705 unsigned int qp,
706 OutputType & hess_u) const;
707
714 template<typename OutputType>
715 void fixed_side_hessian(unsigned int var,
716 unsigned int qp,
717 OutputType & hess_u) const;
718
728 template<typename OutputType>
729 void fixed_point_hessian(unsigned int var,
730 const Point & p,
731 OutputType & hess_u,
732 const Real tolerance = TOLERANCE) const;
733
734#endif // LIBMESH_ENABLE_SECOND_DERIVATIVES
735
740 template<typename OutputType>
741 void interior_curl(unsigned int var,
742 unsigned int qp,
743 OutputType & curl_u) const;
744
752 template<typename OutputType>
753 void point_curl(unsigned int var,
754 const Point & p,
755 OutputType & curl_u,
756 const Real tolerance = TOLERANCE) const;
757
762 template<typename OutputType>
763 void interior_div(unsigned int var,
764 unsigned int qp,
765 OutputType & div_u) const;
766
767 // should be protected:
773 virtual void elem_reinit(Real theta) override;
774
780 virtual void elem_side_reinit(Real theta) override;
781
787 virtual void elem_edge_reinit(Real theta) override;
788
793 virtual void nonlocal_reinit(Real theta) override;
794
798 virtual void pre_fe_reinit(const System &,
799 const Elem * e);
800
804 virtual void elem_fe_reinit(const std::vector<Point> * const pts = nullptr);
805
809 virtual void side_fe_reinit();
810
814 virtual void edge_fe_reinit();
815
820 const QBase & get_element_qrule() const
821 { return this->get_element_qrule(this->get_elem_dim()); }
822
827 const QBase & get_side_qrule() const
828 { return this->get_side_qrule(this->get_elem_dim()); }
829
833 const QBase & get_element_qrule( unsigned short dim ) const
835 return *(this->_element_qrule[dim]); }
836
840 const QBase & get_side_qrule( unsigned short dim ) const
841 {
843 return *(this->_side_qrule[dim]);
844 }
845
849 const QBase & get_edge_qrule() const
850 { return *(this->_edge_qrule); }
851
860 virtual void set_mesh_system(System * sys)
861 { this->_mesh_sys = sys; }
862
866 const System * get_mesh_system() const
867 { return this->_mesh_sys; }
868
873 { return this->_mesh_sys; }
874
878 unsigned int get_mesh_x_var() const
879 { return _mesh_x_var; }
880
886 void set_mesh_x_var(unsigned int x_var)
887 { _mesh_x_var = x_var; }
888
892 unsigned int get_mesh_y_var() const
893 { return _mesh_y_var; }
894
900 void set_mesh_y_var(unsigned int y_var)
901 { _mesh_y_var = y_var; }
902
906 unsigned int get_mesh_z_var() const
907 { return _mesh_z_var; }
908
914 void set_mesh_z_var(unsigned int z_var)
915 { _mesh_z_var = z_var; }
916
920 bool has_elem() const
921 { return (this->_elem != nullptr); }
922
926 const Elem & get_elem() const
927 { libmesh_assert(this->_elem);
928 return *(this->_elem); }
929
934 { libmesh_assert(this->_elem);
935 return *(const_cast<Elem *>(this->_elem)); }
936
940 unsigned char get_side() const
941 { return side; }
942
946 unsigned char get_edge() const
947 { return edge; }
948
954 unsigned char get_dim() const
955 { return this->_dim; }
956
962 unsigned char get_elem_dim() const
963 { return this->_elem ? this->_elem_dim : this->_dim; }
964
969 const std::set<unsigned char> & elem_dimensions() const
970 { return _elem_dims; }
971
977 void elem_position_set(Real theta);
978
983 void elem_position_get();
984
989 enum AlgebraicType { NONE = 0, // Do not reinitialize dof_indices
990 DOFS_ONLY, // Reinitialize dof_indices, not
991 // algebraic structures
992 CURRENT, // Use dof_indices, current solution
993 OLD, // Use old_dof_indices, custom solution
994 OLD_DOFS_ONLY}; // Reinitialize old_dof_indices, not
995 // algebraic structures
996
1005 { _atype = atype; }
1006
1007 /*
1008 * Get the current AlgebraicType setting
1009 */
1011
1020 { _custom_solution = custom_sol; }
1021
1026 void set_jacobian_tolerance(Real tol);
1027
1031 unsigned char side;
1032
1036 unsigned char edge;
1037
1042
1047
1052 const std::vector<unsigned int> * active_vars() const { return _active_vars.get(); }
1053
1060 template<typename OutputShape>
1062 const Point & p,
1063 const Real tolerance = TOLERANCE,
1064 const int get_derivative_level = -1) const;
1065
1066protected:
1067
1072 std::unique_ptr<const std::vector<unsigned int>> _active_vars;
1073
1078
1083
1088
1093
1094 mutable std::unique_ptr<FEGenericBase<Real>> _real_fe;
1095 mutable std::unique_ptr<FEGenericBase<RealGradient>> _real_grad_fe;
1098
1099#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1100 mutable bool _real_fe_is_inf;
1102#endif
1103
1104 template<typename OutputShape>
1105 FEGenericBase<OutputShape> * cached_fe( const unsigned int elem_dim,
1106 const FEType fe_type,
1107 const int get_derivative_level ) const;
1108
1112 void set_elem( const Elem * e );
1113
1114 // gcc-3.4, oracle 12.3 require this typedef to be public
1115 // in order to use it in a return type
1116public:
1117
1121 typedef const DenseSubVector<Number> & (DiffContext::*diff_subsolution_getter)(unsigned int) const;
1122
1123protected:
1127 template <typename OutputType>
1129 {
1130 // Rank decrementer helper types
1133
1134 // Typedefs for "Value getter" function pointer
1137 typedef void (FEMContext::*value_getter) (unsigned int, value_base *&, unsigned short) const;
1138
1139 // Typedefs for "Grad getter" function pointer
1142 typedef void (FEMContext::*grad_getter) (unsigned int, grad_base *&, unsigned short) const;
1143
1144 // Typedefs for "Hessian getter" function pointer
1147 typedef void (FEMContext::*hess_getter) (unsigned int, hess_base *&, unsigned short) const;
1148 };
1149
1150
1151
1156 template<typename OutputType,
1157 typename FENeeded<OutputType>::value_getter fe_getter,
1158 diff_subsolution_getter subsolution_getter>
1159 void some_value(unsigned int var, unsigned int qp, OutputType & u) const;
1160
1165 template<typename OutputType,
1166 typename FENeeded<OutputType>::grad_getter fe_getter,
1167 diff_subsolution_getter subsolution_getter>
1168 void some_gradient(unsigned int var, unsigned int qp, OutputType & u) const;
1169
1170#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1175 template<typename OutputType,
1176 typename FENeeded<OutputType>::hess_getter fe_getter,
1177 diff_subsolution_getter subsolution_getter>
1178 void some_hessian(unsigned int var, unsigned int qp, OutputType & u) const;
1179#endif
1180
1186 std::vector<std::map<FEType, std::unique_ptr<FEAbstract>>> _element_fe;
1187 std::vector<std::map<FEType, std::unique_ptr<FEAbstract>>> _side_fe;
1188 std::map<FEType, std::unique_ptr<FEAbstract>> _edge_fe;
1189
1190
1197 std::vector<std::vector<FEAbstract *>> _element_fe_var;
1198 std::vector<std::vector<FEAbstract *>> _side_fe_var;
1199 std::vector<FEAbstract *> _edge_fe_var;
1200
1206
1210 const Elem * _elem;
1211
1215 unsigned char _dim;
1216
1220 unsigned char _elem_dim;
1221
1226 std::set<unsigned char> _elem_dims;
1227
1234 std::vector<std::unique_ptr<QBase>> _element_qrule;
1235
1242 std::vector<std::unique_ptr<QBase>> _side_qrule;
1243
1251 std::unique_ptr<QBase> _edge_qrule;
1252
1257
1258private:
1262 void init_internal_data(const System & sys);
1263
1272 void _do_elem_position_set(Real theta);
1273
1279 void _update_time_from_system(Real theta);
1280};
1281
1282
1283
1284// ------------------------------------------------------------
1285// FEMContext inline methods
1286
1287inline
1289{
1290 if (_mesh_sys)
1291 this->_do_elem_position_set(theta);
1292}
1293
1294template<typename OutputShape>
1295inline
1297 unsigned short dim ) const
1298{
1299 libmesh_assert( !_element_fe_var[dim].empty() );
1300 libmesh_assert_less ( var, (_element_fe_var[dim].size() ) );
1301 fe = cast_ptr<FEGenericBase<OutputShape> *>( (_element_fe_var[dim][var] ) );
1302}
1303
1304inline
1305void FEMContext::get_element_fe( unsigned int var, FEAbstract *& fe,
1306 unsigned short dim ) const
1307{
1308 libmesh_assert( !_element_fe_var[dim].empty() );
1309 libmesh_assert_less ( var, (_element_fe_var[dim].size() ) );
1310 fe = _element_fe_var[dim][var];
1311}
1312
1313inline
1314FEBase * FEMContext::get_element_fe( unsigned int var, unsigned short dim ) const
1315{
1316 libmesh_assert( !_element_fe_var[dim].empty() );
1317 libmesh_assert_less ( var, (_element_fe_var[dim].size() ) );
1318 return cast_ptr<FEBase *>( (_element_fe_var[dim][var] ) );
1319}
1320
1321template<typename OutputShape>
1322inline
1324 unsigned short dim ) const
1325{
1326 libmesh_assert( !_side_fe_var[dim].empty() );
1327 libmesh_assert_less ( var, (_side_fe_var[dim].size() ) );
1328 fe = cast_ptr<FEGenericBase<OutputShape> *>( (_side_fe_var[dim][var] ) );
1329}
1330
1331inline
1332void FEMContext::get_side_fe( unsigned int var, FEAbstract *& fe,
1333 unsigned short dim ) const
1334{
1335 libmesh_assert( !_side_fe_var[dim].empty() );
1336 libmesh_assert_less ( var, (_side_fe_var[dim].size() ) );
1337 fe = _side_fe_var[dim][var];
1338}
1339
1340inline
1341FEBase * FEMContext::get_side_fe( unsigned int var, unsigned short dim ) const
1342{
1343 libmesh_assert( !_side_fe_var[dim].empty() );
1344 libmesh_assert_less ( var, (_side_fe_var[dim].size() ) );
1345 return cast_ptr<FEBase *>( (_side_fe_var[dim][var] ) );
1346}
1347
1348template<typename OutputShape>
1349inline
1350void FEMContext::get_edge_fe( unsigned int var, FEGenericBase<OutputShape> *& fe ) const
1351{
1352 libmesh_assert_less ( var, _edge_fe_var.size() );
1353 fe = cast_ptr<FEGenericBase<OutputShape> *>( _edge_fe_var[var] );
1354}
1355
1356inline
1357void FEMContext::get_edge_fe( unsigned int var, FEAbstract *& fe ) const
1358{
1359 libmesh_assert_less ( var, _edge_fe_var.size() );
1360 fe = _edge_fe_var[var];
1361}
1362
1363inline
1364FEBase * FEMContext::get_edge_fe( unsigned int var ) const
1365{
1366 libmesh_assert_less ( var, _edge_fe_var.size() );
1367 return cast_ptr<FEBase *>( _edge_fe_var[var] );
1368}
1369
1370
1371} // namespace libMesh
1372
1373#endif // LIBMESH_FEM_CONTEXT_H
unsigned int dim
void ErrorVector unsigned int
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
Defines a dense subvector for use in finite element computations.
This class provides all data required for a physics package (e.g.
This is the base class from which all geometric element types are derived.
Definition elem.h:96
This class forms the foundation from which generic finite elements may be derived.
This class forms the foundation from which generic finite elements may be derived.
Definition fe_base.h:86
This class provides all data required for a physics package (e.g.
Definition fem_context.h:64
void set_mesh_y_var(unsigned int y_var)
Accessor for y-variable of moving mesh System.
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.
Definition fem_context.C:85
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 point_accel(unsigned int var, const Point &p, OutputType &u) const
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...
unsigned int _mesh_x_var
Variables from which to acquire moving mesh information.
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.
FEBase * get_side_fe(unsigned int var) const
Accessor for side finite element object for scalar-valued variable var for the largest dimension in t...
Number side_value(unsigned int var, unsigned int qp) const
void attach_quadrature_rules()
Helper function for attaching quadrature rules.
unsigned char edge
Current edge for edge_* to examine.
void set_mesh_x_var(unsigned int x_var)
Accessor for x-variable of moving mesh System.
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.
unsigned int _mesh_y_var
const std::set< unsigned char > & elem_dimensions() const
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
FEBase * get_element_fe(unsigned int var) const
Accessor for interior finite element object for scalar-valued variable var for the largest dimension ...
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.
void get_edge_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for edge (3D only!) finite element object for variable var.
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
Elem & get_elem()
Accessor for current Elem object.
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.
const QBase & get_element_qrule() const
Accessor for element interior quadrature rule for the dimension of the current _elem.
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.
const QBase & get_element_qrule(unsigned short dim) const
Accessor for element interior quadrature rule.
unsigned char get_dim() const
Accessor for cached mesh dimension.
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.
AlgebraicType
Enum describing what data to use when initializing algebraic structures on each element.
void set_custom_solution(const NumericVector< Number > *custom_sol)
Set a NumericVector to be used in place of current_local_solution for calculating elem_solution.
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.
const QBase & get_edge_qrule() const
Accessor for element edge quadrature rule.
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...
virtual void set_mesh_system(System *sys)
Tells the FEMContext that system sys contains the isoparametric Lagrangian variables which correspond...
const QBase & get_side_qrule(unsigned short dim) const
Accessor for element side quadrature rule.
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.
void set_mesh_z_var(unsigned int z_var)
Accessor for z-variable of moving mesh System.
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.
unsigned int _mesh_z_var
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.
void point_rate(unsigned int var, const Point &p, OutputType &u) const
const System * get_mesh_system() const
Accessor for moving mesh System.
void use_quadrature_rules(QuadratureType qt, int extra_quadrature_order=0)
Use a specified quadrature rule type qt for every element, side, and edge dimension,...
Gradient point_gradient(unsigned int var, const Point &p) const
void set_algebraic_type(const AlgebraicType atype)
Setting which determines whether to initialize algebraic structures (elem_*) on each element and set ...
Tensor fixed_interior_hessian(unsigned int var, unsigned int qp) const
const QBase & get_side_qrule() const
Accessor for element side quadrature rule for the dimension of the current _elem.
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.
System * get_mesh_system()
Accessor for moving mesh System.
Gradient fixed_point_gradient(unsigned int var, const Point &p) const
unsigned char _dim
Cached dimension of largest dimension element in this mesh.
AlgebraicType algebraic_type() const
Gradient fixed_interior_gradient(unsigned int var, unsigned int qp) const
AlgebraicType _atype
Keep track of what type of algebra reinitialization is to be done.
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
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition fe_type.h:197
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:41
The QBase class provides the basic functionality from which various quadrature rules can be derived.
Definition quadrature.h:62
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition system.h:100
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
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.
int8_t boundary_id_type
Definition id_types.h:51
libmesh_assert(ctx)
QuadratureType
Defines an enum for currently available quadrature rules.
static constexpr Real TOLERANCE
FEGenericBase< Real > FEBase
template class LIBMESH_EXPORT FEGenericBase< Real >
Definition fe_base.C:2627
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Helper nested class for C++03-compatible "template typedef".
void(FEMContext::* grad_getter)(unsigned int, grad_base *&, unsigned short) const
TensorTools::MakeReal< Rank1Decrement >::type grad_shape
TensorTools::MakeReal< Rank2Decrement >::type hess_shape
TensorTools::DecrementRank< Rank1Decrement >::type Rank2Decrement
TensorTools::DecrementRank< OutputType >::type Rank1Decrement
void(FEMContext::* value_getter)(unsigned int, value_base *&, unsigned short) const
FEGenericBase< hess_shape > hess_base
void(FEMContext::* hess_getter)(unsigned int, hess_base *&, unsigned short) const
FEGenericBase< grad_shape > grad_base
TensorTools::MakeReal< OutputType >::type value_shape
FEGenericBase< value_shape > value_base