63 if (errCode==NULL)
return;
64 fprintf(stderr,
"FATAL ERROR! %s\n",errCode);
70 printf(
"Usage: makeflo [ -splitaxis <-1, 0, 1, or 2)> ]\n"
71 " [ -splitrcb ] [ -splithalf ]\n"
72 " [ -multilevel <maximum level> ]\n"
73 " <.grd, .grdb, .msh, or .hdf; and .inp and .bc file> \n"
74 " <# PEs> <.flo or .top output file> <.msh or .hdf output file>\n"
76 " Makeflo reads a mesh (first parameter) and boundary condition\n"
77 "(.inp) list and description (.bc), partitions the mesh into the\n"
78 "requested number of processors, and writes out a rocflo control\n"
79 "file (.flo or .top) and the partitioned mesh (last parameter).\n"
80 " The mesh formats supported are:\n"
81 "<*.grd> A Gridgen ASCII double-precision mesh description\n"
82 "<*.msh> A double-precision binary Rocflo mesh file\n"
83 "<*.hdf> A double-precision 3D HDF mesh file\n"
84 " When the mesh consists of multiple files, give only the name of\n"
85 "the first file (e.g., 'tstflo_001.hdf'). The number of blocks and\n"
86 "numeric format will be automatically determined.\n"
89 " -splitaxis <-1, 0, 1, or 2)>: axis to split along. \n"
90 " -splitrcb: split using recursive bisection.\n"
91 " -multilevel <maximum level>: number of multigrid levels to create \n"
92 " -splithalf: split every block in half, <# PEs> is ignored.\n"
97 printf(
"Exiting> %s\n",why);
103 int main(
int argc,
char *argv[])
106 if (argc<5)
printUsage(
"Not enough command-line arguments");
108 while (argv[curArg][0]==
'-')
110 const char *flag=argv[curArg++];
111 if (0==strcmp(flag,
"-h") ||
112 0==strcmp(flag,
"-?") ||
113 0==strcmp(flag,
"--help"))
115 else if (0==strcmp(flag,
"-splitaxis")) {
116 if (1!=sscanf(argv[curArg++],
"%d",¶meters.
splitAxis))
117 printUsage(
"Must pass 0,1, or 2 to -splitaxis");
119 else if (0==strcmp(flag,
"-splitrcb")) {
122 else if (0==strcmp(flag,
"-splithalf")) {
125 else if (0==strcmp(flag,
"-multilevel")) {
127 if ((1!=sscanf(argv[curArg++],
"%d",&level))||(level<=0))
128 printUsage(
"Must pass a positive integer to -multilevel");
133 if (curArg+4!=argc)
printUsage(
"Too many arguments");
134 const char *inMesh=argv[curArg+0];
136 int nPieces=atoi(argv[curArg+1]);
137 const char *floFile=argv[curArg+2];
138 const char *outMesh=argv[curArg+3];
141 const char *bcExt=
"?";
146 else if (
endsWith(floFile,
".top")) {
151 printf(
"UNRECOGNIZED TOPOLOGY NAME: '%s'\n",floFile);
162 printf(
"Mesh file read successfully.\n");
166 for (
unsigned int i=0;
i<blocks.size();
i++)
171 printf(
"Boundary conditions read successfully.\n");
175 nPieces = blocks.size()*2;
176 printf(
"Split every block in half for %d pieces.\n", nPieces);
181 printf(
"Split blocks for %d PEs (%d blocks generated).\n",
182 nPieces,(
int)blocks.size());
186 printf(
"Nodes matched successfully.\n");
191 printf(
".flo file written successfully\n");
194 printf(
".top file written successfully\n");
199 printf(
"Program finished successfully\n");
const char * writeBlocks(vector< block * > &blocks, const char *outMesh)
void printUsage(const char *why)
bool endsWith(const char *a, const char *suffix)
string replaceExtention(const string &a, const string &newSuffix)
const char * writeTop(vector< block * > &blocks, const char *inBcs, const char *out)
void checkQuality(const block &b)
void checkError(const char *errCode)
const char * splitBlocks(vector< block * > &blocks, int nPieces)
bool blocks
Input data is block-structured grid.
int main(int argc, char *argv[])
const char * read(const char *gridFile)
const char * readBoundaries(vector< block * > &blocks, const char *inMesh)
const char * writeFlo(vector< block * > &blocks, int nPEs, const char *inBcs, const char *out)
void buildFaces(vector< block * > &blocks, bool buildTypeTwo)