本文整理汇总了C++中DMat::borrow方法的典型用法代码示例。如果您正苦于以下问题:C++ DMat::borrow方法的具体用法?C++ DMat::borrow怎么用?C++ DMat::borrow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DMat
的用法示例。
在下文中一共展示了DMat::borrow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DMat
//---------------------------------------------------------
DMat& NDG2D::CurvedDGJump2D
(
const DMat& gU, // [in]
const IVec& gmapD, // [in]
const DVec& bcU // [in]
)
//---------------------------------------------------------
{
// function [jumpU] = CurvedDGJump2D(gU, gmapD, bcU)
// purpose: compute discontinuous Galerkin jump applied
// to a field given at cubature and Gauss nodes
DMat mmCHOL; DVec gUM,gUP,fx;
DMat *tmp = new DMat("jumpU", OBJ_temp);
DMat &jumpU(*tmp);
// shorthand references
Cub2D& cub = this->m_cub; Gauss2D& gauss = this->m_gauss;
// surface traces at Gauss nodes
gUM = gU(gauss.mapM);
gUP = gU(gauss.mapP);
if (gmapD.size()>0) { gUP(gmapD) = bcU(gmapD); }
// compute jump term and lift to triangle interiors
fx = gUM - gUP;
jumpU = -gauss.interpT*(gauss.W.dm(fx));
// multiply straight sided triangles by inverse mass matrix
jumpU(All,straight) = VVT * dd(jumpU(All,straight), J(All,straight));
// multiply by custom inverse mass matrix for each curvilinear triangle
int Ncurved = curved.size(), k=0;
for (int m=1; m<=Ncurved; ++m) {
k = curved(m);
mmCHOL.borrow(Np,Np, cub.mmCHOL.pCol(k));
mmCHOL.set_factmode(FACT_CHOL); // indicate factored state
jumpU(All,k) = chol_solve(mmCHOL, jumpU(All,k));
}
// these parameters may be OBJ_temp (allocated on the fly)
if (OBJ_temp == gU.get_mode()) { delete (&gU); }
if (OBJ_temp == bcU.get_mode()) { delete (&bcU); }
return jumpU;
}