本文整理汇总了C++中teuchos::RCP::Normal方法的典型用法代码示例。如果您正苦于以下问题:C++ RCP::Normal方法的具体用法?C++ RCP::Normal怎么用?C++ RCP::Normal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::RCP
的用法示例。
在下文中一共展示了RCP::Normal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReportError
InterfaceT)::ProjectNodes_MastertoSlave_NormalField()
{
if (!IsComplete()) {
std::stringstream oss;
oss << "***ERR*** "
"MoertelT::Interface::ProjectNodes_MastertoSlave_NormalField:\n"
<< "***ERR*** Complete() not called on interface " << Id() << "\n"
<< "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
throw MoertelT::ReportError(oss);
}
if (lcomm_ == Teuchos::null) return true;
int mside = MortarSide();
int sside = OtherSide(mside);
// iterate over all nodes of the master side and project those belonging to me
std::map<int, Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)>>::iterator
mcurr;
for (mcurr = rnode_[mside].begin(); mcurr != rnode_[mside].end(); ++mcurr) {
Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)> mnode = mcurr->second;
if (NodePID(mnode->Id()) != lcomm_->getRank()) continue;
const double* mx = mnode->XCoords();
double mindist = 1.0e+20;
Teuchos::RCP<MoertelT::(NodeT)> closenode = Teuchos::null;
// find a node on the slave side that is closest to me
std::map<int, Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)>>::
iterator scurr;
for (scurr = rnode_[sside].begin(); scurr != rnode_[sside].end(); ++scurr) {
Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)> snode =
scurr->second;
const double* sx = snode->XCoords();
// build distance | snode->XCoords() - mnode->XCoords() |
double dist = 0.0;
for (int i = 0; i < 3; ++i) dist += (mx[i] - sx[i]) * (mx[i] - sx[i]);
dist = sqrt(dist);
if (dist < mindist) {
mindist = dist;
closenode = snode;
}
}
if (closenode == Teuchos::null) {
std::stringstream oss;
oss << "***ERR*** "
"MoertelT::Interface::ProjectNodes_MastertoSlave_NormalField:\n"
<< "***ERR*** Weired: for master node " << mnode->Id()
<< " no closest master node found\n"
<< "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
throw MoertelT::ReportError(oss);
}
#if 0
std::cout << "snode " << *mnode;
std::cout << "closenode " << *closenode;
#endif
// get segments attached to closest node closenode
int nseg = closenode->Nseg();
MoertelT::SEGMENT_TEMPLATE_CLASS(SegmentT)** segs = closenode->Segments();
// create a projection operator
MoertelT::MOERTEL_TEMPLATE_CLASS(ProjectorT)
projector(IsOneDimensional(), OutLevel());
// loop these segments and find best projection
double bestdist[2];
const double tol = 0.2;
double bestgap = 0.0, gap;
bestdist[0] = bestdist[1] = 1.0e+20;
MoertelT::SEGMENT_TEMPLATE_CLASS(SegmentT)* bestseg = NULL;
for (int i = 0; i < nseg; ++i) {
// project the master node on the slave segment along the segments
// interpolated normal field
double xi[2];
xi[0] = xi[1] = 0.0;
projector.ProjectNodetoSegment_SegmentNormal(*mnode, *(segs[i]), xi, gap);
// check whether xi is better then previous projections
if (IsOneDimensional()) {
if (abs(xi[0]) < abs(bestdist[0])) {
bestdist[0] = xi[0];
bestdist[1] = xi[1];
bestseg = segs[i];
bestgap = gap;
}
} else {
double third = 1. / 3.;
// it's 'inside' with some tolerance
if (xi[0] <= 1. + tol && xi[1] <= abs(1. - xi[0]) + tol &&
xi[0] >= 0. - tol && xi[1] >= 0. - tol) {
// it's better in both directions
if (sqrt((xi[0] - third) * (xi[0] - third)) <
sqrt((bestdist[0] - third) * (bestdist[0] - third)) &&
sqrt((xi[1] - third) * (xi[1] - third)) <
sqrt((bestdist[1] - third) * (bestdist[1] - third))) {
bestdist[0] = xi[0];
bestdist[1] = xi[1];
bestseg = segs[i];
//.........这里部分代码省略.........