当前位置: 首页>>代码示例>>C++>>正文


C++ ParticleList::deleteParticles方法代码示例

本文整理汇总了C++中ParticleList::deleteParticles方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleList::deleteParticles方法的具体用法?C++ ParticleList::deleteParticles怎么用?C++ ParticleList::deleteParticles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleList的用法示例。


在下文中一共展示了ParticleList::deleteParticles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: interchangeParticles

void MDcalculation::interchangeParticles(int dim){
	MPI_Status status;
	MPI_Request req0, req1;
	int* stats;
	int* statsIn;
	double* data;
	double* dataIn;
	int nStats, nData;
	int nStatsIn, nDataIn;
	//Senders and recievers
	int right = neighbour[2*dim];
	int left = neighbour[2*dim + 1];
	//Export arrays
	ParticleList* rightExport = exportList[2*dim];
	ParticleList* leftExport = exportList[2*dim + 1];
	
	//Communicating to right
	rightExport->makeArrays(&stats, &data, &nStats, &nData);
	rightExport->deleteParticles();
	shiftCoordinatesOut(data, nData, dim);
	//Send data to right
	MPI_Isend(data, nData, MPI_DOUBLE, right, 0, MPI_COMM_WORLD, &req0);
	//Recieve data from left
	MPI_Probe(left, 0, MPI_COMM_WORLD, &status);
	MPI_Get_count(&status, MPI_DOUBLE, &nDataIn);
	dataIn = new double[nDataIn];
	MPI_Irecv(dataIn, nDataIn, MPI_DOUBLE, left, 0, MPI_COMM_WORLD, &req1);
	MPI_Wait(&req0, &status);
	MPI_Wait(&req1, &status);
	//Send stats to right
	MPI_Isend(stats, nStats, MPI_INT, right, 1, MPI_COMM_WORLD, &req0);
	//Recieve stats from left
	MPI_Probe(left, 1, MPI_COMM_WORLD, &status);
	MPI_Get_count(&status, MPI_INT, &nStatsIn);
	statsIn = new int[nStatsIn];
	MPI_Irecv(statsIn, nStatsIn, MPI_INT, left, 1, MPI_COMM_WORLD, &req1);
	MPI_Wait(&req0, &status);
	MPI_Wait(&req1, &status);
	addParticles(statsIn, dataIn, nStatsIn, nDataIn);
	delete[] stats; delete[] data; delete[] statsIn; delete[] dataIn;
	
	//Communicating to left
	leftExport->makeArrays(&stats, &data, &nStats, &nData);
	leftExport->deleteParticles();
	//Send data to left
	MPI_Isend(data, nData, MPI_DOUBLE, left, 0, MPI_COMM_WORLD, &req0);
	//Recieve data from right
	MPI_Probe(right, 0, MPI_COMM_WORLD, &status);
	MPI_Get_count(&status, MPI_DOUBLE, &nDataIn);
	dataIn = new double[nDataIn];
	MPI_Irecv(dataIn, nDataIn, MPI_DOUBLE, right, 0, MPI_COMM_WORLD, &req1);
	MPI_Wait(&req0, &status);
	MPI_Wait(&req1, &status);
	//Send stats to left
	MPI_Isend(stats, nStats, MPI_INT, left, 1, MPI_COMM_WORLD, &req0);
	//Recieve stats from right
	MPI_Probe(right, 1, MPI_COMM_WORLD, &status);
	MPI_Get_count(&status, MPI_INT, &nStatsIn);
	statsIn = new int[nStatsIn];
	MPI_Irecv(statsIn, nStatsIn, MPI_INT, right, 1, MPI_COMM_WORLD, &req1);
	MPI_Wait(&req0, &status);
	MPI_Wait(&req1, &status);
	shiftCoordinatesIn(dataIn, nDataIn, dim);
	addParticles(statsIn, dataIn, nStatsIn, nDataIn);
	delete[] stats; delete[] data; delete[] statsIn; delete[] dataIn;
}
开发者ID:AndreDouzette,项目名称:MolecularDynamics,代码行数:66,代码来源:MDcalculation.cpp


注:本文中的ParticleList::deleteParticles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。