16 fprintf(
ioQQQ,
"p_ReadResolution opening continuum_mesh.ini:");
18 FILE* ioDATA =
open_data(
"continuum_mesh.ini",
"r" );
24 fprintf(
ioQQQ,
"p_ReadResolution could not read first line of continuum_mesh.ini.\n");
38 if( i1 == 1 && i2 == 9 && i3 == 29 )
42 else if( i1 == 10 && i2 == 8 && i3 == 8 )
49 "p_ReadResolution: the version of continuum_mesh.ini is not supported.\n" );
51 "I found version number %li %li %li.\n" ,
53 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
58 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
68 if( upper_limit == 0. )
72 if( upper_limit <= 0. || val2 <= 0. )
74 fprintf(
ioQQQ,
"DISASTER PROBLEM continuum_mesh.ini has a non-positive number.\n");
95 double toler = upper_limit*resolution*0.1;
105 &&
p_edges[n].Ryd() < upper_limit )
131 "p_ReadResolution: the range upper limits must be in increasing order.\n" );
138 "p_ReadResolution: the last range upper limit must be zero.\n" );
150 fprintf(
ioQQQ,
"p_SetupMesh() setting up the frequency mesh. ResolutionScaleFactor = %g.\n",
173 double hi_bound =
p_emm;
177 double lo_bound = hi_bound;
180 double bound = lo_bound;
181 double step = exp(log(hi_bound/lo_bound)/nbin);
182 for(
size_t i=1; i < nbin; ++i )
199 for(
size_t i=0; i <
p_anu_edge.size()-1; ++i )
203 for(
size_t i=0; i <
p_anu_edge.size()-1; ++i )
207 for(
size_t i=0; i <
p_anu_edge.size()-1; ++i )
211 for(
size_t i=0; i <
p_anu_edge.size()-1; ++i )
215 for(
size_t i=0; i <
p_anu_edge.size()-1; ++i )
219 for(
size_t i=0; i <
p_anu_edge.size()-1; ++i )
223 for(
size_t i=0; i <
p_anu_edge.size()-1; ++i )
278 vector<Energy> cl_edges;
290 sort( cl_edges.begin(), cl_edges.end() );
292 if( cl_edges.size() !=
p_edges.size() )
294 fprintf(
ioQQQ,
"DISASTER INTERNAL ERROR: the cl_edges and p_edges arrays have different size.\n" );
295 fprintf(
ioQQQ,
"In mesh.cpp, make sure the entries in these arrays match one on one.\n\n" );
299 for(
unsigned long i=0; i <
p_edges.size(); ++i )
301 double rel_diff = 1. -
p_edges[i].Ryd()/cl_edges[i].Ryd();
306 if( rel_diff < 1.5*
double(FLT_EPSILON) || rel_diff > 1.e-5 )
308 double expected = cl_edges[i].Ryd()*(1. - 5.*double(FLT_EPSILON));
309 fprintf(
ioQQQ,
"DISASTER INTERNAL ERROR: energy mismatch for p_edges[].\n" );
311 fprintf(
ioQQQ,
"Please update p_edges[] to hold %.8g in mesh.cpp.\n\n", expected );
334 double hi_bound =
emm();
338 double lo_bound = hi_bound;
341 double energy = lo_bound*0.5 + hi_bound*0.5;
348 else if( energy >
anumax(ic) )
355 energy = lo_bound*0.99 + hi_bound*0.01;
362 else if( energy >
anumax(ic) )
369 energy = lo_bound*0.01 + hi_bound*0.99;
376 else if( energy >
anumax(ic) )
385 fprintf(
ioQQQ,
"CheckMesh: sanity check on frequency mesh failed.\n Bailing out\n" );
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
vector< double > p_RangeUpperLimit
vector< double > p_anulog10
bool fp_equal_tol(sys_float x, sys_float y, sys_float tol)
void ValidateEdges() const
vector< double > p_RangeResolution
t_iso_sp iso_sp[NISO][LIMELM]
bool fp_equal(sys_float x, sys_float y, int n=3)
size_t ipointC(double anu) const
void p_SetupMesh(bool lgUnitCell)
double energy(const genericState &gs)
vector< double > p_widflx
const int INPUT_LINE_LENGTH
double anumin(size_t i) const
vector< double > p_anu_edge
double p_ResolutionScaleFactor
vector< double > p_anusqrt
#define DEBUG_ENTRY(funcname)
int fprintf(const Output &stream, const char *format,...)
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
double anumax(size_t i) const
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)