本文整理汇总了C++中std::tr1::shared_ptr::normal_derivative方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::normal_derivative方法的具体用法?C++ shared_ptr::normal_derivative怎么用?C++ shared_ptr::normal_derivative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::tr1::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::normal_derivative方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void GRINS::BoundaryConditions::apply_neumann_normal_axisymmetric( libMesh::FEMContext& context,
const CachedValues& cache,
const bool request_jacobian,
const GRINS::VariableIndex var,
const libMesh::Real sign,
const std::tr1::shared_ptr<GRINS::NeumannFuncObj> neumann_func ) const
{
// The number of local degrees of freedom
const unsigned int n_var_dofs = context.dof_indices_var[var].size();
// Element Jacobian * quadrature weight for side integration.
const std::vector<libMesh::Real> &JxW_side = context.side_fe_var[var]->get_JxW();
// The var shape functions at side quadrature points.
const std::vector<std::vector<libMesh::Real> >& var_phi_side =
context.side_fe_var[var]->get_phi();
// Physical location of the quadrature points
const std::vector<libMesh::Point>& var_qpoint =
context.side_fe_var[var]->get_xyz();
libMesh::DenseSubVector<libMesh::Number> &F_var = *context.elem_subresiduals[var]; // residual
libMesh::DenseSubMatrix<libMesh::Number> &K_var = *context.elem_subjacobians[var][var]; // jacobian
unsigned int n_qpoints = context.side_qrule->n_points();
for (unsigned int qp=0; qp != n_qpoints; qp++)
{
const libMesh::Real bc_value = neumann_func->normal_value( context, cache, qp );
const libMesh::Real jac_value = neumann_func->normal_derivative( context, cache, qp );
const libMesh::Number r = var_qpoint[qp](0);
for (unsigned int i=0; i != n_var_dofs; i++)
{
F_var(i) += sign*r*bc_value*var_phi_side[i][qp]*JxW_side[qp];
if (request_jacobian)
{
for (unsigned int j=0; j != n_var_dofs; j++)
{
K_var(i,j) += sign*r*jac_value*
var_phi_side[i][qp]*var_phi_side[j][qp]*JxW_side[qp];
}
}
}
} // End quadrature loop
// Now must take care of the case that the boundary condition depends on variables
// other than var.
std::vector<GRINS::VariableIndex> other_jac_vars = neumann_func->get_other_jac_vars();
if( (other_jac_vars.size() > 0) && request_jacobian )
{
for( std::vector<GRINS::VariableIndex>::const_iterator var2 = other_jac_vars.begin();
var2 != other_jac_vars.end();
var2++ )
{
libMesh::DenseSubMatrix<libMesh::Number> &K_var2 = *context.elem_subjacobians[var][*var2]; // jacobian
const unsigned int n_var2_dofs = context.dof_indices_var[*var2].size();
const std::vector<std::vector<libMesh::Real> >& var2_phi_side =
context.side_fe_var[*var2]->get_phi();
for (unsigned int qp=0; qp != n_qpoints; qp++)
{
const libMesh::Real jac_value = neumann_func->normal_derivative( context, cache, qp, *var2 );
const libMesh::Number r = var_qpoint[qp](0);
for (unsigned int i=0; i != n_var_dofs; i++)
{
for (unsigned int j=0; j != n_var2_dofs; j++)
{
K_var2(i,j) += sign*r*jac_value*
var_phi_side[i][qp]*var2_phi_side[j][qp]*JxW_side[qp];
}
}
}
} // End loop over auxillary Jacobian variables
}
return;
}