66 printf(
"Usage: simpleblock <output .msh or .hdf file>\n"
67 " <X start> <X end> <X steps> \n"
68 " <Y start> <Y end> <Y steps> \n"
69 " <Z start> <Z end> <Z steps> \n"
70 " Write out a single axis-aligned block with the given dimensions\n"
71 "and coordinate extents. \n"
74 printf(
"Exiting> %s\n",why);
80 int main(
int argc,
char *argv[])
83 if (argc!=11)
printUsage(
"Not enough command-line arguments");
85 const char *outMesh=argv[curArg++];
89 static const char *axisNames[]={
"X",
"Y",
"Z"};
90 for (axis=0;axis<3;axis++) {
92 if (1!=sscanf(argv[curArg++],
"%lg",&s))
94 if (1!=sscanf(argv[curArg++],
"%lg",&e))
96 start[axis]=
s; end[axis]=e;
97 if (1!=sscanf(argv[curArg++],
"%d",&dim[axis]))
99 printf(
"Along %s axis: (%f - %f) in %d steps\n",axisNames[axis],
100 start[axis],end[axis],dim[axis]);
106 for (i[2]=0; i[2]<dim[2]; i[2]++)
107 for (i[1]=0; i[1]<dim[1]; i[1]++)
108 for (i[0]=0; i[0]<dim[0]; i[0]++) {
110 for (axis=0;axis<3;axis++)
111 p[axis]=start[axis]+((end[axis]-start[axis])*i[axis])/(dim[axis]-1);
114 printf(
"Locations built\n");
117 blocks.push_back(
new block(dim,0,0,locs));
118 printf(
"Block built\n");
122 printf(
"Program finished successfully\n");
const char * writeBlocks(vector< block * > &blocks, const char *outMesh)
void printUsage(const char *why)
bool blocks
Input data is block-structured grid.
int main(int argc, char *argv[])