21 #include "libmesh/dof_map.h" 22 #include "libmesh/equation_systems.h" 23 #include "libmesh/int_range.h" 24 #include "libmesh/libmesh_logging.h" 25 #include "libmesh/mesh_base.h" 26 #include "libmesh/numeric_vector.h" 27 #include "libmesh/parameter_vector.h" 28 #include "libmesh/point.h" 29 #include "libmesh/point_locator_base.h" 30 #include "libmesh/qoi_set.h" 31 #include "libmesh/enum_to_string.h" 32 #include "libmesh/sparse_matrix.h" 33 #include "libmesh/system.h" 34 #include "libmesh/system_norm.h" 35 #include "libmesh/utility.h" 36 #include "libmesh/elem.h" 37 #include "libmesh/fe_type.h" 38 #include "libmesh/parallel_fe_type.h" 39 #include "libmesh/fe_interface.h" 40 #include "libmesh/fe_compute_data.h" 41 #include "libmesh/static_condensation.h" 44 #include "libmesh/fe_base.h" 45 #include "libmesh/fe_interface.h" 46 #include "libmesh/parallel.h" 47 #include "libmesh/parallel_algebra.h" 48 #include "libmesh/quadrature.h" 49 #include "libmesh/tensor_value.h" 50 #include "libmesh/vector_value.h" 51 #include "libmesh/tensor_tools.h" 52 #include "libmesh/enum_norm_type.h" 53 #include "libmesh/enum_fe_family.h" 65 const std::string & name_in,
66 const unsigned int number_in) :
69 assemble_before_solve (true),
70 use_fixed_solution (false),
71 extra_quadrature_order (0),
76 qoi_error_estimates (0),
77 _init_system_function (nullptr),
78 _init_system_object (nullptr),
79 _assemble_system_function (nullptr),
80 _assemble_system_object (nullptr),
81 _constrain_system_function (nullptr),
82 _constrain_system_object (nullptr),
83 _qoi_evaluate_function (nullptr),
84 _qoi_evaluate_object (nullptr),
85 _qoi_evaluate_derivative_function (nullptr),
86 _qoi_evaluate_derivative_object (nullptr),
87 _dof_map (
std::make_unique<
DofMap>(number_in, es.get_mesh())),
88 _equation_systems (es),
89 _mesh (es.get_mesh()),
91 _sys_number (number_in),
93 _matrices_initialized (false),
94 _solution_projection (true),
95 _basic_system_only (false),
97 _identify_variable_groups (true),
98 _additional_data_written (false),
99 adjoint_already_solved (false),
100 _hide_output (false),
101 project_with_constraints (true),
102 _prefer_hash_table_matrix_assembly(false),
103 _require_sparsity_pattern (false),
104 _prefix_with_name (false)
130 #ifdef LIBMESH_ENABLE_CONSTRAINTS 132 return _dof_map->n_constrained_dofs();
145 #ifdef LIBMESH_ENABLE_CONSTRAINTS 147 return _dof_map->n_local_constrained_dofs();
168 libmesh_assert_less (global_dof_number,
_dof_map->n_dofs());
210 parallel_object_only();
215 unsigned int n_dof_map_vg =
_dof_map->n_variable_groups();
219 if (vg < n_dof_map_vg)
222 _dof_map->add_variable_group(group);
230 auto max_allowed_id =
solution->max_allowed_id();
231 libmesh_error_msg_if(total_dofs > max_allowed_id,
232 "Cannot allocate a NumericVector with " << total_dofs <<
" degrees of freedom. " 233 "The vector can only index up to " << max_allowed_id <<
" entries.");
244 _dof_map->reinit_static_condensation();
250 #ifdef LIBMESH_ENABLE_GHOSTED 263 for (
auto & [vec_name, vec] :
_vectors)
270 #ifdef LIBMESH_ENABLE_GHOSTED 275 libmesh_error_msg(
"Cannot initialize ghosted vectors when they are not enabled.");
280 vec->init (this->
n_dofs(),
false, type);
284 libmesh_assert_equal_to(type,
PARALLEL);
303 parallel_object_only();
325 parallel_object_only();
340 if (
_matrices.begin()->second->initialized())
361 const bool use_hash =
362 pr.second->use_hash_table() ||
364 pr.second->use_hash_table(use_hash);
366 if (pr.second->require_sparsity_pattern())
388 parallel_object_only();
390 #ifdef LIBMESH_ENABLE_AMR 392 for (
auto & [vec_name, vec] :
_vectors)
406 #ifdef LIBMESH_ENABLE_GHOSTED 411 libmesh_error_msg(
"Cannot initialize ghosted vectors when they are not enabled.");
419 const std::vector<dof_id_type> & send_list =
_dof_map->get_send_list ();
428 #ifdef LIBMESH_ENABLE_GHOSTED 439 #endif // LIBMESH_ENABLE_AMR 446 #ifdef LIBMESH_ENABLE_AMR 456 parallel_object_only();
497 parallel_object_only();
499 #ifdef LIBMESH_ENABLE_CONSTRAINTS 512 parallel_object_only();
516 const std::vector<dof_id_type> & send_list =
_dof_map->get_send_list ();
522 libmesh_assert_less_equal (send_list.size(),
solution->size());
535 parallel_object_only();
548 libmesh_assert_less_equal (send_list.size(),
solution->size());
560 if (subset !=
nullptr)
561 libmesh_not_implemented();
569 LOG_SCOPE(
"assemble()",
"System");
580 LOG_SCOPE(
"assemble_qoi()",
"System");
589 bool include_liftfunc,
590 bool apply_constraints)
593 LOG_SCOPE(
"assemble_qoi_derivative()",
"System");
607 if (qoi_indices.
size(*
this) > parameters_vec.
size())
619 const Real threshold,
620 const bool verbose)
const 629 libMesh::out <<
" comparing matrices not supported." << std::endl;
634 const int name_result =
_sys_name.compare(other_system.
name());
637 if (name_result == 0)
651 if (solu_result == -1)
652 libMesh::out <<
" identical up to threshold." << std::endl;
654 libMesh::out <<
" first difference occurred at index = " 655 << solu_result <<
"." << std::endl;
661 std::vector<int> ov_result;
667 libMesh::out <<
" Fatal difference. This system handles " 668 << this->
n_vectors() <<
" add'l vectors," << std::endl
669 <<
" while the other system handles " 671 <<
" add'l vectors." << std::endl
672 <<
" Aborting comparison." << std::endl;
684 for (
auto & [vec_name, vec] :
_vectors)
688 << vec_name <<
"\" ...";
694 ov_result.push_back(vec->compare(other_system_vector, threshold));
698 if (ov_result[ov_result.size()-1] == -1)
699 libMesh::out <<
" identical up to threshold." << std::endl;
701 libMesh::out <<
" first difference occurred at" << std::endl
702 <<
" index = " << ov_result[ov_result.size()-1] <<
"." << std::endl;
711 if ((name_result==0) && (solu_result==-1))
713 if (ov_result.size()==0)
714 overall_result =
true;
721 ov_identical = (ov_result[n]==-1);
724 while (ov_identical && n<ov_result.size());
725 overall_result = ov_identical;
729 overall_result =
false;
735 libMesh::out <<
"found no differences." << std::endl << std::endl;
737 libMesh::out <<
"found differences." << std::endl << std::endl;
740 return overall_result;
747 parallel_object_only();
749 global_soln.resize (
solution->size());
759 parallel_object_only();
761 global_soln.resize (
solution->size());
763 solution->localize_to_one (global_soln, dest_proc);
769 const bool projections,
772 parallel_object_only();
779 if (
auto it = this->
_vectors.find(vec_name);
796 libmesh_assert_equal_to(type ==
SERIAL,
814 #ifdef LIBMESH_ENABLE_GHOSTED 819 libmesh_error_msg(
"Cannot initialize ghosted vectors when they are not enabled.");
847 auto buf = pr.first->second.get();
858 #ifdef LIBMESH_ENABLE_GHOSTED 863 libmesh_error_msg(
"Cannot initialize ghosted vectors when they are not enabled.");
875 parallel_object_only();
877 if (
const auto pos =
_vectors.find(vec_name);
893 if (
const auto pos =
_vectors.find(vec_name);
895 return pos->second.
get();
905 if (
auto pos =
_vectors.find(vec_name);
907 return pos->second.
get();
923 std::advance(it, vec_num);
924 return it->second.get();
937 std::advance(it, vec_num);
938 return it->second.get();
945 return *(libmesh_map_find(
_vectors, vec_name));
952 return *(libmesh_map_find(
_vectors, vec_name));
960 libmesh_assert_less(vec_num,
_vectors.size());
964 std::advance(it, vec_num);
965 return *(it->second);
973 libmesh_assert_less(vec_num,
_vectors.size());
977 std::advance(it, vec_num);
978 return *(it->second);
986 libmesh_assert_less(vec_num,
_vectors.size());
990 std::advance(it, vec_num);
998 [&vec_reference](
const decltype(
_vectors)::value_type & pr)
999 {
return &vec_reference == pr.second.
get(); });
1014 parallel_object_only();
1021 if (
auto it = this->
_matrices.find(mat_name);
1031 "We do not currently support static condensation of the diagonal matrix type");
1032 matrix = std::make_unique<StaticCondensation>(this->
get_mesh(),
1039 auto & mat = *matrix;
1041 _matrices.emplace(mat_name, std::move(matrix));
1057 parallel_object_only();
1062 auto [it, inserted] =
_matrices.emplace(mat_name, std::move(matrix));
1063 libmesh_error_msg_if(!inserted,
1064 "Tried to add '" << mat_name <<
"' but the matrix already exists");
1091 parallel_object_only();
1093 if (
const auto pos =
_matrices.find(mat_name);
1102 if (
const auto pos =
_matrices.find(mat_name);
1104 return pos->second.get();
1114 if (
auto pos =
_matrices.find(mat_name);
1116 return pos->second.get();
1126 return *libmesh_map_find(
_matrices, mat_name);
1133 return *libmesh_map_find(
_matrices, mat_name);
1141 parallel_object_only();
1163 parallel_object_only();
1167 libmesh_assert_greater_equal(qoi_num, -2);
1184 std::ostringstream sensitivity_name;
1185 sensitivity_name <<
"sensitivity_solution" << i;
1187 return this->
add_vector(sensitivity_name.str());
1194 std::ostringstream sensitivity_name;
1195 sensitivity_name <<
"sensitivity_solution" << i;
1197 return this->
get_vector(sensitivity_name.str());
1204 std::ostringstream sensitivity_name;
1205 sensitivity_name <<
"sensitivity_solution" << i;
1207 return this->
get_vector(sensitivity_name.str());
1214 return this->
add_vector(
"weighted_sensitivity_solution");
1221 return this->
get_vector(
"weighted_sensitivity_solution");
1228 return this->
get_vector(
"weighted_sensitivity_solution");
1235 std::ostringstream adjoint_name;
1236 adjoint_name <<
"adjoint_solution" << i;
1247 std::ostringstream adjoint_name;
1248 adjoint_name <<
"adjoint_solution" << i;
1257 std::ostringstream adjoint_name;
1258 adjoint_name <<
"adjoint_solution" << i;
1267 std::ostringstream adjoint_name;
1268 adjoint_name <<
"weighted_sensitivity_adjoint_solution" << i;
1279 std::ostringstream adjoint_name;
1280 adjoint_name <<
"weighted_sensitivity_adjoint_solution" << i;
1289 std::ostringstream adjoint_name;
1290 adjoint_name <<
"weighted_sensitivity_adjoint_solution" << i;
1299 std::ostringstream adjoint_rhs_name;
1300 adjoint_rhs_name <<
"adjoint_rhs" << i;
1302 return this->
add_vector(adjoint_rhs_name.str(),
false);
1309 std::ostringstream adjoint_rhs_name;
1310 adjoint_rhs_name <<
"adjoint_rhs" << i;
1312 return this->
get_vector(adjoint_rhs_name.str());
1319 std::ostringstream adjoint_rhs_name;
1320 adjoint_rhs_name <<
"adjoint_rhs" << i;
1322 return this->
get_vector(adjoint_rhs_name.str());
1329 std::ostringstream sensitivity_rhs_name;
1330 sensitivity_rhs_name <<
"sensitivity_rhs" << i;
1332 return this->
add_vector(sensitivity_rhs_name.str(),
false);
1339 std::ostringstream sensitivity_rhs_name;
1340 sensitivity_rhs_name <<
"sensitivity_rhs" << i;
1342 return this->
get_vector(sensitivity_rhs_name.str());
1349 std::ostringstream sensitivity_rhs_name;
1350 sensitivity_rhs_name <<
"sensitivity_rhs" << i;
1352 return this->
get_vector(sensitivity_rhs_name.str());
1359 const std::set<subdomain_id_type> *
const active_subdomains)
1361 parallel_object_only();
1367 if (active_subdomains)
1385 bool check1 = (!active_subdomains || active_subdomains->empty()) && existing_var.
implicitly_active();
1388 bool check2 = (active_subdomains && (*active_subdomains == existing_var.
active_subdomains()));
1391 if (check1 || check2)
1395 libmesh_error_msg(
"ERROR: incompatible variable " << var <<
" has already been added for this system!");
1413 const std::set<subdomain_id_type> *
const 1414 their_active_subdomains (vg.implicitly_active() ?
1415 nullptr : &vg.active_subdomains());
1418 if (vg.type() != type)
1419 should_be_in_vg =
false;
1422 if (their_active_subdomains &&
1423 (!active_subdomains || (active_subdomains && active_subdomains->empty())))
1424 should_be_in_vg =
false;
1427 if (!their_active_subdomains && (active_subdomains && !active_subdomains->empty()))
1428 should_be_in_vg =
false;
1430 if (their_active_subdomains && active_subdomains)
1432 if (*their_active_subdomains != *active_subdomains)
1433 should_be_in_vg =
false;
1437 if (should_be_in_vg)
1439 const unsigned int curr_n_vars = this->
n_vars();
1441 std::string varstr(var);
1444 vg.append (std::move(varstr));
1445 _variables.push_back(vg(vg.n_variables()-1));
1452 return this->
add_variables (std::vector<std::string>(1, std::string(var)),
1462 const std::set<subdomain_id_type> *
const active_subdomains)
1473 const std::set<subdomain_id_type> *
const active_subdomains)
1475 parallel_object_only();
1483 if (active_subdomains)
1488 for (
auto ovar : vars)
1498 libmesh_error_msg(
"ERROR: incompatible variable " << ovar <<
" has already been added for this system!");
1515 const std::set<subdomain_id_type> *
const 1516 their_active_subdomains (vg.implicitly_active() ?
1517 nullptr : &vg.active_subdomains());
1520 if (vg.type() != type)
1521 should_be_in_vg =
false;
1524 if (their_active_subdomains &&
1525 (!active_subdomains || (active_subdomains && active_subdomains->empty())))
1526 should_be_in_vg =
false;
1529 if (!their_active_subdomains && (active_subdomains && !active_subdomains->empty()))
1530 should_be_in_vg =
false;
1532 if (their_active_subdomains && active_subdomains)
1534 if (*their_active_subdomains != *active_subdomains)
1535 should_be_in_vg =
false;
1539 if (should_be_in_vg)
1541 unsigned int curr_n_vars = this->
n_vars();
1543 for (
auto ovar : vars)
1545 curr_n_vars = this->
n_vars();
1549 _variables.push_back(vg(vg.n_variables()-1));
1556 const unsigned int curr_n_vars = this->
n_vars();
1558 const unsigned int next_first_component = this->
n_components();
1564 next_first_component, type) :
1566 next_first_component, type, *active_subdomains));
1577 libmesh_assert_equal_to ((curr_n_vars+vars.size()), this->
n_vars());
1585 return cast_int<unsigned int>(curr_n_vars+vars.size()-1);
1593 const std::set<subdomain_id_type> *
const active_subdomains)
1619 all_variable_numbers.resize(
n_vars());
1621 unsigned int count = 0;
1623 all_variable_numbers[count++] = vn.second;
1628 std::set<dof_id_type> & var_indices)
const 1631 var_indices.clear();
1633 std::vector<dof_id_type> dof_indices;
1640 for (
const auto & elem : this->
get_mesh().active_local_element_ptr_range())
1646 if (first_local <= dof && dof < end_local)
1647 var_indices.insert(dof);
1656 for (
const auto & node : this->
get_mesh().local_node_ptr_range())
1660 for (
auto dof : dof_indices)
1661 if (first_local <= dof && dof < end_local)
1662 var_indices.insert(dof);
1669 unsigned int var_num)
const 1672 libmesh_assert_less (var_num, this->
n_vars());
1678 const unsigned int sys_num = this->
number();
1681 for (
const auto & node :
mesh.local_node_ptr_range())
1683 unsigned int n_comp = node->n_comp(sys_num,var_num);
1684 for (
unsigned int i=0; i<n_comp; i++)
1686 const dof_id_type index = node->dof_number(sys_num,var_num,i);
1692 for (
const auto & elem :
mesh.active_local_element_ptr_range())
1694 unsigned int n_comp = elem->n_comp(sys_num,var_num);
1695 for (
unsigned int i=0; i<n_comp; i++)
1697 const dof_id_type index = elem->dof_number(sys_num,var_num,i);
1709 std::set<dof_id_type> var_indices;
1727 std::set<unsigned int> * skip_dimensions)
const 1736 std::vector<FEMNormType> norms(this->
n_vars(),
L2);
1737 std::vector<Real> weights(this->
n_vars(), 0.0);
1738 norms[var] = norm_type;
1748 std::set<unsigned int> * skip_dimensions)
const 1751 parallel_object_only();
1753 LOG_SCOPE (
"calculate_norm()",
"System");
1758 if (
norm.is_discrete())
1762 unsigned int check_var = 0, check_end = this->
n_vars();
1763 for (; check_var != check_end; ++check_var)
1764 if ((
norm.weight(check_var) != 1.0) || (
norm.type(check_var) != norm_type0))
1768 if (check_var == this->
n_vars())
1783 if (norm.
weight(var) == 0.0)
1802 bool using_hilbert_norm =
true,
1803 using_nonhilbert_norm =
true;
1809 Real norm_weight_sq =
norm.weight_sq(var);
1810 if (norm_weight_sq == 0.0)
1812 Real norm_weight =
norm.weight(var);
1816 if ((norm_type==
H1) ||
1822 if (!using_hilbert_norm)
1823 libmesh_not_implemented();
1824 using_nonhilbert_norm =
false;
1826 else if ((norm_type==
L1) ||
1827 (norm_type==
L_INF) ||
1831 if (!using_nonhilbert_norm)
1832 libmesh_not_implemented();
1833 using_hilbert_norm =
false;
1836 libmesh_not_implemented();
1842 std::vector<std::unique_ptr<FEBase>> fe_ptrs(4);
1843 std::vector<std::unique_ptr<FEVectorBase>> vec_fe_ptrs(4);
1844 std::vector<std::unique_ptr<QBase>> q_rules(4);
1849 for (
const auto &
dim : elem_dims)
1851 if (skip_dimensions && skip_dimensions->find(
dim) != skip_dimensions->end())
1861 fe_ptrs[
dim]->attach_quadrature_rule (q_rules[
dim].
get());
1866 vec_fe_ptrs[
dim]->attach_quadrature_rule (q_rules[
dim].
get());
1872 std::vector<dof_id_type> dof_indices;
1875 for (
const auto & elem : this->
get_mesh().active_local_element_ptr_range())
1877 const unsigned int dim = elem->dim();
1882 if (elem->infinite() )
1883 libmesh_not_implemented();
1885 if (skip_dimensions && skip_dimensions->find(
dim) != skip_dimensions->end())
1888 QBase * qrule = q_rules[
dim].get();
1893 auto element_calculation = [&dof_indices, &elem,
1894 norm_type, norm_weight, norm_weight_sq, &qrule,
1895 &local_v, &v_norm](
auto & fe) {
1896 typedef typename std::remove_reference<decltype(fe)>::type::OutputShape OutputShape;
1898 typedef typename std::remove_reference<decltype(fe)>::type::OutputGradient OutputGradient;
1901 const std::vector<Real> & JxW = fe.get_JxW();
1902 const std::vector<std::vector<OutputShape>> * phi =
nullptr;
1903 if (norm_type ==
H1 ||
1908 phi = &(fe.get_phi());
1910 const std::vector<std::vector<OutputGradient>> * dphi =
nullptr;
1911 if (norm_type ==
H1 ||
1915 dphi = &(fe.get_dphi());
1917 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1918 typedef typename std::remove_reference<decltype(fe)>::type::OutputTensor OutputTensor;
1920 const std::vector<std::vector<OutputTensor>> * d2phi =
nullptr;
1921 if (norm_type ==
H2 ||
1924 d2phi = &(fe.get_d2phi());
1929 const unsigned int n_qp = qrule->n_points();
1931 const unsigned int n_sf = cast_int<unsigned int>
1932 (dof_indices.size());
1935 for (
unsigned int qp=0; qp<n_qp; qp++)
1937 if (norm_type ==
L1)
1939 OutputNumberShape u_h = 0.;
1940 for (
unsigned int i=0; i != n_sf; ++i)
1941 u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1942 v_norm += norm_weight *
1946 if (norm_type ==
L_INF)
1948 OutputNumberShape u_h = 0.;
1949 for (
unsigned int i=0; i != n_sf; ++i)
1950 u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1954 if (norm_type ==
H1 ||
1958 OutputNumberShape u_h = 0.;
1959 for (
unsigned int i=0; i != n_sf; ++i)
1960 u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1961 v_norm += norm_weight_sq *
1965 if (norm_type ==
H1 ||
1969 OutputNumberGradient grad_u_h;
1970 for (
unsigned int i=0; i != n_sf; ++i)
1971 grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1972 v_norm += norm_weight_sq *
1973 JxW[qp] * grad_u_h.norm_sq();
1978 OutputNumberGradient grad_u_h;
1979 for (
unsigned int i=0; i != n_sf; ++i)
1980 grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1981 v_norm = std::max(v_norm, norm_weight * grad_u_h.norm());
1984 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1987 if (norm_type ==
H2 ||
1990 OutputNumberTensor hess_u_h;
1991 for (
unsigned int i=0; i != n_sf; ++i)
1992 hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
1993 v_norm += norm_weight_sq *
1994 JxW[qp] * hess_u_h.norm_sq();
1999 OutputNumberTensor hess_u_h;
2000 for (
unsigned int i=0; i != n_sf; ++i)
2001 hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
2002 v_norm = std::max(v_norm, norm_weight * hess_u_h.norm());
2008 FEBase * scalar_fe = fe_ptrs[
dim].get();
2014 element_calculation(*scalar_fe);
2020 element_calculation(*vec_fe);
2025 if (using_hilbert_norm)
2028 v_norm = std::sqrt(v_norm);
2042 std::ostringstream oss;
2045 const std::string & sys_name = this->
name();
2047 oss <<
" System #" << this->
number() <<
", \"" << sys_name <<
"\"\n" 2055 if (vg_description.
n_variables() > 1) oss <<
"{ ";
2057 oss <<
"\"" << vg_description.
name(vn) <<
"\" ";
2058 if (vg_description.
n_variables() > 1) oss <<
"} ";
2063 oss <<
" Finite Element Types=";
2064 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS 2079 oss <<
'\n' <<
" Infinite Element Mapping=";
2088 oss <<
" Approximation Orders=";
2091 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS 2106 oss <<
" n_dofs()=" << this->
n_dofs() <<
'\n';
2108 oss <<
" n_local_dofs()=" << local_dofs <<
'\n';
2110 oss <<
" max(n_local_dofs())=" << local_dofs <<
'\n';
2111 #ifdef LIBMESH_ENABLE_CONSTRAINTS 2115 this->
comm().
max(local_unconstrained_dofs);
2116 oss <<
" max(local unconstrained dofs)=" << local_unconstrained_dofs <<
'\n';
2119 oss <<
" " <<
"n_vectors()=" << this->
n_vectors() <<
'\n';
2120 oss <<
" " <<
"n_matrices()=" << this->
n_matrices() <<
'\n';
2131 const std::string &
name))
2137 libmesh_warning(
"WARNING: Cannot specify both initialization function and object!");
2151 libmesh_warning(
"WARNING: Cannot specify both initialization object and function!");
2162 const std::string &
name))
2168 libmesh_warning(
"WARNING: Cannot specify both assembly function and object!");
2182 libmesh_warning(
"WARNING: Cannot specify both assembly object and function!");
2193 const std::string &
name))
2199 libmesh_warning(
"WARNING: Cannot specify both constraint function and object!");
2213 libmesh_warning(
"WARNING: Cannot specify both constraint object and function!");
2235 const std::string &,
2242 libmesh_warning(
"WARNING: Cannot specify both QOI function and object!");
2256 libmesh_warning(
"WARNING: Cannot specify both QOI object and function!");
2267 const QoISet &,
bool,
bool))
2273 libmesh_warning(
"WARNING: Cannot specify both QOI derivative function and object!");
2287 libmesh_warning(
"WARNING: Cannot specify both QOI derivative object and function!");
2354 bool include_liftfunc,
2355 bool apply_constraints)
2367 (qoi_indices, include_liftfunc, apply_constraints);
2382 qoi[qoi_index] = qoi_value;
2389 return qoi[qoi_index];
2401 libmesh_assert_equal_to(this->
qoi.size(), new_qoi.size());
2402 this->
qoi = std::move(new_qoi);
2423 const bool insist_on_success,
2428 parallel_object_only();
2446 std::unique_ptr<PointLocatorBase> locator_ptr =
mesh.sub_point_locator();
2449 if (!insist_on_success || !
mesh.is_serial())
2454 const std::set<subdomain_id_type> & raw_subdomains =
2456 const std::set<subdomain_id_type> * implicit_subdomains =
2457 raw_subdomains.empty() ? nullptr : &raw_subdomains;
2458 const Elem * e = locator(p, implicit_subdomains);
2462 if (e && this->
get_dof_map().is_evaluable(*e, var))
2469 this->
comm().
min(lowest_owner);
2502 std::vector<dof_id_type> dof_indices;
2508 const unsigned int num_dofs = cast_int<unsigned int>
2509 (dof_indices.size());
2524 for (
unsigned int l=0; l<num_dofs; l++)
2526 u += fe_data.shape[l] * (*sol)(dof_indices[l]);
2552 const bool insist_on_success,
2557 parallel_object_only();
2575 std::unique_ptr<PointLocatorBase> locator_ptr =
mesh.sub_point_locator();
2578 if (!insist_on_success || !
mesh.is_serial())
2583 const std::set<subdomain_id_type> & raw_subdomains =
2585 const std::set<subdomain_id_type> * implicit_subdomains =
2586 raw_subdomains.empty() ? nullptr : &raw_subdomains;
2587 const Elem * e = locator(p, implicit_subdomains);
2591 if (e && this->
get_dof_map().is_evaluable(*e, var))
2598 this->
comm().
min(lowest_owner);
2629 const unsigned int dim = e.
dim();
2635 std::vector<dof_id_type> dof_indices;
2641 const unsigned int num_dofs = cast_int<unsigned int>
2642 (dof_indices.size());
2658 for (
unsigned int l=0; l<num_dofs; l++)
2662 for (std::size_t v=0; v<
dim; v++)
2663 for (std::size_t xyz=0; xyz<LIBMESH_DIM; xyz++)
2668 * (*sol)(dof_indices[l]);
2693 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 2696 const bool insist_on_success,
2701 parallel_object_only();
2719 std::unique_ptr<PointLocatorBase> locator_ptr =
mesh.sub_point_locator();
2722 if (!insist_on_success || !
mesh.is_serial())
2727 const std::set<subdomain_id_type> & raw_subdomains =
2729 const std::set<subdomain_id_type> * implicit_subdomains =
2730 raw_subdomains.empty() ? nullptr : &raw_subdomains;
2731 const Elem * e = locator(p, implicit_subdomains);
2735 if (e && this->
get_dof_map().is_evaluable(*e, var))
2742 this->
comm().
min(lowest_owner);
2769 libmesh_not_implemented();
2778 std::vector<dof_id_type> dof_indices;
2784 const unsigned int num_dofs = cast_int<unsigned int>
2785 (dof_indices.size());
2797 const std::vector<std::vector<RealTensor>> & d2phi = fe->get_d2phi();
2800 fe->reinit (&e, &coor);
2805 for (
unsigned int l=0; l<num_dofs; l++)
2807 hess_u.
add_scaled (d2phi[l][0], (*sol)(dof_indices[l]));
2833 libmesh_error_msg(
"We can only accumulate a hessian with --enable-second");
2842 libmesh_error_msg(
"We can only accumulate a hessian with --enable-second");
2850 libmesh_error_msg(
"We can only accumulate a hessian with --enable-second");
2858 libmesh_error_msg(
"We can only accumulate a hessian with --enable-second");
2864 #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES 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...
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
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.
vectors_iterator vectors_end()
End of vectors container.
virtual bool initialized() const
bool is_initialized() const
FEFamily family
The type of finite element.
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
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 ...
bool closed()
Checks that the library has been closed.
dof_id_type end_dof(const processor_id_type proc) const
virtual Real subset_l2_norm(const std::set< numeric_index_type > &indices) const
This is the EquationSystems class.
virtual void clear()
Clear all the data structures associated with the system.
Order
defines an enum for polynomial orders.
virtual void create_static_condensation()
Request that static condensation be performed for this system.
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.
Abstract base class to be used for system initialization.
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Assembly * _assemble_system_object
Object that assembles the system.
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
virtual void init_matrices()
Initializes the matrices associated with this system.
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
NumericVector< Number > & add_adjoint_solution(unsigned int i=0)
virtual void forward_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the forward method.
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
Number get_qoi_value(unsigned int qoi_index) const
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
class FEComputeData hides arbitrary data to be passed to and from children of FEBase through the FEIn...
unsigned int n_qois() const
Number of currently active quantities of interest.
unsigned int n_components() const
virtual bool initialized() const
virtual void initialize()=0
Initialization function.
virtual numeric_index_type size() const =0
NumericVector< Number > & get_sensitivity_solution(unsigned int i=0)
OrderWrapper radial_order
The approximation order in radial direction of the infinite element.
const FEType & variable_type(const unsigned int c) const
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user qoi derivative function.
NumericVector< Number > & get_sensitivity_rhs(unsigned int i=0)
int vector_is_adjoint(std::string_view vec_name) const
virtual void assemble()=0
Assembly function.
Constraint * _constrain_system_object
Object that constrains the system.
const EquationSystems & get_equation_systems() const
unsigned int n_variable_groups() const
bool is_attached(SparseMatrix< Number > &matrix)
Matrices should not be attached more than once.
virtual void assemble()
Prepares matrix and _dof_map for matrix assembly.
void attach_matrix(SparseMatrix< Number > &matrix)
Additional matrices may be attached to this DofMap.
virtual void init_data()
Initializes the data for the system.
This is the base class from which all geometric element types are derived.
static FEFieldType field_type(const FEType &fe_type)
FEMNormType
defines an enum for norms defined on vectors of finite element coefficients
void init_qois(unsigned int n_qois)
Accessors for qoi and qoi_error_estimates vectors.
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
virtual void user_initialization()
Calls user's attached initialization function, or is overridden by the user in derived classes...
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
std::vector< Gradient > dshape
Storage for the computed shape derivative values.
const Parallel::Communicator & comm() const
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
std::vector< Variable > _variables
The Variable in this System.
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...
OrderWrapper order
The approximation order of the element.
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
const std::string & name(unsigned int v) const
NumericVector< Number > & add_sensitivity_rhs(unsigned int i=0)
void reinit_static_condensation()
Calls reinit on the static condensation map if it exists.
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
std::vector< std::vector< Real > > local_transform
Storage for local to global mapping at p.
bool has_static_condensation() const
The libMesh namespace provides an interface to certain functionality in the library.
vectors_iterator vectors_begin()
Beginning of vectors container.
virtual Real subset_linfty_norm(const std::set< numeric_index_type > &indices) const
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...
virtual void adjoint_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the adjoint method.
dof_id_type n_local_dofs() const
Abstract base class to be used for system assembly.
NumericVector< Number > & add_weighted_sensitivity_solution()
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
const SparseMatrix< Number > * request_matrix(std::string_view mat_name) const
void init()
Initializes degrees of freedom on the current mesh.
const MeshBase & get_mesh() const
NumericVector< Number > & get_weighted_sensitivity_solution()
static std::unique_ptr< SparseMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package(), const MatrixBuildType matrix_build_type=MatrixBuildType::AUTOMATIC)
Builds a SparseMatrix<T> using the linear solver package specified by solver_package.
virtual Real subset_l1_norm(const std::set< numeric_index_type > &indices) const
std::string get_info() const
Gets summary info about the sparsity bandwidth and constraints.
dof_id_type n_dofs() const
uint8_t processor_id_type
This is the MeshBase class.
virtual void prolong_vectors()
Prolong vectors after the mesh has refined.
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...
Number current_solution(const dof_id_type global_dof_number) const
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
unsigned int variable_number(std::string_view var) const
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
NumericVector< Number > & add_weighted_sensitivity_adjoint_solution(unsigned int i=0)
virtual void qoi_derivative(const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)=0
Quantity of interest derivative function.
virtual void qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
Solves for the derivative of each of the system's quantities of interest q in qoi[qoi_indices] with r...
void attach_constraint_object(Constraint &constrain)
Register a user object for imposing constraints.
SolverPackage default_solver_package()
This class handles the numbering of degrees of freedom on a mesh.
std::unique_ptr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
void attach_init_object(Initialization &init)
Register a user class to use to initialize the system.
bool has_variable(std::string_view var) const
processor_id_type n_processors() const
void libmesh_ignore(const Args &...)
unsigned int number() const
void remove_vector(std::string_view vec_name)
Removes the additional vector vec_name from this system.
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
This class defines the notion of a variable in the system.
const std::set< subdomain_id_type > & active_subdomains() const
bool has_static_condensation() const
Checks whether we have static condensation.
virtual Real l2_norm() const =0
std::map< std::string, int, std::less<> > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs, -1 if primal.
Constraint & get_constraint_object()
Return the user object for imposing constraints.
void min(const T &r, T &o, Request &req) const
Data structure for holding completed parameter sensitivity calculations.
bool _is_initialized
Flag that tells if init() has been called.
StaticCondensationDofMap & get_static_condensation()
unsigned int n_variables() const
std::vector< Number > qoi
Values of the quantities of interest.
void remove_matrix(std::string_view mat_name)
Removes the additional matrix mat_name from this system.
std::vector< VariableGroup > _variable_groups
The VariableGroup in this System.
This is a base class for classes which represent subsets of the dofs of a System. ...
unsigned int n_vectors() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
void zero_variable(NumericVector< Number > &v, unsigned int var_num) const
Zeroes all dofs in v that correspond to variable number var_num.
bool _prefer_hash_table_matrix_assembly
Whether to use hash table matrix assembly if the matrix sub-classes support it.
virtual void add_matrices()
Insertion point for adding matrices in derived classes before init_matrices() is called.
static void compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
Lets the appropriate child of FEBase compute the requested data for the input specified in data...
bool has_constraint_object() const
std::string get_info() const
virtual void qoi(const QoISet &qoi_indices)=0
Quantity of interest function.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
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...
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
void print_dof_constraints(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
Prints (from processor 0) all DoF and Node constraints.
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Initialization * _init_system_object
Object that initializes the system.
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 ...
const VariableGroup & variable_group(const unsigned int c) const
unsigned int add_variable(std::string_view 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.
const std::string & variable_name(const unsigned int i) const
InfMapType inf_map
The coordinate mapping type of the infinite element.
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
const std::set< unsigned char > & elem_dimensions() const
std::map< std::string, ParallelType, std::less<> > _matrix_types
Holds the types of the matrices.
This is the base class for point locators.
virtual void restrict_vectors()
Restrict vectors after the mesh has coarsened.
void create_static_condensation(MeshBase &mesh, System &system)
Add a static condensation class.
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.
unsigned int n_matrices() const
An object whose state is distributed along a set of processors.
This class defines a logically grouped set of variables in the system.
std::size_t size(const System &sys) const
std::vector< Number > qoi_error_estimates
Vector to hold error estimates for qois, either from a steady state calculation, or from a single uns...
bool implicitly_active() const
void add_scaled(const TypeTensor< T2 > &, const T &)
Add a scaled tensor to this tensor without creating a temporary.
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
virtual Real l1_norm() const =0
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.
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...
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
virtual void reinit_constraints()
Reinitializes the constraints for this system.
bool identify_variable_groups() const
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
virtual void reinit_mesh()
Reinitializes the system with a new mesh.
const NumericVector< Number > * request_vector(std::string_view vec_name) const
void attach_assemble_object(Assembly &assemble)
Register a user object to use in assembling the system matrix and RHS.
FEFamily radial_family
The type of approximation in radial direction.
bool _solution_projection
Holds true if the solution vector should be projected onto a changed grid, false if it should be zero...
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
std::string enum_to_string(const T e)
virtual bool closed() const
virtual std::string system_type() const
virtual void constrain()=0
Constraint function.
const std::string & vector_name(const unsigned int vec_num) const
void attach_QOI_object(QOI &qoi)
Register a user object for evaluating the quantities of interest, whose values should be placed in Sy...
virtual void user_assembly()
Calls user's attached assembly function, or is overridden by the user in derived classes.
ParallelType type() const
virtual void update()
Update the local values to reflect the solution on neighboring processors.
Real weight(unsigned int var) const
const FEType & variable_type(const unsigned int i) const
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...
void process_constraints(MeshBase &)
Postprocesses any constrained degrees of freedom to be constrained only in terms of unconstrained dof...
void set_qoi_error_estimate(unsigned int qoi_index, Number qoi_error_estimate)
virtual void swap(NumericVector< T > &v)
Swaps the contents of this with v.
void max(const T &r, T &o, Request &req) const
virtual unsigned short dim() const =0
bool _matrices_initialized
false when additional matrices being added require initialization, true otherwise.
bool _require_sparsity_pattern
Whether any of our matrices require an initial sparsity pattern computation in order to determine pre...
const std::string _sys_name
A name associated with this system.
virtual numeric_index_type local_size() const =0
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
std::map< std::string, unsigned int, std::less<> > _variable_numbers
The variable numbers corresponding to user-specified names, useful for name-based lookups...
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
void clear_sparsity()
Clears the sparsity pattern.
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
virtual void re_update()
Re-update the local values when the mesh has changed.
Abstract base class to be used for system constraints.
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
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...
virtual bool compare(const System &other_system, const Real threshold, const bool verbose) const
void set_qoi(unsigned int qoi_index, Number qoi_value)
dof_id_type n_local_constrained_dofs() const
void create_dof_constraints(const MeshBase &, Real time=0)
Rebuilds the raw degree of freedom and DofObject constraints, based on attached DirichletBoundary obj...
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
void prepare_send_list()
Takes the _send_list vector (which may have duplicate entries) and sorts it.
bool on_command_line(std::string arg)
virtual bool infinite() const =0
const std::string & name() const
void attach_constraint_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function for imposing constraints.
virtual void user_constrain()
Calls user's attached constraint function, or is overridden by the user in derived classes...
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...
dof_id_type first_dof(const processor_id_type proc) const
Number get_qoi_error_estimate_value(unsigned int qoi_index) const
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet())
Calls user qoi function.
NumericVector< Number > & add_sensitivity_solution(unsigned int i=0)
FEFamily
defines an enum for finite element families.
unsigned int n_vars() const
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
MatrixBuildType
Defines an enum for matrix build types.
void compute_sparsity(const MeshBase &)
Computes the sparsity pattern for the matrices corresponding to proc_id and sends that data to Linear...
virtual void enable_out_of_mesh_mode()=0
Enables out-of-mesh mode.
processor_id_type processor_id() const
System(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
void enable_derivative()
Enable the computation of shape gradients (dshape).
bool vector_preservation(std::string_view vec_name) const
SparseMatrix< Number > & add_matrix(std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
Adds the additional matrix mat_name to this system.
SubsetSolveMode
defines an enum for the question what happens to the dofs outside the given subset when a system is s...
const DofMap & get_dof_map() const
processor_id_type processor_id() const
void late_matrix_init(SparseMatrix< Number > &mat, ParallelType type)
Helper function to keep DofMap forward declarable in system.h.
const SparseMatrix< Number > & get_matrix(std::string_view mat_name) const
A Point defines a location in LIBMESH_DIM dimensional Real space.
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
template class LIBMESH_EXPORT NumericVector< Number >
The QBase class provides the basic functionality from which various quadrature rules can be derived...
virtual Real linfty_norm() const =0
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
const std::vector< dof_id_type > & get_send_list() const
void attach_init_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in initializing the system.
void set_type(ParallelType t)
Allow the user to change the ParallelType of the NumericVector under some circumstances.
std::map< std::string, bool, std::less<> > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
This class forms the foundation from which generic finite elements may be derived.
Abstract base class to be used for quantities of interest.
bool is_evaluable(const DofObjectSubclass &obj, unsigned int var_num=libMesh::invalid_uint) const
const NumericVector< Number > & get_vector(std::string_view vec_name) const
NumericVector< Number > & get_weighted_sensitivity_adjoint_solution(unsigned int i=0)
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
dof_id_type n_constrained_dofs() const
std::vector< Number > get_qoi_values() const
Returns a copy of qoi, not a reference.
virtual void init(const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1)=0
Initialize SparseMatrix with the specified sizes.
const FEType & type() const
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.
ParallelType
Defines an enum for parallel data structure types.
Abstract base class to be used for derivatives of quantities of interest.
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
bool prefix_with_name() const
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
FEFieldType
defines an enum for finite element field types - i.e.