22 #define _COORD_ROUNDING_ (1E-4)
38 fin = fopen(file_name,
"r");
39 if (!fin)
return NULL;
42 mgrid =
new Mgrid(fin);
71 double value = atof(
string);
73 if (fun) value =
fun(value);
113 for(
int ii=0; ii<coord->coord_num-1; ii++)
114 for(
int ik=0; ik<coord->
coord_num-1; ik++)
120 assert(left && right);
122 if (left->
id > right->
id)
125 buffer[ik] = buffer[ik+1];
149 CoordSystem *field,
int split_mode,
unsigned cell_contents_bits)
164 double chmin[3], chmax[3];
181 if (cell == cells || xx[ik] < min[ik]) min[ik] = xx[ik];
182 if (cell == cells || xx[ik] > max[ik]) max[ik] = xx[ik];
192 next_to_min[ik] = max[ik];
201 next_to_min[ik] = xx[ik];
213 step[ik] = next_to_min[ik] - min[ik];
214 if (!step[ik]) step[ik] = 1.;
218 min[ik] -= step[ik]/2.;
219 max[ik] += step[ik]/2.;
223 dim[ik] = (int)rint((max[ik] - min[ik])/step[ik]);
236 for(
int ch=0; ch<3; ch++)
242 for(
int ik=0; ik<3; ik++)
244 chfield.
fake[ik] = 1;
248 for(
int ik=0; ik<3; ik++)
250 assert(!coord->
fake[ik]);
263 fdir, cell_contents_bits);
279 for(
int ch=0; ch<3; ch++)
285 assert(linear != -1);
289 out->
B[0] = cell->
B[ch];
305 for(
int ik=0; ik<3; ik++)
331 assert(linear != -1);
337 out->
B[ik] = cell->
B[ik];
367 int ik, cswap[3], fswap[3], line_counter = 0;
372 MgridCell *cells = NULL, **tail = &cells, *cell;
384 if (!csystem || !fsystem)
return NULL;
390 fmap = fopen(file_name,
"r");
391 if (!fmap)
return NULL;
399 if (line_counter <= lines_to_skip)
continue;
404 if (splitter->
getArgn() < expected_column_num)
return NULL;
408 if (!cell)
return NULL;