refactoring lbpm_porenetwork

This commit is contained in:
James E McClure 2018-03-22 16:29:39 -04:00
parent 98f3cec8f5
commit 245f5d3dc6

View File

@ -143,17 +143,13 @@ int main(int argc, char **argv)
int index=0;
while ( index < nsph ) {
getline ( SPHERES, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
spheres(0,index)=strtod(value.c_str(),NULL);
spheres(0,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( SPHERES, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
spheres(1,index)=strtod(value.c_str(),NULL);
spheres(1,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( SPHERES, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
spheres(2,index)=strtod(value.c_str(),NULL);
spheres(2,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( SPHERES, value ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
spheres(3,index)=strtod(value.c_str(),NULL);
spheres(3,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
printf("cx=%f,cy=%f,cz=%f,r=%f\n",spheres(0,index),spheres(1,index),spheres(2,index),spheres(3,index));
index++;
//cout << string( value, 1, value.length()-2 ); // display value removing the first and the last character from it
@ -164,26 +160,19 @@ int main(int argc, char **argv)
index=0;
while ( index < ncyl ) {
getline ( CYLINDERS, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
cylinders(0,index)=strtod(value.c_str(),NULL);
cylinders(0,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( CYLINDERS, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
cylinders(1,index)=strtod(value.c_str(),NULL);
cylinders(1,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( CYLINDERS, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
cylinders(2,index)=strtod(value.c_str(),NULL);
cylinders(2,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( CYLINDERS, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
cylinders(3,index)=strtod(value.c_str(),NULL);
cylinders(3,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( CYLINDERS, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
cylinders(4,index)=strtod(value.c_str(),NULL);
cylinders(4,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( CYLINDERS, value, ' ' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
cylinders(5,index)=strtod(value.c_str(),NULL);
cylinders(5,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
getline ( CYLINDERS, value ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
value = value*double(Nx-1)/Lx;
cylinders(6,index)=strtod(value.c_str(),NULL);
cylinders(6,index)=strtod(value.c_str(),NULL)*double(Nx-1)/Lx;
printf("x=%f,y=%f,z=%f,r=%f\n",cylinders(0,index),cylinders(1,index),cylinders(2,index),cylinders(6,index));
index++;
//cout << string( value, 1, value.length()-2 ); // display value removing the first and the last character from it