本文整理汇总了C++中AssemblyContext::get_dim方法的典型用法代码示例。如果您正苦于以下问题:C++ AssemblyContext::get_dim方法的具体用法?C++ AssemblyContext::get_dim怎么用?C++ AssemblyContext::get_dim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssemblyContext
的用法示例。
在下文中一共展示了AssemblyContext::get_dim方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pin_value
void BoundaryConditions::pin_value( AssemblyContext& context,
const CachedValues& /*cache*/,
const bool request_jacobian,
const VariableIndex var,
const double pin_value,
const libMesh::Point& pin_location,
const double penalty )
{
if (context.get_elem().contains_point(pin_location))
{
libMesh::FEGenericBase<libMesh::Real>* elem_fe = NULL;
context.get_element_fe( var, elem_fe );
libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
libMesh::DenseSubMatrix<libMesh::Number> &K_var = context.get_elem_jacobian(var,var); // jacobian
// The number of local degrees of freedom in p variable.
const unsigned int n_var_dofs = context.get_dof_indices(var).size();
libMesh::Number var_value = context.point_value(var, pin_location);
libMesh::FEType fe_type = elem_fe->get_fe_type();
libMesh::Point point_loc_in_masterelem =
libMesh::FEInterface::inverse_map(context.get_dim(), fe_type, &context.get_elem(), pin_location);
std::vector<libMesh::Real> phi(n_var_dofs);
for (unsigned int i=0; i != n_var_dofs; i++)
{
phi[i] = libMesh::FEInterface::shape( context.get_dim(), fe_type, &context.get_elem(), i,
point_loc_in_masterelem );
}
for (unsigned int i=0; i != n_var_dofs; i++)
{
F_var(i) += penalty*(var_value - pin_value)*phi[i];
/** \todo What the hell is the context.get_elem_solution_derivative() all about? */
if (request_jacobian && context.get_elem_solution_derivative())
{
libmesh_assert (context.get_elem_solution_derivative() == 1.0);
for (unsigned int j=0; j != n_var_dofs; j++)
K_var(i,j) += penalty*phi[i]*phi[j];
} // End if request_jacobian
} // End i loop
} // End if pin_location
return;
}
示例2: compute_g
libMesh::RealGradient StabilizationHelper::compute_g( libMesh::FEBase* fe,
AssemblyContext& c,
unsigned int qp ) const
{
libMesh::RealGradient g( fe->get_dxidx()[qp] + fe->get_detadx()[qp],
fe->get_dxidy()[qp] + fe->get_detady()[qp] );
if( c.get_dim() == 3 )
{
g(0) += fe->get_dzetadx()[qp];
g(1) += fe->get_dzetady()[qp];
g(2) = fe->get_dxidz()[qp] + fe->get_detadz()[qp] + fe->get_dzetadz()[qp];
}
return g;
}
示例3: compute_G
libMesh::RealTensor StabilizationHelper::compute_G( libMesh::FEBase* fe,
AssemblyContext& c,
unsigned int qp ) const
{
libMesh::Real dxidx = fe->get_dxidx()[qp];
libMesh::Real dxidy = fe->get_dxidy()[qp];
libMesh::Real detadx = fe->get_detadx()[qp];
libMesh::Real detady = fe->get_detady()[qp];
libMesh::RealTensor G( dxidx*dxidx + detadx*detadx,
dxidx*dxidy + detadx*detady,
0.0,
dxidy*dxidx + detady*detadx,
dxidy*dxidy + detady*detady,
0.0 );
if( c.get_dim() == 3 )
{
libMesh::Real dxidz = fe->get_dxidz()[qp];
libMesh::Real detadz = fe->get_detadz()[qp];
libMesh::Real dzetadx = fe->get_dzetadx()[qp];
libMesh::Real dzetady = fe->get_dzetady()[qp];
libMesh::Real dzetadz = fe->get_dzetadz()[qp];
G(0,0) += dzetadx*dzetadx;
G(0,1) += dzetadx*dzetady;
G(0,2) = dxidx*dxidz + detadx*detadz + dzetadx*dzetadz;
G(1,0) += dzetady*dzetadx;
G(1,1) += dzetady*dzetady;
G(1,2) = dxidy*dxidz + detady*detadz + dzetady*dzetadz;
G(2,0) = dxidz*dxidx + detadz*detadx + dzetadz*dzetadx;
G(2,1) = dxidz*dxidy + detadz*detady + dzetadz*dzetady;
G(2,2) = dxidz*dxidz + detadz*detadz + dzetadz*dzetadz;
}
return G;
}