82 int count=fscanf(
in,
"%d",dest);
88 for (
int i=0;
i<3;
i++) {
92 if (end[i]<0) end[
i]=-end[
i];
93 if (start[i]<0) start[
i]=-start[
i];
111 for (
int i=0;
i<3;
i++)
119 return NULL!=fgets(str,1024,
in);
124 for (
int axis=0;axis<3;axis++)
127 fprintf(stderr,
"%s",what);
132 #define BC_EXTENTION ".inp"
133 #define ERR "Error reading " BC_EXTENTION " file: "
138 FILE *in=
fopen(inMesh,
"r");
140 fprintf(stderr,
"Cannot open boundary condition file '%s'.\n",inMesh);
141 fprintf(stderr,
"Continuing without external boundary conditions\n");
148 if (!r.
read(&solver))
return ERR "Bad file header (line 1)";
149 if (solver!=1)
return ERR "Must use Gridgen generic solver";
151 if (!r.
read(&nBlocks))
return ERR "Bad file header (line 2)";
152 if (nBlocks!=(
int)blocks.size())
return ERR "mesh's block count does not match";
155 for (
int bn=0;bn<nBlocks;bn++) {
159 if (!r.
read(dim))
return ERR "Cannot read block size";
160 if (dim!=b->
getDim())
return ERR "mesh's block size does not match";
167 if (!r.
read(&nPatch))
return ERR "Cannot read patch count";
168 for (
int p=0;p<nPatch;p++) {
172 if (!r.
read(span))
return ERR "Cannot read patch dimensions";
175 if (!r.
read(&type))
return ERR "Cannot read patch type";
180 sprintf(errBuf,
"Bad boundary condition for block %d\n",1+bn);
186 if (!r.
read(dest))
return ERR "Cannot read internal patch dimensions";
188 if (!r.
read(&destBlock))
return ERR "Cannot read destination block";
void addBC(const blockSpan &span, int bcNo)
void multigridError(void)
int fclose(std::FILE *file)
Close a file, and check for possible errors.
const blockDim & getDim(void) const
bool read(blockSpan &ret)
bool blocks
Input data is block-structured grid.
void checkSpan(const blockSpan &s, const char *what)
const char * readBoundaries(vector< block * > &blocks, const char *inMesh)
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.