本文整理汇总了C++中teuchos::RCP::Gap方法的典型用法代码示例。如果您正苦于以下问题:C++ RCP::Gap方法的具体用法?C++ RCP::Gap怎么用?C++ RCP::Gap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::RCP
的用法示例。
在下文中一共展示了RCP::Gap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReportError
//.........这里部分代码省略.........
// check whether the bestseg/bestdist are inside that segment
// (with some tolerance of 20%)
bool ok = false;
if (IsOneDimensional()) {
if (abs(bestdist[0]) < 1.1) ok = true;
} else {
if (bestdist[0] <= 1. + tol &&
bestdist[1] <= abs(1. - bestdist[0]) + tol &&
bestdist[0] >= 0. - tol && bestdist[1] >= 0. - tol)
ok = true;
}
if (ok) // the projection is good
{
// build the interpolated normal and overwrite the mnode normal with -n
int nsnode = bestseg->Nnode();
MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)** snodes = bestseg->Nodes();
std::vector<double> val(nsnode);
bestseg->EvaluateFunction(0, bestdist, &val[0], nsnode, NULL);
double NN[3];
NN[0] = NN[1] = NN[2] = 0.0;
for (int i = 0; i < nsnode; ++i) {
const double* Normal = snodes[i]->Normal();
for (int j = 0; j < 3; ++j) NN[j] -= val[i] * Normal[j];
}
val.clear();
mnode->SetN(NN);
// create projected node and store it in mnode
MoertelT::MOERTEL_TEMPLATE_CLASS(ProjectedNodeT)* pnode =
new MoertelT::MOERTEL_TEMPLATE_CLASS(ProjectedNodeT)(
*mnode, bestdist, bestseg);
mnode->SetProjectedNode(pnode);
mnode->SetGap(bestgap);
} else // this mnode does not have a valid projection
{
if (OutLevel() > 6)
std::cout << "MoertelT: ***WRN***: Projection m->s: Node "
<< mnode->Id() << " does not have projection\n";
mnode->SetProjectedNode(NULL);
}
} // for (scurr=rnode_[mside].begin(); scurr!=rnode_[mside].end(); ++scurr)
// loop all master nodes again and make the projection and the new normal
// redundant
int bsize = 7 * rnode_[mside].size();
std::vector<double> bcast(bsize);
for (int proc = 0; proc < lcomm_->getSize(); ++proc) {
int blength = 0;
if (proc == lcomm_->getRank()) {
for (mcurr = rnode_[mside].begin(); mcurr != rnode_[mside].end();
++mcurr) {
Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)> mnode =
mcurr->second;
if (proc != NodePID(mnode->Id()))
continue; // cannot have a projection on a node i don't own
Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(ProjectedNodeT)> pnode =
mnode->GetProjectedNode();
if (pnode == Teuchos::null)
continue; // this node does not have a projection
const double* xi = pnode->Xi();
const double* Normal = mnode->Normal();
bcast[blength] = (double)pnode->Id();
++blength;
if (pnode->Segment())
bcast[blength] = (double)pnode->Segment()->Id();