本文整理汇总了C++中Epetra_MpiComm::GetMpiComm方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_MpiComm::GetMpiComm方法的具体用法?C++ Epetra_MpiComm::GetMpiComm怎么用?C++ Epetra_MpiComm::GetMpiComm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_MpiComm
的用法示例。
在下文中一共展示了Epetra_MpiComm::GetMpiComm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Teuchos_CommPtr& MeshPartitionPolicy::TeuchosComm()
{
if (_TeuchosComm == Teuchos::null)
{
#ifdef HAVE_MPI
Epetra_MpiComm* mpiComm = dynamic_cast<Epetra_MpiComm*>(_Comm.get());
if (mpiComm == NULL)
{
// serial communicator
_TeuchosComm = MPIWrapper::TeuchosCommSerial();
}
else
{
if (mpiComm->GetMpiComm() == MPI_COMM_WORLD)
{
_TeuchosComm = MPIWrapper::TeuchosCommWorld();
}
else
{
_TeuchosComm = Teuchos::rcp( new Teuchos::MpiComm<int> (mpiComm->GetMpiComm()) );
}
}
#else
// if we don't have MPI, then it can only be a serial communicator
_TeuchosComm = MPIWrapper::TeuchosSerialComm();
#endif
}
return _TeuchosComm;
}
示例2:
//==============================================================================
// Epetra_MpiDistributor constructor
Epetra_MpiDistributor::Epetra_MpiDistributor(const Epetra_MpiComm & Comm):
Epetra_Object("Epetra::MpiDistributor"),
lengths_to_(0),
procs_to_(0),
indices_to_(0),
size_indices_to_(0),
lengths_from_(0),
procs_from_(0),
indices_from_(0),
size_indices_from_(0),
resized_(false),
sizes_(0),
sizes_to_(0),
starts_to_(0),
starts_to_ptr_(0),
indices_to_ptr_(0),
sizes_from_(0),
starts_from_(0),
starts_from_ptr_(0),
indices_from_ptr_(0),
nrecvs_(0),
nsends_(0),
nexports_(0),
self_msg_(0),
max_send_length_(0),
total_recv_length_(0),
tag_(Comm.GetMpiTag()),
epComm_(&Comm),
comm_(Comm.GetMpiComm()),
request_(0),
status_(0),
no_delete_(false),
send_array_(0),
send_array_size_(0),
comm_plan_reverse_(0)
{
}
示例3: ReportError
//.........这里部分代码省略.........
if (node_[i].size() != 0)
{
lin[gcomm_.MyPID()] = 1;
break;
}
gcomm_.MaxAll(&lin[0],&gin[0],gcomm_.NumProc());
lin.clear();
// typecast the Epetra_Comm to Epetra_MpiComm
Epetra_MpiComm* epetrampicomm = dynamic_cast<Epetra_MpiComm*>(&gcomm_);
if (!epetrampicomm)
{
std::stringstream oss;
oss << "***ERR*** MOERTEL::Interface::Complete:\n"
<< "***ERR*** Interface " << Id() << ": Epetra_Comm is not an Epetra_MpiComm\n"
<< "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
throw ReportError(oss);
}
// split the communicator into participating and none-participating procs
int color;
int key = gcomm_.MyPID();
// I am taking part in the new comm if I have any ownership
if (gin[gcomm_.MyPID()])
color = 0;
// I am not taking part in the new comm
else
color = MPI_UNDEFINED;
// tidy up
gin.clear();
// create the local communicator
MPI_Comm mpi_global_comm = epetrampicomm->GetMpiComm();
MPI_Comm* mpi_local_comm = new MPI_Comm();
MPI_Comm_split(mpi_global_comm,color,key,mpi_local_comm);
// create the new Epetra_MpiComm
if (*mpi_local_comm == MPI_COMM_NULL)
lcomm_ = Teuchos::null;
else
lcomm_ = Teuchos::rcp(new Epetra_MpiComm(*mpi_local_comm)); // FIXME: who destroys the MPI_Comm inside?
#if 0
// test this stuff on the mpi level
int grank,lrank;
MPI_Comm_rank(mpi_global_comm,&grank);
if (*mpi_local_comm != MPI_COMM_NULL)
MPI_Comm_rank(*mpi_local_comm,&lrank);
else
lrank = -1;
for (int proc=0; proc<gcomm_.NumProc(); ++proc)
{
if (proc==gcomm_.MyPID())
std::cout << "using mpi comms: I am global rank " << grank << " and local rank " << lrank << std::endl;
gcomm_.Barrier();
}
// test this stuff on the epetra level
if (lComm())
for (int proc=0; proc<lcomm_->NumProc(); ++proc)
{
if (proc==lcomm_->MyPID())
std::cout << "using epetra comms: I am global rank " << gcomm_.MyPID() << " and local rank " << lcomm_->MyPID() << std::endl;
lcomm_->Barrier();
}
gcomm_.Barrier();