94 for (i[2]=0; i[2]<dim[2]; i[2]++)
95 for (i[1]=0; i[1]<dim[1]; i[1]++)
96 for (i[0]=0; i[0]<dim[0]; i[0]++)
98 int c_i=dim[
i], f_i=dim[
i];
106 delete[]
x;
delete[]
y;
delete[]
z;
111 if (a.
x>dest.
x) dest.
x=a.
x;
112 if (a.
y>dest.
y) dest.
y=a.
y;
113 if (a.
z>dest.
z) dest.
z=a.
z;
117 if (a.
x<dest.
x) dest.
x=a.
x;
118 if (a.
y<dest.
y) dest.
y=a.
y;
119 if (a.
z<dest.
z) dest.
z=a.
z;
123 const char *filename_base)
126 sprintf(filename,
"%s.bounds",filename_base);
127 FILE *f=
fopen(filename,
"w");
133 for (i[2]=0; i[2]<dim[2]; i[2]++)
134 for (i[1]=0; i[1]<dim[1]; i[1]++)
135 for (i[0]=0; i[0]<dim[0]; i[0]++) {
139 fprintf(f,
"%f %f %f %f %f %f\n",min.
x,
max.x,min.
y,
max.y,min.
z,
max.z);
144 const char *filename);
151 bool isFortran=
false, isHDF=
false;
152 bool incrementFilenames=
true;
154 strcpy(oName,outMesh);
165 incrementFilenames=
false;
169 int endIdx=strlen(tmp)-1;
170 while (endIdx>0&&(isdigit(tmp[endIdx])||(tmp[endIdx]==
'_')))
176 else return "Unrecognized output mesh extension! (2)";
187 return "Unrecognized output mesh file extension! (1)";
190 for (
unsigned int i=0;
i<blocks.size();
i++) {
195 if (
i+1==blocks.size())
208 printf(
"."); fflush(stdout);
209 if (incrementFilenames) {
211 return "Cannot increment output filename! Use something like 'foo_0001.msh'\n";
bool incrementAscii(char *cur)
void int int REAL REAL * y
const char * writeBlocks(vector< block * > &blocks, const char *outMesh)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
subroutine write_grda(iblock, ni, nj, nk, x, y, z, F_name)
subroutine write_grdb(iblock, ni, nj, nk, x, y, z, F_name)
void(* fn_fortran_write)(int *block, int *ni, int *nj, int *nk, REAL *x, REAL *y, REAL *z, const char *fName)
int fclose(std::FILE *file)
Close a file, and check for possible errors.
void vecMin(const vector3d &a, vector3d &dest)
void int int int REAL REAL REAL const char * fName
bool endsWith(const char *a, const char *suffix)
subroutine write_msh(iblock, ni, nj, nk, x, y, z, F_name)
void vecMax(const vector3d &a, vector3d &dest)
void int int int REAL REAL REAL * z
bool blocks
Input data is block-structured grid.
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
#define FC_GLOBAL(name, NAME)
void int int REAL REAL REAL *z blockDim dim * ni
const char * fortranifyString(const char *src)
void write_bounds(const blockDim &dim, const vector3d *locs, const char *filename_base)
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
const char * write_hdf(const blockDim &dim, const vector3d *locs, const char *filename)
static void write_fortran(int block, blockDim dim, const vector3d *locs, const char *fName, fn_fortran_write writeFn)