'How to import and output several files in voro++?
This script makes me import a single file with the 'con.import()' function and it makes output a single file with 'con.print_costum()' function, now i want to import several files at the same time and each input files makes ma an output file, how can i do ?
int main() {
// Create a container with the geometry given above, and make it
// non-periodic in each of the three coordinates. Allocate space for
// eight particles within each computational block.
container con(x_min,x_max,y_min,y_max,z_min,z_max,n_x,n_y,n_z,
false,false,false,8);
// Add a cylindrical wall to the container
wall_cylinder cyl(0,0,0,0,0,1,10);
con.add_wall(cyl);
// Import the particles from a file
con.import("rpack0.dmp");
// Do a custom output routine that outputs the particle IDs and
// positions, plus the volume
con.print_custom("%i %q %v","packing.custom");}
I did this but what about the Output?
// Import the particles from a files
DIR *di;
char *ptr1,*ptr2;
int retn;
struct dirent *dir;
di = opendir("."); // specify the directory name
if (di)
{
while ((dir = readdir(di))!= NULL)
{
ptr1=strtok(dir->d_name,".");
ptr2=strtok(NULL,".");
if(ptr2!=NULL)
{
retn=strcmp(ptr2,".dmp");
if(retn==0)
{
con.import(ptr1);
}
}
}
//closedir(di);
}
return(0);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|