libMesh
system.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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_SYSTEM_H
21 #define LIBMESH_SYSTEM_H
22 
23 // Local Includes
24 #include "libmesh/elem_range.h"
25 #include "libmesh/enum_subset_solve_mode.h" // SUBSET_ZERO
26 #include "libmesh/enum_parallel_type.h" // PARALLEL
27 #include "libmesh/fem_function_base.h"
28 #include "libmesh/libmesh_common.h"
29 #include "libmesh/parallel_object.h"
30 #include "libmesh/qoi_set.h"
31 #include "libmesh/reference_counted_object.h"
32 #include "libmesh/tensor_value.h" // For point_hessian
33 #include "libmesh/variable.h"
34 
35 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
36 namespace libMesh
37 {
38 enum FEMNormType : int;
39 }
40 #else
41 #include "libmesh/enum_norm_type.h"
42 #endif
43 
44 // C++ includes
45 #include <cstddef>
46 #include <set>
47 #include <vector>
48 #include <memory>
49 
50 // This define may be useful in --disable-optional builds when it is
51 // possible that libmesh will not have any solvers available.
52 #if defined(LIBMESH_HAVE_PETSC) || \
53  defined(LIBMESH_HAVE_EIGEN) || \
54  defined(LIBMESH_HAVE_LASPACK) || \
55  defined(LIBMESH_TRILINOS_HAVE_AZTECOO)
56 #define LIBMESH_HAVE_SOLVER 1
57 #endif
58 
59 namespace libMesh
60 {
61 
62 // Forward Declarations
63 class System;
64 class EquationSystems;
65 class MeshBase;
66 class Xdr;
67 class DofMap;
68 template <typename Output> class FunctionBase;
69 class Parameters;
70 class ParameterVector;
71 class Point;
72 class SensitivityData;
73 template <typename T> class NumericVector;
74 template <typename T> class SparseMatrix;
75 template <typename T> class VectorValue;
76 typedef VectorValue<Number> NumberVectorValue;
78 class SystemSubset;
79 class FEType;
80 class SystemNorm;
81 
100 class System : public ReferenceCountedObject<System>,
101  public ParallelObject
102 {
103 public:
104 
109  System (EquationSystems & es,
110  const std::string & name,
111  const unsigned int number);
112 
120  {
121  public:
125  virtual ~Initialization () {}
126 
132  virtual void initialize () = 0;
133  };
134 
135 
136 
143  class Assembly
144  {
145  public:
149  virtual ~Assembly () {}
150 
156  virtual void assemble () = 0;
157  };
158 
159 
160 
168  {
169  public:
173  virtual ~Constraint () {}
174 
180  virtual void constrain () = 0;
181  };
182 
183 
184 
191  class QOI
192  {
193  public:
197  virtual ~QOI () {}
198 
204  virtual void qoi (const QoISet & qoi_indices) = 0;
205  };
206 
207 
208 
216  {
217  public:
221  virtual ~QOIDerivative () {}
222 
228  virtual void qoi_derivative (const QoISet & qoi_indices,
229  bool include_liftfunc,
230  bool apply_constraints) = 0;
231  };
232 
233 
234 
238  virtual ~System ();
239 
243  typedef System sys_type;
244 
248  sys_type & system () { return *this; }
249 
254  virtual void clear ();
255 
260  void init ();
261 
270  virtual void reinit ();
271 
275  virtual void reinit_constraints ();
276 
280  bool is_initialized();
281 
286  virtual void update ();
287 
294  virtual void assemble ();
295 
300  virtual void assemble_qoi (const QoISet & qoi_indices = QoISet());
301 
306  virtual void assemble_qoi_derivative (const QoISet & qoi_indices = QoISet(),
307  bool include_liftfunc = true,
308  bool apply_constraints = true);
309 
321  virtual void assemble_residual_derivatives (const ParameterVector & parameters);
322 
328  virtual void restrict_solve_to (const SystemSubset * subset,
329  const SubsetSolveMode subset_solve_mode=SUBSET_ZERO);
330 
334  virtual void solve () {}
335 
345  virtual std::pair<unsigned int, Real>
346  sensitivity_solve (const ParameterVector & parameters);
347 
358  virtual std::pair<unsigned int, Real>
359  weighted_sensitivity_solve (const ParameterVector & parameters,
360  const ParameterVector & weights);
361 
372  virtual std::pair<unsigned int, Real>
373  adjoint_solve (const QoISet & qoi_indices = QoISet());
374 
389  virtual std::pair<unsigned int, Real>
391  const ParameterVector & weights,
392  const QoISet & qoi_indices = QoISet());
397  { return adjoint_already_solved;}
398 
402  void set_adjoint_already_solved(bool setting)
403  { adjoint_already_solved = setting;}
404 
405 
423  virtual void qoi_parameter_sensitivity (const QoISet & qoi_indices,
424  const ParameterVector & parameters,
425  SensitivityData & sensitivities);
426 
432  virtual void adjoint_qoi_parameter_sensitivity (const QoISet & qoi_indices,
433  const ParameterVector & parameters,
434  SensitivityData & sensitivities);
435 
441  virtual void forward_qoi_parameter_sensitivity (const QoISet & qoi_indices,
442  const ParameterVector & parameters,
443  SensitivityData & sensitivities);
444 
455  virtual void qoi_parameter_hessian(const QoISet & qoi_indices,
456  const ParameterVector & parameters,
457  SensitivityData & hessian);
458 
471  virtual void qoi_parameter_hessian_vector_product(const QoISet & qoi_indices,
472  const ParameterVector & parameters,
473  const ParameterVector & vector,
474  SensitivityData & product);
475 
481  virtual bool compare (const System & other_system,
482  const Real threshold,
483  const bool verbose) const;
484 
488  const std::string & name () const;
489 
495  virtual std::string system_type () const { return "Basic"; }
496 
507  FunctionBase<Gradient> * g = nullptr) const;
508 
519  FEMFunctionBase<Gradient> * g = nullptr) const;
520 
528  typedef Number (*ValueFunctionPointer)(const Point & p,
529  const Parameters & Parameters,
530  const std::string & sys_name,
531  const std::string & unknown_name);
532  typedef Gradient (*GradientFunctionPointer)(const Point & p,
533  const Parameters & parameters,
534  const std::string & sys_name,
535  const std::string & unknown_name);
538  const Parameters & parameters) const;
539 
553  void project_vector (NumericVector<Number> & new_vector,
555  FunctionBase<Gradient> * g = nullptr,
556  int is_adjoint = -1) const;
557 
571  void project_vector (NumericVector<Number> & new_vector,
573  FEMFunctionBase<Gradient> * g = nullptr,
574  int is_adjoint = -1) const;
575 
589  const Parameters & parameters,
590  NumericVector<Number> & new_vector,
591  int is_adjoint = -1) const;
592 
607  void boundary_project_solution (const std::set<boundary_id_type> & b,
608  const std::vector<unsigned int> & variables,
610  FunctionBase<Gradient> * g = nullptr);
611 
624  void boundary_project_solution (const std::set<boundary_id_type> & b,
625  const std::vector<unsigned int> & variables,
628  const Parameters & parameters);
629 
647  void boundary_project_vector (const std::set<boundary_id_type> & b,
648  const std::vector<unsigned int> & variables,
649  NumericVector<Number> & new_vector,
651  FunctionBase<Gradient> * g = nullptr,
652  int is_adjoint = -1) const;
653 
669  void boundary_project_vector (const std::set<boundary_id_type> & b,
670  const std::vector<unsigned int> & variables,
673  const Parameters & parameters,
674  NumericVector<Number> & new_vector,
675  int is_adjoint = -1) const;
676 
680  unsigned int number () const;
681 
687  void update_global_solution (std::vector<Number> & global_soln) const;
688 
694  void update_global_solution (std::vector<Number> & global_soln,
695  const processor_id_type dest_proc) const;
696 
700  const MeshBase & get_mesh() const;
701 
705  MeshBase & get_mesh();
706 
710  const DofMap & get_dof_map() const;
711 
715  DofMap & get_dof_map();
716 
721 
726 
731  bool active () const;
732 
736  void activate ();
737 
741  void deactivate ();
742 
751  void set_basic_system_only ();
752 
756  typedef std::map<std::string, NumericVector<Number> *>::iterator vectors_iterator;
757  typedef std::map<std::string, NumericVector<Number> *>::const_iterator const_vectors_iterator;
758 
763 
768 
773 
778 
788  NumericVector<Number> & add_vector (const std::string & vec_name,
789  const bool projections=true,
790  const ParallelType type = PARALLEL);
791 
795  void remove_vector(const std::string & vec_name);
796 
803  { return _solution_projection; }
804 
809  bool have_vector (const std::string & vec_name) const;
810 
815  const NumericVector<Number> * request_vector (const std::string & vec_name) const;
816 
821  NumericVector<Number> * request_vector (const std::string & vec_name);
822 
828  const NumericVector<Number> * request_vector (const unsigned int vec_num) const;
829 
835  NumericVector<Number> * request_vector (const unsigned int vec_num);
836 
842  const NumericVector<Number> & get_vector (const std::string & vec_name) const;
843 
849  NumericVector<Number> & get_vector (const std::string & vec_name);
850 
856  const NumericVector<Number> & get_vector (const unsigned int vec_num) const;
857 
863  NumericVector<Number> & get_vector (const unsigned int vec_num);
864 
869  const std::string & vector_name (const unsigned int vec_num) const;
870 
874  const std::string & vector_name (const NumericVector<Number> & vec_reference) const;
875 
886  void set_vector_as_adjoint (const std::string & vec_name, int qoi_num);
887 
893  int vector_is_adjoint (const std::string & vec_name) const;
894 
900  void set_vector_preservation (const std::string & vec_name, bool preserve);
901 
907  bool vector_preservation (const std::string & vec_name) const;
908 
914  NumericVector<Number> & add_adjoint_solution(unsigned int i=0);
915 
920  NumericVector<Number> & get_adjoint_solution(unsigned int i=0);
921 
926  const NumericVector<Number> & get_adjoint_solution(unsigned int i=0) const;
927 
934 
940 
945  const NumericVector<Number> & get_sensitivity_solution(unsigned int i=0) const;
946 
954 
961 
968 
975 
981 
987 
993  NumericVector<Number> & add_adjoint_rhs(unsigned int i=0);
994 
1001  NumericVector<Number> & get_adjoint_rhs(unsigned int i=0);
1002 
1007  const NumericVector<Number> & get_adjoint_rhs(unsigned int i=0) const;
1008 
1014  NumericVector<Number> & add_sensitivity_rhs(unsigned int i=0);
1015 
1025  NumericVector<Number> & get_sensitivity_rhs(unsigned int i=0);
1026 
1031  const NumericVector<Number> & get_sensitivity_rhs(unsigned int i=0) const;
1032 
1038  unsigned int n_vectors () const;
1039 
1046  virtual unsigned int n_matrices () const;
1047 
1051  unsigned int n_vars() const;
1052 
1056  unsigned int n_variable_groups() const;
1057 
1063  unsigned int n_components() const;
1064 
1068  dof_id_type n_dofs() const;
1069 
1074  dof_id_type n_active_dofs() const;
1075 
1081 
1087 
1092  dof_id_type n_local_dofs() const;
1093 
1102  unsigned int add_variable (const std::string & var,
1103  const FEType & type,
1104  const std::set<subdomain_id_type> * const active_subdomains = nullptr);
1105 
1113  unsigned int add_variable (const std::string & var,
1114  const Order order = FIRST,
1115  const FEFamily = LAGRANGE,
1116  const std::set<subdomain_id_type> * const active_subdomains = nullptr);
1117 
1126  unsigned int add_variables (const std::vector<std::string> & vars,
1127  const FEType & type,
1128  const std::set<subdomain_id_type> * const active_subdomains = nullptr);
1129 
1137  unsigned int add_variables (const std::vector<std::string> & vars,
1138  const Order order = FIRST,
1139  const FEFamily = LAGRANGE,
1140  const std::set<subdomain_id_type> * const active_subdomains = nullptr);
1141 
1145  const Variable & variable (unsigned int var) const;
1146 
1150  const VariableGroup & variable_group (unsigned int vg) const;
1151 
1155  bool has_variable(const std::string & var) const;
1156 
1160  const std::string & variable_name(const unsigned int i) const;
1161 
1166  unsigned short int variable_number (const std::string & var) const;
1167 
1172  void get_all_variable_numbers(std::vector<unsigned int> & all_variable_numbers) const;
1173 
1184  unsigned int variable_scalar_number (const std::string & var,
1185  unsigned int component) const;
1186 
1197  unsigned int variable_scalar_number (unsigned int var_num,
1198  unsigned int component) const;
1199 
1200 
1204  const FEType & variable_type (const unsigned int i) const;
1205 
1209  const FEType & variable_type (const std::string & var) const;
1210 
1215  bool identify_variable_groups () const;
1216 
1220  void identify_variable_groups (const bool);
1221 
1227  unsigned int var,
1228  FEMNormType norm_type,
1229  std::set<unsigned int> * skip_dimensions=nullptr) const;
1230 
1236  const SystemNorm & norm,
1237  std::set<unsigned int> * skip_dimensions=nullptr) const;
1238 
1242  void read_header (Xdr & io,
1243  const std::string & version,
1244  const bool read_header=true,
1245  const bool read_additional_data=true,
1246  const bool read_legacy_format=false);
1247 
1255 #ifdef LIBMESH_ENABLE_DEPRECATED
1256  void read_legacy_data (Xdr & io,
1257  const bool read_additional_data=true);
1258 #endif
1259 
1264  template <typename ValType>
1265  void read_serialized_data (Xdr & io,
1266  const bool read_additional_data=true);
1274  const bool read_additional_data=true)
1275  { read_serialized_data<Number>(io, read_additional_data); }
1276 
1282  template <typename InValType>
1283  std::size_t read_serialized_vectors (Xdr & io,
1284  const std::vector<NumericVector<Number> *> & vectors) const;
1285 
1293  std::size_t read_serialized_vectors (Xdr & io,
1294  const std::vector<NumericVector<Number> *> & vectors) const
1295  { return read_serialized_vectors<Number>(io, vectors); }
1296 
1303  template <typename InValType>
1304  void read_parallel_data (Xdr & io,
1305  const bool read_additional_data);
1306 
1316  const bool read_additional_data)
1317  { read_parallel_data<Number>(io, read_additional_data); }
1318 
1322  void write_header (Xdr & io,
1323  const std::string & version,
1324  const bool write_additional_data) const;
1325 
1330  void write_serialized_data (Xdr & io,
1331  const bool write_additional_data = true) const;
1332 
1338  std::size_t write_serialized_vectors (Xdr & io,
1339  const std::vector<const NumericVector<Number> *> & vectors) const;
1340 
1347  void write_parallel_data (Xdr & io,
1348  const bool write_additional_data) const;
1349 
1354  std::string get_info () const;
1355 
1359  void attach_init_function (void fptr(EquationSystems & es,
1360  const std::string & name));
1361 
1367  void attach_init_object (Initialization & init);
1368 
1374  const std::string & name));
1375 
1380  void attach_assemble_object (Assembly & assemble);
1381 
1386  const std::string & name));
1387 
1391  void attach_constraint_object (Constraint & constrain);
1392 
1397  void attach_QOI_function (void fptr(EquationSystems & es,
1398  const std::string & name,
1399  const QoISet & qoi_indices));
1400 
1405  void attach_QOI_object (QOI & qoi);
1406 
1412  void attach_QOI_derivative (void fptr(EquationSystems & es,
1413  const std::string & name,
1414  const QoISet & qoi_indices,
1415  bool include_liftfunc,
1416  bool apply_constraints));
1417 
1423  void attach_QOI_derivative_object (QOIDerivative & qoi_derivative);
1424 
1429  virtual void user_initialization ();
1430 
1435  virtual void user_assembly ();
1436 
1441  virtual void user_constrain ();
1442 
1447  virtual void user_QOI (const QoISet & qoi_indices);
1448 
1453  virtual void user_QOI_derivative (const QoISet & qoi_indices = QoISet(),
1454  bool include_liftfunc = true,
1455  bool apply_constraints = true);
1456 
1462  virtual void re_update ();
1463 
1467  virtual void restrict_vectors ();
1468 
1472  virtual void prolong_vectors ();
1473 
1494 
1499  virtual void disable_cache ();
1500 
1510 
1525 
1526 
1527  //--------------------------------------------------
1528  // The solution and solution access members
1529 
1534  Number current_solution (const dof_id_type global_dof_number) const;
1535 
1539  std::unique_ptr<NumericVector<Number>> solution;
1540 
1551  std::unique_ptr<NumericVector<Number>> current_local_solution;
1552 
1562 
1566  unsigned int n_qois() const;
1567 
1574  std::vector<Number> qoi;
1575 
1597  Number point_value(unsigned int var, const Point & p,
1598  const bool insist_on_success = true,
1599  const NumericVector<Number> * sol = nullptr) const;
1600 
1610  Number point_value(unsigned int var, const Point & p, const Elem & e,
1611  const NumericVector<Number> * sol = nullptr) const;
1612 
1619  Number point_value(unsigned int var, const Point & p, const Elem * e) const;
1620 
1627  Number point_value(unsigned int var, const Point & p, const NumericVector<Number> * sol) const;
1628 
1633  Gradient point_gradient(unsigned int var, const Point & p,
1634  const bool insist_on_success = true,
1635  const NumericVector<Number> * sol = nullptr) const;
1636 
1641  Gradient point_gradient(unsigned int var, const Point & p, const Elem & e,
1642  const NumericVector<Number> * sol = nullptr) const;
1643 
1650  Gradient point_gradient(unsigned int var, const Point & p, const Elem * e) const;
1651 
1658  Gradient point_gradient(unsigned int var, const Point & p, const NumericVector<Number> * sol) const;
1659 
1664  Tensor point_hessian(unsigned int var, const Point & p,
1665  const bool insist_on_success = true,
1666  const NumericVector<Number> * sol = nullptr) const;
1667 
1673  Tensor point_hessian(unsigned int var, const Point & p, const Elem & e,
1674  const NumericVector<Number> * sol = nullptr) const;
1675 
1682  Tensor point_hessian(unsigned int var, const Point & p, const Elem * e) const;
1683 
1690  Tensor point_hessian(unsigned int var, const Point & p, const NumericVector<Number> * sol) const;
1691 
1692 
1697  void local_dof_indices (const unsigned int var,
1698  std::set<dof_id_type> & var_indices) const;
1699 
1704  void zero_variable (NumericVector<Number> & v, unsigned int var_num) const;
1705 
1706 
1712  bool & hide_output() { return _hide_output; }
1713 
1714 #ifdef LIBMESH_HAVE_METAPHYSICL
1715 
1725  void projection_matrix (SparseMatrix<Number> & proj_mat) const;
1726 #endif // LIBMESH_HAVE_METAPHYSICL
1727 
1728 protected:
1729 
1736  virtual void init_data ();
1737 
1746  int is_adjoint = -1) const;
1747 
1756  void project_vector (const NumericVector<Number> &,
1758  int is_adjoint = -1) const;
1759 
1760 private:
1767  System (const System &);
1768 
1775  System & operator=(const System &);
1776 
1782  unsigned int var,
1783  FEMNormType norm_type) const;
1784 
1794  template <typename iterator_type, typename InValType>
1796  const iterator_type begin,
1797  const iterator_type end,
1798  const InValType dummy,
1799  Xdr & io,
1800  const std::vector<NumericVector<Number> *> & vecs,
1801  const unsigned int var_to_read=libMesh::invalid_uint) const;
1802 
1811  unsigned int read_SCALAR_dofs (const unsigned int var,
1812  Xdr & io,
1813  NumericVector<Number> * vec) const;
1814 
1823  template <typename InValType>
1825  NumericVector<Number> * vec);
1826 
1836  NumericVector<Number> & vec)
1837  { return read_serialized_vector<Number>(io, &vec); }
1838 
1845  template <typename iterator_type>
1846  std::size_t write_serialized_blocked_dof_objects (const std::vector<const NumericVector<Number> *> & vecs,
1847  const dof_id_type n_objects,
1848  const iterator_type begin,
1849  const iterator_type end,
1850  Xdr & io,
1851  const unsigned int var_to_write=libMesh::invalid_uint) const;
1852 
1858  unsigned int write_SCALAR_dofs (const NumericVector<Number> & vec,
1859  const unsigned int var,
1860  Xdr & io) const;
1861 
1869  const NumericVector<Number> & vec) const;
1870 
1875  const std::string & name);
1876 
1881 
1886  const std::string & name);
1887 
1892 
1897  const std::string & name);
1898 
1903 
1908  const std::string & name,
1909  const QoISet & qoi_indices);
1910 
1915 
1920  const std::string & name,
1921  const QoISet & qoi_indices,
1922  bool include_liftfunc,
1923  bool apply_constraints);
1924 
1929 
1934  std::unique_ptr<DofMap> _dof_map;
1935 
1941 
1947 
1951  const std::string _sys_name;
1952 
1956  const unsigned int _sys_number;
1957 
1961  std::vector<Variable> _variables;
1962 
1966  std::vector<VariableGroup> _variable_groups;
1967 
1972  std::map<std::string, unsigned short int> _variable_numbers;
1973 
1977  bool _active;
1978 
1985  std::map<std::string, NumericVector<Number> * > _vectors;
1986 
1991  std::map<std::string, bool> _vector_projections;
1992 
1997  std::map<std::string, int> _vector_is_adjoint;
1998 
2002  std::map<std::string, ParallelType> _vector_types;
2003 
2010 
2016 
2022 
2028 
2035 
2046  std::vector<unsigned int> _written_var_indices;
2047 
2054 
2060 };
2061 
2062 
2063 
2064 // ------------------------------------------------------------
2065 // System inline methods
2066 inline
2067 const std::string & System::name() const
2068 {
2069  return _sys_name;
2070 }
2071 
2072 
2073 
2074 inline
2075 unsigned int System::number() const
2076 {
2077  return _sys_number;
2078 }
2079 
2080 
2081 
2082 inline
2084 {
2085  return _mesh;
2086 }
2087 
2088 
2089 
2090 inline
2092 {
2093  return _mesh;
2094 }
2095 
2096 
2097 
2098 inline
2100 {
2101  return *_dof_map;
2102 }
2103 
2104 
2105 
2106 inline
2108 {
2109  return *_dof_map;
2110 }
2111 
2112 
2113 
2114 inline
2115 bool System::active() const
2116 {
2117  return _active;
2118 }
2119 
2120 
2121 
2122 inline
2124 {
2125  _active = true;
2126 }
2127 
2128 
2129 
2130 inline
2132 {
2133  _active = false;
2134 }
2135 
2136 
2137 
2138 inline
2140 {
2141  return _is_initialized;
2142 }
2143 
2144 
2145 
2146 inline
2148 {
2149  _basic_system_only = true;
2150 }
2151 
2152 
2153 
2154 inline
2155 unsigned int System::n_vars() const
2156 {
2157  return cast_int<unsigned int>(_variables.size());
2158 }
2159 
2160 
2161 
2162 inline
2163 unsigned int System::n_variable_groups() const
2164 {
2165  return cast_int<unsigned int>(_variable_groups.size());
2166 }
2167 
2168 
2169 
2170 inline
2171 unsigned int System::n_components() const
2172 {
2173  if (_variables.empty())
2174  return 0;
2175 
2176  const Variable & last = _variables.back();
2177  return last.first_scalar_number() + last.n_components();
2178 }
2179 
2180 
2181 
2182 inline
2183 const Variable & System::variable (const unsigned int i) const
2184 {
2185  libmesh_assert_less (i, _variables.size());
2186 
2187  return _variables[i];
2188 }
2189 
2190 
2191 
2192 inline
2193 const VariableGroup & System::variable_group (const unsigned int vg) const
2194 {
2195  libmesh_assert_less (vg, _variable_groups.size());
2196 
2197  return _variable_groups[vg];
2198 }
2199 
2200 
2201 
2202 inline
2203 const std::string & System::variable_name (const unsigned int i) const
2204 {
2205  libmesh_assert_less (i, _variables.size());
2206 
2207  return _variables[i].name();
2208 }
2209 
2210 
2211 
2212 inline
2213 unsigned int
2214 System::variable_scalar_number (const std::string & var,
2215  unsigned int component) const
2216 {
2217  return variable_scalar_number(this->variable_number(var), component);
2218 }
2219 
2220 
2221 
2222 inline
2223 unsigned int
2224 System::variable_scalar_number (unsigned int var_num,
2225  unsigned int component) const
2226 {
2227  return _variables[var_num].first_scalar_number() + component;
2228 }
2229 
2230 
2231 
2232 inline
2233 const FEType & System::variable_type (const unsigned int i) const
2234 {
2235  libmesh_assert_less (i, _variables.size());
2236 
2237  return _variables[i].type();
2238 }
2239 
2240 
2241 
2242 inline
2243 const FEType & System::variable_type (const std::string & var) const
2244 {
2245  return _variables[this->variable_number(var)].type();
2246 }
2247 
2248 
2249 
2250 inline
2252 {
2254 }
2255 
2256 
2257 
2258 inline
2260 {
2262 }
2263 
2264 
2265 
2266 inline
2268 {
2269  return this->n_dofs() - this->n_constrained_dofs();
2270 }
2271 
2272 
2273 
2274 inline
2275 bool System::have_vector (const std::string & vec_name) const
2276 {
2277  return (_vectors.count(vec_name));
2278 }
2279 
2280 
2281 
2282 inline
2283 unsigned int System::n_vectors () const
2284 {
2285  return cast_int<unsigned int>(_vectors.size());
2286 }
2287 
2288 inline
2289 unsigned int System::n_matrices () const
2290 {
2291  return 0;
2292 }
2293 
2294 inline
2296 {
2297  return _vectors.begin();
2298 }
2299 
2300 inline
2302 {
2303  return _vectors.begin();
2304 }
2305 
2306 inline
2308 {
2309  return _vectors.end();
2310 }
2311 
2312 inline
2314 {
2315  return _vectors.end();
2316 }
2317 
2318 inline
2320 {
2321  libmesh_not_implemented();
2322 }
2323 
2324 inline
2326 
2327 inline
2328 unsigned int System::n_qois() const
2329 {
2330  return cast_int<unsigned int>(this->qoi.size());
2331 }
2332 
2333 inline
2334 std::pair<unsigned int, Real>
2336 {
2337  libmesh_not_implemented();
2338 }
2339 
2340 inline
2341 std::pair<unsigned int, Real>
2343  const ParameterVector &)
2344 {
2345  libmesh_not_implemented();
2346 }
2347 
2348 inline
2349 std::pair<unsigned int, Real>
2351 {
2352  libmesh_not_implemented();
2353 }
2354 
2355 inline
2356 std::pair<unsigned int, Real>
2358  const ParameterVector &,
2359  const QoISet &)
2360 {
2361  libmesh_not_implemented();
2362 }
2363 
2364 inline
2365 void
2367  const ParameterVector &,
2368  SensitivityData &)
2369 {
2370  libmesh_not_implemented();
2371 }
2372 
2373 inline
2374 void
2376  const ParameterVector &,
2377  SensitivityData &)
2378 {
2379  libmesh_not_implemented();
2380 }
2381 
2382 inline
2383 void
2385  const ParameterVector &,
2386  SensitivityData &)
2387 {
2388  libmesh_not_implemented();
2389 }
2390 
2391 inline
2392 void
2394  const ParameterVector &,
2395  const ParameterVector &,
2396  SensitivityData &)
2397 {
2398  libmesh_not_implemented();
2399 }
2400 
2401 
2402 } // namespace libMesh
2403 
2404 #endif // LIBMESH_SYSTEM_H
libMesh::System::set_vector_preservation
void set_vector_preservation(const std::string &vec_name, bool preserve)
Allows one to set the boolean controlling whether the vector identified by vec_name should be "preser...
Definition: system.C:855
libMesh::System
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:100
libMesh::System::write_serialized_vector
dof_id_type write_serialized_vector(Xdr &io, const NumericVector< Number > &vec) const
Writes a vector for this System.
Definition: system_io.C:2152
libMesh::System::activate
void activate()
Activates the system.
Definition: system.h:2123
libMesh::System::_vector_projections
std::map< std::string, bool > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:1991
libMesh::System::read_serialized_vector
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > *vec)
Reads a vector for this System.
Definition: system_io.C:1167
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::System::sys_type
System sys_type
The type of system.
Definition: system.h:243
libMesh::System::boundary_project_solution
void boundary_project_solution(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
Definition: system_projection.C:1126
libMesh::System::n_vars
unsigned int n_vars() const
Definition: system.h:2155
libMesh::FunctionBase< Number >
libMesh::System::have_vector
bool have_vector(const std::string &vec_name) const
Definition: system.h:2275
libMesh::System::get_equation_systems
const EquationSystems & get_equation_systems() const
Definition: system.h:720
libMesh::invalid_uint
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:249
libMesh::System::project_vector
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system.
Definition: system_projection.C:991
libMesh::System::reinit
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
Definition: system.C:390
libMesh::System::get_sensitivity_rhs
NumericVector< Number > & get_sensitivity_rhs(unsigned int i=0)
Definition: system.C:1049
libMesh::System::is_initialized
bool is_initialized()
Definition: system.h:2139
libMesh::System::write_parallel_data
void write_parallel_data(Xdr &io, const bool write_additional_data) const
Writes additional data, namely vectors, for this System.
Definition: system_io.C:1503
libMesh::System::_is_initialized
bool _is_initialized
true when additional vectors and variables do not require immediate initialization,...
Definition: system.h:2021
libMesh::System::_variable_groups
std::vector< VariableGroup > _variable_groups
The VariableGroup in this System.
Definition: system.h:1966
libMesh::System::_constrain_system_function
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
Definition: system.h:1896
libMesh::System::vectors_iterator
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Vector iterator typedefs.
Definition: system.h:756
libMesh::System::attach_QOI_function
void attach_QOI_function(void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices))
Register a user function for evaluating the quantities of interest, whose values should be placed in ...
Definition: system.C:1825
libMesh::System::boundary_project_vector
void boundary_project_vector(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
Definition: system_projection.C:1162
libMesh::System::add_adjoint_solution
NumericVector< Number > & add_adjoint_solution(unsigned int i=0)
Definition: system.C:945
libMesh::System::compare
virtual bool compare(const System &other_system, const Real threshold, const bool verbose) const
Definition: system.C:514
libMesh::PARALLEL
Definition: enum_parallel_type.h:36
libMesh::System::Assembly::~Assembly
virtual ~Assembly()
Destructor.
Definition: system.h:149
libMesh::System::_dof_map
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1934
libMesh::FEMFunctionBase< Number >
libMesh::System::add_variables
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1160
libMesh::System::init
void init()
Initializes degrees of freedom on the current mesh.
Definition: system.C:237
libMesh::System::_assemble_system_function
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
Definition: system.h:1885
libMesh::System::_hide_output
bool _hide_output
Are we allowed to write this system to file? If _hide_output is true, then EquationSystems::write wil...
Definition: system.h:2059
libMesh::System::user_assembly
virtual void user_assembly()
Calls user's attached assembly function, or is overridden by the user in derived classes.
Definition: system.C:1910
libMesh::System::get_adjoint_solution
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
Definition: system.C:957
libMesh::System::system_type
virtual std::string system_type() const
Definition: system.h:495
libMesh::System::_vectors
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1985
libMesh::System::get_weighted_sensitivity_adjoint_solution
NumericVector< Number > & get_weighted_sensitivity_adjoint_solution(unsigned int i=0)
Definition: system.C:989
libMesh::System::_vector_types
std::map< std::string, ParallelType > _vector_types
Holds the type of a vector.
Definition: system.h:2002
libMesh::ReferenceCountedObject
This class implements reference counting.
Definition: reference_counted_object.h:65
libMesh::System::variable_name
const std::string & variable_name(const unsigned int i) const
Definition: system.h:2203
libMesh::System::read_serialized_blocked_dof_objects
std::size_t read_serialized_blocked_dof_objects(const dof_id_type n_objects, const iterator_type begin, const iterator_type end, const InValType dummy, Xdr &io, const std::vector< NumericVector< Number > * > &vecs, const unsigned int var_to_read=libMesh::invalid_uint) const
Reads an input vector from the stream io and assigns the values to a set of DofObjects.
Definition: system_io.C:810
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::Xdr
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
Definition: xdr_cxx.h:65
libMesh::System::n_vectors
unsigned int n_vectors() const
Definition: system.h:2283
libMesh::System::add_sensitivity_solution
NumericVector< Number > & add_sensitivity_solution(unsigned int i=0)
Definition: system.C:894
libMesh::System::restrict_vectors
virtual void restrict_vectors()
Restrict vectors after the mesh has coarsened.
Definition: system.C:324
libMesh::System::qoi_parameter_hessian_vector_product
virtual void qoi_parameter_hessian_vector_product(const QoISet &qoi_indices, const ParameterVector &parameters, const ParameterVector &vector, SensitivityData &product)
For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters...
Definition: system.h:2393
libMesh::System::identify_variable_groups
bool identify_variable_groups() const
Definition: system.h:2251
libMesh::System::_identify_variable_groups
bool _identify_variable_groups
true when VariableGroup structures should be automatically identified, false otherwise.
Definition: system.h:2027
libMesh::Order
Order
Definition: enum_order.h:40
libMesh::Variable::n_components
unsigned int n_components() const
Definition: variable.h:125
libMesh::System::extra_quadrature_order
int extra_quadrature_order
A member int that can be employed to indicate increased or reduced quadrature order.
Definition: system.h:1524
end
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
Definition: variant_filter_iterator.h:343
libMesh::System::_active
bool _active
Flag stating if the system is active or not.
Definition: system.h:1977
libMesh::System::write_header
void write_header(Xdr &io, const std::string &version, const bool write_additional_data) const
Writes the basic data header for this System.
Definition: system_io.C:1298
libMesh::System::set_basic_system_only
void set_basic_system_only()
Sets the system to be "basic only": i.e.
Definition: system.h:2147
libMesh::System::get_adjoint_rhs
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
Definition: system.C:1019
libMesh::System::weighted_sensitivity_solve
virtual std::pair< unsigned int, Real > weighted_sensitivity_solve(const ParameterVector &parameters, const ParameterVector &weights)
Assembles & solves the linear system(s) (dR/du)*u_w = sum(w_p*-dR/dp), for those parameters p contain...
Definition: system.h:2342
libMesh::SensitivityData
Data structure for holding completed parameter sensitivity calculations.
Definition: sensitivity_data.h:46
libMesh::System::number
unsigned int number() const
Definition: system.h:2075
libMesh::System::qoi_parameter_hessian
virtual void qoi_parameter_hessian(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &hessian)
For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters...
Definition: system.h:2384
libMesh::System::restrict_solve_to
virtual void restrict_solve_to(const SystemSubset *subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO)
After calling this method, any solve will be restricted to the given subdomain.
Definition: system.C:453
libMesh::System::re_update
virtual void re_update()
Re-update the local values when the mesh has changed.
Definition: system.C:429
libMesh::System::read_SCALAR_dofs
unsigned int read_SCALAR_dofs(const unsigned int var, Xdr &io, NumericVector< Number > *vec) const
Reads the SCALAR dofs from the stream io and assigns the values to the appropriate entries of vec.
Definition: system_io.C:1120
libMesh::System::variable
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.h:2183
libMesh::System::use_fixed_solution
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e....
Definition: system.h:1509
libMesh::System::Initialization
Abstract base class to be used for system initialization.
Definition: system.h:119
libMesh::System::operator=
System & operator=(const System &)
This isn't a copyable object, so let's make sure nobody tries.
Definition: system.C:114
libMesh::System::~System
virtual ~System()
Destructor.
Definition: system.C:120
libMesh::System::local_dof_indices
void local_dof_indices(const unsigned int var, std::set< dof_id_type > &var_indices) const
Fills the std::set with the degrees of freedom on the local processor corresponding the the variable ...
Definition: system.C:1259
libMesh::System::n_matrices
virtual unsigned int n_matrices() const
Definition: system.h:2289
libMesh::System::is_adjoint_already_solved
bool is_adjoint_already_solved() const
Accessor for the adjoint_already_solved boolean.
Definition: system.h:396
libMesh::SparseMatrix< Number >
libMesh::System::QOI::qoi
virtual void qoi(const QoISet &qoi_indices)=0
Quantity of interest function.
libMesh::SUBSET_ZERO
Definition: enum_subset_solve_mode.h:37
libMesh::System::_init_system_function
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
Definition: system.h:1874
libMesh::System::attach_constraint_object
void attach_constraint_object(Constraint &constrain)
Register a user object for imposing constraints.
Definition: system.C:1809
libMesh::System::_qoi_evaluate_function
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
Definition: system.h:1907
libMesh::System::get_weighted_sensitivity_solution
NumericVector< Number > & get_weighted_sensitivity_solution()
Definition: system.C:931
libMesh::System::vector_name
const std::string & vector_name(const unsigned int vec_num) const
Definition: system.C:820
libMesh::System::assemble
virtual void assemble()
Prepares matrix and _dof_map for matrix assembly.
Definition: system.C:462
libMesh::VectorValue< Number >
libMesh::System::vector_is_adjoint
int vector_is_adjoint(const std::string &vec_name) const
Definition: system.C:884
libMesh::System::QOIDerivative::qoi_derivative
virtual void qoi_derivative(const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)=0
Quantity of interest derivative function.
libMesh::NumericVector< Number >
libMesh::System::current_solution
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:194
libMesh::System::n_qois
unsigned int n_qois() const
Number of currently active quantities of interest.
Definition: system.h:2328
libMesh::System::n_components
unsigned int n_components() const
Definition: system.h:2171
libMesh::System::_basic_system_only
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
Definition: system.h:2015
libMesh::System::attach_QOI_derivative
void attach_QOI_derivative(void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints))
Register a user function for evaluating derivatives of a quantity of interest with respect to test fu...
Definition: system.C:1861
libMesh::System::zero_variable
void zero_variable(NumericVector< Number > &v, unsigned int var_num) const
Zeroes all dofs in v that correspond to variable number var_num.
Definition: system.C:1300
libMesh::System::assemble_before_solve
bool assemble_before_solve
Flag which tells the system to whether or not to call the user assembly function during each call to ...
Definition: system.h:1493
libMesh::System::project_solution_on_reinit
bool & project_solution_on_reinit(void)
Tells the System whether or not to project the solution vector onto new grids when the system is rein...
Definition: system.h:802
libMesh::System::add_adjoint_rhs
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
Definition: system.C:1009
libMesh::System::_init_system_object
Initialization * _init_system_object
Object that initializes the system.
Definition: system.h:1880
libMesh::FEMNormType
FEMNormType
Definition: enum_norm_type.h:34
libMesh::System::attach_assemble_function
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in assembling the system matrix and RHS.
Definition: system.C:1755
libMesh::System::has_variable
bool has_variable(const std::string &var) const
Definition: system.C:1225
libMesh::System::n_variable_groups
unsigned int n_variable_groups() const
Definition: system.h:2163
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
libMesh::System::QOIDerivative
Abstract base class to be used for derivatives of quantities of interest.
Definition: system.h:215
libMesh::System::read_header
void read_header(Xdr &io, const std::string &version, const bool read_header=true, const bool read_additional_data=true, const bool read_legacy_format=false)
Reads the basic data header for this System.
Definition: system_io.C:114
libMesh::System::attach_init_object
void attach_init_object(Initialization &init)
Register a user class to use to initialize the system.
Definition: system.C:1739
libMesh::System::reinit_constraints
virtual void reinit_constraints()
Reinitializes the constraints for this system.
Definition: system.C:397
libMesh::System::vectors_end
vectors_iterator vectors_end()
End of vectors container.
Definition: system.h:2307
libMesh::System::active
bool active() const
Definition: system.h:2115
libMesh::System::qoi
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1574
libMesh::System::vectors_begin
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2295
libMesh::System::_mesh
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:1946
libMesh::System::user_QOI
virtual void user_QOI(const QoISet &qoi_indices)
Calls user's attached quantity of interest function, or is overridden by the user in derived classes.
Definition: system.C:1938
libMesh::System::_variables
std::vector< Variable > _variables
The Variable in this System.
Definition: system.h:1961
libMesh::System::n_local_dofs
dof_id_type n_local_dofs() const
Definition: system.C:187
libMesh::System::variable_scalar_number
unsigned int variable_scalar_number(const std::string &var, unsigned int component) const
Definition: system.h:2214
libMesh::System::_qoi_evaluate_derivative_function
void(* _qoi_evaluate_derivative_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)
Function to evaluate quantity of interest derivative.
Definition: system.h:1919
libMesh::System::variable_group
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
Definition: system.h:2193
libMesh::System::read_serialized_vector
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > &vec)
Non-templated version for backward compatibility.
Definition: system.h:1835
libMesh::QoISet
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
Definition: qoi_set.h:45
libMesh::System::attach_QOI_object
void attach_QOI_object(QOI &qoi)
Register a user object for evaluating the quantities of interest, whose values should be placed in Sy...
Definition: system.C:1845
libMesh::ReferenceCounter::n_objects
static unsigned int n_objects()
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition: reference_counter.h:83
libMesh::System::get_info
std::string get_info() const
Definition: system.C:1636
libMesh::System::prolong_vectors
virtual void prolong_vectors()
Prolong vectors after the mesh has refined.
Definition: system.C:380
libMesh::System::GradientFunctionPointer
Gradient(* GradientFunctionPointer)(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name)
Definition: system.h:532
libMesh::System::set_vector_as_adjoint
void set_vector_as_adjoint(const std::string &vec_name, int qoi_num)
Allows one to set the QoI index controlling whether the vector identified by vec_name represents a so...
Definition: system.C:873
libMesh::System::get_mesh
const MeshBase & get_mesh() const
Definition: system.h:2083
libMesh::System::n_local_constrained_dofs
dof_id_type n_local_constrained_dofs() const
Definition: system.C:172
libMesh::System::update_global_solution
void update_global_solution(std::vector< Number > &global_soln) const
Fill the input vector global_soln so that it contains the global solution on all processors.
Definition: system.C:642
libMesh::System::add_variable
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1069
libMesh::System::current_local_solution
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1551
libMesh::System::Constraint::constrain
virtual void constrain()=0
Constraint function.
libMesh::TensorValue
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
Definition: exact_solution.h:53
libMesh::System::get_sensitivity_solution
NumericVector< Number > & get_sensitivity_solution(unsigned int i=0)
Definition: system.C:904
libMesh::System::QOI
Abstract base class to be used for quantities of interest.
Definition: system.h:191
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::System::Constraint::~Constraint
virtual ~Constraint()
Destructor.
Definition: system.h:173
libMesh::System::System
System(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
Definition: system.C:61
libMesh::Variable
This class defines the notion of a variable in the system.
Definition: variable.h:49
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
libMesh::System::read_serialized_vectors
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > * > &vectors) const
Non-templated version for backward compatibility.
Definition: system.h:1293
libMesh::System::read_serialized_data
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
Reads additional data, namely vectors, for this System.
Definition: system_io.C:724
libMesh::System::QOIDerivative::~QOIDerivative
virtual ~QOIDerivative()
Destructor.
Definition: system.h:221
libMesh::ParameterVector
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
Definition: parameter_vector.h:44
libMesh::System::read_serialized_vectors
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > * > &vectors) const
Read a number of identically distributed vectors.
Definition: system_io.C:2199
libMesh::System::read_serialized_data
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
Non-templated version for backward compatibility.
Definition: system.h:1273
libMesh::System::write_SCALAR_dofs
unsigned int write_SCALAR_dofs(const NumericVector< Number > &vec, const unsigned int var, Xdr &io) const
Writes the SCALAR dofs associated with var to the stream io.
Definition: system_io.C:2097
libMesh::System::_sys_number
const unsigned int _sys_number
The number associated with this system.
Definition: system.h:1956
libMesh::System::system
sys_type & system()
Definition: system.h:248
libMesh::System::_written_var_indices
std::vector< unsigned int > _written_var_indices
This vector is used only when reading in a system from file.
Definition: system.h:2046
libMesh::System::read_legacy_data
void read_legacy_data(Xdr &io, const bool read_additional_data=true)
Reads additional data, namely vectors, for this System.
Definition: system_io.C:309
libMesh::System::assemble_qoi
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet())
Calls user qoi function.
Definition: system.C:473
gptr
Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:95
libMesh::SystemSubset
This is a base class for classes which represent subsets of the dofs of a System.
Definition: system_subset.h:42
libMesh::System::attach_QOI_derivative_object
void attach_QOI_derivative_object(QOIDerivative &qoi_derivative)
Register a user object for evaluating derivatives of a quantity of interest with respect to test func...
Definition: system.C:1880
libMesh::System::qoi_parameter_sensitivity
virtual void qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
Solves for the derivative of each of the system's quantities of interest q in qoi[qoi_indices] with r...
Definition: system.C:498
libMesh::System::_additional_data_written
unsigned int _additional_data_written
This flag is used only when reading in a system from file.
Definition: system.h:2034
libMesh::System::read_parallel_data
void read_parallel_data(Xdr &io, const bool read_additional_data)
Reads additional data, namely vectors, for this System.
Definition: system_io.C:492
libMesh::System::assemble_residual_derivatives
virtual void assemble_residual_derivatives(const ParameterVector &parameters)
Calls residual parameter derivative function.
Definition: system.h:2319
libMesh::System::Assembly
Abstract base class to be used for system assembly.
Definition: system.h:143
libMesh::System::Assembly::assemble
virtual void assemble()=0
Assembly function.
libMesh::numeric_index_type
dof_id_type numeric_index_type
Definition: id_types.h:99
libMesh::EquationSystems
This is the EquationSystems class.
Definition: equation_systems.h:74
libMesh::System::_assemble_system_object
Assembly * _assemble_system_object
Object that assembles the system.
Definition: system.h:1891
libMesh::System::time
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1561
libMesh::System::Constraint
Abstract base class to be used for system constraints.
Definition: system.h:167
libMesh::System::Initialization::~Initialization
virtual ~Initialization()
Destructor.
Definition: system.h:125
libMesh::System::variable_type
const FEType & variable_type(const unsigned int i) const
Definition: system.h:2233
libMesh::System::write_serialized_data
void write_serialized_data(Xdr &io, const bool write_additional_data=true) const
Writes additional data, namely vectors, for this System.
Definition: system_io.C:1703
libMesh::System::adjoint_already_solved
bool adjoint_already_solved
Has the adjoint problem already been solved? If the user sets adjoint_already_solved to true,...
Definition: system.h:2053
libMesh::Variable::first_scalar_number
unsigned int first_scalar_number() const
Definition: variable.h:113
libMesh::System::n_active_dofs
dof_id_type n_active_dofs() const
Definition: system.h:2267
libMesh::System::discrete_var_norm
Real discrete_var_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type) const
Finds the discrete norm for the entries in the vector corresponding to Dofs associated with var.
Definition: system.C:1337
libMesh::System::deactivate
void deactivate()
Deactivates the system.
Definition: system.h:2131
libMesh::System::_constrain_system_object
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:1902
libMesh::Gradient
NumberVectorValue Gradient
Definition: exact_solution.h:58
libMesh::System::solution
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1539
libMesh::FEType
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition: fe_type.h:178
libMesh::System::sensitivity_solve
virtual std::pair< unsigned int, Real > sensitivity_solve(const ParameterVector &parameters)
Solves the sensitivity system, for the provided parameters.
Definition: system.h:2335
libMesh::System::weighted_sensitivity_adjoint_solve
virtual std::pair< unsigned int, Real > weighted_sensitivity_adjoint_solve(const ParameterVector &parameters, const ParameterVector &weights, const QoISet &qoi_indices=QoISet())
Assembles & solves the linear system(s) (dR/du)^T*z_w = sum(w_p*(d^2q/dudp - d^2R/dudp*z)),...
Definition: system.h:2357
libMesh::System::point_value
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:1971
libMesh::FEFamily
FEFamily
Definition: enum_fe_family.h:34
libMesh::System::_qoi_evaluate_derivative_object
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
Definition: system.h:1928
libMesh::NumberVectorValue
VectorValue< Number > NumberVectorValue
Definition: exact_solution.h:57
libMesh::DofMap
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:176
libMesh::System::name
const std::string & name() const
Definition: system.h:2067
libMesh::System::init_data
virtual void init_data()
Initializes the data for the system.
Definition: system.C:262
libMesh::System::attach_constraint_function
void attach_constraint_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function for imposing constraints.
Definition: system.C:1790
libMesh::System::request_vector
const NumericVector< Number > * request_vector(const std::string &vec_name) const
Definition: system.C:716
libMesh::System::n_constrained_dofs
dof_id_type n_constrained_dofs() const
Definition: system.C:157
libMesh::System::attach_init_function
void attach_init_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in initializing the system.
Definition: system.C:1720
libMesh::System::projection_matrix
void projection_matrix(SparseMatrix< Number > &proj_mat) const
This method creates a projection matrix which corresponds to the operation of project_vector between ...
Definition: system_projection.C:870
libMesh::SubsetSolveMode
SubsetSolveMode
Definition: enum_subset_solve_mode.h:35
libMesh::System::write_serialized_vectors
std::size_t write_serialized_vectors(Xdr &io, const std::vector< const NumericVector< Number > * > &vectors) const
Serialize & write a number of identically distributed vectors.
Definition: system_io.C:2293
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::System::variable_number
unsigned short int variable_number(const std::string &var) const
Definition: system.C:1232
libMesh::System::write_serialized_blocked_dof_objects
std::size_t write_serialized_blocked_dof_objects(const std::vector< const NumericVector< Number > * > &vecs, const dof_id_type n_objects, const iterator_type begin, const iterator_type end, Xdr &io, const unsigned int var_to_write=libMesh::invalid_uint) const
Writes an output vector to the stream io for a set of DofObjects.
Definition: system_io.C:1811
std::norm
MetaPhysicL::DualNumber< T, D > norm(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::System::assemble_qoi_derivative
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user qoi derivative function.
Definition: system.C:484
libMesh::System::_equation_systems
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:1940
libMesh::System::calculate_norm
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
Definition: system.C:1356
libMesh::System::clear
virtual void clear()
Clear all the data structures associated with the system.
Definition: system.C:205
libMesh::System::forward_qoi_parameter_sensitivity
virtual void forward_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the forward method.
Definition: system.h:2375
libMesh::System::add_vector
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:661
libMesh::SystemNorm
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
Definition: system_norm.h:51
libMesh::ParallelType
ParallelType
Defines an enum for parallel data structure types.
Definition: enum_parallel_type.h:33
libMesh::System::get_dof_map
const DofMap & get_dof_map() const
Definition: system.h:2099
libMesh::System::n_dofs
dof_id_type n_dofs() const
Definition: system.C:150
libMesh::System::user_initialization
virtual void user_initialization()
Calls user's attached initialization function, or is overridden by the user in derived classes.
Definition: system.C:1896
libMesh::System::attach_assemble_object
void attach_assemble_object(Assembly &assemble)
Register a user object to use in assembling the system matrix and RHS.
Definition: system.C:1774
libMesh::LAGRANGE
Definition: enum_fe_family.h:36
libMesh::System::_qoi_evaluate_object
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Definition: system.h:1914
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::System::QOI::~QOI
virtual ~QOI()
Destructor.
Definition: system.h:197
libMesh::ParallelObject
An object whose state is distributed along a set of processors.
Definition: parallel_object.h:55
libMesh::System::ValueFunctionPointer
Number(* ValueFunctionPointer)(const Point &p, const Parameters &Parameters, const std::string &sys_name, const std::string &unknown_name)
Projects arbitrary functions onto the current solution.
Definition: system.h:528
libMesh::System::user_constrain
virtual void user_constrain()
Calls user's attached constraint function, or is overridden by the user in derived classes.
Definition: system.C:1924
libMesh::System::adjoint_solve
virtual std::pair< unsigned int, Real > adjoint_solve(const QoISet &qoi_indices=QoISet())
Solves the adjoint system, for the specified qoi indices, or for every qoi if qoi_indices is nullptr.
Definition: system.h:2350
libMesh::System::add_weighted_sensitivity_solution
NumericVector< Number > & add_weighted_sensitivity_solution()
Definition: system.C:924
libMesh::System::disable_cache
virtual void disable_cache()
Avoids use of any cached data that might affect any solve result.
Definition: system.h:2325
libMesh::System::get_all_variable_numbers
void get_all_variable_numbers(std::vector< unsigned int > &all_variable_numbers) const
Fills all_variable_numbers with all the variable numbers for the variables that have been added to th...
Definition: system.C:1240
libMesh::System::project_solution
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
Definition: system_projection.C:950
libMesh::System::vector_preservation
bool vector_preservation(const std::string &vec_name) const
Definition: system.C:863
fptr
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:80
libMesh::System::Initialization::initialize
virtual void initialize()=0
Initialization function.
libMesh::System::add_weighted_sensitivity_adjoint_solution
NumericVector< Number > & add_weighted_sensitivity_adjoint_solution(unsigned int i=0)
Definition: system.C:977
libMesh::System::remove_vector
void remove_vector(const std::string &vec_name)
Removes the additional vector vec_name from this system.
Definition: system.C:699
libMesh::VariableGroup
This class defines a logically grouped set of variables in the system.
Definition: variable.h:172
libMesh::System::user_QOI_derivative
virtual void user_QOI_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user's attached quantity of interest derivative function, or is overridden by the user in deriv...
Definition: system.C:1952
libMesh::System::get_vector
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774
libMesh::System::get_equation_systems
EquationSystems & get_equation_systems()
Definition: system.h:725
libMesh::System::solve
virtual void solve()
Solves the system.
Definition: system.h:334
libMesh::System::hide_output
bool & hide_output()
Definition: system.h:1712
libMesh::System::_variable_numbers
std::map< std::string, unsigned short int > _variable_numbers
The variable numbers corresponding to user-specified names, useful for name-based lookups.
Definition: system.h:1972
libMesh::System::read_parallel_data
void read_parallel_data(Xdr &io, const bool read_additional_data)
Non-templated version for backward compatibility.
Definition: system.h:1315
libMesh::System::update
virtual void update()
Update the local values to reflect the solution on neighboring processors.
Definition: system.C:408
libMesh::System::add_sensitivity_rhs
NumericVector< Number > & add_sensitivity_rhs(unsigned int i=0)
Definition: system.C:1039
libMesh::FIRST
Definition: enum_order.h:42
libMesh::System::_solution_projection
bool _solution_projection
Holds true if the solution vector should be projected onto a changed grid, false if it should be zero...
Definition: system.h:2009
libMesh::System::point_gradient
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2100
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::Parameters
This class provides the ability to map between arbitrary, user-defined strings and several data types...
Definition: parameters.h:59
libMesh::System::point_hessian
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2244
libMesh::System::_sys_name
const std::string _sys_name
A name associated with this system.
Definition: system.h:1951
libMesh::System::const_vectors_iterator
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
Definition: system.h:757
libMesh::System::adjoint_qoi_parameter_sensitivity
virtual void adjoint_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the adjoint method.
Definition: system.h:2366
libMesh::System::_vector_is_adjoint
std::map< std::string, int > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs,...
Definition: system.h:1997
libMesh::System::set_adjoint_already_solved
void set_adjoint_already_solved(bool setting)
Setter for the adjoint_already_solved boolean.
Definition: system.h:402