libMesh
system.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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/auto_ptr.h"
25 #include "libmesh/elem_range.h"
26 #include "libmesh/enum_norm_type.h"
27 #include "libmesh/enum_xdr_mode.h"
28 #include "libmesh/enum_subset_solve_mode.h"
29 #include "libmesh/enum_parallel_type.h"
30 #include "libmesh/fem_function_base.h"
31 #include "libmesh/libmesh_common.h"
32 #include "libmesh/parallel_object.h"
33 #include "libmesh/qoi_set.h"
34 #include "libmesh/reference_counted_object.h"
35 #include "libmesh/tensor_value.h" // For point_hessian
36 #include "libmesh/variable.h"
37 
38 // C++ includes
39 #include <cstddef>
40 #include <set>
41 #include <vector>
42 
43 namespace libMesh
44 {
45 
46 // Forward Declarations
47 class System;
48 class EquationSystems;
49 class MeshBase;
50 class Xdr;
51 class DofMap;
52 template <typename Output> class FunctionBase;
53 class Parameters;
54 class ParameterVector;
55 class Point;
56 class SensitivityData;
57 template <typename T> class NumericVector;
58 template <typename T> class VectorValue;
59 typedef VectorValue<Number> NumberVectorValue;
60 typedef NumberVectorValue Gradient;
61 class SystemSubset;
62 class FEType;
63 class SystemNorm;
64 
76 class System : public ReferenceCountedObject<System>,
77  public ParallelObject
78 {
79 public:
80 
85  System (EquationSystems & es,
86  const std::string & name,
87  const unsigned int number);
88 
96  {
97  public:
101  virtual ~Initialization () {}
102 
108  virtual void initialize () = 0;
109  };
110 
111 
112 
119  class Assembly
120  {
121  public:
125  virtual ~Assembly () {}
126 
132  virtual void assemble () = 0;
133  };
134 
135 
136 
144  {
145  public:
149  virtual ~Constraint () {}
150 
156  virtual void constrain () = 0;
157  };
158 
159 
160 
167  class QOI
168  {
169  public:
173  virtual ~QOI () {}
174 
180  virtual void qoi (const QoISet & qoi_indices) = 0;
181  };
182 
183 
184 
192  {
193  public:
197  virtual ~QOIDerivative () {}
198 
204  virtual void qoi_derivative (const QoISet & qoi_indices,
205  bool include_liftfunc,
206  bool apply_constraints) = 0;
207  };
208 
209 
210 
214  virtual ~System ();
215 
219  typedef System sys_type;
220 
224  sys_type & system () { return *this; }
225 
230  virtual void clear ();
231 
236  void init ();
237 
246  virtual void reinit ();
247 
251  virtual void reinit_constraints ();
252 
256  bool is_initialized();
257 
262  virtual void update ();
263 
270  virtual void assemble ();
271 
276  virtual void assemble_qoi (const QoISet & qoi_indices = QoISet());
277 
282  virtual void assemble_qoi_derivative (const QoISet & qoi_indices = QoISet(),
283  bool include_liftfunc = true,
284  bool apply_constraints = true);
285 
297  virtual void assemble_residual_derivatives (const ParameterVector & parameters);
298 
304  virtual void restrict_solve_to (const SystemSubset * subset,
305  const SubsetSolveMode subset_solve_mode=SUBSET_ZERO);
306 
310  virtual void solve () {}
311 
321  virtual std::pair<unsigned int, Real>
322  sensitivity_solve (const ParameterVector & parameters);
323 
334  virtual std::pair<unsigned int, Real>
335  weighted_sensitivity_solve (const ParameterVector & parameters,
336  const ParameterVector & weights);
337 
348  virtual std::pair<unsigned int, Real>
349  adjoint_solve (const QoISet & qoi_indices = QoISet());
350 
365  virtual std::pair<unsigned int, Real>
367  const ParameterVector & weights,
368  const QoISet & qoi_indices = QoISet());
373  { return adjoint_already_solved;}
374 
378  void set_adjoint_already_solved(bool setting)
379  { adjoint_already_solved = setting;}
380 
381 
399  virtual void qoi_parameter_sensitivity (const QoISet & qoi_indices,
400  const ParameterVector & parameters,
401  SensitivityData & sensitivities);
402 
408  virtual void adjoint_qoi_parameter_sensitivity (const QoISet & qoi_indices,
409  const ParameterVector & parameters,
410  SensitivityData & sensitivities);
411 
417  virtual void forward_qoi_parameter_sensitivity (const QoISet & qoi_indices,
418  const ParameterVector & parameters,
419  SensitivityData & sensitivities);
420 
431  virtual void qoi_parameter_hessian(const QoISet & qoi_indices,
432  const ParameterVector & parameters,
433  SensitivityData & hessian);
434 
447  virtual void qoi_parameter_hessian_vector_product(const QoISet & qoi_indices,
448  const ParameterVector & parameters,
449  const ParameterVector & vector,
450  SensitivityData & product);
451 
457  virtual bool compare (const System & other_system,
458  const Real threshold,
459  const bool verbose) const;
460 
464  const std::string & name () const;
465 
471  virtual std::string system_type () const { return "Basic"; }
472 
484 
496 
504  void project_solution (Number fptr(const Point & p,
505  const Parameters & parameters,
506  const std::string & sys_name,
507  const std::string & unknown_name),
508  Gradient gptr(const Point & p,
509  const Parameters & parameters,
510  const std::string & sys_name,
511  const std::string & unknown_name),
512  const Parameters & parameters) const;
513 
527  void project_vector (NumericVector<Number> & new_vector,
530  int is_adjoint = -1) const;
531 
545  void project_vector (NumericVector<Number> & new_vector,
548  int is_adjoint = -1) const;
549 
561  void project_vector (Number fptr(const Point & p,
562  const Parameters & parameters,
563  const std::string & sys_name,
564  const std::string & unknown_name),
565  Gradient gptr(const Point & p,
566  const Parameters & parameters,
567  const std::string & sys_name,
568  const std::string & unknown_name),
569  const Parameters & parameters,
570  NumericVector<Number> & new_vector,
571  int is_adjoint = -1) const;
572 
587  void boundary_project_solution (const std::set<boundary_id_type> & b,
588  const std::vector<unsigned int> & variables,
591 
604  void boundary_project_solution (const std::set<boundary_id_type> & b,
605  const std::vector<unsigned int> & variables,
606  Number fptr(const Point & p,
607  const Parameters & parameters,
608  const std::string & sys_name,
609  const std::string & unknown_name),
610  Gradient gptr(const Point & p,
611  const Parameters & parameters,
612  const std::string & sys_name,
613  const std::string & unknown_name),
614  const Parameters & parameters);
615 
633  void boundary_project_vector (const std::set<boundary_id_type> & b,
634  const std::vector<unsigned int> & variables,
635  NumericVector<Number> & new_vector,
638  int is_adjoint = -1) const;
639 
655  void boundary_project_vector (const std::set<boundary_id_type> & b,
656  const std::vector<unsigned int> & variables,
657  Number fptr(const Point & p,
658  const Parameters & parameters,
659  const std::string & sys_name,
660  const std::string & unknown_name),
661  Gradient gptr(const Point & p,
662  const Parameters & parameters,
663  const std::string & sys_name,
664  const std::string & unknown_name),
665  const Parameters & parameters,
666  NumericVector<Number> & new_vector,
667  int is_adjoint = -1) const;
668 
672  unsigned int number () const;
673 
679  void update_global_solution (std::vector<Number> & global_soln) const;
680 
686  void update_global_solution (std::vector<Number> & global_soln,
687  const processor_id_type dest_proc) const;
688 
692  const MeshBase & get_mesh() const;
693 
697  MeshBase & get_mesh();
698 
702  const DofMap & get_dof_map() const;
703 
707  DofMap & get_dof_map();
708 
713 
718 
723  bool active () const;
724 
728  void activate ();
729 
733  void deactivate ();
734 
743  void set_basic_system_only ();
744 
748  typedef std::map<std::string, NumericVector<Number> *>::iterator vectors_iterator;
749  typedef std::map<std::string, NumericVector<Number> *>::const_iterator const_vectors_iterator;
750 
754  vectors_iterator vectors_begin ();
755 
759  const_vectors_iterator vectors_begin () const;
760 
764  vectors_iterator vectors_end ();
765 
769  const_vectors_iterator vectors_end () const;
770 
780  NumericVector<Number> & add_vector (const std::string & vec_name,
781  const bool projections=true,
782  const ParallelType type = PARALLEL);
783 
787  void remove_vector(const std::string & vec_name);
788 
795  { return _solution_projection; }
796 
801  bool have_vector (const std::string & vec_name) const;
802 
807  const NumericVector<Number> * request_vector (const std::string & vec_name) const;
808 
813  NumericVector<Number> * request_vector (const std::string & vec_name);
814 
820  const NumericVector<Number> * request_vector (const unsigned int vec_num) const;
821 
827  NumericVector<Number> * request_vector (const unsigned int vec_num);
828 
834  const NumericVector<Number> & get_vector (const std::string & vec_name) const;
835 
841  NumericVector<Number> & get_vector (const std::string & vec_name);
842 
848  const NumericVector<Number> & get_vector (const unsigned int vec_num) const;
849 
855  NumericVector<Number> & get_vector (const unsigned int vec_num);
856 
861  const std::string & vector_name (const unsigned int vec_num) const;
862 
866  const std::string & vector_name (const NumericVector<Number> & vec_reference) const;
867 
878  void set_vector_as_adjoint (const std::string & vec_name, int qoi_num);
879 
885  int vector_is_adjoint (const std::string & vec_name) const;
886 
892  void set_vector_preservation (const std::string & vec_name, bool preserve);
893 
899  bool vector_preservation (const std::string & vec_name) const;
900 
906  NumericVector<Number> & add_adjoint_solution(unsigned int i=0);
907 
912  NumericVector<Number> & get_adjoint_solution(unsigned int i=0);
913 
918  const NumericVector<Number> & get_adjoint_solution(unsigned int i=0) const;
919 
926 
932 
937  const NumericVector<Number> & get_sensitivity_solution(unsigned int i=0) const;
938 
946 
953 
960 
967 
973 
979 
985  NumericVector<Number> & add_adjoint_rhs(unsigned int i=0);
986 
993  NumericVector<Number> & get_adjoint_rhs(unsigned int i=0);
994 
999  const NumericVector<Number> & get_adjoint_rhs(unsigned int i=0) const;
1000 
1006  NumericVector<Number> & add_sensitivity_rhs(unsigned int i=0);
1007 
1017  NumericVector<Number> & get_sensitivity_rhs(unsigned int i=0);
1018 
1023  const NumericVector<Number> & get_sensitivity_rhs(unsigned int i=0) const;
1024 
1030  unsigned int n_vectors () const;
1031 
1038  virtual unsigned int n_matrices () const;
1039 
1043  unsigned int n_vars() const;
1044 
1048  unsigned int n_variable_groups() const;
1049 
1055  unsigned int n_components() const;
1056 
1060  dof_id_type n_dofs() const;
1061 
1066  dof_id_type n_active_dofs() const;
1067 
1073 
1079 
1084  dof_id_type n_local_dofs() const;
1085 
1092  unsigned int add_variable (const std::string & var,
1093  const FEType & type,
1094  const std::set<subdomain_id_type> * const active_subdomains = libmesh_nullptr);
1095 
1101  unsigned int add_variable (const std::string & var,
1102  const Order order = FIRST,
1103  const FEFamily = LAGRANGE,
1104  const std::set<subdomain_id_type> * const active_subdomains = libmesh_nullptr);
1105 
1112  unsigned int add_variables (const std::vector<std::string> & vars,
1113  const FEType & type,
1114  const std::set<subdomain_id_type> * const active_subdomains = libmesh_nullptr);
1115 
1121  unsigned int add_variables (const std::vector<std::string> & vars,
1122  const Order order = FIRST,
1123  const FEFamily = LAGRANGE,
1124  const std::set<subdomain_id_type> * const active_subdomains = libmesh_nullptr);
1125 
1129  const Variable & variable (unsigned int var) const;
1130 
1134  const VariableGroup & variable_group (unsigned int vg) const;
1135 
1139  bool has_variable(const std::string & var) const;
1140 
1144  const std::string & variable_name(const unsigned int i) const;
1145 
1150  unsigned short int variable_number (const std::string & var) const;
1151 
1156  void get_all_variable_numbers(std::vector<unsigned int> & all_variable_numbers) const;
1157 
1168  unsigned int variable_scalar_number (const std::string & var,
1169  unsigned int component) const;
1170 
1181  unsigned int variable_scalar_number (unsigned int var_num,
1182  unsigned int component) const;
1183 
1184 
1188  const FEType & variable_type (const unsigned int i) const;
1189 
1193  const FEType & variable_type (const std::string & var) const;
1194 
1199  bool identify_variable_groups () const;
1200 
1204  void identify_variable_groups (const bool);
1205 
1211  unsigned int var,
1212  FEMNormType norm_type,
1213  std::set<unsigned int> * skip_dimensions=libmesh_nullptr) const;
1214 
1220  const SystemNorm & norm,
1221  std::set<unsigned int> * skip_dimensions=libmesh_nullptr) const;
1222 
1226  void read_header (Xdr & io,
1227  const std::string & version,
1228  const bool read_header=true,
1229  const bool read_additional_data=true,
1230  const bool read_legacy_format=false);
1231 
1239 #ifdef LIBMESH_ENABLE_DEPRECATED
1240  void read_legacy_data (Xdr & io,
1241  const bool read_additional_data=true);
1242 #endif
1243 
1248  template <typename ValType>
1249  void read_serialized_data (Xdr & io,
1250  const bool read_additional_data=true);
1258  const bool read_additional_data=true)
1259  { read_serialized_data<Number>(io, read_additional_data); }
1260 
1266  template <typename InValType>
1267  std::size_t read_serialized_vectors (Xdr & io,
1268  const std::vector<NumericVector<Number> *> & vectors) const;
1269 
1277  std::size_t read_serialized_vectors (Xdr & io,
1278  const std::vector<NumericVector<Number> *> & vectors) const
1279  { return read_serialized_vectors<Number>(io, vectors); }
1280 
1287  template <typename InValType>
1288  void read_parallel_data (Xdr & io,
1289  const bool read_additional_data);
1290 
1300  const bool read_additional_data)
1301  { read_parallel_data<Number>(io, read_additional_data); }
1302 
1306  void write_header (Xdr & io,
1307  const std::string & version,
1308  const bool write_additional_data) const;
1309 
1314  void write_serialized_data (Xdr & io,
1315  const bool write_additional_data = true) const;
1316 
1322  std::size_t write_serialized_vectors (Xdr & io,
1323  const std::vector<const NumericVector<Number> *> & vectors) const;
1324 
1331  void write_parallel_data (Xdr & io,
1332  const bool write_additional_data) const;
1333 
1338  std::string get_info () const;
1339 
1343  void attach_init_function (void fptr(EquationSystems & es,
1344  const std::string & name));
1345 
1351  void attach_init_object (Initialization & init);
1352 
1358  const std::string & name));
1359 
1364  void attach_assemble_object (Assembly & assemble);
1365 
1370  const std::string & name));
1371 
1375  void attach_constraint_object (Constraint & constrain);
1376 
1381  void attach_QOI_function (void fptr(EquationSystems & es,
1382  const std::string & name,
1383  const QoISet & qoi_indices));
1384 
1389  void attach_QOI_object (QOI & qoi);
1390 
1396  void attach_QOI_derivative (void fptr(EquationSystems & es,
1397  const std::string & name,
1398  const QoISet & qoi_indices,
1399  bool include_liftfunc,
1400  bool apply_constraints));
1401 
1407  void attach_QOI_derivative_object (QOIDerivative & qoi_derivative);
1408 
1413  virtual void user_initialization ();
1414 
1419  virtual void user_assembly ();
1420 
1425  virtual void user_constrain ();
1426 
1431  virtual void user_QOI (const QoISet & qoi_indices);
1432 
1437  virtual void user_QOI_derivative (const QoISet & qoi_indices = QoISet(),
1438  bool include_liftfunc = true,
1439  bool apply_constraints = true);
1440 
1446  virtual void re_update ();
1447 
1451  virtual void restrict_vectors ();
1452 
1456  virtual void prolong_vectors ();
1457 
1478 
1483  virtual void disable_cache ();
1484 
1494 
1509 
1510 
1511  //--------------------------------------------------
1512  // The solution and solution access members
1513 
1518  Number current_solution (const dof_id_type global_dof_number) const;
1519 
1524 
1536 
1546 
1553  std::vector<Number> qoi;
1554 
1575  Number point_value(unsigned int var, const Point & p,
1576  const bool insist_on_success = true) const;
1577 
1585  Number point_value(unsigned int var, const Point & p, const Elem & e) const;
1586 
1593  Number point_value(unsigned int var, const Point & p, const Elem * e) const;
1594 
1599  Gradient point_gradient(unsigned int var, const Point & p,
1600  const bool insist_on_success = true) const;
1601 
1606  Gradient point_gradient(unsigned int var, const Point & p, const Elem & e) const;
1607 
1614  Gradient point_gradient(unsigned int var, const Point & p, const Elem * e) const;
1615 
1620  Tensor point_hessian(unsigned int var, const Point & p,
1621  const bool insist_on_success = true) const;
1622 
1628  Tensor point_hessian(unsigned int var, const Point & p, const Elem & e) const;
1629 
1636  Tensor point_hessian(unsigned int var, const Point & p, const Elem * e) const;
1637 
1642  void local_dof_indices (const unsigned int var,
1643  std::set<dof_id_type> & var_indices) const;
1644 
1649  void zero_variable (NumericVector<Number> & v, unsigned int var_num) const;
1650 
1651 
1657  bool & hide_output() { return _hide_output; }
1658 
1659 protected:
1660 
1667  virtual void init_data ();
1668 
1677  int is_adjoint = -1) const;
1678 
1687  void project_vector (const NumericVector<Number> &,
1689  int is_adjoint = -1) const;
1690 
1691 private:
1698  System (const System &);
1699 
1706  System & operator=(const System &);
1707 
1713  unsigned int var,
1714  FEMNormType norm_type) const;
1715 
1725  template <typename iterator_type, typename InValType>
1727  const iterator_type begin,
1728  const iterator_type end,
1729  const InValType dummy,
1730  Xdr & io,
1731  const std::vector<NumericVector<Number> *> & vecs,
1732  const unsigned int var_to_read=libMesh::invalid_uint) const;
1733 
1742  unsigned int read_SCALAR_dofs (const unsigned int var,
1743  Xdr & io,
1744  NumericVector<Number> * vec) const;
1745 
1754  template <typename InValType>
1756  NumericVector<Number> * vec);
1757 
1767  NumericVector<Number> & vec)
1768  { return read_serialized_vector<Number>(io, &vec); }
1769 
1776  template <typename iterator_type>
1777  std::size_t write_serialized_blocked_dof_objects (const std::vector<const NumericVector<Number> *> & vecs,
1778  const dof_id_type n_objects,
1779  const iterator_type begin,
1780  const iterator_type end,
1781  Xdr & io,
1782  const unsigned int var_to_write=libMesh::invalid_uint) const;
1783 
1789  unsigned int write_SCALAR_dofs (const NumericVector<Number> & vec,
1790  const unsigned int var,
1791  Xdr & io) const;
1792 
1800  const NumericVector<Number> & vec) const;
1801 
1806  const std::string & name);
1807 
1812 
1817  const std::string & name);
1818 
1823 
1828  const std::string & name);
1829 
1834 
1839  const std::string & name,
1840  const QoISet & qoi_indices);
1841 
1846 
1851  const std::string & name,
1852  const QoISet & qoi_indices,
1853  bool include_liftfunc,
1854  bool apply_constraints);
1855 
1860 
1866 
1872 
1878 
1882  const std::string _sys_name;
1883 
1887  const unsigned int _sys_number;
1888 
1892  std::vector<Variable> _variables;
1893 
1897  std::vector<VariableGroup> _variable_groups;
1898 
1903  std::map<std::string, unsigned short int> _variable_numbers;
1904 
1908  bool _active;
1909 
1916  std::map<std::string, NumericVector<Number> * > _vectors;
1917 
1922  std::map<std::string, bool> _vector_projections;
1923 
1928  std::map<std::string, int> _vector_is_adjoint;
1929 
1933  std::map<std::string, ParallelType> _vector_types;
1934 
1941 
1947 
1953 
1959 
1966 
1977  std::vector<unsigned int> _written_var_indices;
1978 
1985 
1991 };
1992 
1993 
1994 
1995 // ------------------------------------------------------------
1996 // System inline methods
1997 inline
1998 const std::string & System::name() const
1999 {
2000  return _sys_name;
2001 }
2002 
2003 
2004 
2005 inline
2006 unsigned int System::number() const
2007 {
2008  return _sys_number;
2009 }
2010 
2011 
2012 
2013 inline
2015 {
2016  return _mesh;
2017 }
2018 
2019 
2020 
2021 inline
2023 {
2024  return _mesh;
2025 }
2026 
2027 
2028 
2029 inline
2031 {
2032  return *_dof_map;
2033 }
2034 
2035 
2036 
2037 inline
2039 {
2040  return *_dof_map;
2041 }
2042 
2043 
2044 
2045 inline
2046 bool System::active() const
2047 {
2048  return _active;
2049 }
2050 
2051 
2052 
2053 inline
2055 {
2056  _active = true;
2057 }
2058 
2059 
2060 
2061 inline
2063 {
2064  _active = false;
2065 }
2066 
2067 
2068 
2069 inline
2071 {
2072  return _is_initialized;
2073 }
2074 
2075 
2076 
2077 inline
2079 {
2080  _basic_system_only = true;
2081 }
2082 
2083 
2084 
2085 inline
2086 unsigned int System::n_vars() const
2087 {
2088  return cast_int<unsigned int>(_variables.size());
2089 }
2090 
2091 
2092 
2093 inline
2094 unsigned int System::n_variable_groups() const
2095 {
2096  return cast_int<unsigned int>(_variable_groups.size());
2097 }
2098 
2099 
2100 
2101 inline
2102 unsigned int System::n_components() const
2103 {
2104  if (_variables.empty())
2105  return 0;
2106 
2107  const Variable & last = _variables.back();
2108  return last.first_scalar_number() + last.n_components();
2109 }
2110 
2111 
2112 
2113 inline
2114 const Variable & System::variable (const unsigned int i) const
2115 {
2116  libmesh_assert_less (i, _variables.size());
2117 
2118  return _variables[i];
2119 }
2120 
2121 
2122 
2123 inline
2124 const VariableGroup & System::variable_group (const unsigned int vg) const
2125 {
2126  libmesh_assert_less (vg, _variable_groups.size());
2127 
2128  return _variable_groups[vg];
2129 }
2130 
2131 
2132 
2133 inline
2134 const std::string & System::variable_name (const unsigned int i) const
2135 {
2136  libmesh_assert_less (i, _variables.size());
2137 
2138  return _variables[i].name();
2139 }
2140 
2141 
2142 
2143 inline
2144 unsigned int
2145 System::variable_scalar_number (const std::string & var,
2146  unsigned int component) const
2147 {
2148  return variable_scalar_number(this->variable_number(var), component);
2149 }
2150 
2151 
2152 
2153 inline
2154 unsigned int
2155 System::variable_scalar_number (unsigned int var_num,
2156  unsigned int component) const
2157 {
2158  return _variables[var_num].first_scalar_number() + component;
2159 }
2160 
2161 
2162 
2163 inline
2164 const FEType & System::variable_type (const unsigned int i) const
2165 {
2166  libmesh_assert_less (i, _variables.size());
2167 
2168  return _variables[i].type();
2169 }
2170 
2171 
2172 
2173 inline
2174 const FEType & System::variable_type (const std::string & var) const
2175 {
2176  return _variables[this->variable_number(var)].type();
2177 }
2178 
2179 
2180 
2181 inline
2183 {
2185 }
2186 
2187 
2188 
2189 inline
2191 {
2193 }
2194 
2195 
2196 
2197 inline
2199 {
2200  return this->n_dofs() - this->n_constrained_dofs();
2201 }
2202 
2203 
2204 
2205 inline
2206 bool System::have_vector (const std::string & vec_name) const
2207 {
2208  return (_vectors.count(vec_name));
2209 }
2210 
2211 
2212 
2213 inline
2214 unsigned int System::n_vectors () const
2215 {
2216  return cast_int<unsigned int>(_vectors.size());
2217 }
2218 
2219 inline
2220 unsigned int System::n_matrices () const
2221 {
2222  return 0;
2223 }
2224 
2225 inline
2227 {
2228  return _vectors.begin();
2229 }
2230 
2231 inline
2233 {
2234  return _vectors.begin();
2235 }
2236 
2237 inline
2239 {
2240  return _vectors.end();
2241 }
2242 
2243 inline
2245 {
2246  return _vectors.end();
2247 }
2248 
2249 inline
2251 {
2252  libmesh_not_implemented();
2253 }
2254 
2255 inline
2257 
2258 inline
2259 std::pair<unsigned int, Real>
2261 {
2262  libmesh_not_implemented();
2263 }
2264 
2265 inline
2266 std::pair<unsigned int, Real>
2268  const ParameterVector &)
2269 {
2270  libmesh_not_implemented();
2271 }
2272 
2273 inline
2274 std::pair<unsigned int, Real>
2276 {
2277  libmesh_not_implemented();
2278 }
2279 
2280 inline
2281 std::pair<unsigned int, Real>
2283  const ParameterVector &,
2284  const QoISet &)
2285 {
2286  libmesh_not_implemented();
2287 }
2288 
2289 inline
2290 void
2292  const ParameterVector &,
2293  SensitivityData &)
2294 {
2295  libmesh_not_implemented();
2296 }
2297 
2298 inline
2299 void
2301  const ParameterVector &,
2302  SensitivityData &)
2303 {
2304  libmesh_not_implemented();
2305 }
2306 
2307 inline
2308 void
2310  const ParameterVector &,
2311  SensitivityData &)
2312 {
2313  libmesh_not_implemented();
2314 }
2315 
2316 inline
2317 void
2319  const ParameterVector &,
2320  const ParameterVector &,
2321  SensitivityData &)
2322 {
2323  libmesh_not_implemented();
2324 }
2325 
2326 
2327 } // namespace libMesh
2328 
2329 #endif // LIBMESH_SYSTEM_H
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:905
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2011
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition: fe_type.h:178
vectors_iterator vectors_end()
End of vectors container.
Definition: system.h:2238
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1545
dof_id_type n_constrained_dofs() const
Definition: system.C:155
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:1903
This is the EquationSystems class.
static unsigned int n_objects()
Prints the number of outstanding (created, but not yet destroyed) objects.
virtual void clear()
Clear all the data structures associated with the system.
Definition: system.C:203
Abstract base class to be used for system initialization.
Definition: system.h:95
Assembly * _assemble_system_object
Object that assembles the system.
Definition: system.h:1822
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
Definition: system.h:1946
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:184
const std::string & variable_name(const unsigned int i) const
Definition: system.h:2134
std::map< std::string, ParallelType > _vector_types
Holds the type of a vector.
Definition: system.h:1933
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:1952
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
Definition: system.h:1827
void set_adjoint_already_solved(bool setting)
Setter for the adjoint_already_solved boolean.
Definition: system.h:378
This class provides the ability to map between arbitrary, user-defined strings and several data types...
Definition: parameters.h:63
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:1728
NumericVector< Number > & add_adjoint_solution(unsigned int i=0)
Definition: system.C:977
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:2300
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
virtual void assemble_residual_derivatives(const ParameterVector &parameters)
Calls residual parameter derivative function.
Definition: system.h:2250
int vector_is_adjoint(const std::string &vec_name) const
Definition: system.C:916
void write_parallel_data(Xdr &io, const bool write_additional_data) const
Writes additional data, namely vectors, for this System.
Definition: system_io.C:1521
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
Definition: qoi_set.h:45
void read_parallel_data(Xdr &io, const bool read_additional_data)
Non-templated version for backward compatibility.
Definition: system.h:1299
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
Definition: system.C:385
virtual void disable_cache()
Avoids use of any cached data that might affect any solve result.
Definition: system.h:2256
virtual ~Assembly()
Destructor.
Definition: system.h:125
Set dofs outside the subset to zero.
int extra_quadrature_order
A member int that can be employed to indicate increased or reduced quadrature order.
Definition: system.h:1508
virtual void initialize()=0
Initialization function.
sys_type & system()
Definition: system.h:224
NumericVector< Number > & get_sensitivity_solution(unsigned int i=0)
Definition: system.C:936
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1101
bool has_variable(const std::string &var) const
Definition: system.C:1256
const unsigned int _sys_number
The number associated with this system.
Definition: system.h:1887
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:501
NumericVector< Number > & get_sensitivity_rhs(unsigned int i=0)
Definition: system.C:1081
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:1833
virtual void assemble()
Prepares matrix and _dof_map for matrix assembly.
Definition: system.C:479
virtual void init_data()
Initializes the data for the system.
Definition: system.C:260
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=libmesh_nullptr, int is_adjoint=-1) const
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
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:1327
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
uint8_t processor_id_type
Definition: id_types.h:99
UniquePtr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1535
const class libmesh_nullptr_t libmesh_nullptr
bool vector_preservation(const std::string &vec_name) const
Definition: system.C:895
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > * > &vectors) const
Non-templated version for backward compatibility.
Definition: system.h:1277
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
Definition: system.h:749
virtual void user_initialization()
Calls user&#39;s attached initialization function, or is overridden by the user in derived classes...
Definition: system.C:1936
bool _active
Flag stating if the system is active or not.
Definition: system.h:1908
std::vector< Variable > _variables
The Variable in this System.
Definition: system.h:1892
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
Definition: system_norm.h:43
NumericVector< Number > & add_sensitivity_rhs(unsigned int i=0)
Definition: system.C:1071
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:1901
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
void read_legacy_data(Xdr &io, const bool read_additional_data=true)
Reads additional data, namely vectors, for this System.
Definition: system_io.C:310
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr) const
Projects arbitrary functions onto the current solution.
The libMesh namespace provides an interface to certain functionality in the library.
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2226
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:1920
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:2291
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
Definition: system.h:2124
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:2330
Abstract base class to be used for system assembly.
Definition: system.h:119
NumericVector< Number > & add_weighted_sensitivity_solution()
Definition: system.C:956
const FEType & variable_type(const unsigned int i) const
Definition: system.h:2164
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
Definition: system.h:1838
System sys_type
The type of system.
Definition: system.h:219
void init()
Initializes degrees of freedom on the current mesh.
Definition: system.C:235
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:2134
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
const std::string & name() const
Definition: system.h:1998
NumericVector< Number > & get_weighted_sensitivity_solution()
Definition: system.C:963
unsigned int first_scalar_number() const
Definition: variable.h:113
std::string get_info() const
Definition: system.C:1676
bool adjoint_already_solved
Has the adjoint problem already been solved? If the user sets adjoint_already_solved to true...
Definition: system.h:1984
This is the MeshBase class.
Definition: mesh_base.h:68
virtual void prolong_vectors()
Prolong vectors after the mesh has refined.
Definition: system.C:375
virtual ~QOIDerivative()
Destructor.
Definition: system.h:197
virtual void user_QOI(const QoISet &qoi_indices)
Calls user&#39;s attached quantity of interest function, or is overridden by the user in derived classes...
Definition: system.C:1978
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:78
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
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:1865
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
Definition: system.h:1859
void remove_vector(const std::string &vec_name)
Removes the additional vector vec_name from this system.
Definition: system.C:719
NumericVector< Number > & add_weighted_sensitivity_adjoint_solution(unsigned int i=0)
Definition: system.C:1009
virtual void qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
Solves for the derivative of each of the system&#39;s quantities of interest q in qoi[qoi_indices] with r...
Definition: system.C:515
virtual void qoi_parameter_hessian(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &hessian)
For each of the system&#39;s quantities of interest q in qoi[qoi_indices], and for a vector of parameters...
Definition: system.h:2309
void attach_constraint_object(Constraint &constrain)
Register a user object for imposing constraints.
Definition: system.C:1849
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:167
const NumericVector< Number > * request_vector(const std::string &vec_name) const
Definition: system.C:736
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:815
unsigned short int variable_number(const std::string &var) const
Definition: system.C:1263
void attach_init_object(Initialization &init)
Register a user class to use to initialize the system.
Definition: system.C:1779
void set_basic_system_only()
Sets the system to be "basic only": i.e.
Definition: system.h:2078
FEFamily
defines an enum for finite element families.
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:662
unsigned int n_variable_groups() const
Definition: system.h:2094
const MeshBase & get_mesh() const
Definition: system.h:2014
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:681
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:1313
This class defines the notion of a variable in the system.
Definition: variable.h:49
const DofMap & get_dof_map() const
Definition: system.h:2030
unsigned int n_components() const
Definition: system.h:2102
virtual void qoi_parameter_hessian_vector_product(const QoISet &qoi_indices, const ParameterVector &parameters, const ParameterVector &vector, SensitivityData &product)
For each of the system&#39;s quantities of interest q in qoi[qoi_indices], and for a vector of parameters...
Definition: system.h:2318
ParallelType
Defines an enum for parallel data structure types.
Data structure for holding completed parameter sensitivity calculations.
dof_id_type numeric_index_type
Definition: id_types.h:92
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:115
bool have_vector(const std::string &vec_name) const
Definition: system.h:2206
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1553
void deactivate()
Deactivates the system.
Definition: system.h:2062
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.h:2114
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
Non-templated version for backward compatibility.
Definition: system.h:1257
std::vector< VariableGroup > _variable_groups
The VariableGroup in this System.
Definition: system.h:1897
bool is_initialized()
Definition: system.h:2070
This is a base class for classes which represent subsets of the dofs of a System. ...
Definition: system_subset.h:42
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:1493
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:1795
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
void attach_constraint_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function for imposing constraints.
Definition: system.C:1830
bool & hide_output()
Definition: system.h:1657
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > *vec)
Reads a vector for this System.
Definition: system_io.C:1182
NumberVectorValue Gradient
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Definition: system.h:1845
virtual std::pair< unsigned int, Real > sensitivity_solve(const ParameterVector &parameters)
Solves the sensitivity system, for the provided parameters.
Definition: system.h:2260
Initialization * _init_system_object
Object that initializes the system.
Definition: system.h:1811
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 NULL...
Definition: system.h:2275
System & operator=(const System &)
This isn&#39;t a copyable object, so let&#39;s make sure nobody tries.
Definition: system.C:112
bool active() const
Definition: system.h:2046
bool _hide_output
Are we allowed to write this system to file? If _hide_output is true, then EquationSystems::write wil...
Definition: system.h:1990
unsigned int _additional_data_written
This flag is used only when reading in a system from file.
Definition: system.h:1965
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2238
UniquePtr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1523
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
Definition: system.h:1805
virtual void restrict_vectors()
Restrict vectors after the mesh has coarsened.
Definition: system.C:322
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:1760
std::map< std::string, int > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs, -1 if primal.
Definition: system.h:1928
virtual ~Initialization()
Destructor.
Definition: system.h:101
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
This class implements reference counting.
dof_id_type write_serialized_vector(Xdr &io, const NumericVector< Number > &vec) const
Writes a vector for this System.
Definition: system_io.C:2189
This class forms the base class for all other classes that are expected to be implemented in parallel...
This class defines a logically grouped set of variables in the system.
Definition: variable.h:172
virtual ~Constraint()
Destructor.
Definition: system.h:149
void activate()
Activates the system.
Definition: system.h:2054
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
Definition: system.C:1041
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:470
virtual void user_QOI_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user&#39;s attached quantity of interest derivative function, or is overridden by the user in deriv...
Definition: system.C:1992
bool is_adjoint_already_solved() const
Accessor for the adjoint_already_solved boolean.
Definition: system.h:372
virtual void reinit_constraints()
Reinitializes the constraints for this system.
Definition: system.C:414
virtual unsigned int n_matrices() const
Definition: system.h:2220
virtual void solve()
Solves the system.
Definition: system.h:310
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
Definition: xdr_cxx.h:68
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2118
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=libmesh_nullptr) const
Definition: system.C:1383
EquationSystems & get_equation_systems()
Definition: system.h:717
void attach_assemble_object(Assembly &assemble)
Register a user object to use in assembling the system matrix and RHS.
Definition: system.C:1814
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Vector iterator typedefs.
Definition: system.h:748
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:1940
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:1871
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:1297
dof_id_type n_local_dofs() const
Definition: system.C:185
virtual bool compare(const System &other_system, const Real threshold, const bool verbose) const
Definition: system.C:531
void read_parallel_data(Xdr &io, const bool read_additional_data)
Reads additional data, namely vectors, for this System.
Definition: system_io.C:493
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:1885
virtual void user_assembly()
Calls user&#39;s attached assembly function, or is overridden by the user in derived classes.
Definition: system.C:1950
virtual std::string system_type() const
Definition: system.h:471
dof_id_type n_local_constrained_dofs() const
Definition: system.C:170
virtual void update()
Update the local values to reflect the solution on neighboring processors.
Definition: system.C:425
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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:887
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:192
bool _identify_variable_groups
true when VariableGroup structures should be automatically identified, false otherwise.
Definition: system.h:1958
bool identify_variable_groups() const
Definition: system.h:2182
unsigned int number() const
Definition: system.h:2006
unsigned int n_components() const
Definition: variable.h:125
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
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:2267
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:1133
const std::string _sys_name
A name associated with this system.
Definition: system.h:1882
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:794
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1191
Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:93
Order
defines an enum for polynomial orders.
Definition: enum_order.h:32
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
Definition: system.C:989
virtual void re_update()
Re-update the local values when the mesh has changed.
Definition: system.C:446
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:1922
virtual ~QOI()
Destructor.
Definition: system.h:173
const EquationSystems & get_equation_systems() const
Definition: system.h:712
Abstract base class to be used for system constraints.
Definition: system.h:143
void boundary_project_solution(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr)
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
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)), for those parameters p contained within parameters, weighted by the values w_p found within weights.
Definition: system.h:2282
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:2236
unsigned int variable_scalar_number(const std::string &var, unsigned int component) const
Definition: system.h:2145
dof_id_type n_dofs() const
Definition: system.C:148
unsigned int n_vars() const
Definition: system.h:2086
SubsetSolveMode
defines an enum for the question what happens to the dofs outside the given subset when a system is s...
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system...
virtual void user_constrain()
Calls user&#39;s attached constraint function, or is overridden by the user in derived classes...
Definition: system.C:1964
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet())
Calls user qoi function.
Definition: system.C:490
NumericVector< Number > & add_sensitivity_solution(unsigned int i=0)
Definition: system.C:926
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:1839
VectorValue< Number > NumberVectorValue
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
Definition: system.h:1816
virtual ~System()
Destructor.
Definition: system.C:118
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > &vec)
Non-templated version for backward compatibility.
Definition: system.h:1766
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:1477
System(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
Definition: system.C:59
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:1278
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:1877
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
Reads additional data, namely vectors, for this System.
Definition: system_io.C:729
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:1364
const std::string & vector_name(const unsigned int vec_num) const
Definition: system.C:852
dof_id_type n_active_dofs() const
Definition: system.h:2198
Abstract base class to be used for quantities of interest.
Definition: system.h:167
NumericVector< Number > & get_weighted_sensitivity_adjoint_solution(unsigned int i=0)
Definition: system.C:1021
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
std::vector< unsigned int > _written_var_indices
This vector is used only when reading in a system from file.
Definition: system.h:1977
FEMNormType
defines an enum for norms defined on vectors of finite element coefficients
uint8_t dof_id_type
Definition: id_types.h:64
unsigned int n_vectors() const
Definition: system.h:2214
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:1850
Abstract base class to be used for derivatives of quantities of interest.
Definition: system.h:191
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
Definition: system.C:1051