Changeset 1800 for branches/newmole/source
- Timestamp:
- 02/16/08 10:57:45 (9 months ago)
- Location:
- branches/newmole/source
- Files:
-
- 1 removed
- 53 modified
-
cddefines.h (modified) (5 diffs)
-
cddrive.cpp (modified) (1 diff)
-
cdinit.cpp (modified) (2 diffs)
-
container_classes.h (modified) (36 diffs)
-
continuum.h (modified) (1 diff)
-
cont_createpointers.cpp (modified) (3 diffs)
-
cont_gammas.cpp (modified) (4 diffs)
-
cont_setintensity.cpp (modified) (3 diffs)
-
conv_init_solution.cpp (modified) (1 diff)
-
cool_iron.cpp (modified) (1 diff)
-
cpu.h (modified) (1 diff)
-
date.h (modified) (1 diff)
-
headers.txt (modified) (1 diff)
-
heat_sum.cpp (modified) (22 diffs)
-
helike_cs.cpp (modified) (2 diffs)
-
hextra.h (modified) (2 diffs)
-
highen.cpp (modified) (8 diffs)
-
hydroreccool.cpp (modified) (1 diff)
-
ionbal.h (modified) (1 diff)
-
iso.h (modified) (17 diffs)
-
iso_create.cpp (modified) (18 diffs)
-
iso_ionize_recombine.cpp (modified) (1 diff)
-
iso_level.cpp (modified) (32 diffs)
-
iso_solve.cpp (modified) (2 diffs)
-
iter_end_chk.cpp (modified) (7 diffs)
-
iter_startend.cpp (modified) (2 diffs)
-
mole_drive.cpp (modified) (1 diff)
-
nemala2.cpp (modified) (3 diffs)
-
neutrn.h (deleted)
-
opacity.h (modified) (1 diff)
-
opacity_createall.cpp (modified) (6 diffs)
-
parse_atom_h2.cpp (modified) (2 diffs)
-
parse_atom_iso.cpp (modified) (2 diffs)
-
parse_commands.cpp (modified) (2 diffs)
-
parse_compile.cpp (modified) (4 diffs)
-
parse_constant.cpp (modified) (2 diffs)
-
parse_punch.cpp (modified) (1 diff)
-
parse_set.cpp (modified) (2 diffs)
-
phycon.h (modified) (2 diffs)
-
prt_comment.cpp (modified) (1 diff)
-
prt_final.cpp (modified) (1 diff)
-
radius_increment.cpp (modified) (4 diffs)
-
rt_line_all.cpp (modified) (3 diffs)
-
secondaries.h (modified) (3 diffs)
-
service.cpp (modified) (4 diffs)
-
stars.cpp (modified) (34 diffs)
-
stars.h (modified) (8 diffs)
-
state.cpp (modified) (3 diffs)
-
taulines.h (modified) (3 diffs)
-
TestMultiArr.cpp (modified) (2 diffs)
-
thirdparty.cpp (modified) (1 diff)
-
thirdparty.h (modified) (1 diff)
-
vs.txt (modified) (1 diff)
-
zero.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/newmole/source/cddefines.h
r1780 r1800 445 445 }; 446 446 447 #define cdEXIT( FAIL ) throw cloudy_exit( DEBUG_ENTRY.name(), __FILE__, __LINE__, FAIL ) 447 // workarounds for __func__ are defined in cpu.h 448 #define cdEXIT( FAIL ) throw cloudy_exit( __func__, __FILE__, __LINE__, FAIL ) 448 449 449 450 // calls like puts( "[Stop in MyRoutine]" ) have been integrated in cdEXIT above … … 580 581 return p_line; 581 582 } 583 }; 584 585 class bad_mpi { 586 long p_failMode; 587 public: 588 bad_mpi(long failMode) : p_failMode(failMode) {} 589 long failMode() const { return p_failMode; } 582 590 }; 583 591 … … 599 607 { \ 600 608 if( cpu.lgAssertAbort() ) \ 601 raise( SIGABRT );\609 abort(); \ 602 610 else \ 603 611 throw bad_assert(__FILE__,__LINE__); \ … … 609 617 #endif 610 618 619 NORETURN inline void OUT_OF_RANGE(const char* str) 620 { 621 if( cpu.lgAssertAbort() ) 622 abort(); 623 else 624 throw out_of_range( str ); 625 } 626 611 627 /* Windows does not define isnan */ 612 628 /* use our version on all platforms since the isnanf … … 673 689 674 690 #ifdef DEBUG_FUN 675 typedef debugtrace<true> debuginfo; 691 #define DEBUG_ENTRY( funcname ) debugtrace<true> DEBUG_ENTRY( funcname ) 676 692 #else 677 typedef debugtrace<false> debuginfo; 678 #endif 679 680 #define DEBUG_ENTRY( funcname ) debuginfo DEBUG_ENTRY( funcname ) 693 #ifdef __GNUC__ 694 #define DEBUG_ENTRY( funcname ) ((void)0) 695 #else 696 #define DEBUG_ENTRY( funcname ) debugtrace<false> DEBUG_ENTRY( funcname ) 697 #endif 698 #endif 681 699 682 700 /* TorF(l) returns a 'T' or 'F' depending on the 'logical' expr 'l' */ -
branches/newmole/source/cddrive.cpp
r1780 r1800 128 128 if( trace.lgTrace ) 129 129 fprintf( ioQQQ, "cdDrive: calling cloudy\n"); 130 /* optimize did not occur, only compute one model, call cloudy */ 131 lgBAD = cloudy(); 130 try { 131 132 /* optimize did not occur, only compute one model, call cloudy */ 133 lgBAD = cloudy(); 134 } 135 catch( bad_mpi &bad_info ) 136 { 137 fprintf( ioQQQ, "An MPI run failed. The fail mode is %li\n", bad_info.failMode() ); 138 ClosePunchFiles( false ); 139 lgAbort = true; 140 lgBAD = true; 141 } 132 142 } 133 143 -
branches/newmole/source/cdinit.cpp
r1780 r1800 82 82 #include "mewecoef.h" 83 83 #include "mole.h" 84 #include "neutrn.h"85 84 #include "nitro.h" 86 85 #include "noexec.h" … … 251 250 fprintf(ioQQQ," cdExit called\n"); 252 251 253 /* close any open units */ 254 ClosePunchFiles( true ); 255 256 /* this routine must be called upon exit or machine will appear to "hang", 257 * but must not be called on MPI machine when used in serial mode, 258 * or it will drop core */ 252 /* if doing an MPI run, just throw an exception 253 * so that cddrive can report the problem and continue 254 * computing other grid points */ 259 255 if( lgMPI ) 260 256 { 261 # ifdef MPI_ENABLED 262 MPI_Finalize(); 263 # endif 264 } 265 exit( iexit ); 257 throw bad_mpi(-1); 258 } 259 else 260 { 261 /* close any open units */ 262 ClosePunchFiles( true ); 263 exit( iexit ); 264 } 266 265 } 267 266 -
branches/newmole/source/container_classes.h
r1780 r1800 57 57 { 58 58 if( t < p_p[1] || t >= p_p[2] ) 59 throw out_of_range( "basic_pntr::p_index_checked()" );59 OUT_OF_RANGE( "basic_pntr::p_index_checked()" ); 60 60 } 61 61 return t; … … 627 627 { 628 628 if( i >= v->n ) 629 throw out_of_range( "n_pointer::n_pointer()" );629 OUT_OF_RANGE( "n_pointer::n_pointer()" ); 630 630 p_p = *((T**)p + i); 631 631 p_v = &v->d[i]; … … 647 647 { 648 648 if( i >= v->n ) 649 throw out_of_range( "n_pointer::n_pointer()" );649 OUT_OF_RANGE( "n_pointer::n_pointer()" ); 650 650 p_p = p + i*st[d-N]; 651 651 p_v = &v->d[i]; … … 667 667 { 668 668 if( i >= v->n ) 669 throw out_of_range( "n_pointer::n_pointer()" );669 OUT_OF_RANGE( "n_pointer::n_pointer()" ); 670 670 p_p = *((T**)p + i); 671 671 p_v = &v->d[i]; … … 674 674 { 675 675 if( i >= p_v->n ) 676 throw out_of_range( "n_pointer::operator[]" );676 OUT_OF_RANGE( "n_pointer::operator[]" ); 677 677 return *(p_p + i); 678 678 } … … 689 689 { 690 690 if( i >= v->n ) 691 throw out_of_range( "n_pointer::n_pointer()" );691 OUT_OF_RANGE( "n_pointer::n_pointer()" ); 692 692 p_p = p + i*st[d-1]; 693 693 p_v = &v->d[i]; … … 696 696 { 697 697 if( i >= p_v->n ) 698 throw out_of_range( "n_pointer::operator[]" );698 OUT_OF_RANGE( "n_pointer::operator[]" ); 699 699 return *(p_p + i); 700 700 } … … 779 779 { 780 780 if( i >= v->n ) 781 throw out_of_range( "const_n_pointer::const_n_pointer()" );781 OUT_OF_RANGE( "const_n_pointer::const_n_pointer()" ); 782 782 p_p = *((const T**)p + i); 783 783 p_v = &v->d[i]; … … 799 799 { 800 800 if( i >= v->n ) 801 throw out_of_range( "const_n_pointer::const_n_pointer()" );801 OUT_OF_RANGE( "const_n_pointer::const_n_pointer()" ); 802 802 p_p = p + i*st[d-N]; 803 803 p_v = &v->d[i]; … … 819 819 { 820 820 if( i >= v->n ) 821 throw out_of_range( "const_n_pointer::const_n_pointer()" );821 OUT_OF_RANGE( "const_n_pointer::const_n_pointer()" ); 822 822 p_p = *((const T**)p + i); 823 823 p_v = &v->d[i]; … … 826 826 { 827 827 if( i >= p_v->n ) 828 throw out_of_range( "const_n_pointer::operator[]" );828 OUT_OF_RANGE( "const_n_pointer::operator[]" ); 829 829 return *(p_p + i); 830 830 } … … 841 841 { 842 842 if( i >= v->n ) 843 throw out_of_range( "const_n_pointer::const_n_pointer()" );843 OUT_OF_RANGE( "const_n_pointer::const_n_pointer()" ); 844 844 p_p = p + i*st[d-1]; 845 845 p_v = &v->d[i]; … … 848 848 { 849 849 if( i >= p_v->n ) 850 throw out_of_range( "const_n_pointer::operator[]" );850 OUT_OF_RANGE( "const_n_pointer::operator[]" ); 851 851 return *(p_p + i); 852 852 } … … 1196 1196 multi_arr<T,d,ALLOC,lgBC>* t = const_cast<multi_arr<T,d,ALLOC,lgBC>*>(this); 1197 1197 size_type n = p_g.v.getvec( 1, index ).n; 1198 T* s = &(*t)[i1][0];1198 T* s = ( n > 0 ) ? &(*t)[i1][0] : NULL; 1199 1199 if( i2 == npos ) 1200 1200 return iterator( s+n, s, s+n ); … … 1203 1203 } 1204 1204 else 1205 throw out_of_range( "multi_arr::p_iterator()" );1205 OUT_OF_RANGE( "multi_arr::p_iterator()" ); 1206 1206 } 1207 1207 iterator p_iterator(size_type i1, size_type i2, size_type i3) const … … 1226 1226 multi_arr<T,d,ALLOC,lgBC>* t = const_cast<multi_arr<T,d,ALLOC,lgBC>*>(this); 1227 1227 size_type n = p_g.v.getvec( 2, index ).n; 1228 T* s = &(*t)[i1][i2][0];1228 T* s = ( n > 0 ) ? &(*t)[i1][i2][0] : NULL; 1229 1229 if( i3 == npos ) 1230 1230 return iterator( s+n, s, s+n ); … … 1233 1233 } 1234 1234 else 1235 throw out_of_range( "multi_arr::p_iterator()" );1235 OUT_OF_RANGE( "multi_arr::p_iterator()" ); 1236 1236 } 1237 1237 iterator p_iterator(size_type i1, size_type i2, size_type i3, size_type i4) const … … 1256 1256 multi_arr<T,d,ALLOC,lgBC>* t = const_cast<multi_arr<T,d,ALLOC,lgBC>*>(this); 1257 1257 size_type n = p_g.v.getvec( 3, index ).n; 1258 T* s = &(*t)[i1][i2][i3][0];1258 T* s = ( n > 0 ) ? &(*t)[i1][i2][i3][0] : NULL; 1259 1259 if( i4 == npos ) 1260 1260 return iterator( s+n, s, s+n ); … … 1263 1263 } 1264 1264 else 1265 throw out_of_range( "multi_arr::p_iterator()" );1265 OUT_OF_RANGE( "multi_arr::p_iterator()" ); 1266 1266 } 1267 1267 iterator p_iterator(size_type i1, size_type i2, size_type i3, size_type i4, size_type i5) const … … 1286 1286 multi_arr<T,d,ALLOC,lgBC>* t = const_cast<multi_arr<T,d,ALLOC,lgBC>*>(this); 1287 1287 size_type n = p_g.v.getvec( 4, index ).n; 1288 T* s = &(*t)[i1][i2][i3][i4][0];1288 T* s = ( n > 0 ) ? &(*t)[i1][i2][i3][i4][0] : NULL; 1289 1289 if( i5 == npos ) 1290 1290 return iterator( s+n, s, s+n ); … … 1293 1293 } 1294 1294 else 1295 throw out_of_range( "multi_arr::p_iterator()" );1295 OUT_OF_RANGE( "multi_arr::p_iterator()" ); 1296 1296 } 1297 1297 iterator p_iterator(size_type i1, size_type i2, size_type i3, size_type i4, size_type i5, size_type i6) const … … 1316 1316 multi_arr<T,d,ALLOC,lgBC>* t = const_cast<multi_arr<T,d,ALLOC,lgBC>*>(this); 1317 1317 size_type n = p_g.v.getvec( 5, index ).n; 1318 T* s = &(*t)[i1][i2][i3][i4][i5][0];1318 T* s = ( n > 0 ) ? &(*t)[i1][i2][i3][i4][i5][0] : NULL; 1319 1319 if( i6 == npos ) 1320 1320 return iterator( s+n, s, s+n ); … … 1323 1323 } 1324 1324 else 1325 throw out_of_range( "multi_arr::p_iterator()" );1325 OUT_OF_RANGE( "multi_arr::p_iterator()" ); 1326 1326 } 1327 1327 … … 1340 1340 size_type index[] = { i1, i2 }; 1341 1341 if( !p_g.lgInbounds( 2, index ) ) 1342 throw out_of_range( "multi_arr::at()" );1342 OUT_OF_RANGE( "multi_arr::at()" ); 1343 1343 return (*this)[i1][i2]; 1344 1344 } … … 1347 1347 size_type index[] = { i1, i2 }; 1348 1348 if( !p_g.lgInbounds( 2, index ) ) 1349 throw out_of_range( "multi_arr::at()" );1349 OUT_OF_RANGE( "multi_arr::at()" ); 1350 1350 return (*this)[i1][i2]; 1351 1351 } … … 1354 1354 size_type index[] = { i1, i2, i3 }; 1355 1355 if( !p_g.lgInbounds( 3, index ) ) 1356 throw out_of_range( "multi_arr::at()" );1356 OUT_OF_RANGE( "multi_arr::at()" ); 1357 1357 return (*this)[i1][i2][i3]; 1358 1358 } … … 1361 1361 size_type index[] = { i1, i2, i3 }; 1362 1362 if( !p_g.lgInbounds( 3, index ) ) 1363 throw out_of_range( "multi_arr::at()" );1363 OUT_OF_RANGE( "multi_arr::at()" ); 1364 1364 return (*this)[i1][i2][i3]; 1365 1365 } … … 1368 1368 size_type index[] = { i1, i2, i3, i4 }; 1369 1369 if( !p_g.lgInbounds( 4, index ) ) 1370 throw out_of_range( "multi_arr::at()" );1370 OUT_OF_RANGE( "multi_arr::at()" ); 1371 1371 return (*this)[i1][i2][i3][i4]; 1372 1372 } … … 1375 1375 size_type index[] = { i1, i2, i3, i4 }; 1376 1376 if( !p_g.lgInbounds( 4, index ) ) 1377 throw out_of_range( "multi_arr::at()" );1377 OUT_OF_RANGE( "multi_arr::at()" ); 1378 1378 return (*this)[i1][i2][i3][i4]; 1379 1379 } … … 1382 1382 size_type index[] = { i1, i2, i3, i4, i5 }; 1383 1383 if( !p_g.lgInbounds( 5, index ) ) 1384 throw out_of_range( "multi_arr::at()" );1384 OUT_OF_RANGE( "multi_arr::at()" ); 1385 1385 return (*this)[i1][i2][i3][i4][i5]; 1386 1386 } … … 1389 1389 size_type index[] = { i1, i2, i3, i4, i5 }; 1390 1390 if( !p_g.lgInbounds( 5, index ) ) 1391 throw out_of_range( "multi_arr::at()" );1391 OUT_OF_RANGE( "multi_arr::at()" ); 1392 1392 return (*this)[i1][i2][i3][i4][i5]; 1393 1393 } … … 1396 1396 size_type index[] = { i1, i2, i3, i4, i5, i6 }; 1397 1397 if( !p_g.lgInbounds( 6, index ) ) 1398 throw out_of_range( "multi_arr::at()" );1398 OUT_OF_RANGE( "multi_arr::at()" ); 1399 1399 return (*this)[i1][i2][i3][i4][i5][i6]; 1400 1400 } … … 1403 1403 size_type index[] = { i1, i2, i3, i4, i5, i6 }; 1404 1404 if( !p_g.lgInbounds( 6, index ) ) 1405 throw out_of_range( "multi_arr::at()" );1405 OUT_OF_RANGE( "multi_arr::at()" ); 1406 1406 return (*this)[i1][i2][i3][i4][i5][i6]; 1407 1407 } … … 1970 1970 { 1971 1971 if( ! p_lgInbounds( i ) ) 1972 throw out_of_range( "flex_arr::p_index()" );1972 OUT_OF_RANGE( "flex_arr::p_index()" ); 1973 1973 } 1974 1974 return *p_pointer(i); … … 1988 1988 { 1989 1989 if( ! p_lgInbounds(i) ) 1990 throw out_of_range( "flex_arr::at()" );1990 OUT_OF_RANGE( "flex_arr::at()" ); 1991 1991 return (*this)[i]; 1992 1992 } … … 1994 1994 { 1995 1995 if( ! p_lgInbounds(i) ) 1996 throw out_of_range( "flex_arr::at()" );1996 OUT_OF_RANGE( "flex_arr::at()" ); 1997 1997 return (*this)[i]; 1998 1998 } -
branches/newmole/source/continuum.h
r1780 r1800 86 86 lgCoStarInterpolationCaution; 87 87 88 /** TotalLumin is total luminosity in incident continuum*/88 /** TotalLumin is total intensity in incident continuum erg cm-2 s-1 */ 89 89 double TotalLumin, 90 90 totlsv; -
branches/newmole/source/cont_createpointers.cpp
r1780 r1800 985 985 /* first MALLOC LIMELM dimension of space */ 986 986 /* >>chng 02 jun 28, malloc this NISO instead of 2. */ 987 iso.ipSym2nu = (long ***)MALLOC(sizeof(long **)*(unsigned)NISO ); 988 989 iso.As2nu = (realnum ***)MALLOC(sizeof(realnum **)*(unsigned)NISO ); 987 iso.ipSym2nu.reserve( NISO ); 990 988 991 989 /* now loop over the two iso-sequences with two photon continua */ 992 990 for( ipISO=ipH_LIKE; ipISO<NISO; ++ipISO ) 993 991 { 994 iso.ipSym2nu[ipISO] = (long **)MALLOC(sizeof(long *)*(unsigned)LIMELM ); 995 iso.As2nu[ipISO] = (realnum **)MALLOC(sizeof(realnum *)*(unsigned)LIMELM ); 992 iso.ipSym2nu.reserve( ipISO, LIMELM ); 996 993 997 994 /* set up two photon emission */ … … 1001 998 { 1002 999 double E2nu = Transitions[ipISO][nelem][TwoS][0].EnergyWN * WAVNRYD; 1003 double Aul = Transitions[ipISO][nelem][TwoS][0].Emis->Aul;1004 double SumShapeFunction = 0., Renorm= 0.;1005 1000 1006 1001 /* pointer to the Lya energy */ … … 1017 1012 } 1018 1013 1019 iso.ipSym2nu[ipISO][nelem] = (long *)MALLOC(sizeof(long)*(unsigned)iso.ipTwoPhoE[ipISO][nelem] ); 1020 iso.As2nu[ipISO][nelem] = (realnum *)MALLOC(sizeof(realnum)*(unsigned)iso.ipTwoPhoE[ipISO][nelem] ); 1014 iso.ipSym2nu.reserve( ipISO, nelem, iso.ipTwoPhoE[ipISO][nelem] ); 1015 } 1016 } 1017 } 1018 1019 iso.ipSym2nu.alloc(); 1020 iso.As2nu.alloc( iso.ipSym2nu.clone() ); 1021 1022 /* now loop over the two iso-sequences with two photon continua */ 1023 for( ipISO=ipH_LIKE; ipISO<NISO; ++ipISO ) 1024 { 1025 /* set up two photon emission */ 1026 for( nelem=ipISO; nelem<LIMELM; ++nelem ) 1027 { 1028 if( dense.lgElmtOn[nelem] ) 1029 { 1030 double E2nu = Transitions[ipISO][nelem][TwoS][0].EnergyWN * WAVNRYD; 1031 double Aul = Transitions[ipISO][nelem][TwoS][0].Emis->Aul; 1032
