This commit is contained in:
zhangshuai 2019-04-28 15:15:53 +08:00
parent 7e41222cfa
commit 85c423e5ea
1 changed files with 146 additions and 140 deletions

View File

@ -275,8 +275,14 @@ void World::Load(sdf::ElementPtr _sdf)
if (this->dataPtr->sdf->HasElement("distribution")) if (this->dataPtr->sdf->HasElement("distribution"))
{ {
sdf::ElementPtr distributionElem = this->dataPtr->sdf->GetElement("distribution"); sdf::ElementPtr distributionElem = this->dataPtr->sdf->GetElement("distribution");
// int myid = 0; int nproc;
char proc_name[MPI_MAX_PROCESSOR_NAME];
int nameLength;
MPI_Comm_rank(MPI_COMM_WORLD, &this->gazeboLocalID); MPI_Comm_rank(MPI_COMM_WORLD, &this->gazeboLocalID);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
MPI_Get_processor_name(proc_name, &nameLength);
printf("Gazebo, Iam host %s with rank %d of %d\n", proc_name, this->gazeboLocalID, nproc);
this->flag = distributionElem->Get<int>("flag"); this->flag = distributionElem->Get<int>("flag");
std::cout << "================= gazebo_local_ID: " << this->gazeboLocalID << "\t Flag: " << this->flag << " =================" << std::endl; std::cout << "================= gazebo_local_ID: " << this->gazeboLocalID << "\t Flag: " << this->flag << " =================" << std::endl;