79 post+=l.substr(loc+1);
95 string lookup(
int bcNo,
string insert)
const;
105 while (NULL!=fgets(line,200,inF)) {
109 case '\n':
case '\r':
case 0:
113 if (1!=sscanf(&line[1],
"%d",&bcNo)) {
114 fprintf(stderr,
"ERROR!\n"
115 "Can't parse boundary condition number from '%s',\n"
116 "found on line %d of the boundary condition file\n",
121 if (curBC!=NULL)
b.push_back(curBC);
122 curBC=
new bcRec(bcNo);
125 if (curBC!=NULL) curBC->
addLine(line);
129 if (curBC!=NULL)
b.push_back(curBC);
136 for (i=0;i<
b.size();i++)
137 if (
b[i]->hasNumber(bcNo))
138 return b[i]->getString(insert);
140 fprintf(stderr,
"ERROR! Can't find boundary condition %d in .bc file!\n",bcNo);
150 "%d %d ! ndom, nproc\n"
162 sprintf(buf,
" %d %d %d %d %d %d",
174 fprintf(out,
"%s",bcDesc.c_str());
183 const char *selfFlag=
"";
186 selfFlag=
"(self-connecting)";
188 fprintf(out,
"%d %s ! Internal boundary %s%s\n",
189 type,srcS.c_str(),(
type==2)?
"(TYPE TWO)":
"",selfFlag);
190 fprintf(out,
"%-5d %s\n",
191 destBlockNo,destS.c_str());
192 fprintf(out,
"%d %d %d ! Orientation\n",
201 "%d %d 1 ! BLOCK %d (Split from source block %d) ======================\n"
206 "%d %d %d ! Block size (ni, nj, nk)\n",
209 fprintf(out,
"%s\n",bc.
lookup(-1,
"").c_str());
214 int nPatches=patches.size();
217 "%d ! Block %d, Face (%s) has %d patch\n",
220 for (
int p=0;p<nPatches;p++) {
221 patches[p]->writeFlo(out,bc);
235 FILE *bcs=
fopen(inBcs,
"r");
237 char *ret=(
char *)malloc(
sizeof(
char)*1000);
238 sprintf(ret,
"Couldn't open input .bc file '%s'!\n",inBcs);
244 FILE *flo=
fopen(outFlo,
"w");
245 if (flo==NULL)
return "Couldn't open output .flo file!\n";
248 int nBlocks=blocks.size();
252 for (
int bn=0;bn<nBlocks;bn++)
bool hasNumber(int n) const
int getOriginalNumber(void) const
const vector< patch * > & getPatches(void) const
string getSpan(const blockSpan &s)
string lookup(int bcNo, string insert) const
string getString(string insert) const
void writeBlock(FILE *out, const bcList &bc, const block *b)
int fclose(std::FILE *file)
Close a file, and check for possible errors.
static const char * face2name[nFaces]
const blockDim & getDim(void) const
virtual void writeFlo(FILE *out, const bcList &bc)
bool blocks
Input data is block-structured grid.
void writeHeader(FILE *out, int nBlocks, int nPEs)
virtual void writeFlo(FILE *out, const bcList &bc)
const char * writeFlo(vector< block * > &blocks, int nPEs, const char *inBcs, const char *out)
int getBlockNumber(void) const
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
face & getFace(int faceNo)