[cig-commits] commit: Found a bug in the 3D population control code.
Mercurial
hg at geodynamics.org
Mon Nov 24 11:31:09 PST 2008
changeset: 115:890d548d459c
user: LukeHodkinson
date: Sat Sep 06 14:12:37 2008 +0000
files: Utils/src/PCDVC.c
description:
Found a bug in the 3D population control code.
Arrays to store deleted and split particles were
being allocated before a block of code that
would modify the number of particles in a cell, so
when the arrays were used later there were
occaisionally more particles in the cell than
there was space allocated to hold deletions/splits.
diff -r 3872a13a51c9 -r 890d548d459c Utils/src/PCDVC.c
--- a/Utils/src/PCDVC.c Sat Aug 30 13:16:03 2008 +0000
+++ b/Utils/src/PCDVC.c Sat Sep 06 14:12:37 2008 +0000
@@ -789,12 +789,6 @@ void _PCDVC_Calculate3D( void* pcdvc, vo
nump_orig = nump = cParticleCount = intSwarm->cellParticleCountTbl[lCell_I];
- /* need a struct for the deletList because we must sort it by indexOnCPU and delete in reverse order
- so we don't have the potential problem of deleting a particle from the list that points to the last particle on the swarm */
- deleteList = (struct deleteParticle*)malloc(nump*sizeof(struct deleteParticle));/* I don't think I am going to let you delete more than half the particles in a given cell */
- splitList = (Particle_Index*)malloc(nump*sizeof(Particle_Index));
-
-
Journal_Firewall( nump , Journal_Register(Error_Type, "PCDVC"), "Error in %s: Problem has an under resolved cell (Cell Id = %d), add more particles to your model\n", __func__, lCell_I );
dx = (BBXMAX - BBXMIN)/numx;
@@ -1035,6 +1029,10 @@ void _PCDVC_Calculate3D( void* pcdvc, vo
break;
}
}
+ /* need a struct for the deletList because we must sort it by indexOnCPU and delete in reverse order
+ so we don't have the potential problem of deleting a particle from the list that points to the last particle on the swarm */
+ deleteList = (struct deleteParticle*)malloc(nump*sizeof(struct deleteParticle));/* I don't think I am going to let you delete more than half the particles in a given cell */
+ splitList = (Particle_Index*)malloc(nump*sizeof(Particle_Index));
for(i=0;i<nump;i++){
if(pList[i].w > maxW){ /* maxW = pList[i].w; maxI = i;*/ splitList[splitCount] = i; splitCount++;}
if(pList[i].w < minW){
More information about the CIG-COMMITS
mailing list