本文整理汇总了C++中MooseSharedPointer::computeOffDiagJacobianScalar方法的典型用法代码示例。如果您正苦于以下问题:C++ MooseSharedPointer::computeOffDiagJacobianScalar方法的具体用法?C++ MooseSharedPointer::computeOffDiagJacobianScalar怎么用?C++ MooseSharedPointer::computeOffDiagJacobianScalar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MooseSharedPointer
的用法示例。
在下文中一共展示了MooseSharedPointer::computeOffDiagJacobianScalar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ComputeFullJacobianThread::computeJacobian()
{
std::vector<std::pair<MooseVariable *, MooseVariable *> > & ce = _fe_problem.couplingEntries(_tid);
for (std::vector<std::pair<MooseVariable *, MooseVariable *> >::iterator it = ce.begin(); it != ce.end(); ++it)
{
MooseVariable & ivariable = *(*it).first;
MooseVariable & jvariable = *(*it).second;
unsigned int ivar = ivariable.number();
unsigned int jvar = jvariable.number();
if (ivariable.activeOnSubdomain(_subdomain) && jvariable.activeOnSubdomain(_subdomain) && _kernels.hasActiveVariableBlockObjects(ivar, _subdomain, _tid))
{
// only if there are dofs for j-variable (if it is subdomain restricted var, there may not be any)
const std::vector<MooseSharedPointer<KernelBase> > & kernels = _kernels.getActiveVariableBlockObjects(ivar, _subdomain, _tid);
for (std::vector<MooseSharedPointer<KernelBase> >::const_iterator kt = kernels.begin(); kt != kernels.end(); ++kt)
{
MooseSharedPointer<KernelBase> kernel = *kt;
if ((kernel->variable().number() == ivar) && kernel->isImplicit())
{
kernel->subProblem().prepareShapes(jvar, _tid);
kernel->computeOffDiagJacobian(jvar);
}
}
}
}
const std::vector<MooseVariableScalar *> & scalar_vars = _sys.getScalarVariables(_tid);
if (scalar_vars.size() > 0)
{
// go over nl-variables (non-scalar)
const std::vector<MooseVariable *> & vars = _sys.getVariables(_tid);
for (std::vector<MooseVariable *>::const_iterator it = vars.begin(); it != vars.end(); it++)
{
MooseVariable & ivariable = *(*it);
if (ivariable.activeOnSubdomain(_subdomain) > 0 && _kernels.hasActiveVariableBlockObjects(ivariable.number(), _subdomain, _tid))
{
// for each variable get the list of active kernels
const std::vector<MooseSharedPointer<KernelBase> > & kernels = _kernels.getActiveVariableBlockObjects(ivariable.number(), _subdomain, _tid);
for (std::vector<MooseSharedPointer<KernelBase> >::const_iterator kt = kernels.begin(); kt != kernels.end(); ++kt)
{
MooseSharedPointer<KernelBase> kernel = *kt;
if (kernel->isImplicit())
{
// now, get the list of coupled scalar vars and compute their off-diag jacobians
const std::vector<MooseVariableScalar *> coupled_scalar_vars = kernel->getCoupledMooseScalarVars();
for (std::vector<MooseVariableScalar *>::const_iterator jt = coupled_scalar_vars.begin(); jt != coupled_scalar_vars.end(); jt++)
{
MooseVariableScalar & jvariable = *(*jt);
// Do: dvar / dscalar_var
if (_sys.hasScalarVariable(jvariable.name())) // want to process only nl-variables (not aux ones)
kernel->computeOffDiagJacobianScalar(jvariable.number());
}
}
}
}
}
}
}