79 std::size_t max_dofs_per_elem,
81 unsigned int num_vars_in_system = 0)
86 "If our element type is anything other than ElementType::Element, then you "
87 "must supply num_vars_in_system in order to calculate the offset");
92 return var_num * max_dofs_per_elem;
95 return num_vars_in_system * max_dofs_per_elem + var_num * max_dofs_per_elem;
98 return 2 * num_vars_in_system * max_dofs_per_elem + var_num * max_dofs_per_elem;
102 "Unsupported element type ",
103 static_cast<typename std::underlying_type<decltype(element_type)
>::type>(element_type));
109 std::size_t max_dofs_per_elem,
111 unsigned int num_vars_in_system = 0)
123std::unordered_map<dof_id_type, Real>
139 -> std::vector<std::unordered_map<
141 typename std::enable_if<std::is_same<ADReal, typename T::value_type>::value, Real>::type>>
143 std::vector<std::unordered_map<dof_id_type, Real>> ret_val(ad_real_container.size());
145 for (MooseIndex(ad_real_container) i = 0; i < ad_real_container.size(); ++i)
DualNumber< Real, DNDerivativeType, true > ADReal
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Moose::GenericType< Real, is_ad > GenericReal
Generic class for solving transient nonlinear problems.
Base class for a system (of equations)
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
GenericReal< is_ad > ADRealToGenericReal(const ADReal &u_ad)
Converts an ADReal to a GenericReal<is_ad>
std::size_t adOffset(unsigned int var_num, std::size_t max_dofs_per_elem, ElementType element_type=ElementType::Element, unsigned int num_vars_in_system=0)
Helper function for computing automatic differentiation offset.
bool doDerivatives(const SubProblem &subproblem, const SystemBase &sys)
std::unordered_map< dof_id_type, Real > globalDofIndexToDerivative(const ADReal &ad_real, const SystemBase &sys, ElementType elem_type=ElementType::Element, THREAD_ID tid=0)
Generate a map from global dof index to derivative value.
bool globalADIndexing()
Whether we are using global AD indexing.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...