81 int i, iCmp, min, mid, max, Z,
A, m, level;
87 max = numberOfParticles;
89 mid = ( min + max ) / 2;
90 iCmp = strcmp( name, particleSortedList[mid]->name );
91 if( iCmp == 0 )
return( particleSortedList[mid] );
94 if( mid == 0 ) max = 0; }
97 if( min > max ) min = max;
101 if( numberOfParticles > 0 ) {
102 iCmp = strcmp( name, particleSortedList[mid]->name );
103 if( iCmp == 0 )
return( particleSortedList[mid] );
104 if( ( iCmp < 0 ) && ( mid != 0 ) ) {
106 iCmp = strcmp( name, particleSortedList[mid]->name );
111 if( ( particle->
name =
smr_allocateCopyString( smr, name,
"particle->name", __FILE__, __LINE__, __func__ ) ) == NULL )
goto err;
113 particle->
prior = NULL;
114 particle->
next = NULL;
125 if( sizeOfParticleSortedList < ( numberOfParticles + 1 ) ) {
126 if( sizeOfParticleSortedList == 0 ) {
127 sizeOfParticleSortedList = initialSizeOfList; }
129 sizeOfParticleSortedList += incrementalSizeOfList;
132 "particleSortedList" ) ) == NULL )
goto err;
135 if( particleList == NULL ) {
137 particleListEnd = particleList = particle; }
140 particle->
prior = particleListEnd;
141 particleListEnd->
next = particle;
142 particleListEnd = particle;
145 if( ( mid != 0 ) || ( iCmp > 0 ) ) mid++;
146 for( i = numberOfParticles; i > mid; i-- ) particleSortedList[i] = particleSortedList[i-1];
147 particleSortedList[mid] = particle;
char * smr_allocateCopyString(statusMessageReporting *smr, char const *s, char const *forItem, char const *file, int line, char const *function)