87 while (NULL!=fgets(lineBuf,200,inF)) {
89 while (isspace(*line)) line++;
90 line[strlen(line)-1]=0;
93 case '#':
case '!':
break;
94 case '\n':
case '\r':
case 0:
97 case '0':
case '1':
case '2':
case '3':
case '4':
98 case '5':
case '6':
case '7':
case '8':
case '9':
100 int in,out,coupled=0;
101 if (sscanf(line,
"%d%d%d",&in,&out,&coupled)<2) {
102 fprintf(stderr,
"ERROR!\n"
103 "Can't parse boundary condition number from '%s',\n"
104 "found on line %d of the boundary condition file\n",
108 b.push_back(
new bcRecTop(in,out,coupled));
112 fprintf(stderr,
"ERROR!\n"
113 "This appears to be a rocflo-style boundary condition file--\n"
114 "RocfloMP does not use @ signs.\n");
117 fprintf(stderr,
"ERROR!\n"
118 "Can't parse line of boundary condition \n"
119 "'%s', found on line %d.\n",
130 for (i=0;i<
b.size();i++)
131 if (
b[i]->hasNumber(bcNo))
134 fprintf(stderr,
"ERROR! Can't find boundary condition %d in .bc file!\n",bcNo);
142 static void write5(FILE *out,
int face,
int l1lo,
int l1hi,
int l2lo,
int l2hi)
144 fprintf(out,
"%d %3d %3d %3d %3d ",face,l1lo,l1hi,l2lo,l2hi);
164 const static int faceMap[6]=
169 int l1Axis=(flatAxis+1)%3;
170 int l2Axis=(flatAxis+2)%3;
172 int l1S=s.
start[l1Axis], l1E=s.
end[l1Axis];
173 int l2S=s.
start[l2Axis], l2E=s.
end[l2Axis];
176 int l1Sign=sign[l1Axis];
177 int l2Sign=sign[l2Axis];
179 l1Sign*(1+l1S),l1Sign*(1+l1E),
180 l2Sign*(1+l2S),l2Sign*(1+l2E));
184 fprintf(out,
"%4d ",patchType);
187 fprintf(out,
"%5d ",connBlock);
190 fprintf(out,
" %d\n",coupled);
208 int l1Axis=(flatAxis+1)%3;
209 blockLoc srcSign(1,1,1), destSign(1,1,1);
211 destSign[
orient[flatAxis]]=0;
213 destSign[orient[l1Axis]]=-1;
215 const int internalBcType=30;
229 "%d %d ! ======== BLOCK %d (Split from source block %d) ========\n",
237 "%d %d %d %d ! number of patches; block size (ni, nj, nk)\n",
238 nPatches,d[0]-1,d[1]-1,d[2]-1);
242 static int order[6]={0,3,1,4,2,5};
244 int nPatches=patches.size();
246 for (
int p=0;p<nPatches;p++) {
247 patches[p]->writeTop(out,bc);
256 FILE *bcs=
fopen(inBcs,
"r");
258 char *ret=(
char *)malloc(
sizeof(
char)*1000);
259 sprintf(ret,
"Couldn't open input .bcmp file '%s'!\n",inBcs);
265 FILE *top=
fopen(outTop,
"w");
266 if (top==NULL)
return "Couldn't open output .top file!\n";
269 int nBlocks=blocks.size();
270 fprintf(top,
"# RocfloMP topology file, generated by makeflo\n"
272 "%d ! Total number of blocks in this file\n",
276 for (
int bn=0;bn<nBlocks;bn++)
bcRecTop * lookup(int bcNo) const
int getOriginalNumber(void) const
static SURF_BEGIN_NAMESPACE double sign(double x)
const vector< patch * > & getPatches(void) const
static void write5(FILE *out, int face, int l1lo, int l1hi, int l2lo, int l2hi)
void writeBlock(FILE *out, const bcList &bc, const block *b)
int fclose(std::FILE *file)
Close a file, and check for possible errors.
virtual void writeTop(FILE *out, const bcListTop &d)
static void writePatchEnd(FILE *out, int coupled)
virtual void writeTop(FILE *out, const bcListTop &d)
const char * writeTop(vector< block * > &blocks, const char *inBcs, const char *out)
const blockDim & getDim(void) const
static void writePatchMiddle(FILE *out, int connBlock)
bool hasNumber(int n) const
bool blocks
Input data is block-structured grid.
bcRecTop(int in, int out, int coupled)
static void writeSpan(FILE *out, const blockSpan &s, const blockLoc &sign)
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)
void node2block(int a, int b, int &o, int &p)
static void writePatchStart(FILE *out, int patchType)