本文整理汇总了C++中teuchos::SerialDenseMatrix::shape方法的典型用法代码示例。如果您正苦于以下问题:C++ SerialDenseMatrix::shape方法的具体用法?C++ SerialDenseMatrix::shape怎么用?C++ SerialDenseMatrix::shape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::SerialDenseMatrix
的用法示例。
在下文中一共展示了SerialDenseMatrix::shape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: B
void DislocationDensity<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
Teuchos::SerialDenseMatrix<int, double> A;
Teuchos::SerialDenseMatrix<int, double> X;
Teuchos::SerialDenseMatrix<int, double> B;
Teuchos::SerialDenseSolver<int, double> solver;
A.shape(numNodes,numNodes);
X.shape(numNodes,numNodes);
B.shape(numNodes,numNodes);
// construct Identity for RHS
for (int i = 0; i < numNodes; ++i)
B(i,i) = 1.0;
for (int i=0; i < G.size() ; i++) G[i] = 0.0;
// construct the node --> point operator
for (std::size_t cell=0; cell < workset.numCells; ++cell)
{
for (std::size_t node=0; node < numNodes; ++node)
for (std::size_t qp=0; qp < numQPs; ++qp)
A(qp,node) = BF(cell,node,qp);
X = 0.0;
solver.setMatrix( Teuchos::rcp( &A, false) );
solver.setVectors( Teuchos::rcp( &X, false ), Teuchos::rcp( &B, false ) );
// Solve the system A X = B to find A_inverse
int status = 0;
status = solver.factor();
status = solver.solve();
// compute nodal Fp
nodalFp.initialize(0.0);
for (std::size_t node=0; node < numNodes; ++node)
for (std::size_t qp=0; qp < numQPs; ++qp)
for (std::size_t i=0; i < numDims; ++i)
for (std::size_t j=0; j < numDims; ++j)
nodalFp(node,i,j) += X(node,qp) * Fp(cell,qp,i,j);
// compute the curl using nodalFp
curlFp.initialize(0.0);
for (std::size_t node=0; node < numNodes; ++node)
{
for (std::size_t qp=0; qp < numQPs; ++qp)
{
curlFp(qp,0,0) += nodalFp(node,0,2) * GradBF(cell,node,qp,1) - nodalFp(node,0,1) * GradBF(cell,node,qp,2);
curlFp(qp,0,1) += nodalFp(node,1,2) * GradBF(cell,node,qp,1) - nodalFp(node,1,1) * GradBF(cell,node,qp,2);
curlFp(qp,0,2) += nodalFp(node,2,2) * GradBF(cell,node,qp,1) - nodalFp(node,2,1) * GradBF(cell,node,qp,2);
curlFp(qp,1,0) += nodalFp(node,0,0) * GradBF(cell,node,qp,2) - nodalFp(node,0,2) * GradBF(cell,node,qp,0);
curlFp(qp,1,1) += nodalFp(node,1,0) * GradBF(cell,node,qp,2) - nodalFp(node,1,2) * GradBF(cell,node,qp,0);
curlFp(qp,1,2) += nodalFp(node,2,0) * GradBF(cell,node,qp,2) - nodalFp(node,2,2) * GradBF(cell,node,qp,0);
curlFp(qp,2,0) += nodalFp(node,0,1) * GradBF(cell,node,qp,0) - nodalFp(node,0,0) * GradBF(cell,node,qp,1);
curlFp(qp,2,1) += nodalFp(node,1,1) * GradBF(cell,node,qp,0) - nodalFp(node,1,0) * GradBF(cell,node,qp,1);
curlFp(qp,2,2) += nodalFp(node,2,1) * GradBF(cell,node,qp,0) - nodalFp(node,2,0) * GradBF(cell,node,qp,1);
}
}
for (std::size_t qp=0; qp < numQPs; ++qp)
for (std::size_t i=0; i < numDims; ++i)
for (std::size_t j=0; j < numDims; ++j)
for (std::size_t k=0; k < numDims; ++k)
G(cell,qp,i,j) += Fp(cell,qp,i,k) * curlFp(qp,k,j);
}
}