本文整理汇总了C++中teuchos::RCP::Id方法的典型用法代码示例。如果您正苦于以下问题:C++ RCP::Id方法的具体用法?C++ RCP::Id怎么用?C++ RCP::Id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::RCP
的用法示例。
在下文中一共展示了RCP::Id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: points
/*----------------------------------------------------------------------*
| copy a polygon of points (private) mwgee 10/05|
*----------------------------------------------------------------------*/
bool MOERTEL::Overlap::CopyPointPolygon(std::map<int,Teuchos::RCP<MOERTEL::Point> >& from, std::map<int,Teuchos::RCP<MOERTEL::Point> >& to)
{
std::map<int,Teuchos::RCP<MOERTEL::Point> >::iterator pcurr;
for (pcurr=from.begin(); pcurr != from.end(); ++pcurr)
if (pcurr->second != Teuchos::null)
{
Teuchos::RCP<MOERTEL::Point> tmp = Teuchos::rcp(new MOERTEL::Point(pcurr->second->Id(),pcurr->second->Xi(),pcurr->second->OutLevel()));
to.insert(std::pair<int,Teuchos::RCP<MOERTEL::Point> >(tmp->Id(),tmp));
}
return true;
}
示例2:
bool MoertelT::MOERTEL_TEMPLATE_CLASS_1A(OverlapT, IFace)::CopyPointPolygon(
std::map<int, Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(PointT)>>& from,
std::map<int, Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(PointT)>>& to)
{
std::map<int, Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(PointT)>>::
iterator pcurr;
for (pcurr = from.begin(); pcurr != from.end(); ++pcurr)
if (pcurr->second != Teuchos::null) {
Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(PointT)> tmp =
Teuchos::rcp(new MoertelT::MOERTEL_TEMPLATE_CLASS(PointT)(
pcurr->second->Id(),
pcurr->second->Xi(),
pcurr->second->OutLevel()));
to.insert(
std::
pair<int, Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(PointT)>>(
tmp->Id(), tmp));
}
return true;
}
示例3: ReportError
InterfaceT)::ProjectNodes_SlavetoMaster_Orthogonal()
{
if (!IsComplete()) {
std::stringstream oss;
oss << "***ERR*** "
"MoertelT::Interface::ProjectNodes_SlavetoMaster_Orthogonal:\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 slave side and project those belonging 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;
#if 0
std::cout << "now projecting\n " << *snode;
#endif
if (NodePID(snode->Id()) != lcomm_->getRank()) continue;
const double* sx = snode->XCoords();
double mindist = 1.0e+20;
Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)> closenode =
Teuchos::null;
// find a node on the master side, that is closest 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;
const double* mx = mnode->XCoords();
// build distance | mnode->XCoords() - snode->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 = mnode;
}
// std::cout << "snode " << snode->Id() << " mnode " << mnode->Id() << "
// mindist " << mindist << " dist " << dist << std::endl;
}
if (closenode == Teuchos::null) {
std::stringstream oss;
oss << "***ERR*** "
"MoertelT::Interface::ProjectNodes_SlavetoMaster_Orthogonal:\n"
<< "***ERR*** Weired: for slave node " << snode->Id()
<< " no closest master node found\n"
<< "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
throw MoertelT::ReportError(oss);
}
// get segments attached to closest node cnode
int nmseg = closenode->Nseg();
MoertelT::SEGMENT_TEMPLATE_CLASS(SegmentT)** msegs = closenode->Segments();
// create a projection-iterator
MoertelT::MOERTEL_TEMPLATE_CLASS(ProjectorT)
projector(IsOneDimensional(), OutLevel());
// loop segments and find all projections onto them
int nsseg = snode->Nseg();
MoertelT::SEGMENT_TEMPLATE_CLASS(SegmentT)** ssegs = snode->Segments();
for (int i = 0; i < nmseg; ++i) {
// loop all segments that are adjacent to the slave node
for (int j = 0; j < nsseg; ++j) {
// project the slave node onto that master segment
double xi[2];
xi[0] = xi[1] = 0.0;
double gap;
projector.ProjectNodetoSegment_Orthogonal_to_Slave(
*snode, *(msegs[i]), xi, gap, *(ssegs[j]));
// check whether this projection is good
bool ok = false;
if (IsOneDimensional()) {
if (abs(xi[0]) < 1.01) ok = true;
} else {
std::stringstream oss;
oss << "***ERR*** "
"MoertelT::Interface::ProjectNodes_SlavetoMaster_Orthogonal:\n"
<< "***ERR*** not impl. for 3D\n"
<< "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
throw MoertelT::ReportError(oss);
}
if (ok) // the projection is good
{
// create a projected node and store it in snode
MoertelT::MOERTEL_TEMPLATE_CLASS(ProjectedNodeT)* pnode =
new MoertelT::MOERTEL_TEMPLATE_CLASS(ProjectedNodeT)(
//.........这里部分代码省略.........
示例4: ReportError
/*----------------------------------------------------------------------*
| finalize construction of this interface |
*----------------------------------------------------------------------*/
bool MOERTEL::Interface::Complete()
{
if (IsComplete())
{
if (OutLevel()>0)
std::cout << "MOERTEL: ***WRN*** MOERTEL::Interface::InterfaceComplete:\n"
<< "MOERTEL: ***WRN*** InterfaceComplete() was called before, do nothing\n"
<< "MOERTEL: ***WRN*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
return true;
}
//-------------------------------------------------------------------
// check for NULL entries in maps
bool ok = true;
for (int i=0; i<2; ++i)
{
std::map<int,Teuchos::RCP<MOERTEL::Node> >::const_iterator curr;
for (curr=node_[i].begin(); curr!=node_[i].end(); ++curr)
{
if (curr->second == Teuchos::null)
{
std::cout << "***ERR*** MOERTEL::Interface::Complete:\n"
<< "***ERR*** Interface # " << Id_ << ":\n"
<< "***ERR*** found NULL entry in map of nodes\n"
<< "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
ok = false;
}
}
}
for (int i=0; i<2; ++i)
{
std::map<int,Teuchos::RCP<MOERTEL::Segment> >::const_iterator curr;
for (curr=seg_[i].begin(); curr!=seg_[i].end(); ++curr)
{
if (curr->second == Teuchos::null)
{
std::cout << "***ERR*** MOERTEL::Interface::Complete:\n"
<< "***ERR*** Interface # " << Id_ << ":\n"
<< "***ERR*** found NULL entry in map of segments\n"
<< "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
ok = false;
}
}
}
int lok = ok;
int gok = 1;
gcomm_.MinAll(&lok,&gok,1);
if (!gok) return false;
//-------------------------------------------------------------------
// check whether all nodes for segments are present
// (take in account that node might be on different processor)
// this test is expensive and does not scale. It is therefore only performed
// when user requests a high output level
#if 1
if (OutLevel()>9)
{
for (int proc=0; proc<gcomm_.NumProc(); ++proc)
{
for (int side=0; side<2; ++side)
{
// create length of list of all nodes adjacent to segments on proc
int sendsize = 0;
if (proc==gcomm_.MyPID())
{
std::map<int,Teuchos::RCP<MOERTEL::Segment> >::const_iterator curr;
for (curr=seg_[side].begin(); curr!=seg_[side].end(); ++curr)
sendsize += curr->second->Nnode();
}
gcomm_.Broadcast(&sendsize,1,proc);
// create list of all nodes adjacent to segments on proc
std::vector<int> ids(sendsize);
if (proc==gcomm_.MyPID())
{
std::map<int,Teuchos::RCP<MOERTEL::Segment> >::const_iterator curr;
int counter=0;
for (curr=seg_[side].begin(); curr!=seg_[side].end(); ++curr)
{
const int* segids = curr->second->NodeIds();
for (int i=0; i<curr->second->Nnode(); ++i)
ids[counter++] = segids[i];
}
}
gcomm_.Broadcast(&ids[0],sendsize,proc);
// check on all processors for nodes in ids
std::vector<int> foundit(sendsize);
std::vector<int> gfoundit(sendsize);
for (int i=0; i<sendsize; ++i)
{
foundit[i] = 0;
if (node_[side].find(ids[i]) != node_[side].end())
foundit[i] = 1;
}
gcomm_.MaxAll(&foundit[0],&gfoundit[0],sendsize);
for (int i=0; i<sendsize; ++i)
//.........这里部分代码省略.........