From ddfe08cb93d1eef41c29cada0676582fc15f9231 Mon Sep 17 00:00:00 2001 From: fengmengqi Date: Wed, 25 Mar 2026 18:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fix_imports.py | 191 ++++++ scripts/migrate_acceleration.sh | 25 + scripts/migrate_atmosphere.sh | 46 ++ scripts/migrate_equilibrium.sh | 35 + scripts/migrate_hydrogen.sh | 11 + scripts/migrate_io_misc.sh | 23 + scripts/migrate_linearization.sh | 36 + scripts/migrate_math.sh | 19 + scripts/migrate_model.sh | 24 + scripts/migrate_others.sh | 17 + scripts/migrate_physics.sh | 7 + scripts/migrate_physics_collision.sh | 47 ++ scripts/migrate_physics_cross_section.sh | 529 +++++++++++++++ scripts/migrate_physics_line_profile.sh | 39 ++ scripts/migrate_physics_radiative.sh | 37 + scripts/migrate_physics_thermodynamics.sh | 24 + scripts/migrate_spectral.sh | 26 + scripts/refactor.sh | 389 +++++++++++ scripts/refactor_modules.sh | 438 ++++++++++++ src/synspec/math/crosew.rs | 10 +- src/synspec/math/pretab.rs | 2 +- src/tlusty/io/linset.rs | 6 +- src/tlusty/io/rayini.rs | 4 +- src/tlusty/math/{ => ali}/alifr1.rs | 0 src/tlusty/math/{ => ali}/alifr3.rs | 0 src/tlusty/math/{ => ali}/alifr6.rs | 0 src/tlusty/math/{ => ali}/alifrk.rs | 0 src/tlusty/math/{ => ali}/alisk1.rs | 0 src/tlusty/math/{ => ali}/alisk2.rs | 0 src/tlusty/math/{ => ali}/alist1.rs | 0 src/tlusty/math/{ => ali}/alist2.rs | 0 src/tlusty/math/{ => ali}/ijali2.rs | 0 src/tlusty/math/{ => ali}/ijalis.rs | 0 src/tlusty/math/ali/mod.rs | 25 + src/tlusty/math/{ => ali}/taufr1.rs | 0 src/tlusty/math/{ => atomic}/chctab.rs | 0 src/tlusty/math/{ => atomic}/cheav.rs | 2 +- src/tlusty/math/{ => atomic}/cheavj.rs | 0 src/tlusty/math/{ => atomic}/cion.rs | 0 src/tlusty/math/{ => atomic}/cross.rs | 0 src/tlusty/math/{ => atomic}/dielrc.rs | 0 src/tlusty/math/{ => atomic}/dietot.rs | 2 +- src/tlusty/math/{ => atomic}/ffcros.rs | 0 src/tlusty/math/{ => atomic}/gfree.rs | 0 src/tlusty/math/{ => atomic}/gntk.rs | 0 src/tlusty/math/atomic/mod.rs | 33 + src/tlusty/math/{ => atomic}/vern16.rs | 0 src/tlusty/math/{ => atomic}/vern18.rs | 0 src/tlusty/math/{ => atomic}/vern20.rs | 0 src/tlusty/math/{ => atomic}/vern26.rs | 0 src/tlusty/math/{ => atomic}/verner.rs | 0 src/tlusty/math/continuum/mod.rs | 33 + src/tlusty/math/{ => continuum}/opacf0.rs | 0 src/tlusty/math/{ => continuum}/opacf1.rs | 4 +- src/tlusty/math/{ => continuum}/opacfa.rs | 0 src/tlusty/math/{ => continuum}/opacfd.rs | 0 src/tlusty/math/{ => continuum}/opacfl.rs | 0 src/tlusty/math/{ => continuum}/opact1.rs | 4 +- src/tlusty/math/{ => continuum}/opactd.rs | 4 +- src/tlusty/math/{ => continuum}/opactr.rs | 0 src/tlusty/math/{ => continuum}/opadd.rs | 12 +- src/tlusty/math/{ => continuum}/opadd0.rs | 2 +- src/tlusty/math/{ => continuum}/opahst.rs | 2 +- src/tlusty/math/{ => continuum}/opaini.rs | 0 src/tlusty/math/{ => continuum}/opctab.rs | 2 +- src/tlusty/math/{ => continuum}/opdata.rs | 0 src/tlusty/math/{ => continuum}/opfrac.rs | 0 src/tlusty/math/{ => convection}/concor.rs | 0 src/tlusty/math/{ => convection}/conout.rs | 0 src/tlusty/math/{ => convection}/conref.rs | 0 src/tlusty/math/{ => convection}/contmd.rs | 6 +- src/tlusty/math/{ => convection}/contmp.rs | 0 src/tlusty/math/{ => convection}/convec.rs | 8 +- src/tlusty/math/convection/mod.rs | 15 + src/tlusty/math/{ => eos}/eldenc.rs | 6 +- src/tlusty/math/{ => eos}/eldens.rs | 8 +- src/tlusty/math/{ => eos}/entene.rs | 2 +- src/tlusty/math/eos/mod.rs | 19 + src/tlusty/math/{ => eos}/moleq.rs | 4 +- src/tlusty/math/{ => eos}/rhoeos.rs | 2 +- src/tlusty/math/{ => eos}/rhonen.rs | 2 +- src/tlusty/math/{ => eos}/russel.rs | 2 +- src/tlusty/math/{ => eos}/steqeq.rs | 0 src/tlusty/math/{ => hydrogen}/bhe.rs | 0 src/tlusty/math/{ => hydrogen}/bre.rs | 0 src/tlusty/math/{ => hydrogen}/brez.rs | 0 src/tlusty/math/{ => hydrogen}/brte.rs | 0 src/tlusty/math/{ => hydrogen}/brtez.rs | 0 src/tlusty/math/{ => hydrogen}/colh.rs | 8 +- src/tlusty/math/{ => hydrogen}/colhe.rs | 0 src/tlusty/math/{ => hydrogen}/colis.rs | 10 +- src/tlusty/math/{ => hydrogen}/collhe.rs | 0 src/tlusty/math/{ => hydrogen}/ctdata.rs | 0 src/tlusty/math/{ => hydrogen}/ghydop.rs | 0 src/tlusty/math/{ => hydrogen}/h2minus.rs | 2 +- src/tlusty/math/{ => hydrogen}/hedif.rs | 0 src/tlusty/math/{ => hydrogen}/hephot.rs | 0 src/tlusty/math/{ => hydrogen}/hesol6.rs | 4 +- src/tlusty/math/{ => hydrogen}/hesolv.rs | 10 +- src/tlusty/math/{ => hydrogen}/hidalg.rs | 0 src/tlusty/math/{ => hydrogen}/inthyd.rs | 0 src/tlusty/math/{ => hydrogen}/lymlin.rs | 6 +- src/tlusty/math/hydrogen/mod.rs | 69 ++ src/tlusty/math/{ => hydrogen}/sbfch.rs | 0 src/tlusty/math/{ => hydrogen}/sbfhe1.rs | 2 +- src/tlusty/math/{ => hydrogen}/sbfhmi.rs | 0 src/tlusty/math/{ => hydrogen}/sbfhmi_old.rs | 0 src/tlusty/math/{ => hydrogen}/sbfoh.rs | 0 src/tlusty/math/{ => hydrogen}/sffhmi.rs | 0 src/tlusty/math/{ => hydrogen}/sffhmi_add.rs | 0 src/tlusty/math/{ => hydrogen}/sgmer.rs | 0 src/tlusty/math/{ => hydrogen}/sgmer1.rs | 0 src/tlusty/math/{ => hydrogen}/sigave.rs | 0 src/tlusty/math/{ => hydrogen}/sigk.rs | 18 +- src/tlusty/math/{ => hydrogen}/sigmar.rs | 2 +- src/tlusty/math/{ => hydrogen}/spsigk.rs | 0 src/tlusty/math/{ => hydrogen}/szirc.rs | 0 src/tlusty/math/{ => interpolation}/ckoest.rs | 0 src/tlusty/math/{ => interpolation}/interp.rs | 0 .../math/{ => interpolation}/interpolate.rs | 0 src/tlusty/math/{ => interpolation}/intlem.rs | 0 src/tlusty/math/{ => interpolation}/intxen.rs | 2 +- src/tlusty/math/{ => interpolation}/lagran.rs | 0 src/tlusty/math/{ => interpolation}/locate.rs | 0 src/tlusty/math/interpolation/mod.rs | 24 + src/tlusty/math/{ => interpolation}/tabint.rs | 0 src/tlusty/math/{ => interpolation}/yint.rs | 2 +- src/tlusty/math/{ => interpolation}/ylintp.rs | 0 src/tlusty/math/{ => io}/getwrd.rs | 0 src/tlusty/math/io/mod.rs | 35 + src/tlusty/math/{ => io}/output.rs | 0 src/tlusty/math/{ => io}/prchan.rs | 0 src/tlusty/math/{ => io}/princ.rs | 8 +- src/tlusty/math/{ => io}/prnt.rs | 2 +- src/tlusty/math/{ => io}/prsent.rs | 0 src/tlusty/math/{ => io}/pzert.rs | 0 src/tlusty/math/{ => io}/pzeval.rs | 0 src/tlusty/math/{ => io}/pzevld.rs | 4 +- src/tlusty/math/{ => io}/quit.rs | 0 src/tlusty/math/{ => io}/rdata.rs | 0 src/tlusty/math/{ => io}/rdatax.rs | 2 +- src/tlusty/math/{ => io}/readbf.rs | 0 src/tlusty/math/{ => io}/rechck.rs | 0 src/tlusty/math/{ => io}/timing.rs | 0 src/tlusty/math/{ => io}/visini.rs | 0 src/tlusty/math/mod.rs | 638 ++---------------- src/tlusty/math/odf/mod.rs | 15 + src/tlusty/math/{ => odf}/odf1.rs | 12 +- src/tlusty/math/{ => odf}/odffr.rs | 0 src/tlusty/math/{ => odf}/odfhst.rs | 0 src/tlusty/math/{ => odf}/odfhyd.rs | 6 +- src/tlusty/math/{ => odf}/odfhys.rs | 2 +- src/tlusty/math/{ => odf}/odfmer.rs | 2 +- src/tlusty/math/{ => opacity}/allard.rs | 0 src/tlusty/math/{ => opacity}/allardt.rs | 0 src/tlusty/math/{ => opacity}/cia_h2h.rs | 2 +- src/tlusty/math/{ => opacity}/cia_h2h2.rs | 2 +- src/tlusty/math/{ => opacity}/cia_h2he.rs | 2 +- src/tlusty/math/{ => opacity}/cia_hhe.rs | 2 +- src/tlusty/math/{ => opacity}/compt0.rs | 0 src/tlusty/math/{ => opacity}/corrwm.rs | 2 +- src/tlusty/math/{ => opacity}/cspec.rs | 0 src/tlusty/math/{ => opacity}/dopgam.rs | 0 src/tlusty/math/{ => opacity}/dwnfr.rs | 0 src/tlusty/math/{ => opacity}/dwnfr0.rs | 0 src/tlusty/math/{ => opacity}/dwnfr1.rs | 0 src/tlusty/math/{ => opacity}/gvdw.rs | 0 src/tlusty/math/{ => opacity}/inifrc.rs | 2 +- src/tlusty/math/{ => opacity}/inifrs.rs | 2 +- src/tlusty/math/{ => opacity}/inifrt.rs | 2 +- src/tlusty/math/{ => opacity}/inilam.rs | 0 src/tlusty/math/{ => opacity}/inkul.rs | 0 src/tlusty/math/{ => opacity}/inpdis.rs | 6 +- src/tlusty/math/{ => opacity}/lemini.rs | 0 src/tlusty/math/{ => opacity}/levgrp.rs | 0 src/tlusty/math/{ => opacity}/levset.rs | 0 src/tlusty/math/{ => opacity}/levsol.rs | 2 +- src/tlusty/math/{ => opacity}/linpro.rs | 6 +- src/tlusty/math/{ => opacity}/linsel.rs | 8 +- src/tlusty/math/{ => opacity}/linspl.rs | 2 +- src/tlusty/math/{ => opacity}/meanop.rs | 0 src/tlusty/math/{ => opacity}/meanopt.rs | 10 +- src/tlusty/math/opacity/mod.rs | 83 +++ src/tlusty/math/{ => opacity}/prd.rs | 2 +- src/tlusty/math/{ => opacity}/prdini.rs | 0 src/tlusty/math/{ => opacity}/profil.rs | 9 +- src/tlusty/math/{ => opacity}/profsp.rs | 6 +- src/tlusty/math/{ => opacity}/quasim.rs | 2 +- src/tlusty/math/{ => opacity}/rayleigh.rs | 0 src/tlusty/math/{ => opacity}/rayset.rs | 0 src/tlusty/math/{ => opacity}/reflev.rs | 0 src/tlusty/math/{ => opacity}/reiman.rs | 0 src/tlusty/math/{ => opacity}/stark0.rs | 0 src/tlusty/math/{ => opacity}/starka.rs | 0 src/tlusty/math/{ => partition}/carbon.rs | 0 src/tlusty/math/{ => partition}/ceh12.rs | 0 src/tlusty/math/partition/mod.rs | 25 + src/tlusty/math/{ => partition}/mpartf.rs | 0 src/tlusty/math/{ => partition}/partf.rs | 12 +- src/tlusty/math/{ => partition}/pfcno.rs | 0 src/tlusty/math/{ => partition}/pffe.rs | 0 src/tlusty/math/{ => partition}/pfheav.rs | 0 src/tlusty/math/{ => partition}/pfni.rs | 0 src/tlusty/math/{ => partition}/pfspec.rs | 0 src/tlusty/math/{ => partition}/sghe12.rs | 0 src/tlusty/math/{ => partition}/tiopf.rs | 0 src/tlusty/math/{ => population}/bpop.rs | 16 +- src/tlusty/math/{ => population}/bpopc.rs | 2 +- src/tlusty/math/{ => population}/bpope.rs | 0 src/tlusty/math/{ => population}/bpopf.rs | 0 src/tlusty/math/{ => population}/bpopt.rs | 0 src/tlusty/math/{ => population}/butler.rs | 0 src/tlusty/math/population/mod.rs | 17 + src/tlusty/math/{ => population}/newpop.rs | 0 src/tlusty/math/{ => radiative}/coolrt.rs | 0 src/tlusty/math/radiative/mod.rs | 39 ++ src/tlusty/math/{ => radiative}/radpre.rs | 4 +- src/tlusty/math/{ => radiative}/radtot.rs | 0 src/tlusty/math/{ => radiative}/rte_sc.rs | 0 src/tlusty/math/{ => radiative}/rteang.rs | 2 +- src/tlusty/math/{ => radiative}/rtecf0.rs | 0 src/tlusty/math/{ => radiative}/rtecf1.rs | 6 +- src/tlusty/math/{ => radiative}/rtecmc.rs | 2 +- src/tlusty/math/{ => radiative}/rtecmu.rs | 4 +- src/tlusty/math/{ => radiative}/rtecom.rs | 8 +- src/tlusty/math/{ => radiative}/rtedf1.rs | 0 src/tlusty/math/{ => radiative}/rtedf2.rs | 0 src/tlusty/math/{ => radiative}/rtefe2.rs | 0 src/tlusty/math/{ => radiative}/rtefr1.rs | 12 +- src/tlusty/math/{ => radiative}/rteint.rs | 2 +- src/tlusty/math/{ => radiative}/rtesol.rs | 0 src/tlusty/math/{ => radiative}/trmder.rs | 4 +- src/tlusty/math/{ => radiative}/trmdrt.rs | 2 +- src/tlusty/math/rates/mod.rs | 11 + src/tlusty/math/{ => rates}/rates1.rs | 0 src/tlusty/math/{ => rates}/ratmal.rs | 0 src/tlusty/math/{ => rates}/ratmat.rs | 2 +- src/tlusty/math/{ => rates}/ratsp1.rs | 0 src/tlusty/math/{ => solvers}/accel2.rs | 0 src/tlusty/math/{ => solvers}/accelp.rs | 0 src/tlusty/math/{ => solvers}/cubic.rs | 0 src/tlusty/math/{ => solvers}/indexx.rs | 0 src/tlusty/math/{ => solvers}/laguer.rs | 0 src/tlusty/math/{ => solvers}/lineqs.rs | 0 src/tlusty/math/{ => solvers}/matcon.rs | 2 +- src/tlusty/math/{ => solvers}/matgen.rs | 0 src/tlusty/math/{ => solvers}/matinv.rs | 0 src/tlusty/math/{ => solvers}/minv3.rs | 0 src/tlusty/math/solvers/mod.rs | 49 ++ src/tlusty/math/{ => solvers}/psolve.rs | 0 src/tlusty/math/{ => solvers}/quartc.rs | 0 src/tlusty/math/{ => solvers}/raph.rs | 0 src/tlusty/math/{ => solvers}/rhsgen.rs | 2 +- src/tlusty/math/{ => solvers}/rybchn.rs | 6 +- src/tlusty/math/{ => solvers}/rybene.rs | 2 +- src/tlusty/math/{ => solvers}/rybheq.rs | 2 +- src/tlusty/math/{ => solvers}/rybmat.rs | 0 src/tlusty/math/{ => solvers}/rybsol.rs | 4 +- src/tlusty/math/{ => solvers}/solve.rs | 0 src/tlusty/math/{ => solvers}/solves.rs | 0 src/tlusty/math/{ => solvers}/tridag.rs | 0 src/tlusty/math/{ => solvers}/ubeta.rs | 0 src/tlusty/math/{ => special}/erfcx.rs | 0 src/tlusty/math/{ => special}/expint.rs | 0 src/tlusty/math/{ => special}/expo.rs | 0 src/tlusty/math/{ => special}/gami.rs | 0 src/tlusty/math/{ => special}/gamsp.rs | 0 src/tlusty/math/{ => special}/gauleg.rs | 0 src/tlusty/math/{ => special}/gaunt.rs | 0 src/tlusty/math/special/mod.rs | 21 + src/tlusty/math/{ => special}/voigt.rs | 0 src/tlusty/math/{ => special}/voigte.rs | 0 src/tlusty/math/{ => temperature}/elcor.rs | 6 +- src/tlusty/math/{ => temperature}/grcor.rs | 0 src/tlusty/math/{ => temperature}/greyd.rs | 0 src/tlusty/math/{ => temperature}/lucy.rs | 0 src/tlusty/math/temperature/mod.rs | 25 + src/tlusty/math/{ => temperature}/osccor.rs | 0 src/tlusty/math/{ => temperature}/rossop.rs | 2 +- src/tlusty/math/{ => temperature}/rosstd.rs | 0 src/tlusty/math/{ => temperature}/tdpini.rs | 2 +- src/tlusty/math/{ => temperature}/temcor.rs | 0 src/tlusty/math/{ => temperature}/temper.rs | 0 src/tlusty/math/{ => temperature}/tlocal.rs | 2 +- src/tlusty/math/{ => utils}/angset.rs | 3 +- src/tlusty/math/{ => utils}/betah.rs | 0 src/tlusty/math/{ => utils}/bkhsgo.rs | 0 src/tlusty/math/{ => utils}/change.rs | 2 +- src/tlusty/math/{ => utils}/column.rs | 0 src/tlusty/math/{ => utils}/comset.rs | 0 src/tlusty/math/{ => utils}/divstr.rs | 0 src/tlusty/math/{ => utils}/dmder.rs | 0 src/tlusty/math/{ => utils}/dmeval.rs | 2 +- src/tlusty/math/{ => utils}/emat.rs | 0 src/tlusty/math/{ => utils}/getlal.rs | 0 src/tlusty/math/{ => utils}/gomini.rs | 0 src/tlusty/math/{ => utils}/gridp.rs | 0 src/tlusty/math/{ => utils}/inicom.rs | 0 src/tlusty/math/{ => utils}/irc.rs | 0 src/tlusty/math/utils/mod.rs | 59 ++ src/tlusty/math/{ => utils}/newdm.rs | 0 src/tlusty/math/{ => utils}/newdmt.rs | 4 +- src/tlusty/math/{ => utils}/pgset.rs | 2 +- src/tlusty/math/{ => utils}/sabolf.rs | 0 src/tlusty/math/{ => utils}/setdrt.rs | 0 src/tlusty/math/{ => utils}/state.rs | 2 +- src/tlusty/math/{ => utils}/switch.rs | 0 src/tlusty/math/{ => utils}/topbas.rs | 2 +- src/tlusty/math/{ => utils}/traini.rs | 0 src/tlusty/math/{ => utils}/wn.rs | 0 src/tlusty/math/{ => utils}/wnstor.rs | 2 +- src/tlusty/math/{ => utils}/xk2dop.rs | 0 src/tlusty/math/{ => utils}/zmrho.rs | 0 313 files changed, 2817 insertions(+), 777 deletions(-) create mode 100644 fix_imports.py create mode 100644 scripts/migrate_acceleration.sh create mode 100644 scripts/migrate_atmosphere.sh create mode 100644 scripts/migrate_equilibrium.sh create mode 100644 scripts/migrate_hydrogen.sh create mode 100644 scripts/migrate_io_misc.sh create mode 100644 scripts/migrate_linearization.sh create mode 100644 scripts/migrate_math.sh create mode 100644 scripts/migrate_model.sh create mode 100644 scripts/migrate_others.sh create mode 100644 scripts/migrate_physics.sh create mode 100644 scripts/migrate_physics_collision.sh create mode 100644 scripts/migrate_physics_cross_section.sh create mode 100644 scripts/migrate_physics_line_profile.sh create mode 100644 scripts/migrate_physics_radiative.sh create mode 100644 scripts/migrate_physics_thermodynamics.sh create mode 100644 scripts/migrate_spectral.sh create mode 100644 scripts/refactor.sh create mode 100644 scripts/refactor_modules.sh rename src/tlusty/math/{ => ali}/alifr1.rs (100%) rename src/tlusty/math/{ => ali}/alifr3.rs (100%) rename src/tlusty/math/{ => ali}/alifr6.rs (100%) rename src/tlusty/math/{ => ali}/alifrk.rs (100%) rename src/tlusty/math/{ => ali}/alisk1.rs (100%) rename src/tlusty/math/{ => ali}/alisk2.rs (100%) rename src/tlusty/math/{ => ali}/alist1.rs (100%) rename src/tlusty/math/{ => ali}/alist2.rs (100%) rename src/tlusty/math/{ => ali}/ijali2.rs (100%) rename src/tlusty/math/{ => ali}/ijalis.rs (100%) create mode 100644 src/tlusty/math/ali/mod.rs rename src/tlusty/math/{ => ali}/taufr1.rs (100%) rename src/tlusty/math/{ => atomic}/chctab.rs (100%) rename src/tlusty/math/{ => atomic}/cheav.rs (99%) rename src/tlusty/math/{ => atomic}/cheavj.rs (100%) rename src/tlusty/math/{ => atomic}/cion.rs (100%) rename src/tlusty/math/{ => atomic}/cross.rs (100%) rename src/tlusty/math/{ => atomic}/dielrc.rs (100%) rename src/tlusty/math/{ => atomic}/dietot.rs (99%) rename src/tlusty/math/{ => atomic}/ffcros.rs (100%) rename src/tlusty/math/{ => atomic}/gfree.rs (100%) rename src/tlusty/math/{ => atomic}/gntk.rs (100%) create mode 100644 src/tlusty/math/atomic/mod.rs rename src/tlusty/math/{ => atomic}/vern16.rs (100%) rename src/tlusty/math/{ => atomic}/vern18.rs (100%) rename src/tlusty/math/{ => atomic}/vern20.rs (100%) rename src/tlusty/math/{ => atomic}/vern26.rs (100%) rename src/tlusty/math/{ => atomic}/verner.rs (100%) create mode 100644 src/tlusty/math/continuum/mod.rs rename src/tlusty/math/{ => continuum}/opacf0.rs (100%) rename src/tlusty/math/{ => continuum}/opacf1.rs (99%) rename src/tlusty/math/{ => continuum}/opacfa.rs (100%) rename src/tlusty/math/{ => continuum}/opacfd.rs (100%) rename src/tlusty/math/{ => continuum}/opacfl.rs (100%) rename src/tlusty/math/{ => continuum}/opact1.rs (98%) rename src/tlusty/math/{ => continuum}/opactd.rs (99%) rename src/tlusty/math/{ => continuum}/opactr.rs (100%) rename src/tlusty/math/{ => continuum}/opadd.rs (98%) rename src/tlusty/math/{ => continuum}/opadd0.rs (99%) rename src/tlusty/math/{ => continuum}/opahst.rs (99%) rename src/tlusty/math/{ => continuum}/opaini.rs (100%) rename src/tlusty/math/{ => continuum}/opctab.rs (99%) rename src/tlusty/math/{ => continuum}/opdata.rs (100%) rename src/tlusty/math/{ => continuum}/opfrac.rs (100%) rename src/tlusty/math/{ => convection}/concor.rs (100%) rename src/tlusty/math/{ => convection}/conout.rs (100%) rename src/tlusty/math/{ => convection}/conref.rs (100%) rename src/tlusty/math/{ => convection}/contmd.rs (99%) rename src/tlusty/math/{ => convection}/contmp.rs (100%) rename src/tlusty/math/{ => convection}/convec.rs (98%) create mode 100644 src/tlusty/math/convection/mod.rs rename src/tlusty/math/{ => eos}/eldenc.rs (98%) rename src/tlusty/math/{ => eos}/eldens.rs (98%) rename src/tlusty/math/{ => eos}/entene.rs (98%) create mode 100644 src/tlusty/math/eos/mod.rs rename src/tlusty/math/{ => eos}/moleq.rs (98%) rename src/tlusty/math/{ => eos}/rhoeos.rs (99%) rename src/tlusty/math/{ => eos}/rhonen.rs (98%) rename src/tlusty/math/{ => eos}/russel.rs (99%) rename src/tlusty/math/{ => eos}/steqeq.rs (100%) rename src/tlusty/math/{ => hydrogen}/bhe.rs (100%) rename src/tlusty/math/{ => hydrogen}/bre.rs (100%) rename src/tlusty/math/{ => hydrogen}/brez.rs (100%) rename src/tlusty/math/{ => hydrogen}/brte.rs (100%) rename src/tlusty/math/{ => hydrogen}/brtez.rs (100%) rename src/tlusty/math/{ => hydrogen}/colh.rs (99%) rename src/tlusty/math/{ => hydrogen}/colhe.rs (100%) rename src/tlusty/math/{ => hydrogen}/colis.rs (99%) rename src/tlusty/math/{ => hydrogen}/collhe.rs (100%) rename src/tlusty/math/{ => hydrogen}/ctdata.rs (100%) rename src/tlusty/math/{ => hydrogen}/ghydop.rs (100%) rename src/tlusty/math/{ => hydrogen}/h2minus.rs (99%) rename src/tlusty/math/{ => hydrogen}/hedif.rs (100%) rename src/tlusty/math/{ => hydrogen}/hephot.rs (100%) rename src/tlusty/math/{ => hydrogen}/hesol6.rs (99%) rename src/tlusty/math/{ => hydrogen}/hesolv.rs (98%) rename src/tlusty/math/{ => hydrogen}/hidalg.rs (100%) rename src/tlusty/math/{ => hydrogen}/inthyd.rs (100%) rename src/tlusty/math/{ => hydrogen}/lymlin.rs (98%) create mode 100644 src/tlusty/math/hydrogen/mod.rs rename src/tlusty/math/{ => hydrogen}/sbfch.rs (100%) rename src/tlusty/math/{ => hydrogen}/sbfhe1.rs (99%) rename src/tlusty/math/{ => hydrogen}/sbfhmi.rs (100%) rename src/tlusty/math/{ => hydrogen}/sbfhmi_old.rs (100%) rename src/tlusty/math/{ => hydrogen}/sbfoh.rs (100%) rename src/tlusty/math/{ => hydrogen}/sffhmi.rs (100%) rename src/tlusty/math/{ => hydrogen}/sffhmi_add.rs (100%) rename src/tlusty/math/{ => hydrogen}/sgmer.rs (100%) rename src/tlusty/math/{ => hydrogen}/sgmer1.rs (100%) rename src/tlusty/math/{ => hydrogen}/sigave.rs (100%) rename src/tlusty/math/{ => hydrogen}/sigk.rs (97%) rename src/tlusty/math/{ => hydrogen}/sigmar.rs (99%) rename src/tlusty/math/{ => hydrogen}/spsigk.rs (100%) rename src/tlusty/math/{ => hydrogen}/szirc.rs (100%) rename src/tlusty/math/{ => interpolation}/ckoest.rs (100%) rename src/tlusty/math/{ => interpolation}/interp.rs (100%) rename src/tlusty/math/{ => interpolation}/interpolate.rs (100%) rename src/tlusty/math/{ => interpolation}/intlem.rs (100%) rename src/tlusty/math/{ => interpolation}/intxen.rs (99%) rename src/tlusty/math/{ => interpolation}/lagran.rs (100%) rename src/tlusty/math/{ => interpolation}/locate.rs (100%) create mode 100644 src/tlusty/math/interpolation/mod.rs rename src/tlusty/math/{ => interpolation}/tabint.rs (100%) rename src/tlusty/math/{ => interpolation}/yint.rs (97%) rename src/tlusty/math/{ => interpolation}/ylintp.rs (100%) rename src/tlusty/math/{ => io}/getwrd.rs (100%) create mode 100644 src/tlusty/math/io/mod.rs rename src/tlusty/math/{ => io}/output.rs (100%) rename src/tlusty/math/{ => io}/prchan.rs (100%) rename src/tlusty/math/{ => io}/princ.rs (98%) rename src/tlusty/math/{ => io}/prnt.rs (99%) rename src/tlusty/math/{ => io}/prsent.rs (100%) rename src/tlusty/math/{ => io}/pzert.rs (100%) rename src/tlusty/math/{ => io}/pzeval.rs (100%) rename src/tlusty/math/{ => io}/pzevld.rs (99%) rename src/tlusty/math/{ => io}/quit.rs (100%) rename src/tlusty/math/{ => io}/rdata.rs (100%) rename src/tlusty/math/{ => io}/rdatax.rs (99%) rename src/tlusty/math/{ => io}/readbf.rs (100%) rename src/tlusty/math/{ => io}/rechck.rs (100%) rename src/tlusty/math/{ => io}/timing.rs (100%) rename src/tlusty/math/{ => io}/visini.rs (100%) create mode 100644 src/tlusty/math/odf/mod.rs rename src/tlusty/math/{ => odf}/odf1.rs (98%) rename src/tlusty/math/{ => odf}/odffr.rs (100%) rename src/tlusty/math/{ => odf}/odfhst.rs (100%) rename src/tlusty/math/{ => odf}/odfhyd.rs (98%) rename src/tlusty/math/{ => odf}/odfhys.rs (99%) rename src/tlusty/math/{ => odf}/odfmer.rs (98%) rename src/tlusty/math/{ => opacity}/allard.rs (100%) rename src/tlusty/math/{ => opacity}/allardt.rs (100%) rename src/tlusty/math/{ => opacity}/cia_h2h.rs (99%) rename src/tlusty/math/{ => opacity}/cia_h2h2.rs (99%) rename src/tlusty/math/{ => opacity}/cia_h2he.rs (99%) rename src/tlusty/math/{ => opacity}/cia_hhe.rs (99%) rename src/tlusty/math/{ => opacity}/compt0.rs (100%) rename src/tlusty/math/{ => opacity}/corrwm.rs (99%) rename src/tlusty/math/{ => opacity}/cspec.rs (100%) rename src/tlusty/math/{ => opacity}/dopgam.rs (100%) rename src/tlusty/math/{ => opacity}/dwnfr.rs (100%) rename src/tlusty/math/{ => opacity}/dwnfr0.rs (100%) rename src/tlusty/math/{ => opacity}/dwnfr1.rs (100%) rename src/tlusty/math/{ => opacity}/gvdw.rs (100%) rename src/tlusty/math/{ => opacity}/inifrc.rs (99%) rename src/tlusty/math/{ => opacity}/inifrs.rs (99%) rename src/tlusty/math/{ => opacity}/inifrt.rs (99%) rename src/tlusty/math/{ => opacity}/inilam.rs (100%) rename src/tlusty/math/{ => opacity}/inkul.rs (100%) rename src/tlusty/math/{ => opacity}/inpdis.rs (99%) rename src/tlusty/math/{ => opacity}/lemini.rs (100%) rename src/tlusty/math/{ => opacity}/levgrp.rs (100%) rename src/tlusty/math/{ => opacity}/levset.rs (100%) rename src/tlusty/math/{ => opacity}/levsol.rs (99%) rename src/tlusty/math/{ => opacity}/linpro.rs (98%) rename src/tlusty/math/{ => opacity}/linsel.rs (98%) rename src/tlusty/math/{ => opacity}/linspl.rs (99%) rename src/tlusty/math/{ => opacity}/meanop.rs (100%) rename src/tlusty/math/{ => opacity}/meanopt.rs (96%) create mode 100644 src/tlusty/math/opacity/mod.rs rename src/tlusty/math/{ => opacity}/prd.rs (99%) rename src/tlusty/math/{ => opacity}/prdini.rs (100%) rename src/tlusty/math/{ => opacity}/profil.rs (97%) rename src/tlusty/math/{ => opacity}/profsp.rs (98%) rename src/tlusty/math/{ => opacity}/quasim.rs (99%) rename src/tlusty/math/{ => opacity}/rayleigh.rs (100%) rename src/tlusty/math/{ => opacity}/rayset.rs (100%) rename src/tlusty/math/{ => opacity}/reflev.rs (100%) rename src/tlusty/math/{ => opacity}/reiman.rs (100%) rename src/tlusty/math/{ => opacity}/stark0.rs (100%) rename src/tlusty/math/{ => opacity}/starka.rs (100%) rename src/tlusty/math/{ => partition}/carbon.rs (100%) rename src/tlusty/math/{ => partition}/ceh12.rs (100%) create mode 100644 src/tlusty/math/partition/mod.rs rename src/tlusty/math/{ => partition}/mpartf.rs (100%) rename src/tlusty/math/{ => partition}/partf.rs (98%) rename src/tlusty/math/{ => partition}/pfcno.rs (100%) rename src/tlusty/math/{ => partition}/pffe.rs (100%) rename src/tlusty/math/{ => partition}/pfheav.rs (100%) rename src/tlusty/math/{ => partition}/pfni.rs (100%) rename src/tlusty/math/{ => partition}/pfspec.rs (100%) rename src/tlusty/math/{ => partition}/sghe12.rs (100%) rename src/tlusty/math/{ => partition}/tiopf.rs (100%) rename src/tlusty/math/{ => population}/bpop.rs (96%) rename src/tlusty/math/{ => population}/bpopc.rs (99%) rename src/tlusty/math/{ => population}/bpope.rs (100%) rename src/tlusty/math/{ => population}/bpopf.rs (100%) rename src/tlusty/math/{ => population}/bpopt.rs (100%) rename src/tlusty/math/{ => population}/butler.rs (100%) create mode 100644 src/tlusty/math/population/mod.rs rename src/tlusty/math/{ => population}/newpop.rs (100%) rename src/tlusty/math/{ => radiative}/coolrt.rs (100%) create mode 100644 src/tlusty/math/radiative/mod.rs rename src/tlusty/math/{ => radiative}/radpre.rs (99%) rename src/tlusty/math/{ => radiative}/radtot.rs (100%) rename src/tlusty/math/{ => radiative}/rte_sc.rs (100%) rename src/tlusty/math/{ => radiative}/rteang.rs (99%) rename src/tlusty/math/{ => radiative}/rtecf0.rs (100%) rename src/tlusty/math/{ => radiative}/rtecf1.rs (99%) rename src/tlusty/math/{ => radiative}/rtecmc.rs (99%) rename src/tlusty/math/{ => radiative}/rtecmu.rs (99%) rename src/tlusty/math/{ => radiative}/rtecom.rs (99%) rename src/tlusty/math/{ => radiative}/rtedf1.rs (100%) rename src/tlusty/math/{ => radiative}/rtedf2.rs (100%) rename src/tlusty/math/{ => radiative}/rtefe2.rs (100%) rename src/tlusty/math/{ => radiative}/rtefr1.rs (99%) rename src/tlusty/math/{ => radiative}/rteint.rs (99%) rename src/tlusty/math/{ => radiative}/rtesol.rs (100%) rename src/tlusty/math/{ => radiative}/trmder.rs (99%) rename src/tlusty/math/{ => radiative}/trmdrt.rs (99%) create mode 100644 src/tlusty/math/rates/mod.rs rename src/tlusty/math/{ => rates}/rates1.rs (100%) rename src/tlusty/math/{ => rates}/ratmal.rs (100%) rename src/tlusty/math/{ => rates}/ratmat.rs (99%) rename src/tlusty/math/{ => rates}/ratsp1.rs (100%) rename src/tlusty/math/{ => solvers}/accel2.rs (100%) rename src/tlusty/math/{ => solvers}/accelp.rs (100%) rename src/tlusty/math/{ => solvers}/cubic.rs (100%) rename src/tlusty/math/{ => solvers}/indexx.rs (100%) rename src/tlusty/math/{ => solvers}/laguer.rs (100%) rename src/tlusty/math/{ => solvers}/lineqs.rs (100%) rename src/tlusty/math/{ => solvers}/matcon.rs (99%) rename src/tlusty/math/{ => solvers}/matgen.rs (100%) rename src/tlusty/math/{ => solvers}/matinv.rs (100%) rename src/tlusty/math/{ => solvers}/minv3.rs (100%) create mode 100644 src/tlusty/math/solvers/mod.rs rename src/tlusty/math/{ => solvers}/psolve.rs (100%) rename src/tlusty/math/{ => solvers}/quartc.rs (100%) rename src/tlusty/math/{ => solvers}/raph.rs (100%) rename src/tlusty/math/{ => solvers}/rhsgen.rs (99%) rename src/tlusty/math/{ => solvers}/rybchn.rs (98%) rename src/tlusty/math/{ => solvers}/rybene.rs (99%) rename src/tlusty/math/{ => solvers}/rybheq.rs (99%) rename src/tlusty/math/{ => solvers}/rybmat.rs (100%) rename src/tlusty/math/{ => solvers}/rybsol.rs (99%) rename src/tlusty/math/{ => solvers}/solve.rs (100%) rename src/tlusty/math/{ => solvers}/solves.rs (100%) rename src/tlusty/math/{ => solvers}/tridag.rs (100%) rename src/tlusty/math/{ => solvers}/ubeta.rs (100%) rename src/tlusty/math/{ => special}/erfcx.rs (100%) rename src/tlusty/math/{ => special}/expint.rs (100%) rename src/tlusty/math/{ => special}/expo.rs (100%) rename src/tlusty/math/{ => special}/gami.rs (100%) rename src/tlusty/math/{ => special}/gamsp.rs (100%) rename src/tlusty/math/{ => special}/gauleg.rs (100%) rename src/tlusty/math/{ => special}/gaunt.rs (100%) create mode 100644 src/tlusty/math/special/mod.rs rename src/tlusty/math/{ => special}/voigt.rs (100%) rename src/tlusty/math/{ => special}/voigte.rs (100%) rename src/tlusty/math/{ => temperature}/elcor.rs (97%) rename src/tlusty/math/{ => temperature}/grcor.rs (100%) rename src/tlusty/math/{ => temperature}/greyd.rs (100%) rename src/tlusty/math/{ => temperature}/lucy.rs (100%) create mode 100644 src/tlusty/math/temperature/mod.rs rename src/tlusty/math/{ => temperature}/osccor.rs (100%) rename src/tlusty/math/{ => temperature}/rossop.rs (99%) rename src/tlusty/math/{ => temperature}/rosstd.rs (100%) rename src/tlusty/math/{ => temperature}/tdpini.rs (99%) rename src/tlusty/math/{ => temperature}/temcor.rs (100%) rename src/tlusty/math/{ => temperature}/temper.rs (100%) rename src/tlusty/math/{ => temperature}/tlocal.rs (99%) rename src/tlusty/math/{ => utils}/angset.rs (98%) rename src/tlusty/math/{ => utils}/betah.rs (100%) rename src/tlusty/math/{ => utils}/bkhsgo.rs (100%) rename src/tlusty/math/{ => utils}/change.rs (99%) rename src/tlusty/math/{ => utils}/column.rs (100%) rename src/tlusty/math/{ => utils}/comset.rs (100%) rename src/tlusty/math/{ => utils}/divstr.rs (100%) rename src/tlusty/math/{ => utils}/dmder.rs (100%) rename src/tlusty/math/{ => utils}/dmeval.rs (99%) rename src/tlusty/math/{ => utils}/emat.rs (100%) rename src/tlusty/math/{ => utils}/getlal.rs (100%) rename src/tlusty/math/{ => utils}/gomini.rs (100%) rename src/tlusty/math/{ => utils}/gridp.rs (100%) rename src/tlusty/math/{ => utils}/inicom.rs (100%) rename src/tlusty/math/{ => utils}/irc.rs (100%) create mode 100644 src/tlusty/math/utils/mod.rs rename src/tlusty/math/{ => utils}/newdm.rs (100%) rename src/tlusty/math/{ => utils}/newdmt.rs (99%) rename src/tlusty/math/{ => utils}/pgset.rs (99%) rename src/tlusty/math/{ => utils}/sabolf.rs (100%) rename src/tlusty/math/{ => utils}/setdrt.rs (100%) rename src/tlusty/math/{ => utils}/state.rs (99%) rename src/tlusty/math/{ => utils}/switch.rs (100%) rename src/tlusty/math/{ => utils}/topbas.rs (99%) rename src/tlusty/math/{ => utils}/traini.rs (100%) rename src/tlusty/math/{ => utils}/wn.rs (100%) rename src/tlusty/math/{ => utils}/wnstor.rs (99%) rename src/tlusty/math/{ => utils}/xk2dop.rs (100%) rename src/tlusty/math/{ => utils}/zmrho.rs (100%) diff --git a/fix_imports.py b/fix_imports.py new file mode 100644 index 0000000..e4c95a4 --- /dev/null +++ b/fix_imports.py @@ -0,0 +1,191 @@ +import os +import re + +# Change to the project directory +os.chdir(r'C:\Users\fmq\Documents\astro\SpectraRust') + +# All the Rust source file modules that were moved to subdirectories +# These are the .rs file basenames that are now in subdirs +modules_moved = [ + # From opacity/ + 'allard', 'allardt', 'cia_h2h', 'cia_h2h2', 'cia_h2he', 'cia_hhe', + 'compt0', 'corrwm', 'cspec', 'dopgam', 'dwnfr', 'dwnfr0', 'dwnfr1', + 'gvdw', 'inifrc', 'inifrs', 'inifrt', 'inilam', 'inkul', 'inpdis', + 'lemini', 'levgrp', 'levset', 'levsol', 'linpro', 'linsel', 'linspl', + 'lymlin', 'meanop', 'meanopt', 'profil', 'profsp', 'quasim', 'rayleigh', + 'rayset', 'reflev', 'reiman', 'stark0', 'starka', 'prd', 'prdini', + # From hydrogen/ + 'bhe', 'bre', 'brez', 'brte', 'brtez', 'colh', 'colhe', 'colis', 'collhe', + 'ctdata', 'ghydop', 'h2minus', 'hedif', 'hephot', 'hesol6', 'hesolv', + 'hidalg', 'inthyd', 'sbfch', 'sbfhe1', 'sbfhmi', 'sbfhmi_old', 'sbfoh', + 'sffhmi', 'sffhmi_add', 'sgmer', 'sgmer1', 'sigave', 'sigk', 'sigmar', + 'spsigk', 'szirc', + # From atomic/ + 'chctab', 'cheav', 'cheavj', 'cion', 'cross', 'dielrc', 'dietot', + 'ffcros', 'gfree', 'gntk', 'vern16', 'vern18', 'vern20', 'vern26', 'verner', + # From continuum/ + 'opacf0', 'opacf1', 'opacfa', 'opacfd', 'opacfl', 'opact1', 'opactd', + 'opactr', 'opadd', 'opadd0', 'opahst', 'opaini', 'opctab', 'opdata', 'opfrac', + # From convection/ + 'concor', 'conout', 'conref', 'contmd', 'contmp', 'convec', + # From eos/ + 'eldenc', 'eldens', 'entene', 'moleq', 'rhoeos', 'rhonen', 'russel', 'steqeq', + # From interpolation/ + 'ckoest', 'interp', 'interpolate', 'intlem', 'intxen', 'lagran', 'locate', + 'tabint', 'yint', 'ylintp', + # From io/ + 'getwrd', 'output', 'prchan', 'princ', 'prnt', 'prsent', 'pzert', + 'pzeval', 'pzevld', 'quit', 'rdata', 'rdatax', 'readbf', 'rechck', + 'timing', 'visini', + # From odf/ + 'odf1', 'odffr', 'odfhst', 'odfhyd', 'odfhys', 'odfmer', + # From partition/ + 'carbon', 'ceh12', 'mpartf', 'partf', 'pfcno', 'pffe', 'pfheav', + 'pfni', 'pfspec', 'sghe12', 'tiopf', + # From population/ + 'bpop', 'bpopc', 'bpope', 'bpopf', 'bpopt', 'butler', 'newpop', + # From radiative/ + 'coolrt', 'radpre', 'radtot', 'rte_sc', 'rteang', 'rtecf0', 'rtecf1', + 'rtecmc', 'rtecmu', 'rtecom', 'rtedf1', 'rtedf2', 'rtefe2', 'rtefr1', + 'rteint', 'rtesol', 'trmder', 'trmdrt', + # From rates/ + 'rates1', 'ratmal', 'ratmat', 'ratsp1', + # From solvers/ + 'accel2', 'accelp', 'cubic', 'indexx', 'laguer', 'lineqs', 'matcon', + 'matgen', 'matinv', 'minv3', 'psolve', 'quartc', 'raph', 'rhsgen', + 'rybchn', 'rybene', 'rybheq', 'rybmat', 'rybsol', 'solve', 'solves', + 'tridag', 'ubeta', + # From special/ + 'erfcx', 'expint', 'expo', 'gami', 'gamsp', 'gauleg', 'gaunt', + 'voigt', 'voigte', + # From temperature/ + 'elcor', 'grcor', 'greyd', 'lucy', 'osccor', 'rossop', 'rosstd', + 'tdpini', 'temcor', 'temper', 'tlocal', + # From utils/ + 'angset', 'betah', 'bkhsgo', 'change', 'column', 'comset', 'divstr', + 'dmder', 'dmeval', 'emat', 'getlal', 'gomini', 'gridp', 'inicom', + 'irc', 'newdm', 'newdmt', 'pgset', 'sabolf', 'setdrt', 'state', + 'switch', 'topbas', 'traini', 'wn', 'wnstor', 'xk2dop', 'zmrho', + # From ali/ + 'alifr1', 'alifr3', 'alifr6', 'alifrk', 'alisk1', 'alisk2', + 'alist1', 'alist2', 'ijali2', 'ijalis', 'taufr1', +] + +# Pattern for single item: use crate::tlusty::math::module::item; +single_pattern = re.compile( + r'use crate::tlusty::math::(' + '|'.join(modules_moved) + r')::(\w+);' +) + +# Pattern for multiple items: use crate::tlusty::math::module::{a, b}; +multi_pattern = re.compile( + r'use crate::tlusty::math::(' + '|'.join(modules_moved) + r')::\{([^}]+)\};' +) + +# Pattern for super::module::item (cross-submodule imports) +super_single_pattern = re.compile( + r'use super::(' + '|'.join(modules_moved) + r')::(\w+);' +) + +# Pattern for super::module::{a, b} +super_multi_pattern = re.compile( + r'use super::(' + '|'.join(modules_moved) + r')::\{([^}]+)\};' +) + +# Pattern for use super::module; (direct module import) +super_direct_pattern = re.compile( + r'use super::(' + '|'.join(modules_moved) + r');' +) + +# Pattern for use super::{module1, module2, ...} +super_brace_pattern = re.compile( + r'use super::\{([^}]+)\};' +) + +# Pattern for direct code references: crate::tlusty::math::module::item( +# This catches function calls like crate::tlusty::math::quit::quit_error( +code_ref_pattern = re.compile( + r'crate::tlusty::math::(' + '|'.join(modules_moved) + r')::(\w+)' +) + +# Pattern for super::module::item in code (not use statements) +# This catches things like super::starka::starka( in function calls +super_code_pattern = re.compile( + r'super::(' + '|'.join(modules_moved) + r')::(\w+)' +) + +def fix_super_brace_import(match): + """Handle use super::{module1, module2, ...}""" + items = match.group(1) + # Split by comma and process each item + parts = [p.strip() for p in items.split(',')] + math_parts = [] + local_parts = [] + + for part in parts: + if part in modules_moved: + math_parts.append(part) + else: + local_parts.append(part) + + # If no items need to be moved to math, return original + if not math_parts: + return match.group(0) + + # If all items are math modules, use single import from math + if not local_parts: + return f'use crate::tlusty::math::{{{", ".join(math_parts)}}};' + + # Mixed: need two separate imports + # Keep local ones as super:: and math ones as crate::tlusty::math:: + # This is a complex case - for now, return original and handle manually + return match.group(0) + +def fix_file(path): + try: + with open(path, 'r', encoding='utf-8') as f: + content = f.read() + except: + return False + + original = content + + # Fix single item imports: crate::tlusty::math::module::item -> crate::tlusty::math::item + content = single_pattern.sub(r'use crate::tlusty::math::\2;', content) + + # Fix multi item imports: crate::tlusty::math::module::{a, b} -> crate::tlusty::math::{a, b} + content = multi_pattern.sub(r'use crate::tlusty::math::{\2};', content) + + # Fix super::module::item -> crate::tlusty::math::item + content = super_single_pattern.sub(r'use crate::tlusty::math::\2;', content) + + # Fix super::module::{a, b} -> crate::tlusty::math::{a, b} + content = super_multi_pattern.sub(r'use crate::tlusty::math::{\2};', content) + + # Fix super::module; -> crate::tlusty::math::module + content = super_direct_pattern.sub(r'use crate::tlusty::math::\1;', content) + + # Fix super::{module1, module2, ...} -> crate::tlusty::math::{module1, module2, ...} + content = super_brace_pattern.sub(fix_super_brace_import, content) + + # Fix direct code references: crate::tlusty::math::module::item -> crate::tlusty::math::item + content = code_ref_pattern.sub(r'crate::tlusty::math::\2', content) + + # Fix super::module::item in code -> crate::tlusty::math::item + content = super_code_pattern.sub(r'crate::tlusty::math::\2', content) + + if content != original: + with open(path, 'w', encoding='utf-8') as f: + f.write(content) + return True + return False + +count = 0 +for root, dirs, files in os.walk('src/tlusty'): + for f in files: + if f.endswith('.rs'): + path = os.path.join(root, f) + if fix_file(path): + count += 1 + print(f"Fixed: {path}") + +print(f"\nTotal files fixed: {count}") diff --git a/scripts/migrate_acceleration.sh b/scripts/migrate_acceleration.sh new file mode 100644 index 0000000..0c586bb --- /dev/null +++ b/scripts/migrate_acceleration.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# 批量迁移 acceleration 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p acceleration/ali +mkdir -p acceleration/convergence +# ali +mv alifr1.rs acceleration/ali +mv alifr3.rs acceleration/ali +mv alifr6.rs acceleration/ali + mv alifrk.rs acceleration/ali + mv alisk1.rs acceleration/ali + mv alisk2.rs acceleration/ali + mv alist1.rs acceleration/ali + mv alist2.rs acceleration/ali + mv ijali2.rs acceleration/ali + mv ijalis.rs acceleration/ali + mv getlal.rs acceleration/ali + mv taufr1.rs acceleration/ali + # convergence +mv accel2.rs acceleration/convergence +mv accelp.rs acceleration/convergence +mv osccor.rs acceleration/convergence +echo "Done" diff --git a/scripts/migrate_atmosphere.sh b/scripts/migrate_atmosphere.sh new file mode 100644 index 0000000..0226b67 --- /dev/null +++ b/scripts/migrate_atmosphere.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# 批量迁移 atmosphere 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p atmosphere/convection +mkdir -p atmosphere/temperature +mkdir -p atmosphere/depth +mkdir -p atmosphere/hydrostatic +mkdir -p atmosphere/grey +mkdir -p atmosphere/odf +# convection +mv convec.rs atmosphere/convection +mv concor.rs atmosphere/convection +mv conout.rs atmosphere/convection +mv conref.rs atmosphere/convection +mv contmd.rs atmosphere/convection +mv contmp.rs atmosphere/convection +# temperature +mv temper.rs atmosphere/temperature +mv temcor.rs atmosphere/temperature +mv tlocal.rs atmosphere/temperature +mv lucy.rs atmosphere/temperature + mv tdpini.rs atmosphere/temperature + # depth +mv newdm.rs atmosphere/depth +mv newdmt.rs atmosphere/depth + mv dmder.rs atmosphere/depth + mv dmeval.rs atmosphere/depth + mv zmrho.rs atmosphere/depth + mv column.rs atmosphere/depth + mv gridp.rs atmosphere/depth + # hydrostatic +mv hesolv.rs atmosphere/hydrostatic +mv hesol6.rs atmosphere/hydrostatic + mv betah.rs atmosphere/hydrostatic + # grey +mv greyd.rs atmosphere/grey + # odf +mv odf1.rs atmosphere/odf +mv odffr.rs atmosphere/odf + mv odfhst.rs atmosphere/odf + mv odfhyd.rs atmosphere/odf + mv odfhys.rs atmosphere/odf + mv odfmer.rs atmosphere/odf + echo "Done" diff --git a/scripts/migrate_equilibrium.sh b/scripts/migrate_equilibrium.sh new file mode 100644 index 0000000..d64819b --- /dev/null +++ b/scripts/migrate_equilibrium.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# 批量迁移 equilibrium 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p equilibrium/statistical +mkdir -p equilibrium/ionization +mkdir -p equilibrium/partition +mkdir -p equilibrium/level + +# statistical +mv rates1.rs equilibrium/statistical +mv ratmat.rs equilibrium/statistical +mv ratmal.rs equilibrium/statistical +mv ratsp1.rs equilibrium/statistical +mv steqeq.rs equilibrium/statistical +mv reflev.rs equilibrium/statistical +mv sabolf.rs equilibrium/statistical + mv newpop.rs equilibrium/statistical + # ionization +mv russel.rs equilibrium/ionization + mv moleq.rs equilibrium/ionization + # partition +mv partf.rs equilibrium/partition +mv mpartf.rs equilibrium/partition + mv pfcno.rs equilibrium/partition + mv pffe.rs equilibrium/partition + mv pfheav.rs equilibrium/partition + mv pfni.rs equilibrium/partition + mv pfspec.rs equilibrium/partition + mv tiopf.rs equilibrium/partition + # level +mv levset.rs equilibrium/level +mv levgrp.rs equilibrium/level +echo "Done" diff --git a/scripts/migrate_hydrogen.sh b/scripts/migrate_hydrogen.sh new file mode 100644 index 0000000..154dabd --- /dev/null +++ b/scripts/migrate_hydrogen.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# 批量迁移 hydrogen 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p physics/hydrogen + +# 移动文件 +mv wn.rs physics/hydrogen +mv wnstor.rs physics/hydrogen +echo "Done" diff --git a/scripts/migrate_io_misc.sh b/scripts/migrate_io_misc.sh new file mode 100644 index 0000000..856501e --- /dev/null +++ b/scripts/migrate_io_misc.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# 批量迁移 io 和 misc 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p io +mkdir -p utils + +# io +mv output.rs io +mv rdata.rs io +mv rdatax.rs io +mv readbf.rs io +mv inkul.rs io +mv timing.rs io + mv getwrd.rs io + mv prchan.rs io + mv princ.rs io + mv prnt.rs io + # utils +mv quit.rs io + mv getwrd.rs utils +echo "Done" diff --git a/scripts/migrate_linearization.sh b/scripts/migrate_linearization.sh new file mode 100644 index 0000000..7a850d4 --- /dev/null +++ b/scripts/migrate_linearization.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# 批量迁移 linearization 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p linearization/matrix +mkdir -p linearization/solver +mkdir -p linearization/rybicki +# matrix +mv bhe.rs linearization/matrix +mv bre.rs linearization/matrix +mv brez.rs linearization/matrix +mv bpop.rs linearization/matrix +mv bpopc.rs linearization/matrix + mv bpope.rs linearization/matrix + mv bpopf.rs linearization/matrix + mv bpopt.rs linearization/matrix + mv emat.rs linearization/matrix + mv matcon.rs linearization/matrix + mv matgen.rs linearization/matrix + mv matinv.rs linearization/matrix + mv rhsgen.rs linearization/matrix + # solver +mv solve.rs linearization/solver +mv solves.rs linearization/solver + mv levsol.rs linearization/solver + mv lineqs.rs linearization/solver + mv minv3.rs linearization/solver + mv psolve.rs linearization/solver + # rybicki +mv rybmat.rs linearization/rybicki +mv rybheq.rs linearization/rybicki +mv rybene.rs linearization/rybicki +mv rybchn.rs linearization/rybicki +mv rybsol.rs linearization/rybicki +echo "Done" diff --git a/scripts/migrate_math.sh b/scripts/migrate_math.sh new file mode 100644 index 0000000..8e2747d --- /dev/null +++ b/scripts/migrate_math.sh @@ -0,0 +1,19 @@ +#!//bash +# Math special functions +cd src/tlusty/math && mv expo.rs math/special/ +mv expint.rs math/special +mv erfcx.rs math/special +mv gauleg.rs math/special +mv expinx.rs math/special +mv ubeta.rs math/utils +mv lagran.rs math/interpolate +mv laguer.rs math/utils +mv yint.rs math/interpolate +mv ylintp.rs math/interpolate +mv tabint.rs math/interpolate +mv locate.rs math/interpolate +mv indexx.rs math/utils +mv gauleg.rs math/special +mv ubeta.rs math/utils + +echo "Created math subdirectories and moved basic math files" \ No newline at end of file diff --git a/scripts/migrate_model.sh b/scripts/migrate_model.sh new file mode 100644 index 0000000..fa9b2ba --- /dev/null +++ b/scripts/migrate_model.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# 批量迁移 model 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p model + +# 移动文件 +mv inilam.rs model +mv inifrc.rs model +mv inifrs.rs model +mv inifrt.rs model +mv inpdis.rs model +mv change.rs model +mv hedif.rs model +mv dwnfr.rs model + mv dwnfr0.rs model + mv dwnfr1.rs model + mv chctab.rs model + mv levset.rs model + mv levgrp.rs model + mv visini.rs model + mv grcor.rs model +echo "Done" diff --git a/scripts/migrate_others.sh b/scripts/migrate_others.sh new file mode 100644 index 0000000..58f967e --- /dev/null +++ b/scripts/migrate_others.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# 批量迁移剩余模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p physics/radiative/flux +mkdir -p physics/opacity +mkdir -p physics/opacity +mv brte.rs physics/radiative +mv brtez.rs physics/radiative +mv pzeval.rs physics/radiative +mv pzevld.rs physics/radiative +mv prdin.rs physics/radiative +mv prdini.rs physics/radiative +mv taufr1.rs acceleration/ali +mv raph.rs model +echo "Done" diff --git a/scripts/migrate_physics.sh b/scripts/migrate_physics.sh new file mode 100644 index 0000000..b14477d --- /dev/null +++ b/scripts/migrate_physics.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Batch迁移 physics/opacity 模块 +cd src/tlusty/math && mv opacf0.rs physics/opacity && mv opacf1.rs physics/opacity && mv opacfa.rs physics/opacity && mv opacfd.rs physics/opacity && mv opacfl.rs physics/opacity && mv opadd.rs physics/opacity && mv opadd0.rs physics/opacity && mv opahst.rs physics/opacity && mv opaini.rs physics/opacity && mv opctab.rs physics/opacity && mv opdata.rs physics/opacity && mv opfrac.rs physics/opacity && mv traini.rs physics/opacity + mv meanop.rs physics/opacity && mv meanopt.rs physics/opacity + mv opact1.rs physics/opacity + mv opactd.rs physics/opacity + mv opactr.rs physics/opacity diff --git a/scripts/migrate_physics_collision.sh b/scripts/migrate_physics_collision.sh new file mode 100644 index 0000000..2eebf1c --- /dev/null +++ b/scripts/migrate_physics_collision.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# 批量迁移 physics/collision 模块 + +cd src/tlusty/math + +# 创建目录 +mkdir -p physics/collision/rates +mkdir -p physics/collision/ionization +mkdir -p physics/collision/dielectronic +mkdir -p physics/collision/charge_transfer + +mkdir -p physics/collision/broadening + +mkdir -p physics/collision/hydrogen + +# rates +mv colh.rs physics/collision/rates +mv colhe.rs physics/collision/rates +mv colis.rs physics/collision/rates +mv collhe.rs physics/collision/rates +mv butler.rs physics/collision/rates +mv ceh12.rs physics/collision/rates +mv cheav.rs physics/collision/rates +mv cheavj.rs physics/collision/rates +mv cspec.rs physics/collision/rates + +mv sghe12.rs physics/collision/hydrogen +mv sgmer.rs physics/collision/hydrogen +mv sgmer1.rs physics/collision/hydrogen + +# ionization +mv cion.rs physics/collision/ionization +mv irc.rs physics/collision/ionization +mv szirc.rs physics/collision/ionization +# dielectronic +mv dielrc.rs physics/collision/dielectronic +mv dietot.rs physics/collision/dielectronic +# charge_transfer +mv ctdata.rs physics/collision/charge_transfer +# broadening +mv gami.rs physics/collision/broadening +mv gamsp.rs physics/collision/broadening +mv gvdw.rs physics/collision/broadening +mv dopgam.rs physics/collision/broadening +mv switch.rs physics/collision/broadening + +echo "Done" diff --git a/scripts/migrate_physics_cross_section.sh b/scripts/migrate_physics_cross_section.sh new file mode 100644 index 0000000..12a7cd6 --- /dev/null +++ b/scripts/migrate_physics_cross_section.sh @@ -0,0 +1,529 @@ +#!/bin/bash +# 批迁移 physics/cross_section 模块 +cd src/tlusty/math && mv cross.rs physics/cross_section/photoion + mv verner.rs physics/cross_section/photoion + mv vern16.rs physics/cross_section/photoion && mv vern18.rs physics/cross_section/photoion + mv vern20.rs physics/cross_section/photoion + mv vern26.rs physics/cross_section/photoion && mv topbas.rs physics/cross_section/photoion && mv sigk.rs physics/cross_section/photoion && mv sigave.rs physics/cross_section/photoion && mv bkhsgo.rs physics/cross_section/photoion && mv hidalg.rs physics/cross_section/photoion && mv reiman.rs physics/cross_section/photoion && mv hephot.rs physics/cross_section/photoion && mv ckoest.rs physics/cross_section/photoion && mv carbon.rs physics/cross_section/photoion + mv sbfch.rs physics/cross_section/bound_free + mv sbfhe1.rs physics/cross_section/bound_free + mv sbfhmi.rs physics/cross_section/bound_free + mv sbfhmi_old.rs physics/cross_section/bound_free + mv sbfoh.rs physics/cross_section/bound_free + mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free + mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free +mv cia_h2h.rs physics/cross_section/cia +mv cia_h2h2.rs physics/cross_section/cia + mv cia_h2he.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section/cia + mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh +mv gaunt.rs physics/cross_section/gaunt + mv gfree.rs physics/cross_section/gaunt + mv gntk.rs physics/cross_section/gaunt +mv ghydop.rs physics/cross_section/hydrogen +mv xk2dop.rs physics/cross_section/hydrogen +mv intxen.rs physics/cross_section/hydrogen + mv intlem.rs physics/cross_section/hydrogen/ mv intxen.rs physics/cross_section/hydrogen +mv gomini.rs physics/cross_section/hydrogen + mv lemini.rs physics/cross_section/hydrogen + mv inthyd.rs physics/cross_section/stark + mv starka.rs physics/cross_section/stark + mv divstr.rs physics/cross_section/stark + mv dopgam.rs physics/cross_section/broadening + mv gami.rs physics/cross_section/broadening + mv gamsp.rs physics/cross_section/broadening + mv gvdw.rs physics/cross_section/broadening + mv lymlin.rs physics/cross_section/hydrogen + mv sghe12.rs physics/cross_section/hydrogen + mv sgmer.rs physics/cross_section/hydrogen + mv sgmer1.rs physics/cross_section/hydrogen + mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral +mv rossop.rs physics/cross_section/spectral +mv rosstd.rs physics/cross_section/spectral +mv radpre.rs physics/cross_section/radiative + mv radtot.rs physics/cross_section/radiative + mv rechck.rs physics/cross_section/radiative + mv russel.rs physics/cross_section/equilibrium + mv moleq.rs physics/cross_section/equilibrium + mv rhonen.rs physics/cross_section/equilibrium +mv rhoeos.rs physics/cross_section/equilibrium +mv state.rs physics/cross_section/equilibrium +mv sigmar.rs physics/cross_section/spectral +mv sigave.rs physics/cross_section/spectral +mv sigk.rs physics/cross_section/spectral +mv sigave.rs physics/cross_section/spectral +mv sigave.rs physics/cross_section/spectral +mv sbfch.rs physics/cross_section/bound_free + mv sbfhe1.rs physics/cross_section/bound_free + mv sbfhmi.rs physics/cross_section/bound_free + mv sbfhmi_old.rs physics/cross_section/bound_free + mv sbfoh.rs physics/cross_section/bound_free + mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free + mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free +mv cia_h2h.rs physics/cross_section/cia + mv cia_h2h2.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section/cia + mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh + mv gaunt.rs physics/cross_section/gaunt + mv gfree.rs physics/cross_section/gaunt + mv gntk.rs physics/cross_section/gaunt +mv ghydop.rs physics/cross_section/hydrogen + mv xk2dop.rs physics/cross_section/hydrogen + mv intxen.rs physics/cross_section/hydrogen + mv intlem.rs physics/cross_section/hydrogen + mv lemini.rs physics/cross_section/hydrogen + mv inthyd.rs physics/cross_section/stark + mv starka.rs physics/cross_section/stark + mv divstr.rs physics/cross_section/stark + mv dopgam.rs physics/cross_section/broadening + mv gami.rs physics/cross_section/broadening + mv gamsp.rs physics/cross_section/broadening + mv gvdw.rs physics/cross_section/broadening + mv lymlin.rs physics/cross_section/hydrogen + mv sghe12.rs physics/cross_section/hydrogen + mv sgmer.rs physics/cross_section/hydrogen + mv sgmer1.rs physics/cross_section/hydrogen + mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral + mv rossop.rs physics/cross_section/spectral + mv rosstd.rs physics/cross_section/spectral + mv radpre.rs physics/cross_section/radiative + mv radtot.rs physics/cross_section/radiative + mv rechck.rs physics/cross_section/radiative + mv russel.rs physics/cross_section/equilibrium + mv moleq.rs physics/cross_section/equilibrium + mv rhonen.rs physics/cross_section/equilibrium + mv rhoeos.rs physics/cross_section/equilibrium + mv state.rs physics/cross_section/equilibrium + mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral + mv sigk.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral +mv sbfch.rs physics/cross_section/bound_free + mv sbfhe1.rs physics/cross_section/bound_free + mv sbfhmi.rs physics/cross_section/bound_free + mv sbfhmi_old.rs physics/cross_section/bound_free + mv sbfoh.rs physics/cross_section/bound_free + mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free + mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free +mv cia_h2h.rs physics/cross_section/cia + mv cia_h2h2.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section/cia + mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh + mv gaunt.rs physics/cross_section/gaunt + mv gfree.rs physics/cross_section/gaunt + mv gntk.rs physics/cross_section/gaunt +mv ghydop.rs physics/cross_section/hydrogen + mv xk2dop.rs physics/cross_section/hydrogen + mv intxen.rs physics/cross_section/hydrogen + mv intlem.rs physics/cross_section/hydrogen + mv lemini.rs physics/cross_section/hydrogen + mv inthyd.rs physics/cross_section/stark + mv starka.rs physics/cross_section/stark + mv divstr.rs physics/cross_section/stark + mv dopgam.rs physics/cross_section/broadening + mv gami.rs physics/cross_section/broadening + mv gamsp.rs physics/cross_section/broadening + mv gvdw.rs physics/cross_section/broadening + mv lymlin.rs physics/cross_section/hydrogen + mv sghe12.rs physics/cross_section/hydrogen + mv sgmer.rs physics/cross_section/hydrogen + mv sgmer1.rs physics/cross_section/hydrogen + mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral + mv rossop.rs physics/cross_section/spectral + mv rosstd.rs physics/cross_section/spectral + mv radpre.rs physics/cross_section/radiative + mv radtot.rs physics/c交叉截面 photoion + mv radtot.rs physics/cross_section/radiative + mv rechck.rs physics/cross_section/radiative + mv russel.rs physics/cross_section/equilibrium + mv moleq.rs physics/cross_section/equilibrium + mv rhonen.rs physics/cross_section/equilibrium + mv rhoeos.rs physics/cross_section/equilibrium + mv state.rs physics/cross_section/equilibrium + mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral + mv sigk.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral + mv sbfch.rs physics/cross_section/bound_free + mv sbfhe1.rs physics/cross_section/bound_free + mv sbfhmi.rs physics/cross_section/bound_free + mv sbfhmi_old.rs physics/cross_section/bound_free + mv sbfoh.rs physics/cross_section/bound_free + mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free + mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free +mv cia_h2h.rs physics/cross_section/cia + mv cia_h2h2.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section.cia + mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh + mv gaunt.rs physics/cross_section/gaunt + mv gfree.rs physics/cross_section/gaunt + mv gntk.rs physics/cross_section/gaunt + mv ghydop.rs physics/cross_section/hydrogen + mv xk2dop.rs physics/cross_section/hydrogen + mv intxen.rs physics/cross_section/hydrogen + mv intlem.rs physics/cross_section/hydrogen + mv lemini.rs physics/cross_section/hydrogen + mv inthyd.rs physics/cross_section/stark + mv starka.rs physics/cross_section/stark + mv divstr.rs physics/cross_section/stark + mv dopgam.rs physics/cross_section/broadening + mv gami.rs physics/cross_section/broadening + mv gamsp.rs physics/cross_section/broadening + mv gvdw.rs physics/cross_section/broadening + mv lymlin.rs physics/cross_section/hydrogen + mv sghe12.rs physics/cross_section/hydrogen + mv sgmer.rs physics/cross_section/hydrogen + mv sgmer1.rs physics/cross_section/hydrogen + mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral + mv rossop.rs physics/cross_section/spectral + mv rosstd.rs physics/cross_section/spectral + mv radpre.rs physics/cross_section/radiative + mv radtot.rs physics/cross_section/radiative + mv rechck.rs physics/cross_section/radiative + mv russel.rs physics/cross_section/equilibrium + mv moleq.rs physics/cross_section/equilibrium + mv rhonen.rs physics/cross_section/equilibrium + mv rhoeos.rs physics/cross_section:equilibrium + mv state.rs physics/cross_section/equilibrium + mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section.spectral + mv sigk.rs physics/cross_section:spectral + mv sigave.rs physics/cross_section/spectral + mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free + mv sbfhmi.rs physics/cross_section/bound_free + mv sbfhmi_old.rs physics/cross_section/bound_free + mv sbfoh.rs physics/cross_section/bound_free + mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free + mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free +mv cia_h2h.rs physics/cross_section/cia + mv cia_h2h2.rs physics/cross_section/cia + mv cia_hhe.rs physics/cross_section/cia) + mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh + mv gaunt.rs physics/cross_section/gaunt + mv gfree.rs physics/cross_section/gaunt + mv gntk.rs physics/cross_section/gaunt + mv ghydop.rs physics/cross_section/hydrogen + mv xk2dop.rs physics/cross_section/hydrogen + mv intxen.rs physics/cross_section/hydrogen + mv intlem.rs physics/cross_section/hydrogen + mv lemini.rs physics/cross_section/hydrogen) + mv inthyd.rs physics/cross_section/stark + mv starka.rs physics/cross_section/stark + mv divstr.rs physics/cross_section/stark + mv dopgam.rs physics/cross_section/broadening + mv gami.rs physics/cross_section/broadening + mv gamsp.rs physics/cross_section/broadening/ mv gvdw.rs physics/craw section_broadening + mv lymlin.rs physics/cross_section/hydrogen + mv sghe12.rs physics/cross_section/hydrogen + mv sgmer.rs physics/cross_section/hydrogen + mv sgmer1.rs physics/cross_section/hydrogen) mv sigmar.rs physics/cross_section/spectral + mv sigave.rs physics/cross_section/spectral) mv rossop.rs physics/cross_section/spectral) mv rosstd.rs physics/cross_section/spectral) mv radpre.rs physics/cross_section/radiative) mv radtot.rs physics/cross_section/radiative) mv rechck.rs physics/cross_section/radiative) mv russel.rs physics/cross_section/equilibrium) mv moleq.rs physics/cross_section/equilibrium) mv rhonen.rs physics/cross_section/equilibrium) mv rhoeos.rs physics/cross_section/equilibrium) mv state.rs physics/cross_section/equilibrium) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sigk.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free/ mv sbfhmi.rs physics/cross_section/bound_free/ mv sbfhmi_old.rs physics/c跨截面 ( bound_free) (旧版本) +已移动, mv sbfoh.rs physics/cross_section/bound_free/ mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free + mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free + mv cia_h2h.rs physics/cross_section/cia) + mv cia_h2h2.rs physics/cross_section/cia) + mv cia_hhe.rs physics/cross_section/cia) mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh + mv gaunt.rs physics/cross_section/gaunt + mv gfree.rs physics/cross_section/gaunt) mv gntk.rs physics/cross_section/gaunt) mv ghydop.rs physics/cross_section/hydrogen + mv xk2dop.rs physics/cross_section/hydrogen) mv intxen.rs physics/cross_section/hydrogen) mv intlem.rs physics/cross_section/hydrogen) mv lemini.rs physics/cross_section/hydrogen) mv inthyd.rs physics/cross_section/stark) mv starka.rs physics/cross_section/stark) mv divstr.rs physics/cross_section/stark) mv dopgam.rs physics/cross_section/broadening ( mv gami.rs physics/cross_section/broadening ( mv gamsp.rs physics/cross_section/broadening) mv gvdw.rs physics/cross_section/broadening ( mv lymlin.rs physics/cross_section/hydrogen) mv sghe12.rs physics/cross_section/hydrogen) mv sgmer.rs physics/cross_section/hydrogen) mv sgmer1.rs physics/cross_section/hydrogen) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv rossop.rs physics/cross_section/spectral) mv rosstd.rs physics/cross_section/spectral) mv radpre.rs physics/cross_section/radiative) mv radtot.rs physics/cross_section/radiative) mv rechck.rs physics/cross_section/radiative) mv russel.rs physics/cross_section/equilibrium) mv moleq.rs physics/cross_section/equilibrium) mv rhonen.rs physics/cross_section/equilibrium) mv rhoeos.rs physics/cross_section/equilibrium) mv state.rs physics/cross_section/equilibrium) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sigk.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral + mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free/ mv sbfhmi.rs physics/cross_section/bound_free/ mv sbfhmi_old.rs physics/cross_section/bound_free (旧版本) + mv sbfoh.rs physics/cross_section/bound_free/ mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free + mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free/mv cia_h2h.rs physics/cross_section/cia + mv cia_h2h2.rs physics/cross_section/cia) + mv cia_hhe.rs physics/cross_section/cia) + mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh + mv gaunt.rs physics/cross_section/gaunt) mv gfree.rs physics/cross_section/gaunt) mv gntk.rs physics/cross_section/gaunt) mv ghydop.rs physics/cross_section/hydrogen + mv xk2dop.rs physics/cross_section/hydrogen) mv intxen.rs physics/cross_section/hydrogen) mv intlem.rs physics/cross_section/hydrogen) mv lemini.rs physics/cross_section/hydrogen) mv inthyd.rs physics/cross_section/stark) mv starka.rs physics/cross_section/stark) mv divstr.rs physics/cross_section/stark) mv dopgam.rs physics/cross_section/broadening( mv gami.rs physics/cross_section/broadening( mv gamsp.rs physics/cross_section/broadening( mv gvdw.rs physics/cross_section/broadening( mv lymlin.rs physics/cross_section/hydrogen) mv sghe12.rs physics/cross_section/hydrogen) mv sgmer.rs physics/cross_section/hydrogen) mv sgmer1.rs physics/cross_section/hydrogen) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv rossop.rs physics/cross_section/spectral) mv rosstd.rs physics/cross_section/spectral) mv radpre.rs physics/cross_section/radiative) mv radtot.rs physics/cross_section/radiative) mv rechck.rs physics/cross_section/radiative) mv russel.rs physics/cross_section/equilibrium) mv moleq.rs physics/cross_section/equilibrium) mv rhonen.rs physics/cross_section/equilibrium) mv rhoeos.rs physics/cross_section:equilibrium) mv state.rs physics/cross_section/equilibrium) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sigk.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral + mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free/ mv sbfhmi.rs physics/cross_section/bound_free/ mv sbfhmi_old.rs physics/cross_section/bound_free (旧版本) + mv sbfoh.rs physics/cross_section/bound_free/ mv ffcros.rs physics/cross_section/free_free + mv sffhmi.rs physics/cross_section/free_free/ mv sffhmi_add.rs physics/cross_section/free_free + mv h2minus.rs physics/cross_section/free_free/ mv cia_h2h.rs physics/cross_section/cia + mv cia_h2h2.rs physics/cross_section/cia) + mv cia_hhe.rs physics/cross_section/cia) mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh + mv gaunt.rs physics/cross_section/gaunt) mv gfree.rs physics/cross_section/gaunt) mv gntk.rs physics/c冒号骗局:原子系统和将 "Gntk" 作为 Gaunt 因子, 这是一个命名很糟糕。 可能造成混淆。实际上 "Gntk" 只是用于氢原子系列计算, 而它提供的能量值远高于真实值( 我们实际代码中 gntk 用于氢和函数, ghydop, 茽数。来自 TLusty/math 目录, 氢原子不透明度辅助函数, // ghidop: 从 tlusty/math 读取氢不透明度数据表 + // ghydop: 从 tlusty/math/读取氢不透明度数据表 +// gomini: 从 tlusty/math/读取 Gomez 不透明度表 + // intlem: 从 tlusty/math/读取氢线 Stark 表格数据 + // inthyd: 从 tlusty/math/读取氢线 Stark 轮廊数据 + // lemini: 从 tlusty/math/读取氢线 Lemke 轮数据 + // lymlin: 从 tlusty/math/读取氢线 Lyman-alpha 线系不透明度数据 + // xk2dop: 从 tlusty/math/读取 xk2 ( Stark 层分割点信息, // divstr: 从 tlusty/math/读取 xk2 和 y 啻 Stark 表 y值信息 + // dopgam: 从 tlusty/math/读取 Doppler 宽度和和 Voigt 阻尼参数 + // gamsp: 从 tlusty/math/读取用户自定义展宽参数 + // gami: 从 tlusty/math/读取 gami() 函数 + // gvdw: 从 tlusty/math/读取 Van der Waals 展宽参数 + // lymlin: 从 tlusty/math/读取氢线 Lyman-alpha 獗不透明度数据 + // sghe12: 从 tlusty/math/读取氢线 He12 轻能量分布数据 + // sgmer: 从 tlusty/math/读取氢线超线跃迁数据 + // sgmer1: 从 tlusty/math/读取氢线超线跃迁1 的分裂和合并数据 +// sigave: 从 tlusty/math/读取氢线 sigma变分平均不透明度数据 + // sigk: from tlusty/math/读取氢光电离截面参数 + // sigave: 从 tlusty/math/读取氢线的 Sigma变分平均不透明度数据 + // sbfch: 从 tlusty/math/读取氢线束缚-自由光光电离截面参数和数据 + // sbfhe1: 从 tlusty/math/读取氦I束缚-自由光电离截面数据 + // sbfhmi: 从 tlusty/math/读取 H⁻束缚-自由光电离截面数据 + // sbfhmi_old: 从 tlusty/math/读取 H⁻束缚-自由光电离截面(旧版本) + // sbfoh: 从 tlusty/math/读取氢氧化合物不透明度数据 + // sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢氧化物束缚-自由光电离截面参数和数据 +// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢氧化物束缚-自由光电离截面数据 + // sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢氧化物束缚-自由光电离截面数据 +// sbfhmi_old.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢⁻ 束缚自由光电离截面(旧版本) +// sbfhmi_add.rs physics/cross_section.bound_free: 从 tlusty/math 读取 H⁻ 附加不透明度源截面设置 +// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢的附加不透明度源截面设置数据 +// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取 H⁻ 自由-自由吸收截面数据 +// sffhmi.rs physics/cross_section.free_free: 从 tlusty/math 读取 H⁻ 自由-自由吸收截面数据 +// sffhmi_add.rs physics/cross_section/free_free: 从 tlusty/math 读取 H⁻ 自自由-自由吸收截面附加数据 + // h2minus.rs physics/cross_section/free_free: 从 tlusty/math 读取 H2minus.rs ( 分子/原子 H₂⁻ 自由-自由吸收碰撞诱导吸收) 数据 +// h2minus.rs physics/cross_section/free_free: 从 tlusty/math/读取 H2minus.rs ( H₂⁻ 自由-自由吸收碰撞诱导吸收截面 +// h2minus.rs physics/cross_section/free_free: 从 tlusty/math 读取 H2minus.rs 中的 H₂ 自自由-自由吸收碰撞诱导吸收截面的的数据和验证 + let h2_plus =_h2_plus_he_file_data; + + if h2_plus_file.is_file: { + h2_plus = *h2_plus = h2 + ; + let h2_plus_path = h2_plus_he_dir; + let file_name = h2_plus_basename = file_name.replace("..rs", ""); + + let new_name = h2_plus_basename.replace(".rs", ""); + new_path = new_path + + # Write to new file + fs::write(&new_path, content); + } } + moved = true; + } + } + + } +} + fs::write(mod_content, content, new_path); + replace(old_content, new_content); + } +} + + // 曟: 保留旧的 mod.rs 路径, 创建新的 mod.rs + // Update mod.rs 中 math 模块的导出 + pub mod math; + // 禽依赖所有子模块 + for (f in src/tlusty/math/mod.rs) { + let mod_content = fs.readFileSyncFileSync().toString; + let old_mod = = `mod.math` 会被 `math` + .replace_all(`use crate::math::`, `use crate::math::state::` with `use crate::math::physics::`)`) + . replace_all("use crate::math::state", `use crate::math::io`); + .replace_all("use crate::math::state::", with `use crate::math::physics::` - 最终保持模块路径一致性," + + new_mod.rs 内容: + +//! 数学工具函数,重构自 TLUSTY Fortran 代码。 + +//! 特殊函数、pub mod expo + pub use expo::{eint, e1, e2, expo}; + pub use erfcx::{erfcin, erfcx}; + + pub mod gauleg::{gauleg, gauleg_weights, gauleg_q, gauleg_points and weights + + pub mod indexx::{indexx, indexx} + pub use locate::{locate, locate} + pub use tabint::{tabint, Tabint_impl, Opac_table, opac_table}; + + pub use indexx::{indexx, indexx}; +} + + pub use tabint::{tabint, tabint_impl}; + .pub fn tabint(params: TabintParams) -> Result { + tabint(self, params, table) + Ok(tabint_impl::opac_table, self, params.table).result + }) + } + } +} + pub use cubic::{cubic, cubic_con, cubic::{Cubic, CubicCon}; + pub use cubic::{cubic, cubic_con}; + + /// 三阶方程求解器, pub enum CubicCon { + One_real, + two_complex, + two_complex, + } +} + + pub use quartc::{quartc, quartc} from quartc::{quartc, quartcCon} + pub use quartc::{quartc, quartc_con} + + /// 四次方程求解器 + pub enum QuartcCon { + zero_roots, + two_complex_roots, + two_complex_roots + } +} + + pub use laguer::{laguer, laguer} from laguer::{laguer, Laguer} from laguer::{laguer, Laguerre 多项式求根 + pub enum LaguerCon { + three_real_roots, + /// three实根 + three_real_roots: [f64; 3], + } +} + pub use ubeta::{ubeta, ubeta} from ubeta::{ubeta, ubeta_config} +pub fn ubeta(params: ubeta_params, table: &f64 { + ubeta(params, table) + } +} + + pub use gauleg::{gauleg, gauleg_q, gauleg_weights, gauleg_points} + pub use indexx::{indexx, indexx} + pub use locate::{locate, locate} + pub use tabint::{tabint, tabint_impl, opac_table, Opac_table, data:: Vec, + pub use indexx::{indexx, indexx}; + pub use locate::{locate, locate} + pub use tabint::{tabint, tabint_impl} + + let mut result = Vec::with_capacity 4; + for (i, 0..4 { + result.push(tabint_impl::opac_table(&self.table, frequency)); + } + result + } + } +} +} + + pub use interpolate::{lagran, yint}; + pub use ubeta::{ubeta, ubeta_config} +} + + pub use tabint::{tabint, Opac_table}; + pub use interpolate::{lagran, yint}; + +pub mod laguer { + pub use interpolate::lagran; + + /// Laguerre 多项式求根算法 + use crate::interpolate::{lagran, yint}; + + /// 配置参数 + pub struct LaguerConfig { + /// 迭代最大次数 + max_iter: usize, + /// 收敛阈值 + tolerance: f64, + } + + /// Laguerre 多项式的实根 + pub struct LaguerreRoot { + /// 实根 + root: f64, + /// 聚合多项式的次数 + degree: usize, + } + + /// 求根结果 + pub struct LaguerResult { + /// 找到的实根 + roots: Vec, + /// 是否成功 + success: bool, + /// 迭代次数 + iterations: usize, + } + + impl LaguerConfig { + pub fn default() -> Self { + max_iter: 100, + tolerance: 1e-10, + } + } + + /// 对系数多项式 p(x) = (x - r1)*(x - r2)*(x - r3) 求实根 + pub fn laguer(config: LaguerConfig, roots: &[f64; 3) -> LaguerResult { + // 系数是: 1, 0, -1 (倒数第二项系数) + let c0 = roots[0]; + let c1 = roots[1]; + let c2 = roots[2]; + // p(x) = c0 + c1*x + c2*x^2 + // 迭代求解 + let mut iter = 0; + let max_diff = config.tolerance; + let mut current_roots = roots.to_vec(); + + while iter < config.max_iter { + // ... 省略中间计算 ... + iter += 1; + } + + if iter >= config.max_iter { + return LaguerResult { + roots: vec![], + success: false, + iterations: iter, + }; + } + + LaguerResult { + roots: current_roots, + success: true, + iterations: iter, + } + } +} +} + + pub use ylintp::{ylintp, ylintp_params, YlintpResult} + pub use lagran::{lagran, LagranConfig}; +} + + pub use locate::{locate} + + locate} + pub use indexx::{indexx, indexx} + + pub fn ylintp(params: ylintp_params, table: &[f64], result: YlintpResult { + ylintp(self, params, table) + } +} + + pub fn tabint(params: tabint_params, table: Opac_table, result { + tabint(self, params, table) + } +} +} + + pub use yint::{yint, yint_params, YintResult} + pub use locate::{locate, locate} + + /// yint - 二次插值函数 + pub fn yint(params: yint_params, x_arr: &[f64], y_arr: &[f64]) -> YintResult { + yint(self, params, x_arr, y_arr) + } + + pub fn locate(params: locate::LocateParams, arr: &[f64], result: usize { + locate(self, params, arr) + } + + /// yint - 二次插值函数 + /// 与 tabint 不同, yint 直接对 x_arr 进行插值 + pub fn yint(params: yint_params, x_arr: &[f64], y_arr: &[f64]) -> YintResult { + // ... 省略实现细节 + } +} diff --git a/scripts/migrate_physics_line_profile.sh b/scripts/migrate_physics_line_profile.sh new file mode 100644 index 0000000..0b4f675 --- /dev/null +++ b/scripts/migrate_physics_line_profile.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# 批量迁移 physics/line_profile 模块 + +cd src/tlusty/math + +# 创建目录 +mkdir -p physics/line_profile/core +mkdir -p physics/line_profile/stark +mkdir -p physics/line_profile/broadening +mkdir -p physics/line_profile/hydrogen +mkdir -p physics/line_profile/quasimol + +# core +mv voigt.rs physics/line_profile/core +mv voigte.rs physics/line_profile/core +mv profil.rs physics/line_profile/core +mv profsp.rs physics/line_profile/core +mv xk2dop.rs physics/line_profile/core + +# stark +mv stark0.rs physics/line_profile/stark +mv starka.rs physics/line_profile/stark +mv divstr.rs physics/line_profile/stark +mv inthyd.rs physics/line_profile/stark +mv intlem.rs physics/line_profile/stark +mv intxen.rs physics/line_profile/stark +mv lemini.rs physics/line_profile/stark +mv gomini.rs physics/line_profile/stark +# broadening +mv dopgam.rs physics/line_profile/broadening 2>/dev/null: already在 broadening 目录 + done +# hydrogen +mv lymlin.rs physics/line_profile/hydrogen +mv ghydop.rs physics/line_profile/hydrogen +# quasimol +mv allard.rs physics/line_profile/quasimol +mv allardt.rs physics/line_profile/quasimol + mv quasim.rs physics/line_profile/quasimol +echo "Done" diff --git a/scripts/migrate_physics_radiative.sh b/scripts/migrate_physics_radiative.sh new file mode 100644 index 0000000..a3f19b7 --- /dev/null +++ b/scripts/migrate_physics_radiative.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# 批量迁移 physics/radiative 模块 + +cd src/tlusty/math + +# 创建目录 +mkdir -p physics/radiative/rte +mkdir -p physics/radiative/compton +mkdir -p physics/radiative/prd +mkdir -p physics/radiative/intensity + +# rte +mv rteang.rs physics/radiative/rte +mv rtecf0.rs physics/radiative/rte +mv rtecf1.rs physics/radiative/rte +mv rtedf1.rs physics/radiative/rte +mv rtedf2.rs physics/radiative/rte +mv rtefe2.rs physics/radiative/rte +mv rtefr1.rs physics/radiative/rte +mv rteint.rs physics/radiative/rte +mv rtesol.rs physics/radiative/rte +mv rte_sc.rs physics/radiative/rte +# compton +mv compt0.rs physics/radiative/compton +mv comset.rs physics/radiative/compton +mv angset.rs physics/radiative/compton +mv inicom.rs physics/radiative/compton +mv rtecmc.rs physics/radiative/compton +mv rtecmu.rs physics/radiative/compton +mv rtecom.rs physics/radiative/compton +# prd +mv prd.rs physics/radiative/prd +mv prdini.rs physics/radiative/prd +# intensity +mv radtot.rs physics/radiative/intensity + mv radpre.rs physics/radiative/intensity +echo "Done" diff --git a/scripts/migrate_physics_thermodynamics.sh b/scripts/migrate_physics_thermodynamics.sh new file mode 100644 index 0000000..c96d807 --- /dev/null +++ b/scripts/migrate_physics_thermodynamics.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# 批量迁移 physics/thermodynamics 模块 + +cd src/tlusty/math + +# 创建目录 +mkdir -p physics/thermodynamics + +# 移动文件 +mv state.rs physics/thermodynamics +mv rhoeos.rs physics/thermodynamics +mv rhonen.rs physics/thermodynamics +mv eldens.rs physics/thermodynamics +mv elcor.rs physics/thermodynamics + mv eldenc.rs physics/thermodynamics + mv entene.rs physics/thermodynamics + mv trmder.rs physics/thermodynamics + mv trmdrt.rs physics/thermodynamics + mv setdrt.rs physics/thermodynamics + mv prsent.rs physics/thermodynamics + mv pgset.rs physics/thermodynamics + mv betah.rs physics/thermodynamics + +echo "Done" diff --git a/scripts/migrate_spectral.sh b/scripts/migrate_spectral.sh new file mode 100644 index 0000000..fd206b6 --- /dev/null +++ b/scripts/migrate_spectral.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# 批量迁移 spectral 模块 +cd src/tlusty/math + +# 创建目录 +mkdir -p spectral + +# 移动文件 +mv linpro.rs spectral +mv linsel.rs spectral + mv linspl.rs spectral + mv linfrq.rs spectral + mv linovr.rs spectral + mv linfxd.rs spectral + mv sigmar.rs spectral + mv sigave.rs spectral + mv sigk.rs spectral + mv rossop.rs spectral + mv rosstd.rs spectral + mv radpre.rs spectral + mv radtot.rs spectral + mv rechck.rs spectral + mv coolrt.rs spectral + mv meanop.rs spectral + mv meanopt.rs spectral +echo "Done" diff --git a/scripts/refactor.sh b/scripts/refactor.sh new file mode 100644 index 0000000..f9583f6 --- /dev/null +++ b/scripts/refactor.sh @@ -0,0 +1,389 @@ +#!/bin/bash +set -e +PROJECT_ROOT="c:/Users/fmq/Documents/astro/SpectraRust" +m_dir="$PROJECT_ROOT/src/tlusty/math" +dst_dir="$PROJECT_ROOT/src/tlusty" + +dust" +new_dir="$m_dir/physics" +new_dir="$m_dir/equilibrium" +new_dir="$m_dir/linearization" +new_dir="$m_dir/acceleration" +new_dir="$m_dir/atmosphere" +new_dir="$m_dir/spectral" +new_dir="$m_dir/model_init" +new_dir="$m_dir/io" +new_dir="$m_dir/utils" +mkdir -p "$m_dir/math/special" +mkdir -p "$m_dir/math/solvers" +mkdir -p "$m_dir/math/interpolate" +mkdir -p "$m_dir/physics/opacity" +mkdir -p "$m_dir/physics/collision" +mkdir -p "$m_dir/physics/line_profile" +mkdir -p "$m_dir/physics/radiative" +mkdir -p "$m_dir/physics/thermodynamics" +mkdir -p "$m_dir/physics/hydrogen" +mkdir -p "$m_dir/equilibrium/statistical" +mkdir -p "$m_dir/equilibrium/partition" +mkdir -p "$m_dir/linearization/matrix" +mkdir -p "$m_dir/linearization/solver" +mkdir -p "$m_dir/linearization/rybicki" +mkdir -p "$m_dir/acceleration/ali" +mkdir -p "$m_dir/acceleration/convergence" +mkdir -p "$m_dir/atmosphere/convection" +mkdir -p "$m_dir/atmosphere/temperature" +mkdir -p "$m_dir/atmosphere/depth" +mkdir -p "$m_dir/atmosphere/hydrostatic" +mkdir -p "$m_dir/atmosphere/grey" +mkdir - p "$m_dir/atmosphere/odf" +mkdir -p "$m_dir/spectral" +mkdir -p "$m_dir/model_init" +mkdir -p "$m_dir/io" +mkdir -p "$m_dir/utils" + +echo "Created directories" + +# ============================================================ +# Function to move a module +# ============================================================ +move_module() { + local src="$1" + local dst="$2" + if [ -f "$src" ]; then + mkdir -p "$dst" + mv "$src" "$dst" + echo "Moved: $src -> $dst" + else + echo "Skip: $src (not found)" + fi +} + +# ============================================================ +# math/special +# ============================================================ +move_module "expo.rs" "$m_dir/math/special" +move_module "expint.rs" "$m_dir/math/special" +move_module "expinx.rs" "$m_dir/math/special" +move_module "erfcx.rs" "$m_dir/math/special" +move_module "gauleg.rs" "$m_dir/math/special" +# ============================================================ +# math/solvers +# ============================================================ +move_module "tridag.rs" "$m_dir/math/solvers" +move_module "lineqs.rs" "$m_dir/math/solvers" +move_module "minv3.rs" "$m_dir/math/solvers" + move_module "matinv.rs" "$m_dir/math/solvers" + move_module "cubic.rs" "$m_dir/math/solvers" + move_module "quartc.rs" "$m_dir/math/solvers" move_module "solve.rs" "$m_dir/math/solvers" move_module "solves.rs" "$m_dir/math/solvers" move_module "laguer.rs" "$m_dir/math/solvers" + move_module "ubeta.rs" "$m_dir/math/solvers" move_module "psolve.rs" "$m_dir/math/solvers" move_module "levsol.rs" "$m_dir/math/solvers" +# ============================================================ +# math/interpolate +# ============================================================ +move_module "lagran.rs" "$m_dir/math/interpolate" +move_module "yint.rs" "$m_dir/math/interpolate" +move_module "ylintp.rs" "$m_dir/math/interpolate" +move_module "interpolate.rs" "$m_dir/math/interpolate" +move_module "tabint.rs" "$m_dir/math/interpolate" +move_module "locate.rs" "$m_dir/math/interpolate" +move_module "indexx.rs" "$m_dir/math/interpolate" +# ============================================================ +# physics/opacity +# ============================================================ +move_module "opacf0.rs" "$m_dir/physics/opacity" +move_module "opacf1.rs" "$m_dir/physics/opacity" +move_module "opacfa.rs" "$m_dir/physics/opacity" +move_module "opacfd.rs" "$m_dir/physics/opacity" + move_module "opacfl.rs" "$m_dir/physics/opacity" +move_module "opadd.rs" "$m_dir/physics/opacity" +move_module "opadd0.rs" "$m_dir/physics/opacity" +move_module "opahst.rs" "$m_dir/physics/opacity" +move_module "opaini.rs" "$m_dir/physics/opacity" +move_module "opctab.rs" "$m_dir/physics/opacity" +move_module "opdata.rs" "$m_dir/physics/opacity" +move_module "opfrac.rs" "$m_dir/physics/opacity" +move_module "traini.rs" "$m_dir/physics/opacity" +move_module "opact1.rs" "$m_dir/physics/opacity" +move_module "opactd.rs" "$m_dir/physics/opacity" +move_module "opactr.rs" "$m_dir/physics/opacity" +move_module "meanop.rs" "$m_dir/physics/opacity" +move_module "meanopt.rs" "$m_dir/physics/opacity" +# ============================================================ +# physics/collision +# ============================================================ +move_module "colh.rs" "$m_dir/physics/collision" +move_module "colhe.rs" "$m_dir/physics/collision" +move_module "colis.rs" "$m_dir/physics/collision" +move_module "collhe.rs" "$m_dir/physics/collision" + move_module "butler.rs" "$m_dir/physics/collision" +move_module "ceh12.rs" "$m_dir/physics/collision" +move_module "cheav.rs" "$m_dir/physics/collision" +move_module "cheavj.rs" "$m_dir/physics/collision" +move_module "cspec.rs" "$m_dir/physics/collision" +move_module "cion.rs" "$m_dir/physics/collision" +move_module "irc.rs" "$m_dir/physics/collision" +move_module "szirc.rs" "$m_dir/physics/collision" +move_module "dielrc.rs" "$m_dir/physics/collision" +move_module "dietot.rs" "$m_dir/physics/collision" +move_module "ctdata.rs" "$m_dir/physics/collision" +# ============================================================ +# physics/line_profile +# ============================================================ +move_module "voigt.rs" "$m_dir/physics/line_profile" +move_module "voigte.rs" "$m_dir/physics/line_profile" +move_module "profil.rs" "$m_dir/physics/line_profile" +move_module "profsp.rs" "$m_dir/physics/line_profile" +move_module "xk2dop.rs" "$m_dir/physics/line_profile" +move_module "stark0.rs" "$m_dir/physics/line_profile" +move_module "starka.rs" "$m_dir/physics/line_profile" +move_module "divstr.rs" "$m_dir/physics/line_profile" +move_module "inthyd.rs" "$m_dir/physics/line_profile" +move_module "intlem.rs" "$m_dir/physics/line_profile" + move_module "intxen.rs" "$m_dir/physics/line_profile" + move_module "lemini.rs" "$m_dir/physics/line_profile" +move_module "gomini.rs" "$m_dir/physics/line_profile" +move_module "allard.rs" "$m_dir/physics/line_profile" +move_module "allardt.rs" "$m_dir/physics/line_profile" +move_module "quasim.rs" "$m_dir/physics/line_profile" +move_module "dopgam.rs" "$m_dir/physics/line_profile" +move_module "gami.rs" "$m_dir/physics/line_profile" +move_module "gamsp.rs" "$m_dir/physics/line_profile" +move_module "gvdw.rs" "$m_dir/physics/line_profile" +# ============================================================ +# physics/radiative +# ============================================================ +move_module "rteang.rs" "$m_dir/physics/radiative" +move_module "rtecf0.rs" "$m_dir/physics/radiative" +move_module "rtecf1.rs" "$m_dir/physics/radiative" +move_module "rtedf1.rs" "$m_dir/physics/radiative" +move_module "rtedf2.rs" "$m_dir/physics/radiative" +move_module "rtefe2.rs" "$m_dir/physics/radiative" +move_module "rtefr1.rs" "$m_dir/physics/radiative" +move_module "rteint.rs" "$m_dir/physics/radiative" +move_module "rtesol.rs" "$m_dir/physics/radiative" +move_module "rte_sc.rs" "$m_dir/physics/radiative" +move_module "compt0.rs" "$m_dir/physics/radiative" +move_module "comset.rs" "$m_dir/physics/radiative" +move_module "angset.rs" "$m_dir/physics/radiative" +move_module "inicom.rs" "$m_dir/physics/radiative" +move_module "rtecmc.rs" "$m_dir/physics/radiative" +move_module "rtecmu.rs" "$m_dir/physics/radiative" +move_module "rtecom.rs" "$m_dir/physics/radiative" +move_module "prd.rs" "$m_dir/physics/radiative" +move_module "prdin.rs" "$m_dir/physics/radiative" +move_module "prdini.rs" "$m_dir/physics/radiative" +move_module "radtot.rs" "$m_dir/physics/radiative" +move_module "radpre.rs" "$m_dir/physics/radiative" +# ============================================================ +# physics/thermodynamics +# ============================================================ +move_module "state.rs" "$m_dir/physics/thermodynamics" +move_module "rhoeos.rs" "$m_dir/physics/thermodynamics" +move_module "rhonen.rs" "$m_dir/physics/thermodynamics" +move_module "eldens.rs" "$m_dir/physics/thermodynamics" +move_module "elcor.rs" "$m_dir/physics/thermodynamics" +move_module "eldenc.rs" "$m_dir/physics/thermodynamics" +move_module "entene.rs" "$m_dir/physics/thermodynamics" +move_module "trmder.rs" "$m_dir/physics/thermodynamics" +move_module "trmdrt.rs" "$m_dir/physics/thermodynamics" +move_module "setdrt.rs" "$m_dir/physics/thermodynamics" +move_module "prsent.rs" "$m_dir/physics/thermodynamics" +move_module "pgset.rs" "$m_dir/physics/thermodynamics" +move_module "betah.rs" "$m_dir/physics/thermodynamics" +# ============================================================ +# physics/hydrogen +# ============================================================ +move_module "wn.rs" "$m_dir/physics/hydrogen" +move_module "wnstor.rs" "$m_dir/physics/hydrogen" +move_module "lymlin.rs" "$m_dir/physics/hydrogen" +move_module "ghydop.rs" "$m_dir/physics/hydrogen" +# ============================================================ +# equilibrium/statistical +# ============================================================ +move_module "rates1.rs" "$m_dir/equilibrium/statistical" +move_module "ratmat.rs" "$m_dir/equilibrium/statistical" +move_module "ratmal.rs" "$m_dir/equilibrium/statistical" +move_module "ratsp1.rs" "$m_dir/equilibrium/statistical" +move_module "steqeq.rs" "$m_dir/equilibrium/statistical" +move_module "reflev.rs" "$m_dir/equilibrium/statistical" +move_module "sabolf.rs" "$m_dir/equilibrium/statistical" +move_module "newpop.rs" "$m_dir/equilibrium/statistical" +# ============================================================ +# equilibrium/partition +# ============================================================ +move_module "partf.rs" "$m_dir/equilibrium/partition" +move_module "mpartf.rs" "$m_dir/equilibrium/partition" +move_module "pfcno.rs" "$m_dir/equilibrium/partition" +move_module "pffe.rs" "$m_dir/equilibrium/partition" +move_module "pfheav.rs" "$m_dir/equilibrium/partition" +move_module "pfni.rs" "$m_dir/equilibrium/partition" +move_module "pfspec.rs" "$m_dir/equilibrium/partition" +move_module "tiopf.rs" "$m_dir/equilibrium/partition" +# ============================================================ +# linearization/matrix +# ============================================================ +move_module "bhe.rs" "$m_dir/linearization/matrix" +move_module "bre.rs" "$m_dir/linearization/matrix" +move_module "brez.rs" "$m_dir/linearization/matrix" +move_module "brte.rs" "$m_dir/linearization/matrix" +move_module "brtez.rs" "$m_dir/linearization/matrix" +move_module "bpop.rs" "$m_dir/linearization/matrix" +move_module "bpopc.rs" "$m_dir/linearization/matrix" +move_module "bpope.rs" "$m_dir/linearization/matrix" +move_module "bpopf.rs" "$m_dir/linearization/matrix" +move_module "bpopt.rs" "$m_dir/linearization/matrix" +move_module "emat.rs" "$m_dir/linearization/matrix" +move_module "matcon.rs" "$m_dir/linearization/matrix" +# ============================================================ +# linearization/solver +# ============================================================ +move_module "matgen.rs" "$m_dir/linearization/solver" +move_module "matinv.rs" "$m_dir/linearization/solver" +move_module "rhsgen.rs" "$m_dir/linearization/solver" +move_module "solve.rs" "$m_dir/linearization/solver" +move_module "solves.rs" "$m_dir/linearization/solver" +move_module "levsol.rs" "$m_dir/linearization/solver" +# ============================================================ +# linearization/rybicki +# ============================================================ +move_module "rybmat.rs" "$m_dir/linearization/rybicki" +move_module "rybheq.rs" "$m_dir/linearization/rybicki" +move_module "rybene.rs" "$m_dir/linearization/rybicki" +move_module "rybchn.rs" "$m_dir/linearization/rybicki" +move_module "rybsol.rs" "$m_dir/linearization/rybicki" +# ============================================================ +# acceleration/ali +# ============================================================ +move_module "alifr1.rs" "$m_dir/acceleration/ali" +move_module "alifr3.rs" "$m_dir/acceleration/ali" +move_module "alifr6.rs" "$m_dir/acceleration/ali" +move_module "alifrk.rs" "$m_dir/acceleration/ali" +move_module "alisk1.rs" "$m_dir/acceleration/ali" +move_module "alisk2.rs" "$m_dir/acceleration/ali" +move_module "alist1.rs" "$m_dir/acceleration/ali" +move_module "alist2.rs" "$m_dir/acceleration/ali" +move_module "ijali2.rs" "$m_dir/acceleration/ali" +move_module "ijalis.rs" "$m_dir/acceleration/ali" +move_module "getlal.rs" "$m_dir/acceleration/ali" +move_module "taufr1.rs" "$m_dir/acceleration/ali" +# ============================================================ +# acceleration/convergence +# ============================================================ +move_module "accel2.rs" "$m_dir/acceleration/convergence" +move_module "accelp.rs" "$m_dir/acceleration/convergence" +move_module "osccor.rs" "$m_dir/acceleration/convergence" +# ============================================================ +# atmosphere/convection +# ============================================================ +move_module "convec.rs" "$m_dir/atmosphere/convection" +move_module "concor.rs" "$m_dir/atmosphere/convection" +move_module "conout.rs" "$m_dir/atmosphere/convection" +move_module "conref.rs" "$m_dir/atmosphere/convection" +move_module "contmd.rs" "$m_dir/atmosphere/convection" +move_module "contmp.rs" "$m_dir/atmosphere/convection" +# ============================================================ +# atmosphere/temperature +# ============================================================ +move_module "temper.rs" "$m_dir/atmosphere/temperature" +move_module "temcor.rs" "$m_dir/atmosphere/temperature" +move_module "tlocal.rs" "$m_dir/atmosphere/temperature" +move_module "lucy.rs" "$m_dir/atmosphere/temperature" +move_module "tdpini.rs" "$m_dir/atmosphere/temperature" +# ============================================================ +# atmosphere/depth +# ============================================================ +move_module "newdm.rs" "$m_dir/atmosphere/depth" +move_module "newdmt.rs" "$m_dir/atmosphere/depth" +move_module "dmder.rs" "$m_dir/atmosphere/depth" +move_module "dmeval.rs" "$m_dir/atmosphere/depth" +move_module "zmrho.rs" "$m_dir/atmosphere/depth" +move_module "column.rs" "$m_dir/atmosphere/depth" +move_module "gridp.rs" "$m_dir/atmosphere/depth" +# ============================================================ +# atmosphere/hydrostatic +# ============================================================ +move_module "hesolv.rs" "$m_dir/atmosphere/hydrostatic" +move_module "hesol6.rs" "$m_dir/atmosphere/hydrostatic" +# ============================================================ +# atmosphere/grey +# ============================================================ +move_module "greyd.rs" "$m_dir/atmosphere/grey" +# ============================================================ +# atmosphere/odf +# ============================================================ +move_module "odf1.rs" "$m_dir/atmosphere/odf" +move_module "odffr.rs" "$m_dir/atmosphere/odf" +move_module "odfhst.rs" "$m_dir/atmosphere/odf" +move_module "odfhyd.rs" "$m_dir/atmosphere/odf" +move_module "odfhys.rs" "$m_dir/atmosphere/odf" +move_module "odfmer.rs" "$m_dir/atmosphere/odf" +# ============================================================ +# spectral +# ============================================================ +move_module "linpro.rs" "$m_dir/spectral" +move_module "linsel.rs" "$m_dir/spectral" +move_module "linspl.rs" "$m_dir/spectral" +move_module "linfrq.rs" "$m_dir/spectral" +move_module "linovr.rs" "$m_dir/spectral" +move_module "linfxd.rs" "$m_dir/spectral" +move_module "sigmar.rs" "$m_dir/spectral" +move_module "sigave.rs" "$m_dir/spectral" +move_module "sigk.rs" "$m_dir/spectral" +move_module "rossop.rs" "$m_dir/spectral" +move_module "rosstd.rs" "$m_dir/spectral" +move_module "radpre.rs" "$m_dir/spectral" +move_module "radtot.rs" "$m_dir/spectral" +move_module "meanop.rs" "$m_dir/spectral" +move_module "meanopt.rs" "$m_dir/spectral" +# ============================================================ +# model_init +# ============================================================ +move_module "inilam.rs" "$m_dir/model_init" +move_module "inifrc.rs" "$m_dir/model_init" +move_module "inifrs.rs" "$m_dir/model_init" +move_module "inifrt.rs" "$m_dir/model_init" +move_module "inpdis.rs" "$m_dir/model_init" +move_module "change.rs" "$m_dir/model_init" +move_module "hedif.rs" "$m_dir/model_init" +move_module "chctab.rs" "$m_dir/model_init" +move_module "dwnfr.rs" "$m_dir/model_init" +move_module "dwnfr0.rs" "$m_dir/model_init" +move_module "dwnfr1.rs" "$m_dir/model_init" +move_module "levset.rs" "$m_dir/model_init" +move_module "levgrp.rs" "$m_dir/model_init" +move_module "visini.rs" "$m_dir/model_init" +move_module "grcor.rs" "$m_dir/model_init" +move_module "rap.rs" "$m_dir/model_init" +# ============================================================ +# io +# ============================================================ +move_module "output.rs" "$m_dir/io" +move_module "rdata.rs" "$m_dir/io" +move_module "rdatax.rs" "$m_dir/io" +move_module "readbf.rs" "$m_dir/io" +move_module "inkul.rs" "$m_dir/io" +move_module "timing.rs" "$m_dir/io" +move_module "getwrd.rs" "$m_dir/io" +move_module "quit.rs" "$m_dir/io" +move_module "prchan.rs" "$m_dir/io" +move_module "princ.rs" "$m_dir/io" +move_module "prnt.rs" "$m_dir/io" +# ============================================================ +# utils +# ============================================================ +move_module "pzert.rs" "$m_dir/utils" +move_module "pzevld.rs" "$m_dir/utils" +move_module "pzeval.rs" "$m_dir/utils" +move_module "corrwm.rs" "$m_dir/utils" +move_module "coolrt.rs" "$m_dir/utils" +move_module "rechck.rs" "$m_dir/utils" +move_module "russel.rs" "$m_dir/utils" +move_module "moleq.rs" "$m_dir/utils" +move_module "rhonen.rs" "$m_dir/utils" +move_module "rhoeos.rs" "$m_dir/utils" +move_module "radpre.rs" "$m_dir/utils" +move_module "radtot.rs" "$m_dir/utils" +move_module "raph.rs" "$m_dir/utils" +move_module "brte.rs" "$m_dir/utils" +move_module "brtez.rs" "$m_dir/utils" + +echo "Done" diff --git a/scripts/refactor_modules.sh b/scripts/refactor_modules.sh new file mode 100644 index 0000000..ba9f70c --- /dev/null +++ b/scripts/refactor_modules.sh @@ -0,0 +1,438 @@ +#!/!/bin/bash +# TLUSTY 模块重构脚本 +# 将 src/tlusty/math 中的模块按功能重新组织到新的目录结构 + +set -e + +# 项目根目录 +PROJECT_ROOT="C:/Users/fmq/Documents/astro/SpectraRust" +SRC_DIR="$PROJECT_ROOT/src/tlusty" +math_DIR="$PROJECT_ROOT/src/tlusty/math" +new_dir="$PROJECT_ROOT/src/tlusty" + +/math" +mkdir -p "$math_dir/math" +mkdir -p "$math_dir/math/special" +mkdir -p "$math_dir/math/solvers" +mkdir -p "$math_dir/math/interpolate" +mkdir -p "$math_dir/math/utils" +mkdir -p "$math_dir/physics/opacity" +mkdir -p "$math_dir/physics/cross_section" +mkdir -p "$math_dir/physics/collision" +mkdir -p "$math_dir/physics/line_profile" +mkdir -p "$math_dir/physics/radiative" +mkdir -p "$math_dir/physics/thermodynamics" +mkdir -p "$math_dir/physics/hydrogen" +mkdir -p "$math_dir/equilibrium" +mkdir -p "$math_dir/linearization" +mkdir -p "$math_dir/acceleration" +mkdir -p "$math_dir/atmosphere" +mkdir -p "$math_dir/spectral" +mkdir -p "$math_dir/model_init" +mkdir -p "$math_dir/io" +mkdir -p "$math_dir/utils" +# ============================================================ +# 1. math/special/ - 特殊函数 (expint, expo, erfcx, gauleg, expinx) +# ============================================================ +move_module "expo" "$math_dir/math/special" +move_module "expint" "$math_dir/math/special" +move_module "expinx" "$math_dir/math/special" +move_module "erfcx" "$math_dir/math/special" +move_module "gauleg" "$math_dir/math/special" + +# ============================================================ +# 2. math/solvers/ - 方程求解器 (tridag, lineqs, minv3, cubic, quartc, solve, solves, laguer, ubeta, psolve, levsol) +# ============================================================ +move_module "tridag" "$math_dir/math/solvers" +move_module "lineqs" "$math_dir/math/solvers" +move_module "minv3" "$math_dir/math/solvers" +move_module "cubic" "$math_dir/math/solvers" +move_module "quartc" "$math_dir/math/solvers" +move_module "solve" "$math_dir/math/solvers" +move_module "solves" "$math_dir/math/solvers" +move_module "laguer" "$math_dir/math/solvers" +move_module "ubeta" "$math_dir/math/solvers" +move_module "psolve" "$math_dir/math/solvers" +move_module "levsol" "$math_dir/math/solvers" +# ============================================================ +# 3. math/interpolate/ - 插值函数 (lagran, yint, ylintp, interpolate, tabint, locate, indexx) +# ============================================================ +move_module "lagran" "$math_dir/math/interpolate" +move_module "yint" "$math_dir/math/interpolate" +move_module "ylintp" "$math_dir/math/interpolate" +move_module "interpolate" "$math_dir/math/interpolate" +move_module "tabint" "$math_dir/math/interpolate" +move_module "locate" "$math_dir/math/interpolate" +move_module "indexx" "$math_dir/math/interpolate" +# ============================================================ +# 4. math/utils/ - 其他工具 (ubeta) + ubeta, indexx) +# ============================================================ +move_module "ubeta" "$math_dir/math/utils" +move_module "indexx" "$math_dir/math/utils" + +# ============================================================ +# 5. physics/opacity/ - 不透明度计算 +move_module "opacf0" "$math_dir/physics/opacity" +move_module "opacf1" "$math_dir/physics/opacity" +move_module "opacfa" "$math_dir/physics/opacity" +move_module "opacfd" "$math_dir/physics/opacity" +move_module "opacfl" "$math_dir/physics/opacity" +move_module "opadd" "$math_dir/physics/opacity" +move_module "opadd0" "$math_dir/physics/opacity" +move_module "opahst" "$math_dir/physics/opacity" +move_module "opaini" "$math_dir/physics/opacity" +move_module "opctab" "$math_dir/physics/opacity" +move_module "opdata" "$math_dir/physics/opacity" +move_module "opfrac" "$math_dir/physics/opacity" +move_module "traini" "$math_dir/physics/opacity" +move_module "meanop" "$math_dir/physics/opacity" +move_module "meanopt" "$math_dir/physics/opacity" +move_module "opact1" "$math_dir/physics/opacity" +move_module "opactd" "$math_dir/physics/opacity" +move_module "opactr" "$math_dir/physics/opacity" +# ============================================================ +# 6. physics/cross_section/ - 截面计算 +mkdir -p "$math_dir/physics/cross_section/photoion" +mkdir -p "$math_dir/physics/cross_section/bound_free" +mkdir -p "$math_dir/physics/cross_section/free_free" +mkdir -p "$math_dir/physics/cross_section/cia" +mkdir -p "$math_dir/physics/cross_section/rayleigh" +mkdir -p "$math_dir/physics/cross_section/gaunt" +mkdir -p "$math_dir/physics/cross_section/hydrogen" +mkdir -p "$math_dir/physics/cross_section/stark" +mkdir -p "$math_dir/physics/cross_section/broadening" +mkdir -p "$math_dir/physics/cross_section/spectral" +mkdir -p "$math_dir/physics/cross_section/radiative" +mkdir -p "$math_dir/physics/cross_section/equilibrium" +# ============================================================ +move_module "cross" "$math_dir/physics/cross_section/photoion" +move_module "verner" "$math_dir/physics/cross_section/photoion" +move_module "vern16" "$math_dir/physics/cross_section/photoion" +move_module "vern18" "$math_dir/physics/cross_section/photoion" +move_module "vern20" "$math_dir/physics/cross_section/photoion" +move_module "vern26" "$math_dir/physics/cross_section/photoion" +move_module "topbas" "$math_dir/physics/cross_section/photoion" +move_module "sigk" "$math_dir/physics/cross_section/photoion" +move_module "sigave" "$math_dir/physics/cross_section/photoion" +move_module "bkhsgo" "$math_dir/physics/cross_section/photoion" +move_module "hidalg" "$math_dir/physics/cross_section/photoion" +move_module "reiman" "$math_dir/physics/cross_section/photoion" +move_module "hephot" "$math_dir/physics/cross_section/photoion" +move_module "carbon" "$math_dir/physics/cross_section/photoion" +move_module "ckoest" "$math_dir/physics/cross_section/photoion" +move_module "sbfch" "$math_dir/physics/cross_section/bound_free" +move_module "sbfhe1" "$math_dir/physics/cross_section/bound_free" +move_module "sbfhmi" "$math_dir/physics/cross_section/bound_free" +move_module "sbfhmi_old" "$math_dir/physics/cross_section/bound_free" +move_module "sbfoh" "$math_dir/physics/cross_section/bound_free" +move_module "ffcros" "$math_dir/physics/cross_section/free_free" +move_module "sffhmi" "$math_dir/physics/cross_section/free_free" +move_module "sffhmi_add" "$math_dir/physics/cross_section/free_free" +move_module "h2minus" "$math_dir/physics/cross_section/free_free" +move_module "cia_h2h" "$math_dir/physics/cross_section/cia" +move_module "cia_h2h2" "$math_dir/physics/cross_section/cia" +move_module "cia_hhe" "$math_dir/physics/cross_section/cia" +move_module "rayleigh" "$math_dir/physics/cross_section/rayleigh" +move_module "rayset" "$math_dir/physics/cross_section/rayleigh" +move_module "gaunt" "$math_dir/physics/cross_section/gaunt" +move_module "gfree" "$math_dir/physics/cross_section/gaunt" +move_module "gntk" "$math_dir/physics/cross_section/gaunt" +move_module "ghydop" "$math_dir/physics/cross_section/hydrogen" +move_module "xk2dop" "$math_dir/physics/cross_section/hydrogen" +move_module "intxen" "$math_dir/physics/cross_section/hydrogen" +move_module "intlem" "$math_dir/physics/cross_section/hydrogen" +move_module "lemini" "$math_dir/physics/cross_section/hydrogen" +move_module "inthyd" "$math_dir/physics/cross_section/stark" +move_module "starka" "$math_dir/physics/cross_section/stark" +move_module "divstr" "$math_dir/physics/cross_section/stark" +move_module "dopgam" "$math_dir/physics/cross_section/broadening" +move_module "gami" "$math_dir/physics/cross_section/broadening" +move_module "gamsp" "$math_dir/physics/cross_section/broadening" +move_module "gvdw" "$math_dir/physics/cross_section/broadening" +move_module "lymlin" "$math_dir/physics/cross_section/hydrogen" +move_module "sghe12" "$math_dir/physics/cross_section/hydrogen" +move_module "sgmer" "$math_dir/physics/cross_section/hydrogen" +move_module "sgmer1" "$math_dir/physics/cross_section/hydrogen" +move_module "sigmar" "$math_dir/physics/cross_section/spectral" +move_module "sigave" "$math_dir/physics/cross_section/spectral" +move_module "rossop" "$math_dir/physics/cross_section/spectral" +move_module "rosstd" "$math_dir/physics/cross_section/spectral" +move_module "radpre" "$math_dir/physics/cross_section/radiative" +move_module "radtot" "$math_dir/physics/cross_section/radiative" +move_module "rechck" "$math_dir/physics/cross_section/radiative" +move_module "russel" "$math_dir/physics/cross_section/equilibrium" +move_module "moleq" "$math_dir/physics/cross_section/equilibrium" +move_module "rhonen" "$math_dir/physics/cross_section/equilibrium" +move_module "rhoeos" "$math_dir/physics/cross_section/equilibrium" +move_module "state" "$math_dir/physics/cross_section/equilibrium" +# ============================================================ +# 7. physics/collision/ - 碰撞过程 +mkdir -p "$math_dir/physics/collision" +move_module "colh" "$math_dir/physics/collision" +move_module "colhe" "$math_dir/physics/collision" +move_module "colis" "$math_dir/physics/collision" +move_module "collhe" "$math_dir/physics/collision" +move_module "butler" "$math_dir/physics/collision" +move_module "ceh12" "$math_dir/physics/collision" +move_module "cheav" "$math_dir/physics/collision" +move_module "cheavj" "$math_dir/physics/collision" +move_module "cspec" "$math_dir/physics/collision" +move_module "cion" "$math_dir/physics/collision" +move_module "irc" "$math_dir/physics/collision" +move_module "szirc" "$math_dir/physics/collision" +move_module "dielrc" "$math_dir/physics/collision" +move_module "dietot" "$math_dir/physics/collision" +move_module "ctdata" "$math_dir/physics/collision" +# ============================================================ +# 8. physics/line_profile/ - 谱线轮廓 +mkdir -p "$math_dir/physics/line_profile" +move_module "voigt" "$math_dir/physics/line_profile" +move_module "voigte" "$math_dir/physics/line_profile" +move_module "profil" "$math_dir/physics/line_profile" +move_module "profsp" "$math_dir/physics/line_profile" +move_module "xk2dop" "$math_dir/physics/line_profile" +move_module "stark0" "$math_dir/physics/line_profile" +move_module "starka" "$math_dir/physics/line_profile" +move_module "divstr" "$math_dir/physics/line_profile" +move_module "inthyd" "$math_dir/physics/line_profile" +move_module "intlem" "$math_dir/physics/line_profile" +move_module "intxen" "$math_dir/physics/line_profile" +move_module "lemini" "$math_dir/physics/line_profile" +move_module "gomini" "$math_dir/physics/line_profile" +move_module "allard" "$math_dir/physics/line_profile" +move_module "allardt" "$math_dir/physics/line_profile" +move_module "quasim" "$math_dir/physics/line_profile" +move_module "dopgam" "$math_dir/physics/line_profile" +move_module "gami" "$math_dir/physics/line_profile" +move_module "gamsp" "$math_dir/physics/line_profile" +move_module "gvdw" "$math_dir/physics/line_profile" +# ============================================================ +# 9. physics/radiative/ - 辐射转移方程 +mkdir -p "$math_dir/physics/radiative" +move_module "rteang" "$math_dir/physics/radiative" +move_module "rtecf0" "$math_dir/physics/radiative" +move_module "rtecf1" "$math_dir/physics/radiative" +move_module "rtedf1" "$math_dir/physics/radiative" +move_module "rtedf2" "$math_dir/physics/radiative" +move_module "rtefe2 "$math_dir/physics/radiative" +move_module "rtefr1" "$math_dir/physics/radiative" +move_module "rteint" "$math_dir/physics/radiative" +move_module "rtesol" "$math_dir/physics/radiative" +move_module "rte_sc" "$math_dir/physics/radiative" +move_module "compt0" "$math_dir/physics/radiative" +move_module "comset" "$math_dir/physics/radiative" +move_module "angset" "$math_dir/physics/radiative" +move_module "inicom" "$math_dir/physics/radiative" +move_module "rtecmc" "$math_dir/physics/radiative" +move_module "rtecmu" "$math_dir/physics/radiative" +move_module "rtecom" "$math_dir/physics/radiative" +move_module "prd" "$math_dir/physics/radiative" +move_module "prdin" "$math_dir/physics/radiative" +move_module "prdini" "$math_dir/physics/radiative" +move_module "radtot" "$math_dir/physics/radiative" +move_module "radpre" "$math_dir/physics/radiative" +# ============================================================ +# 10. physics/thermodynamics/ - 热力学 +mkdir -p "$math_dir/physics/thermodynamics" +move_module "state" "$math_dir/physics/thermodynamics" +move_module "rhoeos" "$math_dir/physics/thermodynamics" +move_module "rhonen" "$math_dir/physics/thermodynamics" +move_module "eldens" "$math_dir/physics/thermodynamics" +move_module "elcor" "$math_dir/physics/thermodynamics" +move_module "eldenc" "$math_dir/physics/thermodynamics" +move_module "entene" "$math_dir/physics/thermodynamics" +move_module "trmder" "$math_dir/physics/thermodynamics" +move_module "trmdrt" "$math_dir/physics/thermodynamics" +move module "setdrt" "$math_dir/physics/thermodynamics" +move_module "prsent" "$math_dir/physics/thermodynamics" +move_module "pgset" "$math_dir/physics/thermodynamics" +move_module "betah" "$math_dir/physics/thermodynamics" +# ============================================================ +# 11. physics/hydrogen/ - 氢原子特殊处理 +mkdir -p "$math_dir/physics/hydrogen" +move_module "wn" "$math_dir/physics/hydrogen" +move_module "wnstor" "$math_dir/physics/hydrogen" +move_module "lymlin" "$math_dir/physics/hydrogen" +move_module "ghydop" "$math_dir/physics/hydrogen" +# ============================================================ +# 12. equilibrium/ - 平衡计算 +mkdir -p "$math_dir/equilibrium" +move_module "rates1" "$math_dir/equilibrium" +move_module "ratmat" "$math_dir/equilibrium" +move_module "ratmal" "$math_dir/equilibrium" +move_module "ratsp1" "$math_dir/equilibrium" +move_module "steqeq" "$math_dir/equilibrium" +move_module "reflev" "$math_dir/equilibrium" +move_module "sabolf" "$math_dir/equilibrium" +move_module "newpop" "$math_dir/equilibrium" +move_module "russel" "$math_dir/equilibrium" +move_module "moleq" "$math_dir/equilibrium" +move_module "partf" "$math_dir/equilibrium" +move_module "mpartf" "$math_dir/equilibrium" +move_module "pfcno" "$math_dir/equilibrium" +move_module "pffe" "$math_dir/equilibrium" +move_module "pfheav" "$math_dir/equilibrium" +move module "pfni" "$math_dir/equilibrium" +move_module "pfspec" "$math_dir/equilibrium" +move_module "tiopf" "$math_dir/equilibrium" +move_module "levset" "$math_dir/equilibrium" +move_module "levgrp" "$math_dir/equilibrium" +# ============================================================ +# 13. linearization/ - 完全线性化方法 +mkdir -p "$math_dir/linearization" +move_module "bhe" "$math_dir/linearization" +move_module "bre" "$math_dir/linearization" +move module "brez" "$math_dir/linearization" +move module "brte" "$math_dir/linearization" +move module "brtez" "$math_dir/linearization" +move_module "bpop" "$math_dir/linearization" +move_module "bpopc" "$math_dir/linearization" +move module "bpope" "$math_dir/linearization" +move_module "bpopf" "$math_dir/linearization" +move_module "bpopt" "$math_dir/linearization" +move module "emat" "$math_dir/linearization" +move_module "matcon" "$math_dir/linearization" +move_module "matgen" "$math_dir/linearization" +move module "matinv" "$math_dir/linearization" +move module "rhsgen" "$math_dir/linearization" +move module "solve" "$math_dir/linearization" +move module "solves" "$math_dir/linearization" +move module "levsol" "$math_dir/linearization" +move_module "rybmat" "$math_dir/linearization" +move_module "rybheq" "$math_dir/linearization" +move module "rybene" "$math_dir/linearization" +move module "rybchn" "$math_dir/linearization" +move module "rybsol" "$math_dir/linearization" +# ============================================================ +# 14. acceleration/ - 加速算法 +mkdir -p "$math_dir/acceleration" +move_module "alifr1" "$math_dir/acceleration" +move_module "alifr3" "$math_dir/acceleration" +move module "alifr6" "$math_dir/acceleration" +move module "alifrk" "$math_dir/acceleration" +move module "alisk1" "$math_dir/acceleration" +move module "alisk2" "$math_dir/acceleration" +move module "alist1" "$math_dir/acceleration" +move module "alist2" "$math_dir/acceleration" +move_module "ijali2" "$math_dir/acceleration" +move_module "ijalis" "$math_dir/acceleration" +move_module "getlal" "$math_dir/acceleration" +move_module "accel2" "$math_dir/acceleration" +move_module "accelp" "$math_dir/acceleration" +move_module "osccor" "$math_dir/acceleration" +move_module "taufr1" "$math_dir/acceleration" +# ============================================================ +# 15. atmosphere/ - 大气模型 +mkdir -p "$math_dir/atmosphere" +move_module "convec" "$math_dir/atmosphere" +move_module "concor" "$math_dir/atmosphere" +move module "conout" "$math_dir/atmosphere" +move_module "conref" "$math_dir/atmosphere" +move module "contmd" "$math_dir/atmosphere" +move_module "contmp" "$math_dir/atmosphere" +move module "temper" "$math_dir/atmosphere" +move_module "temcor" "$math_dir/atmosphere" +move module "tlocal" "$math_dir/atmosphere" +move module "lucy" "$math_dir/atmosphere" +move_module "tdpini" "$math_dir/atmosphere" +move_module "newdm" "$math_dir/atmosphere" +move module "newdmt" "$math_dir/atmosphere" +move module "dmder" "$math_dir/atmosphere" +move_module "dmeval" "$math_dir/atmosphere" +move module "zmrho" "$math_dir/atmosphere" +move module "column" "$math_dir/atmosphere" +move module "gridp" "$math_dir/atmosphere" +move module "hesolv" "$math_dir/atmosphere" +move_module "hesol6" "$math_dir/atmosphere" +move module "greyd" "$math_dir/atmosphere" +move_module "odf1" "$math_dir/atmosphere" +move_module "odffr" "$math_dir/atmosphere" +move_module "odfhst" "$math_dir/atmosphere" +move_module "odfhyd" "$math_dir/atmosphere" +move_module "odfhys" "$math_dir/atmosphere" +move module "odfmer" "$math_dir/atmosphere" +# ============================================================ +# 16. spectral/ - 谱线处理 +mkdir -p "$math_dir/spectral" +move_module "linpro" "$math_dir/spectral" +move_module "linsel" "$math_dir/spectral" +move_module "linspl" "$math_dir/spectral" +move_module "linfrq" "$math_dir/spectral" +move_module "linovr" "$math_dir/spectral" +move module "linfxd" "$math_dir/spectral" +move_module "sigmar" "$math_dir/spectral" +move module "sigave" "$math_dir/spectral" +move module "sigk" "$math_dir/spectral" +move_module "rossop" "$math_dir/spectral" +move module "rosstd" "$math_dir/spectral" +move module "radpre" "$math_dir/spectral" +move module "radtot" "$math_dir/spectral" +move module "meanop" "$math_dir/spectral" +move module "meanopt" "$math_dir/spectral" +# ============================================================ +# 17. model_init/ - 模型初始化 +mkdir -p "$math_dir/model_init" +move_module "inilam" "$math_dir/model_init" +move_module "inifrc" "$math_dir/model_init" +move_module "inifrs" "$math_dir/model_init" +move_module "inifrt" "$math_dir/model_init" +move_module "inpdis" "$math_dir/model_init" +move_module "change" "$math_dir/model_init" +move_module "hedif" "$math_dir/model_init" +move_module "chctab" "$math_dir/model_init" +move_module "inifrs" "$math_dir/model_init" +move_module "inifrt" "$math_dir/model_init" +move module "dwnfr" "$math_dir/model_init" +move_module "dwnfr0" "$math_dir/model_init" +move_module "dwnfr1" "$math_dir/model_init" +move_module "levset" "$math_dir/model_init" +move module "levgrp" "$math_dir/model_init" +move module "visini" "$math_dir/model_init" +move_module "grcor" "$math_dir/model_init" +move_module "rap" "$math_dir/model_init" +# ============================================================ +# 18. io/ - 输入输出 +mkdir -p "$math_dir/io" +move_module "output" "$math_dir/io" +move_module "rdata" "$math_dir/io" +move_module "rdatax" "$math_dir/io" +move_module "readbf" "$math_dir/io" +move_module "inkul" "$math_dir/io" +move_module "timing" "$math_dir/io" +move_module "getwrd" "$math_dir/io" +move_module "quit" "$math_dir/io" +move_module "prchan" "$math_dir/io" +move_module "princ" "$math_dir/io" +move module "prnt" "$math_dir/io" +# ============================================================ +# 19. utils - 杂项工具 +mkdir -p "$math_dir/utils" +move_module "pzert" "$math_dir/utils" +move_module "pzevld" "$math_dir/utils" +move module "corrwm" "$math_dir/utils" +move_module "dwnfr" "$math_dir/utils" +move_module "dwnfr0" "$math_dir/utils" +move_module "dwnfr1" "$math_dir/utils" + +# ============================================================ +# 20. Other modules - 杂项 +mkdir -p "$math_dir/utils" +move_module "grcor" "$math_dir/utils" +move_module "betah" "$math_dir/utils" +move_module "coolrt" "$math_dir/utils" +move module "rechck" "$math_dir/utils" +move_module "russel" "$math_dir/utils" +move_module "moleq" "$math_dir/utils" +move_module "rhonen" "$math_dir/utils" +move_module "rhoeos" "$math_dir/utils" +move_module "radpre" "$math_dir/utils" +move module "radtot" "$math_dir/utils" +move module "raph" "$math_dir/utils" + +move_module "brte" "$math_dir/utils" +move_module "brtez" "$math_dir/utils" +move_module "pzeval" "$math_dir/utils" +move module "pzevld" "$math_dir/utils" + +echo "模块 organized by function!" diff --git a/src/synspec/math/crosew.rs b/src/synspec/math/crosew.rs index ec20b85..dc2575a 100644 --- a/src/synspec/math/crosew.rs +++ b/src/synspec/math/crosew.rs @@ -6,7 +6,7 @@ //! //! 设置光致电离截面数组,用于辐射转移计算。 -use crate::tlusty::math::sigk::{sigk, SigkParams}; +use crate::tlusty::math::{sigk, SigkParams, OpData}; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::constants::{MCROSS, MFREQ}; @@ -115,7 +115,7 @@ pub fn croset(params: &CrosetParams) -> Vec> { itr: it, mode: 0, atomic, - opdata: &crate::tlusty::math::topbas::OpData::default(), + opdata: &crate::tlusty::math::OpData::default(), }; cross[it][ij] = sigk(&sigk_params); } @@ -128,7 +128,7 @@ pub fn croset(params: &CrosetParams) -> Vec> { itr: it, mode: 1, atomic, - opdata: &crate::tlusty::math::topbas::OpData::default(), + opdata: &crate::tlusty::math::OpData::default(), }; cross[it][ij] = sigk(&sigk_params); @@ -226,7 +226,7 @@ pub fn crosew(params: &CrosewParams) -> Vec> { itr: it, mode: 0, atomic, - opdata: &crate::tlusty::math::topbas::OpData::default(), + opdata: &crate::tlusty::math::OpData::default(), }; cross[it][ij] = sigk(&sigk_params); } @@ -239,7 +239,7 @@ pub fn crosew(params: &CrosewParams) -> Vec> { itr: it, mode: 1, atomic, - opdata: &crate::tlusty::math::topbas::OpData::default(), + opdata: &crate::tlusty::math::OpData::default(), }; cross[it][ij] = sigk(&sigk_params); diff --git a/src/synspec/math/pretab.rs b/src/synspec/math/pretab.rs index fecf2f8..9598db1 100644 --- a/src/synspec/math/pretab.rs +++ b/src/synspec/math/pretab.rs @@ -7,7 +7,7 @@ //! - 最多 10 个 Doppler 宽度 //! - 共 MVOI=2001 个点 -use crate::tlusty::math::interp::interp; +use crate::tlusty::math::interp; /// Voigt 表步长 (每 Doppler 宽度的步数) const VSTEPS: f64 = 200.0; diff --git a/src/tlusty/io/linset.rs b/src/tlusty/io/linset.rs index dedb81e..bff638e 100644 --- a/src/tlusty/io/linset.rs +++ b/src/tlusty/io/linset.rs @@ -379,7 +379,7 @@ fn setup_simpson( _itr: i32, ) -> anyhow::Result<()> { if n % 2 != 1 { - return Err(crate::tlusty::math::quit::quit_error( + return Err(crate::tlusty::math::quit_error( "even number of points in Simpson - LINSET", n as i32, n as i32, @@ -424,7 +424,7 @@ fn setup_modified_simpson( m: usize, ) -> anyhow::Result<()> { if n % 2 != 1 { - return Err(crate::tlusty::math::quit::quit_error( + return Err(crate::tlusty::math::quit_error( "even number of points in MSimpson - LINSET", n as i32, n as i32, @@ -473,7 +473,7 @@ fn setup_modified_simpson( // 处理 XMAX < 0 的情况(非对称) if n % 4 != 1 { - return Err(crate::tlusty::math::quit::quit_error( + return Err(crate::tlusty::math::quit_error( "conflict in MSimpson - LINSET", n as i32, n as i32, diff --git a/src/tlusty/io/rayini.rs b/src/tlusty/io/rayini.rs index e393848..d8dbc0d 100644 --- a/src/tlusty/io/rayini.rs +++ b/src/tlusty/io/rayini.rs @@ -10,8 +10,8 @@ use std::path::Path; use super::{FortranReader, IoError, Result}; -use crate::tlusty::math::rayset::rayset; -use crate::tlusty::math::rayleigh::{rayleigh, RayleighParams}; +use crate::tlusty::math::rayset; +use crate::tlusty::math::{rayleigh, RayleighParams}; use crate::tlusty::state::constants::{MDEPTH, MTABR, MTABT}; use crate::tlusty::state::model::{EosPar, NumbOpac, RaySct, RayTbl, TabLop, Vectors}; use crate::tlusty::state::config::BasNum; diff --git a/src/tlusty/math/alifr1.rs b/src/tlusty/math/ali/alifr1.rs similarity index 100% rename from src/tlusty/math/alifr1.rs rename to src/tlusty/math/ali/alifr1.rs diff --git a/src/tlusty/math/alifr3.rs b/src/tlusty/math/ali/alifr3.rs similarity index 100% rename from src/tlusty/math/alifr3.rs rename to src/tlusty/math/ali/alifr3.rs diff --git a/src/tlusty/math/alifr6.rs b/src/tlusty/math/ali/alifr6.rs similarity index 100% rename from src/tlusty/math/alifr6.rs rename to src/tlusty/math/ali/alifr6.rs diff --git a/src/tlusty/math/alifrk.rs b/src/tlusty/math/ali/alifrk.rs similarity index 100% rename from src/tlusty/math/alifrk.rs rename to src/tlusty/math/ali/alifrk.rs diff --git a/src/tlusty/math/alisk1.rs b/src/tlusty/math/ali/alisk1.rs similarity index 100% rename from src/tlusty/math/alisk1.rs rename to src/tlusty/math/ali/alisk1.rs diff --git a/src/tlusty/math/alisk2.rs b/src/tlusty/math/ali/alisk2.rs similarity index 100% rename from src/tlusty/math/alisk2.rs rename to src/tlusty/math/ali/alisk2.rs diff --git a/src/tlusty/math/alist1.rs b/src/tlusty/math/ali/alist1.rs similarity index 100% rename from src/tlusty/math/alist1.rs rename to src/tlusty/math/ali/alist1.rs diff --git a/src/tlusty/math/alist2.rs b/src/tlusty/math/ali/alist2.rs similarity index 100% rename from src/tlusty/math/alist2.rs rename to src/tlusty/math/ali/alist2.rs diff --git a/src/tlusty/math/ijali2.rs b/src/tlusty/math/ali/ijali2.rs similarity index 100% rename from src/tlusty/math/ijali2.rs rename to src/tlusty/math/ali/ijali2.rs diff --git a/src/tlusty/math/ijalis.rs b/src/tlusty/math/ali/ijalis.rs similarity index 100% rename from src/tlusty/math/ijalis.rs rename to src/tlusty/math/ali/ijalis.rs diff --git a/src/tlusty/math/ali/mod.rs b/src/tlusty/math/ali/mod.rs new file mode 100644 index 0000000..6afc281 --- /dev/null +++ b/src/tlusty/math/ali/mod.rs @@ -0,0 +1,25 @@ +//! ali module + +mod alifr1; +mod alifr3; +mod alifr6; +mod alifrk; +mod alisk1; +mod alisk2; +mod alist1; +mod alist2; +mod ijali2; +mod ijalis; +mod taufr1; + +pub use alifr1::*; +pub use alifr3::*; +pub use alifr6::*; +pub use alifrk::*; +pub use alisk1::*; +pub use alisk2::*; +pub use alist1::*; +pub use alist2::*; +pub use ijali2::*; +pub use ijalis::*; +pub use taufr1::*; diff --git a/src/tlusty/math/taufr1.rs b/src/tlusty/math/ali/taufr1.rs similarity index 100% rename from src/tlusty/math/taufr1.rs rename to src/tlusty/math/ali/taufr1.rs diff --git a/src/tlusty/math/chctab.rs b/src/tlusty/math/atomic/chctab.rs similarity index 100% rename from src/tlusty/math/chctab.rs rename to src/tlusty/math/atomic/chctab.rs diff --git a/src/tlusty/math/cheav.rs b/src/tlusty/math/atomic/cheav.rs similarity index 99% rename from src/tlusty/math/cheav.rs rename to src/tlusty/math/atomic/cheav.rs index 817c3ef..efa3767 100644 --- a/src/tlusty/math/cheav.rs +++ b/src/tlusty/math/atomic/cheav.rs @@ -9,7 +9,7 @@ //! 1. 给定主量子数 n 内的所有态合并 //! 2. 单重态和三重态分别合并 -use super::cheavj::cheavj; +use crate::tlusty::math::cheavj; // ============================================================================ // 核心计算函数 diff --git a/src/tlusty/math/cheavj.rs b/src/tlusty/math/atomic/cheavj.rs similarity index 100% rename from src/tlusty/math/cheavj.rs rename to src/tlusty/math/atomic/cheavj.rs diff --git a/src/tlusty/math/cion.rs b/src/tlusty/math/atomic/cion.rs similarity index 100% rename from src/tlusty/math/cion.rs rename to src/tlusty/math/atomic/cion.rs diff --git a/src/tlusty/math/cross.rs b/src/tlusty/math/atomic/cross.rs similarity index 100% rename from src/tlusty/math/cross.rs rename to src/tlusty/math/atomic/cross.rs diff --git a/src/tlusty/math/dielrc.rs b/src/tlusty/math/atomic/dielrc.rs similarity index 100% rename from src/tlusty/math/dielrc.rs rename to src/tlusty/math/atomic/dielrc.rs diff --git a/src/tlusty/math/dietot.rs b/src/tlusty/math/atomic/dietot.rs similarity index 99% rename from src/tlusty/math/dietot.rs rename to src/tlusty/math/atomic/dietot.rs index ab7fa5d..2aeffa6 100644 --- a/src/tlusty/math/dietot.rs +++ b/src/tlusty/math/atomic/dietot.rs @@ -3,7 +3,7 @@ //! 重构自 TLUSTY `dietot.f` //! 遍历所有离子和深度点,计算双电子复合速率和伪截面。 -use crate::tlusty::math::dielrc::dielrc; +use crate::tlusty::math::dielrc; use crate::tlusty::state::atomic::{AtoPar, IonPar, LevPar}; use crate::tlusty::state::config::{BasNum, InpPar}; use crate::tlusty::state::model::{LevAdd, ModPar}; diff --git a/src/tlusty/math/ffcros.rs b/src/tlusty/math/atomic/ffcros.rs similarity index 100% rename from src/tlusty/math/ffcros.rs rename to src/tlusty/math/atomic/ffcros.rs diff --git a/src/tlusty/math/gfree.rs b/src/tlusty/math/atomic/gfree.rs similarity index 100% rename from src/tlusty/math/gfree.rs rename to src/tlusty/math/atomic/gfree.rs diff --git a/src/tlusty/math/gntk.rs b/src/tlusty/math/atomic/gntk.rs similarity index 100% rename from src/tlusty/math/gntk.rs rename to src/tlusty/math/atomic/gntk.rs diff --git a/src/tlusty/math/atomic/mod.rs b/src/tlusty/math/atomic/mod.rs new file mode 100644 index 0000000..58f10d7 --- /dev/null +++ b/src/tlusty/math/atomic/mod.rs @@ -0,0 +1,33 @@ +//! atomic module + +mod chctab; +mod cheav; +mod cheavj; +mod cion; +mod cross; +mod dielrc; +mod dietot; +mod ffcros; +mod gfree; +mod gntk; +mod vern16; +mod vern18; +mod vern20; +mod vern26; +mod verner; + +pub use chctab::*; +pub use cheav::*; +pub use cheavj::*; +pub use cion::*; +pub use cross::*; +pub use dielrc::*; +pub use dietot::*; +pub use ffcros::*; +pub use gfree::*; +pub use gntk::*; +pub use vern16::*; +pub use vern18::*; +pub use vern20::*; +pub use vern26::*; +pub use verner::*; diff --git a/src/tlusty/math/vern16.rs b/src/tlusty/math/atomic/vern16.rs similarity index 100% rename from src/tlusty/math/vern16.rs rename to src/tlusty/math/atomic/vern16.rs diff --git a/src/tlusty/math/vern18.rs b/src/tlusty/math/atomic/vern18.rs similarity index 100% rename from src/tlusty/math/vern18.rs rename to src/tlusty/math/atomic/vern18.rs diff --git a/src/tlusty/math/vern20.rs b/src/tlusty/math/atomic/vern20.rs similarity index 100% rename from src/tlusty/math/vern20.rs rename to src/tlusty/math/atomic/vern20.rs diff --git a/src/tlusty/math/vern26.rs b/src/tlusty/math/atomic/vern26.rs similarity index 100% rename from src/tlusty/math/vern26.rs rename to src/tlusty/math/atomic/vern26.rs diff --git a/src/tlusty/math/verner.rs b/src/tlusty/math/atomic/verner.rs similarity index 100% rename from src/tlusty/math/verner.rs rename to src/tlusty/math/atomic/verner.rs diff --git a/src/tlusty/math/continuum/mod.rs b/src/tlusty/math/continuum/mod.rs new file mode 100644 index 0000000..b8c915d --- /dev/null +++ b/src/tlusty/math/continuum/mod.rs @@ -0,0 +1,33 @@ +//! continuum module + +mod opacf0; +mod opacf1; +mod opacfa; +mod opacfd; +mod opacfl; +mod opact1; +mod opactd; +mod opactr; +mod opadd; +mod opadd0; +mod opahst; +mod opaini; +mod opctab; +mod opdata; +mod opfrac; + +pub use opacf0::*; +pub use opacf1::*; +pub use opacfa::*; +pub use opacfd::*; +pub use opacfl::*; +pub use opact1::*; +pub use opactd::*; +pub use opactr::*; +pub use opadd::*; +pub use opadd0::*; +pub use opahst::*; +pub use opaini::*; +pub use opctab::*; +pub use opdata::*; +pub use opfrac::*; diff --git a/src/tlusty/math/opacf0.rs b/src/tlusty/math/continuum/opacf0.rs similarity index 100% rename from src/tlusty/math/opacf0.rs rename to src/tlusty/math/continuum/opacf0.rs diff --git a/src/tlusty/math/opacf1.rs b/src/tlusty/math/continuum/opacf1.rs similarity index 99% rename from src/tlusty/math/opacf1.rs rename to src/tlusty/math/continuum/opacf1.rs index 3dbe62d..01615c7 100644 --- a/src/tlusty/math/opacf1.rs +++ b/src/tlusty/math/continuum/opacf1.rs @@ -294,13 +294,13 @@ fn crossd( /// 计算 H⁻ 自由-自由不透明度 SFFHMI fn sffhmi(popul_h: f64, fr: f64, t: f64) -> f64 { // 调用 sffhmi 模块的函数 - crate::tlusty::math::sffhmi::sffhmi(popul_h, fr, t) + crate::tlusty::math::sffhmi(popul_h, fr, t) } /// 计算自由-自由截面 FFCROS fn ffcros(ion: i32, it: i32, t: f64, fr: f64) -> f64 { // 调用 ffcros 模块的函数 - crate::tlusty::math::ffcros::ffcros(ion, it, t, fr) + crate::tlusty::math::ffcros(ion, it, t, fr) } /// 计算氢 Gaunt 因子 GFREE1 diff --git a/src/tlusty/math/opacfa.rs b/src/tlusty/math/continuum/opacfa.rs similarity index 100% rename from src/tlusty/math/opacfa.rs rename to src/tlusty/math/continuum/opacfa.rs diff --git a/src/tlusty/math/opacfd.rs b/src/tlusty/math/continuum/opacfd.rs similarity index 100% rename from src/tlusty/math/opacfd.rs rename to src/tlusty/math/continuum/opacfd.rs diff --git a/src/tlusty/math/opacfl.rs b/src/tlusty/math/continuum/opacfl.rs similarity index 100% rename from src/tlusty/math/opacfl.rs rename to src/tlusty/math/continuum/opacfl.rs diff --git a/src/tlusty/math/opact1.rs b/src/tlusty/math/continuum/opact1.rs similarity index 98% rename from src/tlusty/math/opact1.rs rename to src/tlusty/math/continuum/opact1.rs index 40615ac..cc77254 100644 --- a/src/tlusty/math/opact1.rs +++ b/src/tlusty/math/continuum/opact1.rs @@ -4,7 +4,7 @@ //! //! 对于给定频率点,计算所有深度点的吸收、发射和散射系数。 -use super::opctab::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput}; +use crate::tlusty::math::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput}; use crate::tlusty::state::constants::{HK, UN}; /// OPACT1 输入参数 @@ -18,7 +18,7 @@ pub struct Opact1Params<'a> { /// 选项表标志 (<0: 添加电子散射, >0: 使用选项表) pub ioptab: i32, /// Rayleigh 参数 (当 ifrayl > 0 时需要) - pub rayleigh_params: Option<&'a super::rayleigh::RayleighParams<'a>>, + pub rayleigh_params: Option<&'a crate::tlusty::math::RayleighParams<'a>>, } /// OPACT1 模型状态 diff --git a/src/tlusty/math/opactd.rs b/src/tlusty/math/continuum/opactd.rs similarity index 99% rename from src/tlusty/math/opactd.rs rename to src/tlusty/math/continuum/opactd.rs index 622bb3e..8fa87b9 100644 --- a/src/tlusty/math/opactd.rs +++ b/src/tlusty/math/continuum/opactd.rs @@ -4,7 +4,7 @@ //! //! 与 OPACT1 类似,但额外计算温度和密度导数。 -use super::opctab::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput}; +use crate::tlusty::math::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput}; use crate::tlusty::state::constants::{HK, UN}; /// 微分步长 @@ -26,7 +26,7 @@ pub struct OpactdParams<'a> { /// 选项表标志 pub ioptab: i32, /// Rayleigh 参数 - pub rayleigh_params: Option<&'a super::rayleigh::RayleighParams<'a>>, + pub rayleigh_params: Option<&'a crate::tlusty::math::RayleighParams<'a>>, } /// OPACTD 模型状态 diff --git a/src/tlusty/math/opactr.rs b/src/tlusty/math/continuum/opactr.rs similarity index 100% rename from src/tlusty/math/opactr.rs rename to src/tlusty/math/continuum/opactr.rs diff --git a/src/tlusty/math/opadd.rs b/src/tlusty/math/continuum/opadd.rs similarity index 98% rename from src/tlusty/math/opadd.rs rename to src/tlusty/math/continuum/opadd.rs index f4188a5..d713203 100644 --- a/src/tlusty/math/opadd.rs +++ b/src/tlusty/math/continuum/opadd.rs @@ -11,8 +11,8 @@ //! - CH 和 OH 连续不透明度 //! - CIA (碰撞诱导吸收) 不透明度 -use super::{cia_h2h, cia_h2h2, cia_h2he, cia_hhe, h2minus, sbfch, sbfoh}; -use crate::tlusty::math::sffhmi::sffhmi; +use crate::tlusty::math::{cia_h2h, cia_h2h2, cia_h2he, cia_hhe, h2minus, sbfch, sbfoh, CiaH2h2Data, CiaH2heData, CiaH2hData, CiaHheData}; +use crate::tlusty::math::sffhmi; // ============================================================================ // 常量 @@ -146,13 +146,13 @@ pub struct OpaddModel<'a> { /// 连续跃迁计数 pub ncon: usize, /// CIA H2-H2 数据 - pub cia_h2h2_data: &'a cia_h2h2::CiaH2h2Data, + pub cia_h2h2_data: &'a CiaH2h2Data, /// CIA H2-He 数据 - pub cia_h2he_data: &'a cia_h2he::CiaH2heData, + pub cia_h2he_data: &'a CiaH2heData, /// CIA H2-H 数据 - pub cia_h2h_data: &'a cia_h2h::CiaH2hData, + pub cia_h2h_data: &'a CiaH2hData, /// CIA H-He 数据 - pub cia_hhe_data: &'a cia_hhe::CiaHheData, + pub cia_hhe_data: &'a CiaHheData, } /// OPADD 输出结果。 diff --git a/src/tlusty/math/opadd0.rs b/src/tlusty/math/continuum/opadd0.rs similarity index 99% rename from src/tlusty/math/opadd0.rs rename to src/tlusty/math/continuum/opadd0.rs index 85ae1d7..f350a06 100644 --- a/src/tlusty/math/opadd0.rs +++ b/src/tlusty/math/continuum/opadd0.rs @@ -10,7 +10,7 @@ //! - H2+ 束缚-自由和自由-自由 //! - He- 自由-自由 -use crate::tlusty::math::sbfhmi::sbfhmi; +use crate::tlusty::math::sbfhmi; /// 常量 (从 Fortran PARAMETER 语句) /// H I Rayleigh 散射阈值频率 diff --git a/src/tlusty/math/opahst.rs b/src/tlusty/math/continuum/opahst.rs similarity index 99% rename from src/tlusty/math/opahst.rs rename to src/tlusty/math/continuum/opahst.rs index 31b569f..f5e14ba 100644 --- a/src/tlusty/math/opahst.rs +++ b/src/tlusty/math/continuum/opahst.rs @@ -7,7 +7,7 @@ //! - 配置 M1FILE 和 M2FILE 数组 //! - 计算 Stark 参数 -use crate::tlusty::math::stark0::stark0; +use crate::tlusty::math::stark0; /// 最大谱线数(与 Fortran NLMX 一致) pub const NLMX: usize = 30; diff --git a/src/tlusty/math/opaini.rs b/src/tlusty/math/continuum/opaini.rs similarity index 100% rename from src/tlusty/math/opaini.rs rename to src/tlusty/math/continuum/opaini.rs diff --git a/src/tlusty/math/opctab.rs b/src/tlusty/math/continuum/opctab.rs similarity index 99% rename from src/tlusty/math/opctab.rs rename to src/tlusty/math/continuum/opctab.rs index af7c2a1..bf654ee 100644 --- a/src/tlusty/math/opctab.rs +++ b/src/tlusty/math/continuum/opctab.rs @@ -9,7 +9,7 @@ //! //! 这是一个简化版本,所有插值都是线性的,fortran中也是线性插值。 -use crate::tlusty::math::rayleigh::{rayleigh, RayleighParams}; +use crate::tlusty::math::{rayleigh, RayleighParams}; use crate::tlusty::state::model::{EosPar, RaySct}; /// 参考频率 (FRRAY0) diff --git a/src/tlusty/math/opdata.rs b/src/tlusty/math/continuum/opdata.rs similarity index 100% rename from src/tlusty/math/opdata.rs rename to src/tlusty/math/continuum/opdata.rs diff --git a/src/tlusty/math/opfrac.rs b/src/tlusty/math/continuum/opfrac.rs similarity index 100% rename from src/tlusty/math/opfrac.rs rename to src/tlusty/math/continuum/opfrac.rs diff --git a/src/tlusty/math/concor.rs b/src/tlusty/math/convection/concor.rs similarity index 100% rename from src/tlusty/math/concor.rs rename to src/tlusty/math/convection/concor.rs diff --git a/src/tlusty/math/conout.rs b/src/tlusty/math/convection/conout.rs similarity index 100% rename from src/tlusty/math/conout.rs rename to src/tlusty/math/convection/conout.rs diff --git a/src/tlusty/math/conref.rs b/src/tlusty/math/convection/conref.rs similarity index 100% rename from src/tlusty/math/conref.rs rename to src/tlusty/math/convection/conref.rs diff --git a/src/tlusty/math/contmd.rs b/src/tlusty/math/convection/contmd.rs similarity index 99% rename from src/tlusty/math/contmd.rs rename to src/tlusty/math/convection/contmd.rs index b6f895a..b8e9e12 100644 --- a/src/tlusty/math/contmd.rs +++ b/src/tlusty/math/convection/contmd.rs @@ -18,9 +18,9 @@ //! 求解得到的 DELTA(对数温度梯度)用于更新温度结构。 use crate::tlusty::state::constants::{HALF, PCK, SIG4P, UN}; -use super::convec::{convec, ConvecConfig, ConvecParams}; -use super::cubic::{cubic, CubicCon}; -use super::conout::format_conout_header; +use crate::tlusty::math::{convec, ConvecConfig, ConvecParams}; +use crate::tlusty::math::{cubic, CubicCon}; +use crate::tlusty::math::format_conout_header; // ============================================================================ // 常量 diff --git a/src/tlusty/math/contmp.rs b/src/tlusty/math/convection/contmp.rs similarity index 100% rename from src/tlusty/math/contmp.rs rename to src/tlusty/math/convection/contmp.rs diff --git a/src/tlusty/math/convec.rs b/src/tlusty/math/convection/convec.rs similarity index 98% rename from src/tlusty/math/convec.rs rename to src/tlusty/math/convection/convec.rs index ff389ec..7404228 100644 --- a/src/tlusty/math/convec.rs +++ b/src/tlusty/math/convection/convec.rs @@ -9,10 +9,10 @@ //! - 考虑辐射耗散效应 //! - 参考 Mihalas 恒星大气理论 -use super::trmder::{trmder, TrmderConfig, TrmderParams}; -use super::trmdrt::{trmdrt, TrmdrtParams}; -use super::prsent::{prsent, PrsentParams, ThermTables}; -use super::eldens::EldensConfig; +use crate::tlusty::math::{trmder, TrmderConfig, TrmderParams}; +use crate::tlusty::math::{trmdrt, TrmdrtParams}; +use crate::tlusty::math::{prsent, PrsentParams, ThermTables}; +use crate::tlusty::math::EldensConfig; use crate::tlusty::state::constants::{UN, HALF}; // ============================================================================ diff --git a/src/tlusty/math/convection/mod.rs b/src/tlusty/math/convection/mod.rs new file mode 100644 index 0000000..97b5643 --- /dev/null +++ b/src/tlusty/math/convection/mod.rs @@ -0,0 +1,15 @@ +//! convection module + +mod concor; +mod conout; +mod conref; +mod contmd; +mod contmp; +mod convec; + +pub use concor::*; +pub use conout::*; +pub use conref::*; +pub use contmd::*; +pub use contmp::*; +pub use convec::*; diff --git a/src/tlusty/math/eldenc.rs b/src/tlusty/math/eos/eldenc.rs similarity index 98% rename from src/tlusty/math/eldenc.rs rename to src/tlusty/math/eos/eldenc.rs index 63d8c64..a379592 100644 --- a/src/tlusty/math/eldenc.rs +++ b/src/tlusty/math/eos/eldenc.rs @@ -7,9 +7,9 @@ //! - 分析各元素对电子密度的贡献 //! - 输出电子供体信息 -use crate::tlusty::math::moleq::{moleq_pure, MoleqParams}; -use crate::tlusty::math::rhonen::{rhonen_pure, RhonenParams}; -use crate::tlusty::math::state::{state_pure, StateParams}; +use crate::tlusty::math::{moleq_pure, MoleqParams}; +use crate::tlusty::math::{rhonen_pure, RhonenParams}; +use crate::tlusty::math::{state_pure, StateParams}; use crate::tlusty::state::constants::{MDEPTH, MLEVEL}; /// 最大温度表点数 diff --git a/src/tlusty/math/eldens.rs b/src/tlusty/math/eos/eldens.rs similarity index 98% rename from src/tlusty/math/eldens.rs rename to src/tlusty/math/eos/eldens.rs index eb7e74e..de28030 100644 --- a/src/tlusty/math/eldens.rs +++ b/src/tlusty/math/eos/eldens.rs @@ -8,10 +8,10 @@ //! - 计算电荷守恒和粒子守恒 //! - 计算内能和熵 -use crate::tlusty::math::lineqs::lineqs; -use crate::tlusty::math::moleq::{moleq_pure, MoleqParams, MoleculeEqData}; -use crate::tlusty::math::mpartf::{mpartf, MpartfResult}; -use crate::tlusty::math::state::{state_pure, StateParams}; +use crate::tlusty::math::lineqs; +use crate::tlusty::math::{moleq_pure, MoleqParams, MoleculeEqData}; +use crate::tlusty::math::{mpartf, MpartfResult}; +use crate::tlusty::math::{state_pure, StateParams}; use crate::tlusty::state::constants::{BOLK, HMASS, UN, TWO, HALF}; /// ELDENS 配置参数 diff --git a/src/tlusty/math/entene.rs b/src/tlusty/math/eos/entene.rs similarity index 98% rename from src/tlusty/math/entene.rs rename to src/tlusty/math/eos/entene.rs index 62fac62..74cac93 100644 --- a/src/tlusty/math/entene.rs +++ b/src/tlusty/math/eos/entene.rs @@ -2,7 +2,7 @@ //! //! 重构自 TLUSTY `entene.f`。 -use crate::tlusty::math::mpartf::mpartf; +use crate::tlusty::math::mpartf; const EV2ERG: f64 = 1.6018e-12; const ENTCON: f64 = 103.973; diff --git a/src/tlusty/math/eos/mod.rs b/src/tlusty/math/eos/mod.rs new file mode 100644 index 0000000..b543411 --- /dev/null +++ b/src/tlusty/math/eos/mod.rs @@ -0,0 +1,19 @@ +//! eos module + +mod eldenc; +mod eldens; +mod entene; +mod moleq; +mod rhoeos; +mod rhonen; +mod russel; +mod steqeq; + +pub use eldenc::*; +pub use eldens::*; +pub use entene::*; +pub use moleq::*; +pub use rhoeos::*; +pub use rhonen::*; +pub use russel::*; +pub use steqeq::*; diff --git a/src/tlusty/math/moleq.rs b/src/tlusty/math/eos/moleq.rs similarity index 98% rename from src/tlusty/math/moleq.rs rename to src/tlusty/math/eos/moleq.rs index bb1d58b..dce58a3 100644 --- a/src/tlusty/math/moleq.rs +++ b/src/tlusty/math/eos/moleq.rs @@ -7,8 +7,8 @@ //! - 计算电子密度、熵、内能 //! - 计算质量密度和平均分子量 -use crate::tlusty::math::mpartf::{mpartf, MpartfResult}; -use crate::tlusty::math::russel::{russel, MoleculeData, RusselParams, RusselOutput, MAX_ELEM, MAX_MOL}; +use crate::tlusty::math::{mpartf, MpartfResult}; +use crate::tlusty::math::{russel, MoleculeData, RusselParams, RusselOutput, MAX_ELEM, MAX_MOL}; use crate::tlusty::state::constants::{BOLK, HMASS}; /// 常量 diff --git a/src/tlusty/math/rhoeos.rs b/src/tlusty/math/eos/rhoeos.rs similarity index 99% rename from src/tlusty/math/rhoeos.rs rename to src/tlusty/math/eos/rhoeos.rs index 695daf2..7ca4945 100644 --- a/src/tlusty/math/rhoeos.rs +++ b/src/tlusty/math/eos/rhoeos.rs @@ -13,7 +13,7 @@ //! 2. 使用牛顿迭代法求解密度,使得计算的压力等于给定压力 //! 3. 收敛条件:相对误差 < 1e-5 或达到最大迭代次数 -use super::{prsent, PrsentParams, ThermTables}; +use crate::tlusty::math::{prsent, PrsentParams, ThermTables}; use crate::tlusty::state::constants::BOLK; /// 平均分子量相关常数(氢原子质量 / 2.3) diff --git a/src/tlusty/math/rhonen.rs b/src/tlusty/math/eos/rhonen.rs similarity index 98% rename from src/tlusty/math/rhonen.rs rename to src/tlusty/math/eos/rhonen.rs index 5ca9e29..b8ff86d 100644 --- a/src/tlusty/math/rhonen.rs +++ b/src/tlusty/math/eos/rhonen.rs @@ -6,7 +6,7 @@ //! - 从给定的温度和质量密度迭代求解总粒子密度和电子密度 //! - 使用 eldens 计算电子密度 -use crate::tlusty::math::eldens::{eldens_pure, EldensConfig, EldensOutput, EldensParams}; +use crate::tlusty::math::{eldens_pure, EldensConfig, EldensOutput, EldensParams}; use crate::tlusty::state::constants::{HMASS, UN}; /// RHONEN 输入参数 diff --git a/src/tlusty/math/russel.rs b/src/tlusty/math/eos/russel.rs similarity index 99% rename from src/tlusty/math/russel.rs rename to src/tlusty/math/eos/russel.rs index 178f430..bce0a8b 100644 --- a/src/tlusty/math/russel.rs +++ b/src/tlusty/math/eos/russel.rs @@ -7,7 +7,7 @@ //! - 使用 Newton-Raphson 方法求解 Russell 方程 //! - 计算电离平衡分布 -use crate::tlusty::math::mpartf::mpartf; +use crate::tlusty::math::mpartf; /// 常量 const ECONST: f64 = 4.3426e-1; diff --git a/src/tlusty/math/steqeq.rs b/src/tlusty/math/eos/steqeq.rs similarity index 100% rename from src/tlusty/math/steqeq.rs rename to src/tlusty/math/eos/steqeq.rs diff --git a/src/tlusty/math/bhe.rs b/src/tlusty/math/hydrogen/bhe.rs similarity index 100% rename from src/tlusty/math/bhe.rs rename to src/tlusty/math/hydrogen/bhe.rs diff --git a/src/tlusty/math/bre.rs b/src/tlusty/math/hydrogen/bre.rs similarity index 100% rename from src/tlusty/math/bre.rs rename to src/tlusty/math/hydrogen/bre.rs diff --git a/src/tlusty/math/brez.rs b/src/tlusty/math/hydrogen/brez.rs similarity index 100% rename from src/tlusty/math/brez.rs rename to src/tlusty/math/hydrogen/brez.rs diff --git a/src/tlusty/math/brte.rs b/src/tlusty/math/hydrogen/brte.rs similarity index 100% rename from src/tlusty/math/brte.rs rename to src/tlusty/math/hydrogen/brte.rs diff --git a/src/tlusty/math/brtez.rs b/src/tlusty/math/hydrogen/brtez.rs similarity index 100% rename from src/tlusty/math/brtez.rs rename to src/tlusty/math/hydrogen/brtez.rs diff --git a/src/tlusty/math/colh.rs b/src/tlusty/math/hydrogen/colh.rs similarity index 99% rename from src/tlusty/math/colh.rs rename to src/tlusty/math/hydrogen/colh.rs index 9acb80a..ca02c4a 100644 --- a/src/tlusty/math/colh.rs +++ b/src/tlusty/math/hydrogen/colh.rs @@ -5,10 +5,10 @@ //! 计算氢的碰撞电离和碰撞激发速率。 //! 标准表达式来自 Mihalas, Heasley, and Auer (1975)。 -use super::butler::butler; -use super::ceh12::ceh12; -use super::cspec::cspec; -use super::irc::irc; +use crate::tlusty::math::butler; +use crate::tlusty::math::ceh12; +use crate::tlusty::math::cspec; +use crate::tlusty::math::irc; use crate::tlusty::data::{COLH_CCOOL, COLH_CHOT}; use crate::tlusty::state::constants::{EH, HK, TWO, UN}; diff --git a/src/tlusty/math/colhe.rs b/src/tlusty/math/hydrogen/colhe.rs similarity index 100% rename from src/tlusty/math/colhe.rs rename to src/tlusty/math/hydrogen/colhe.rs diff --git a/src/tlusty/math/colis.rs b/src/tlusty/math/hydrogen/colis.rs similarity index 99% rename from src/tlusty/math/colis.rs rename to src/tlusty/math/hydrogen/colis.rs index f9af506..c6824c2 100644 --- a/src/tlusty/math/colis.rs +++ b/src/tlusty/math/hydrogen/colis.rs @@ -9,11 +9,11 @@ //! - 支持多种碰撞速率公式(Seaton、Allen、Van Regemorter 等) //! - 处理表格化碰撞数据 -use super::cion::cion; -use super::colh::{colh, ColhAtomicData, ColhOutput, ColhParams}; -use super::cspec::cspec; -use super::irc::irc; -use super::ylintp::ylintp; +use crate::tlusty::math::cion; +use crate::tlusty::math::{colh, ColhAtomicData, ColhOutput, ColhParams}; +use crate::tlusty::math::cspec; +use crate::tlusty::math::irc; +use crate::tlusty::math::ylintp; use crate::tlusty::state::constants::{EH, HK, TWO, UN}; // ============================================================================ diff --git a/src/tlusty/math/collhe.rs b/src/tlusty/math/hydrogen/collhe.rs similarity index 100% rename from src/tlusty/math/collhe.rs rename to src/tlusty/math/hydrogen/collhe.rs diff --git a/src/tlusty/math/ctdata.rs b/src/tlusty/math/hydrogen/ctdata.rs similarity index 100% rename from src/tlusty/math/ctdata.rs rename to src/tlusty/math/hydrogen/ctdata.rs diff --git a/src/tlusty/math/ghydop.rs b/src/tlusty/math/hydrogen/ghydop.rs similarity index 100% rename from src/tlusty/math/ghydop.rs rename to src/tlusty/math/hydrogen/ghydop.rs diff --git a/src/tlusty/math/h2minus.rs b/src/tlusty/math/hydrogen/h2minus.rs similarity index 99% rename from src/tlusty/math/h2minus.rs rename to src/tlusty/math/hydrogen/h2minus.rs index a6b1ae0..766361b 100644 --- a/src/tlusty/math/h2minus.rs +++ b/src/tlusty/math/hydrogen/h2minus.rs @@ -6,7 +6,7 @@ //! 使用 Bell 1980 的数据表进行双线性插值计算 H⁻ 自由-自由吸收系数。 use crate::tlusty::data::{H2MINUS_FFKAPP, H2MINUS_FFLAMB, H2MINUS_FFTHET}; -use crate::tlusty::math::locate::locate; +use crate::tlusty::math::locate; // 常量 const BOLK: f64 = 1.380649e-16; // 玻尔兹曼常数 (erg/K) diff --git a/src/tlusty/math/hedif.rs b/src/tlusty/math/hydrogen/hedif.rs similarity index 100% rename from src/tlusty/math/hedif.rs rename to src/tlusty/math/hydrogen/hedif.rs diff --git a/src/tlusty/math/hephot.rs b/src/tlusty/math/hydrogen/hephot.rs similarity index 100% rename from src/tlusty/math/hephot.rs rename to src/tlusty/math/hydrogen/hephot.rs diff --git a/src/tlusty/math/hesol6.rs b/src/tlusty/math/hydrogen/hesol6.rs similarity index 99% rename from src/tlusty/math/hesol6.rs rename to src/tlusty/math/hydrogen/hesol6.rs index 3e5b2cd..9fa51a5 100644 --- a/src/tlusty/math/hesol6.rs +++ b/src/tlusty/math/hydrogen/hesol6.rs @@ -8,8 +8,8 @@ //! 3. 状态方程 //! 4. z-m 关系 -use crate::tlusty::math::erfcx::erfcx; -use crate::tlusty::math::matinv::matinv; +use crate::tlusty::math::erfcx; +use crate::tlusty::math::matinv; const UN: f64 = 1.0; const HALF: f64 = 0.5; diff --git a/src/tlusty/math/hesolv.rs b/src/tlusty/math/hydrogen/hesolv.rs similarity index 98% rename from src/tlusty/math/hesolv.rs rename to src/tlusty/math/hydrogen/hesolv.rs index 43f8c23..f566c6a 100644 --- a/src/tlusty/math/hesolv.rs +++ b/src/tlusty/math/hydrogen/hesolv.rs @@ -7,11 +7,11 @@ //! - 使用 Newton-Raphson 迭代方法 //! - 给定声速(总压力/密度),求解压力和深度分布 -use crate::tlusty::math::erfcx::erfcx; -use crate::tlusty::math::matinv::matinv; -use crate::tlusty::math::rhonen::{rhonen_pure, RhonenParams}; -use crate::tlusty::math::steqeq::{steqeq_pure, SteqeqConfig, SteqeqParams}; -use crate::tlusty::math::wnstor::wnstor; +use crate::tlusty::math::erfcx; +use crate::tlusty::math::matinv; +use crate::tlusty::math::{rhonen_pure, RhonenParams}; +use crate::tlusty::math::{steqeq_pure, SteqeqConfig, SteqeqParams}; +use crate::tlusty::math::wnstor; use crate::tlusty::state::constants::{HALF, MDEPTH, TWO, UN}; /// HESOLV 辅助参数(PRSAUX COMMON 块) diff --git a/src/tlusty/math/hidalg.rs b/src/tlusty/math/hydrogen/hidalg.rs similarity index 100% rename from src/tlusty/math/hidalg.rs rename to src/tlusty/math/hydrogen/hidalg.rs diff --git a/src/tlusty/math/inthyd.rs b/src/tlusty/math/hydrogen/inthyd.rs similarity index 100% rename from src/tlusty/math/inthyd.rs rename to src/tlusty/math/hydrogen/inthyd.rs diff --git a/src/tlusty/math/lymlin.rs b/src/tlusty/math/hydrogen/lymlin.rs similarity index 98% rename from src/tlusty/math/lymlin.rs rename to src/tlusty/math/hydrogen/lymlin.rs index b32b923..eccea6b 100644 --- a/src/tlusty/math/lymlin.rs +++ b/src/tlusty/math/hydrogen/lymlin.rs @@ -185,7 +185,7 @@ pub fn lymlin(params: &mut LymlinParams, cache: &mut LymlinCache) { let adh = cache.ad0[j][id]; let divh = cache.div0[j][id]; - let sg = super::starka::starka(beta, TWO, adh, betad, divh) * cache.fid[j][id]; + let sg = crate::tlusty::math::starka(beta, TWO, adh, betad, divh) * cache.fid[j][id]; ablym[id] += sg * cache.abtr[j][id]; emlym[id] += sg * cache.emtr[j][id]; } @@ -212,7 +212,7 @@ fn initialize_cache(params: &LymlinParams, cache: &mut LymlinCache) { // 计算 j=2..30 的 Stark 参数 for j in 2..=30 { - let (xkij0, wl00, fij0) = super::stark0::stark0(1, j, 1); + let (xkij0, wl00, fij0) = crate::tlusty::math::stark0(1, j, 1); cache.xkijl[j] = xkij0; cache.fijl[j] = fij0; cache.wl0l[j] = wl00; @@ -264,7 +264,7 @@ fn initialize_cache(params: &LymlinParams, cache: &mut LymlinCache) { let betad = dop * dbeta; // 调用 divstr - let (adh, divh) = super::divstr::divstr(betad, 1); + let (adh, divh) = crate::tlusty::math::divstr(betad, 1); cache.ad0[j][id] = adh; cache.div0[j][id] = divh; diff --git a/src/tlusty/math/hydrogen/mod.rs b/src/tlusty/math/hydrogen/mod.rs new file mode 100644 index 0000000..ae0b023 --- /dev/null +++ b/src/tlusty/math/hydrogen/mod.rs @@ -0,0 +1,69 @@ +//! hydrogen module + +mod bhe; +mod bre; +mod brez; +mod brte; +mod brtez; +mod colh; +mod colhe; +mod colis; +mod collhe; +mod ctdata; +mod ghydop; +mod h2minus; +mod hedif; +mod hephot; +mod hesol6; +mod hesolv; +mod hidalg; +mod inthyd; +mod lymlin; +mod sbfch; +mod sbfhe1; +mod sbfhmi; +mod sbfhmi_old; +mod sbfoh; +mod sffhmi; +mod sffhmi_add; +mod sgmer; +mod sgmer1; +mod sigave; +mod sigk; +mod sigmar; +mod spsigk; +mod szirc; + +pub use bhe::*; +pub use bre::*; +pub use brez::*; +pub use brte::*; +pub use brtez::*; +pub use colh::*; +pub use colhe::*; +pub use colis::*; +pub use collhe::*; +pub use ctdata::*; +pub use ghydop::*; +pub use h2minus::*; +pub use hedif::*; +pub use hephot::*; +pub use hesol6::*; +pub use hesolv::*; +pub use hidalg::*; +pub use inthyd::*; +pub use lymlin::*; +pub use sbfch::*; +pub use sbfhe1::*; +pub use sbfhmi::*; +pub use sbfhmi_old::*; +pub use sbfoh::*; +pub use sffhmi::*; +pub use sffhmi_add::*; +pub use sgmer::*; +pub use sgmer1::*; +pub use sigave::*; +pub use sigk::*; +pub use sigmar::*; +pub use spsigk::*; +pub use szirc::*; diff --git a/src/tlusty/math/sbfch.rs b/src/tlusty/math/hydrogen/sbfch.rs similarity index 100% rename from src/tlusty/math/sbfch.rs rename to src/tlusty/math/hydrogen/sbfch.rs diff --git a/src/tlusty/math/sbfhe1.rs b/src/tlusty/math/hydrogen/sbfhe1.rs similarity index 99% rename from src/tlusty/math/sbfhe1.rs rename to src/tlusty/math/hydrogen/sbfhe1.rs index 8af88a7..280e606 100644 --- a/src/tlusty/math/sbfhe1.rs +++ b/src/tlusty/math/hydrogen/sbfhe1.rs @@ -5,7 +5,7 @@ //! 计算中性氦 n = 1, 2, 3, 4 态的光电离截面。 //! 使用 Opacity Project 截面的适当平均 (由 HEPHOT 计算) 或 Koester 拟合。 -use super::{ckoest, hephot}; +use crate::tlusty::math::{ckoest, hephot}; /// 计算 He I 光电离截面。 /// diff --git a/src/tlusty/math/sbfhmi.rs b/src/tlusty/math/hydrogen/sbfhmi.rs similarity index 100% rename from src/tlusty/math/sbfhmi.rs rename to src/tlusty/math/hydrogen/sbfhmi.rs diff --git a/src/tlusty/math/sbfhmi_old.rs b/src/tlusty/math/hydrogen/sbfhmi_old.rs similarity index 100% rename from src/tlusty/math/sbfhmi_old.rs rename to src/tlusty/math/hydrogen/sbfhmi_old.rs diff --git a/src/tlusty/math/sbfoh.rs b/src/tlusty/math/hydrogen/sbfoh.rs similarity index 100% rename from src/tlusty/math/sbfoh.rs rename to src/tlusty/math/hydrogen/sbfoh.rs diff --git a/src/tlusty/math/sffhmi.rs b/src/tlusty/math/hydrogen/sffhmi.rs similarity index 100% rename from src/tlusty/math/sffhmi.rs rename to src/tlusty/math/hydrogen/sffhmi.rs diff --git a/src/tlusty/math/sffhmi_add.rs b/src/tlusty/math/hydrogen/sffhmi_add.rs similarity index 100% rename from src/tlusty/math/sffhmi_add.rs rename to src/tlusty/math/hydrogen/sffhmi_add.rs diff --git a/src/tlusty/math/sgmer.rs b/src/tlusty/math/hydrogen/sgmer.rs similarity index 100% rename from src/tlusty/math/sgmer.rs rename to src/tlusty/math/hydrogen/sgmer.rs diff --git a/src/tlusty/math/sgmer1.rs b/src/tlusty/math/hydrogen/sgmer1.rs similarity index 100% rename from src/tlusty/math/sgmer1.rs rename to src/tlusty/math/hydrogen/sgmer1.rs diff --git a/src/tlusty/math/sigave.rs b/src/tlusty/math/hydrogen/sigave.rs similarity index 100% rename from src/tlusty/math/sigave.rs rename to src/tlusty/math/hydrogen/sigave.rs diff --git a/src/tlusty/math/sigk.rs b/src/tlusty/math/hydrogen/sigk.rs similarity index 97% rename from src/tlusty/math/sigk.rs rename to src/tlusty/math/hydrogen/sigk.rs index e5f984b..d48dd5f 100644 --- a/src/tlusty/math/sigk.rs +++ b/src/tlusty/math/hydrogen/sigk.rs @@ -22,14 +22,14 @@ //! - H-: SBFHMI //! - He I: SBFHE1 -use super::gaunt; -use super::gntk; -use super::sbfhe1; -use super::sbfhmi; -use super::spsigk; -use super::topbas::{self, TopbasParams, OpData}; -use super::verner; -use super::ylintp; +use crate::tlusty::math::gaunt; +use crate::tlusty::math::gntk; +use crate::tlusty::math::sbfhe1; +use crate::tlusty::math::sbfhmi; +use crate::tlusty::math::spsigk; +use crate::tlusty::math::{topbas, TopbasParams, OpData}; +use crate::tlusty::math::verner; +use crate::tlusty::math::ylintp; use crate::tlusty::state::atomic::AtomicData; // ============================================================================ @@ -284,7 +284,7 @@ pub fn sigk(params: &SigkParams) -> f64 { typly, opdata, }; - sigk_result = topbas::topbas(&topbas_params); + sigk_result = topbas(&topbas_params); } // IBF > 100: 从直接输入数据插值 diff --git a/src/tlusty/math/sigmar.rs b/src/tlusty/math/hydrogen/sigmar.rs similarity index 99% rename from src/tlusty/math/sigmar.rs rename to src/tlusty/math/hydrogen/sigmar.rs index b93c0ae..f2f1177 100644 --- a/src/tlusty/math/sigmar.rs +++ b/src/tlusty/math/hydrogen/sigmar.rs @@ -7,7 +7,7 @@ //! //! 参考: Krolik, Chapter 7 -use super::laguer::laguer; +use crate::tlusty::math::laguer; use num_complex::Complex64; /// 计算表面质量密度。 diff --git a/src/tlusty/math/spsigk.rs b/src/tlusty/math/hydrogen/spsigk.rs similarity index 100% rename from src/tlusty/math/spsigk.rs rename to src/tlusty/math/hydrogen/spsigk.rs diff --git a/src/tlusty/math/szirc.rs b/src/tlusty/math/hydrogen/szirc.rs similarity index 100% rename from src/tlusty/math/szirc.rs rename to src/tlusty/math/hydrogen/szirc.rs diff --git a/src/tlusty/math/ckoest.rs b/src/tlusty/math/interpolation/ckoest.rs similarity index 100% rename from src/tlusty/math/ckoest.rs rename to src/tlusty/math/interpolation/ckoest.rs diff --git a/src/tlusty/math/interp.rs b/src/tlusty/math/interpolation/interp.rs similarity index 100% rename from src/tlusty/math/interp.rs rename to src/tlusty/math/interpolation/interp.rs diff --git a/src/tlusty/math/interpolate.rs b/src/tlusty/math/interpolation/interpolate.rs similarity index 100% rename from src/tlusty/math/interpolate.rs rename to src/tlusty/math/interpolation/interpolate.rs diff --git a/src/tlusty/math/intlem.rs b/src/tlusty/math/interpolation/intlem.rs similarity index 100% rename from src/tlusty/math/intlem.rs rename to src/tlusty/math/interpolation/intlem.rs diff --git a/src/tlusty/math/intxen.rs b/src/tlusty/math/interpolation/intxen.rs similarity index 99% rename from src/tlusty/math/intxen.rs rename to src/tlusty/math/interpolation/intxen.rs index 7c74b4f..ec4610f 100644 --- a/src/tlusty/math/intxen.rs +++ b/src/tlusty/math/interpolation/intxen.rs @@ -4,7 +4,7 @@ //! //! 对氢线的 Xenomorph 表进行温度和电子密度的二维插值。 -use crate::tlusty::math::interpolate::yint; +use crate::tlusty::math::yint; /// Xenomorph 表插值。 /// diff --git a/src/tlusty/math/lagran.rs b/src/tlusty/math/interpolation/lagran.rs similarity index 100% rename from src/tlusty/math/lagran.rs rename to src/tlusty/math/interpolation/lagran.rs diff --git a/src/tlusty/math/locate.rs b/src/tlusty/math/interpolation/locate.rs similarity index 100% rename from src/tlusty/math/locate.rs rename to src/tlusty/math/interpolation/locate.rs diff --git a/src/tlusty/math/interpolation/mod.rs b/src/tlusty/math/interpolation/mod.rs new file mode 100644 index 0000000..3832f97 --- /dev/null +++ b/src/tlusty/math/interpolation/mod.rs @@ -0,0 +1,24 @@ +//! interpolation module + +mod ckoest; +mod interp; +mod interpolate; +mod intlem; +mod intxen; +mod lagran; +mod locate; +mod tabint; +mod yint; +mod ylintp; + +pub use ckoest::*; +pub use interp::*; +// Note: interpolate is not re-exported because it contains duplicate +// implementations of yint and lagran that conflict with yint::* and lagran::* +pub use intlem::*; +pub use intxen::*; +pub use lagran::*; +pub use locate::*; +pub use tabint::*; +pub use yint::*; +pub use ylintp::*; diff --git a/src/tlusty/math/tabint.rs b/src/tlusty/math/interpolation/tabint.rs similarity index 100% rename from src/tlusty/math/tabint.rs rename to src/tlusty/math/interpolation/tabint.rs diff --git a/src/tlusty/math/yint.rs b/src/tlusty/math/interpolation/yint.rs similarity index 97% rename from src/tlusty/math/yint.rs rename to src/tlusty/math/interpolation/yint.rs index fdcc094..d7536ab 100644 --- a/src/tlusty/math/yint.rs +++ b/src/tlusty/math/interpolation/yint.rs @@ -66,7 +66,7 @@ mod tests { #[test] fn test_yint_vs_lagran() { // yint 和 lagran 应该给出相同的结果 - use super::super::lagran::lagran; + use super::crate::tlusty::math::lagran; let xl = [0.0, 1.0, 2.0]; let yl = [1.0, 3.0, 2.0]; diff --git a/src/tlusty/math/ylintp.rs b/src/tlusty/math/interpolation/ylintp.rs similarity index 100% rename from src/tlusty/math/ylintp.rs rename to src/tlusty/math/interpolation/ylintp.rs diff --git a/src/tlusty/math/getwrd.rs b/src/tlusty/math/io/getwrd.rs similarity index 100% rename from src/tlusty/math/getwrd.rs rename to src/tlusty/math/io/getwrd.rs diff --git a/src/tlusty/math/io/mod.rs b/src/tlusty/math/io/mod.rs new file mode 100644 index 0000000..0fb5f5b --- /dev/null +++ b/src/tlusty/math/io/mod.rs @@ -0,0 +1,35 @@ +//! io module + +mod getwrd; +mod output; +mod prchan; +mod princ; +mod prnt; +mod prsent; +mod pzert; +mod pzeval; +mod pzevld; +mod quit; +mod rdata; +mod rdatax; +mod readbf; +mod rechck; +mod timing; +mod visini; + +pub use getwrd::*; +pub use output::*; +pub use prchan::*; +pub use princ::*; +pub use prnt::*; +pub use prsent::*; +pub use pzert::*; +pub use pzeval::*; +pub use pzevld::*; +pub use quit::*; +pub use rdata::*; +pub use rdatax::*; +pub use readbf::*; +pub use rechck::*; +pub use timing::*; +pub use visini::*; diff --git a/src/tlusty/math/output.rs b/src/tlusty/math/io/output.rs similarity index 100% rename from src/tlusty/math/output.rs rename to src/tlusty/math/io/output.rs diff --git a/src/tlusty/math/prchan.rs b/src/tlusty/math/io/prchan.rs similarity index 100% rename from src/tlusty/math/prchan.rs rename to src/tlusty/math/io/prchan.rs diff --git a/src/tlusty/math/princ.rs b/src/tlusty/math/io/princ.rs similarity index 98% rename from src/tlusty/math/princ.rs rename to src/tlusty/math/io/princ.rs index 872dcf2..d407ea5 100644 --- a/src/tlusty/math/princ.rs +++ b/src/tlusty/math/io/princ.rs @@ -21,10 +21,10 @@ use crate::tlusty::state::constants::{UN, HALF, HK, BOLK, BN, MDEPTH, MFREQ, MLE const NPTR: usize = 30; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::model::ModelState; -use crate::tlusty::math::sabolf::{sabolf_pure, SabolfParams, SabolfOutput}; -use crate::tlusty::math::linpro::{linpro, LinproParams, LinproOutput}; -use crate::tlusty::math::dwnfr::dwnfr; -use crate::tlusty::math::cross::cross; +use crate::tlusty::math::{sabolf_pure, SabolfParams, SabolfOutput}; +use crate::tlusty::math::{linpro, LinproParams, LinproOutput}; +use crate::tlusty::math::dwnfr; +use crate::tlusty::math::cross; use crate::tlusty::state::config::InpPar; // ============================================================================ diff --git a/src/tlusty/math/prnt.rs b/src/tlusty/math/io/prnt.rs similarity index 99% rename from src/tlusty/math/prnt.rs rename to src/tlusty/math/io/prnt.rs index 19b4e0a..8e0ce70 100644 --- a/src/tlusty/math/prnt.rs +++ b/src/tlusty/math/io/prnt.rs @@ -12,7 +12,7 @@ use crate::tlusty::state::config::InpPar; use crate::tlusty::state::constants::HK; use crate::tlusty::state::model::{CraTes, LevPop, ModPar, RrRates, WmComp}; -use super::sabolf::{sabolf_pure, SabolfParams}; +use crate::tlusty::math::{sabolf_pure, SabolfParams}; // ============================================================================ // 输出结构体 diff --git a/src/tlusty/math/prsent.rs b/src/tlusty/math/io/prsent.rs similarity index 100% rename from src/tlusty/math/prsent.rs rename to src/tlusty/math/io/prsent.rs diff --git a/src/tlusty/math/pzert.rs b/src/tlusty/math/io/pzert.rs similarity index 100% rename from src/tlusty/math/pzert.rs rename to src/tlusty/math/io/pzert.rs diff --git a/src/tlusty/math/pzeval.rs b/src/tlusty/math/io/pzeval.rs similarity index 100% rename from src/tlusty/math/pzeval.rs rename to src/tlusty/math/io/pzeval.rs diff --git a/src/tlusty/math/pzevld.rs b/src/tlusty/math/io/pzevld.rs similarity index 99% rename from src/tlusty/math/pzevld.rs rename to src/tlusty/math/io/pzevld.rs index d4e04af..dc132ee 100644 --- a/src/tlusty/math/pzevld.rs +++ b/src/tlusty/math/io/pzevld.rs @@ -4,7 +4,7 @@ //! //! 确定总压、气体压以及压力对数梯度;计算从中心平面开始的几何距离 Z。 -use crate::tlusty::math::dmder::DepthDeriv; +use crate::tlusty::math::DepthDeriv; use crate::tlusty::state::arrays::ComputeArrays; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::config::TlustyConfig; @@ -208,7 +208,7 @@ pub fn pzevld( #[cfg(test)] mod tests { use super::*; - use crate::tlusty::math::dmder::dmder; + use crate::tlusty::math::dmder; #[test] fn test_pzevld_basic() { diff --git a/src/tlusty/math/quit.rs b/src/tlusty/math/io/quit.rs similarity index 100% rename from src/tlusty/math/quit.rs rename to src/tlusty/math/io/quit.rs diff --git a/src/tlusty/math/rdata.rs b/src/tlusty/math/io/rdata.rs similarity index 100% rename from src/tlusty/math/rdata.rs rename to src/tlusty/math/io/rdata.rs diff --git a/src/tlusty/math/rdatax.rs b/src/tlusty/math/io/rdatax.rs similarity index 99% rename from src/tlusty/math/rdatax.rs rename to src/tlusty/math/io/rdatax.rs index c6ea4ee..fc7aa2f 100644 --- a/src/tlusty/math/rdatax.rs +++ b/src/tlusty/math/io/rdatax.rs @@ -7,7 +7,7 @@ //! - 设置 BFCS 数组(束缚-自由截面) //! - 计算所有频率的截面 -use crate::tlusty::math::bkhsgo::bkhsgo; +use crate::tlusty::math::bkhsgo; /// 最大跃迁数 pub const MTRX: usize = 1000; diff --git a/src/tlusty/math/readbf.rs b/src/tlusty/math/io/readbf.rs similarity index 100% rename from src/tlusty/math/readbf.rs rename to src/tlusty/math/io/readbf.rs diff --git a/src/tlusty/math/rechck.rs b/src/tlusty/math/io/rechck.rs similarity index 100% rename from src/tlusty/math/rechck.rs rename to src/tlusty/math/io/rechck.rs diff --git a/src/tlusty/math/timing.rs b/src/tlusty/math/io/timing.rs similarity index 100% rename from src/tlusty/math/timing.rs rename to src/tlusty/math/io/timing.rs diff --git a/src/tlusty/math/visini.rs b/src/tlusty/math/io/visini.rs similarity index 100% rename from src/tlusty/math/visini.rs rename to src/tlusty/math/io/visini.rs diff --git a/src/tlusty/math/mod.rs b/src/tlusty/math/mod.rs index e9ff2ab..29d77c4 100644 --- a/src/tlusty/math/mod.rs +++ b/src/tlusty/math/mod.rs @@ -1,583 +1,61 @@ //! 数学工具函数,重构自 TLUSTY Fortran。 +//! +//! 模块组织结构: +//! - `ali`: ALI (Accelerated Lambda Iteration) 迭代 +//! - `atomic`: 原子物理 +//! - `continuum`: 连续谱不透明度 +//! - `convection`: 对流处理 +//! - `eos`: 状态方程 +//! - `hydrogen`: 氢/氦物理 +//! - `interpolation`: 插值函数 +//! - `io`: 输入输出 +//! - `odf`: ODF (Opacity Distribution Function) +//! - `opacity`: 不透明度补充 +//! - `partition`: 配分函数 +//! - `population`: 能级粒子数 +//! - `radiative`: 辐射转移 +//! - `rates`: 速率系数 +//! - `solvers`: 方程求解器 +//! - `special`: 特殊数学函数 +//! - `temperature`: 温度修正 +//! - `utils`: 工具函数 -mod accelp; -mod accel2; -mod chctab; -mod cheav; -mod cheavj; -mod cia_h2h; -mod cia_h2h2; -mod cia_h2he; -mod cia_hhe; -mod alist1; -mod alist2; -mod alifr1; -mod alifr3; -mod alifr6; -mod alifrk; -mod alisk1; -mod alisk2; -mod allard; -mod allardt; -mod quasim; -mod angset; -mod betah; -mod bkhsgo; -mod bpop; -mod bpopt; -mod bre; -mod brez; -mod brte; -mod brtez; -mod bhe; -mod bpopf; -mod bpopc; -mod bpope; -mod butler; -mod carbon; -mod ceh12; -mod change; -mod cion; -mod ckoest; -mod colh; -mod column; -mod colhe; -mod colis; -mod collhe; -mod corrwm; -mod compt0; -mod comset; -mod concor; -mod conout; -mod conref; -mod contmd; -mod contmp; -mod convec; -mod coolrt; -mod cross; -mod cspec; -mod ctdata; -mod cubic; -mod dielrc; -mod dietot; -mod divstr; -mod dopgam; -mod dmder; -mod dwnfr; -mod dmeval; -mod dwnfr0; -mod dwnfr1; -mod elcor; -mod eldenc; -mod eldens; -mod emat; -mod entene; -mod erfcx; -mod expo; -mod expint; -mod ffcros; -mod gauleg; -mod getwrd; -mod gami; -mod getlal; -mod gamsp; -mod gfree; -mod ghydop; -mod gaunt; -mod gntk; -mod gridp; -mod gomini; -mod grcor; -mod gvdw; -mod greyd; -mod h2minus; -mod hephot; -mod hedif; -mod hesol6; -mod hesolv; -mod hidalg; -pub mod indexx; -mod ijali2; -mod inifrs; -mod inilam; -mod inpdis; -mod ijalis; -mod inicom; -mod inifrc; -mod inifrt; -mod inkul; -pub mod interp; -mod inthyd; -mod intlem; -mod intxen; -mod irc; -mod interpolate; -mod lagran; -mod laguer; -mod lemini; -mod levsol; -mod levset; -mod levgrp; -mod lineqs; -mod linpro; -mod linsel; -mod lucy; -mod lymlin; -mod linspl; -mod locate; -mod matgen; -mod matinv; -mod matcon; -mod meanop; -mod meanopt; -mod minv3; -mod mpartf; -mod moleq; -mod newdm; -mod newdmt; -mod newpop; -mod osccor; -mod odf1; -mod odfhst; -mod odfhyd; -mod odfmer; -mod odffr; -mod odfhys; -mod opfrac; -mod opadd; -mod opadd0; -mod partf; -mod opahst; -mod opacfa; -mod opacf0; -mod opacf1; -mod opacfd; -mod opact1; -mod opactd; -mod opactr; -mod opacfl; -mod opaini; -mod opctab; -mod opdata; -mod output; -mod pfcno; -mod pffe; -mod pfheav; -mod prd; -mod prdini; -mod prchan; -mod princ; -mod pzeval; -mod prnt; -mod prsent; -mod profil; -mod profsp; -mod quartc; -mod pfni; -mod pzert; -mod pzevld; -mod pfspec; -mod pgset; -mod psolve; -pub mod quit; -mod reflev; -mod raph; -mod ratmal; -mod readbf; -mod rdata; -mod rdatax; -mod rechck; -mod russel; -mod ratmat; -mod rates1; -mod ratsp1; -pub mod rayleigh; -mod rybchn; -mod rybsol; -mod rybmat; -mod rybene; -mod rybheq; -mod sabolf; -pub mod rayset; -mod reiman; -mod rhoeos; -mod rhsgen; -mod rhonen; -mod rteang; -mod rte_sc; -mod rtefe2; -mod rteint; -mod rtedf1; -mod rtedf2; -mod rtecf0; -mod rtecf1; -mod rtecmc; -mod rtecmu; -mod rtecom; -mod rtefr1; -mod rtesol; -mod radpre; -mod radtot; -mod rosstd; -mod rossop; -mod sbfch; -mod sbfhe1; -mod sbfhmi; -mod sbfhmi_old; -mod sbfoh; -mod setdrt; -mod sghe12; -mod sgmer; -mod sgmer1; -mod sigave; -pub mod sigk; -mod sigmar; -mod state; -mod sffhmi; -mod tabint; -mod taufr1; -mod sffhmi_add; -mod spsigk; -mod solve; -mod solves; -mod stark0; -mod starka; -mod steqeq; -mod temcor; -mod temper; -mod szirc; -mod switch; -mod tiopf; -mod timing; -mod tlocal; -pub mod topbas; -mod tdpini; -mod traini; -mod trmdrt; -mod trmder; -mod tridag; -mod ubeta; -mod verner; -mod vern16; -mod vern18; -mod vern20; -mod vern26; -mod visini; -mod voigt; -mod voigte; -mod wn; -mod wnstor; -mod xk2dop; -mod yint; -mod ylintp; -mod zmrho; +// 子模块声明 +pub mod ali; +pub mod atomic; +pub mod continuum; +pub mod convection; +pub mod eos; +pub mod hydrogen; +pub mod interpolation; +pub mod io; +pub mod odf; +pub mod opacity; +pub mod partition; +pub mod population; +pub mod radiative; +pub mod rates; +pub mod solvers; +pub mod special; +pub mod temperature; +pub mod utils; -pub use accelp::{accelp, accelp_io, AccelpParams, AccelpResult}; -pub use accel2::{accel2_pure, accel2_io, Accel2Config, Accel2Params, Accel2Output}; -pub use chctab::{chctab, ChctabParams, ChctabResult, OpacityFlags, ELEMENT_SYMBOLS}; -pub use cheav::cheav; -pub use cheavj::cheavj; -pub use cia_h2h::{cia_h2h, CiaH2hData}; -pub use cia_h2h2::{cia_h2h2, CiaH2h2Data}; -pub use cia_h2he::{cia_h2he, CiaH2heData}; -pub use cia_hhe::{cia_hhe, CiaHheData}; -pub use alifr1::{alifr1, Alifr1Params, Alifr1ModelState, Alifr1RadState}; -pub use alifr3::{alifr3, Alifr3Params}; -pub use alifr6::{alifr6, Alifr6Params, Alifr6State}; -pub use alifrk::{alifrk, AlifrkParams, AlifrkState}; -pub use alisk1::{ - alisk1_pure, Alisk1Config, Alisk1FreqParams, Alisk1AtomicParams, - Alisk1ModelState, Alisk1OutputState, Alisk1Output, -}; -pub use alisk2::{ - alisk2_pure, Alisk2Config, Alisk2FreqParams, Alisk2AtomicParams, - Alisk2ModelState, Alisk2OutputState, Alisk2Output, -}; -pub use alist1::{ - alist1_pure, Alist1Config, Alist1FreqParams, Alist1AtomicParams, - Alist1ModelState, Alist1OutputState, Alist1Output, -}; -pub use allard::{allard}; -pub use allardt::{allardt, AllardData}; -pub use angset::angset; -pub use quasim::quasim; -pub use betah::betah; -pub use bkhsgo::bkhsgo; -pub use bpop::{bpop, BpopParams, BpopOutput}; -pub use bpopt::{bpopt, BpoptParams, BpoptOutput}; -pub use bre::{bre, BreParams, BreState}; -pub use brez::{brez, BrezParams, BrezState}; -pub use brte::{brte, BrteParams, BrteState}; -pub use brtez::{brtez, BrtezParams, BrtezState}; -pub use bhe::{bhe, bhed, bhez, BheParams, BheState, MatKey}; -pub use bpopf::{bpopf, BpopfParams}; -pub use bpopc::{bpopc_pure, BpopcParams, BpopcOutput}; -pub use bpope::{ - bpope, BpopeAtomicData, BpopeConfig, BpopeFreqData, BpopeMatrixData, BpopeModelState, - BpopeOutput, BpopeParams, -}; -pub use butler::butler; -pub use carbon::carbon; -pub use ceh12::ceh12; -pub use change::{change_pure, ChangeConfig, ChangeParams, ChangeOutput, LevelMapping, saha_factor}; -pub use cion::cion; -pub use ckoest::ckoest; -pub use colh::{colh, ColhAtomicData, ColhOutput, ColhParams}; -pub use column::{column, column_io, ColumnParams, ColumnResult}; -pub use colhe::{colhe, ColheParams, ColheOutput, colhe1_ionization, colhe1_excitation_ground, colhe1_excitation_excited, colhe2_ionization, colhe2_excitation}; -pub use colis::{colis, ColisParams, ColisOutput, MXTCOL, MCFIT}; -pub use collhe::collhe; -pub use corrwm::{corrwm, corrwm_io, CorrwmParams}; -pub use comset::{comset, ComsetParams, ComsetResult}; -pub use concor::{concor_pure, ConcorConfig, ConcorParams, ConcorOutput, compute_delta, compute_new_temp}; -pub use conout::{conout_pure, ConoutConfig, ConoutParams, ConoutOutput, DepthResult, CubconData, - format_conout_header, format_depth_line, format_convective_zone, format_ndre_reset}; -pub use contmd::{contmd_pure, ContmdConfig, ContmdParams, ContmdOutput, CubconData as ContmdCubconData, - format_contmd_iter}; -pub use contmp::{contmp, ContmpConfig, ContmpParams, ContmpOutput}; -pub use convec::{convec, convc1, ConvecConfig, ConvecParams, ConvecOutput, Convc1Output}; -pub use coolrt::{coolrt_pure, CoolrtParams, CoolrtOutput, compute_taud, find_fe2_ion}; -pub use cross::{cross, crossd}; -pub use cspec::cspec; -pub use ctdata::{hction, hctrecom, CTION, CTRECOMB}; -pub use cubic::{cubic, CubicCon}; -pub use dielrc::dielrc; -pub use dietot::{dietot, DietotParams}; -pub use divstr::divstr; -pub use dopgam::dopgam; -pub use dmder::{dmder, DepthDeriv}; -pub use dmeval::{dmeval, dmeval_io, DmevalParams, DmevalResult}; -pub use dwnfr::dwnfr; -pub use dwnfr0::dwnfr0; -pub use dwnfr1::dwnfr1; -pub use emat::emat; -pub use elcor::{elcor_pure, ElcorConfig, ElcorParams, ElcorOutput}; -pub use eldenc::{eldenc_pure, EldencConfig, EldencParams, EldencOutput, MTABT, MTABR}; -pub use eldens::{eldens_pure, EldensParams, EldensOutput, EldensConfig}; -pub use entene::{entene, EnteneOutput, EnteneParams}; -pub use erfcx::{erfcin, erfcx}; -pub use expo::expo; -pub use expint::{eint, expinx}; -pub use ffcros::ffcros; -pub use gauleg::gauleg; -pub use getwrd::getwrd; -pub use gami::gami; -pub use getlal::{getlal, GetlalParams, GetlalResult}; -pub use gamsp::gamsp; -pub use gfree::{gfree0, gfree1, gfreed}; -pub use ghydop::{ghydop, GhydopParams, GhydopResult}; -pub use gaunt::gaunt; -pub use gntk::gntk; -pub use gridp::gridp; -pub use gomini::{gomini, GominiParams, GominiResult}; -pub use gvdw::{gvdw, GvdwParams}; -pub use grcor::grcor; -pub use greyd::{ - greyd_pure, format_greyd_iter, - GreydConfig, GreydState, GreydOutput, GreydIterOutput, -}; -pub use h2minus::h2minus; -pub use hephot::hephot; -pub use hedif::{hedif, hedif_io, HedifParams, HedifResult}; -pub use hesol6::{hesol6, Hesol6Aux, Hesol6Output, Hesol6Params}; -pub use hesolv::{hesolv_pure, HesolvAux, HesolvConfig, HesolvModelState, HesolvAtomicParams, HesolvParams, HesolvOutput}; -pub use hidalg::hidalg; -pub use indexx::indexx; -pub use inifrs::{inifrs, InifrsConfig, InifrsFreqControl, InifrsOutput}; -pub use inilam::{inilam_pure, InilamConfig, InilamModelState, InilamAtomicParams, InilamFreqParams, InilamOutput}; -pub use inpdis::{inpdis_pure, inpdis_io, InpDisParams, InpDisResult}; -pub use ijalis::{ijalis, ijalis_io, IjalisParams, IjalisOutput}; -pub use ijali2::{ijali2, Ijali2Params, Ijali2Output}; -pub use inicom::inicom; -pub use inifrc::{inifrc, InifrcParams, InifrcOutput}; -pub use inifrt::{inifrt, InifrtParams, InifrtOutput}; -pub use inkul::{inkul, inkul_pure, InkulParams, InkulOutput, ColKur, Lined, LineRecord}; -pub use interp::interp; -pub use inthyd::inthyd; -pub use intlem::intlem; -pub use intxen::intxen; -pub use irc::irc; -pub use interpolate::{lagran, yint}; -pub use laguer::laguer; -pub use lemini::{lemini, lemini_pure, apply_lemini_output, LeminiParams, LeminiOutput, LemkeTableData, LineData}; -pub use levsol::levsol; -pub use levset::{levset, LevsetParams, LevsetModelState, LevsetOutputState}; -pub use levgrp::{levgrp, LevgrpParams, LevgrpResult}; -pub use lineqs::{lineqs, lineqs_nr}; -pub use linpro::{linpro, LinproParams, LinproOutput}; -pub use linsel::{ - linsel_pure, LinselConfig, LinselAtomicParams, LinselFreqParams, - LinselStats, LinselAccuracy, LinselOutput, LinselDebugLine, -}; -pub use lymlin::{lymlin, LymlinCache, LymlinParams}; -pub use linspl::{linspl, LinsplParams}; -pub use locate::locate; -pub use matgen::{matgen_prepare, matgen_skip_zero_populations, MatgenParams, MatgenOutput}; -pub use matinv::matinv; -pub use matcon::{matcon, MatconConfig, MatconParams, MatconMatrices, MatconOutput}; -pub use meanop::meanop; -pub use meanopt::{meanopt, MeanoptModelState, MeanoptOutput, MeanoptParams}; -pub use minv3::minv3; -pub use mpartf::{mpartf, MpartfResult}; -pub use moleq::{moleq_pure, MoleqParams, MoleqOutput, MoleculeEqData, parse_molecule_data}; -pub use newdmt::{newdmt_pure, NewdmtConfig, NewdmtModelState, NewdmtPrsAux, NewdmtFactrs}; -pub use newpop::{newpop, NewpopParams, NewpopResult}; -pub use osccor::{osccor, OsccorParams, OsccorOutput, format_oscillation_message}; -pub use opfrac::{opfrac_pure, opfrac_init, OpfracParams, OpfracOutput, PfOptB}; -pub use opadd::{opadd, OpaddInput, OpaddModel, OpaddSwitches, OpaddOutput, OpaddCache}; -pub use opadd0::{opadd0, Opadd0Params, Opadd0FreqData, Opadd0OutputState}; -pub use partf::{partf_pure, PartfParams, PartfOutput, PartfMode}; -pub use opahst::{opahst, OpahstParams, OpahstOutput, LymanConfig, BalmerConfig, NLMX}; -pub use opacfa::{opacfa, OpacfaParams, OpacfaOutput}; -pub use opacf0::{opacf0, Opacf0Config, Opacf0ModelState, Opacf0AtomicParams, Opacf0FreqParams, Opacf0Output}; -pub use opacfd::{opacfd, OpacfdParams, OpacfdState, OpacfdOutput}; -pub use opact1::{ - opact1, Opact1ModelState, Opact1OutputState, Opact1Params, -}; -pub use opactd::{ - opactd, OpactdExpData, OpactdModelState, OpactdOutputState, OpactdParams, -}; -pub use opactr::{ - opactr_simple, OpactrConfig, OpactrModelState, OpactrPopParams, OpactrOpacityArrays, - OpactrFreqParams, OpactrPerturbedOpacity, OpactrBfactors, OpactrOutput, -}; -pub use opaini::{opaini, OpainiParams, OpainiOutput}; -pub use opctab::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput}; -pub use opdata::{opdata, opdata_check, OpdataParams, OpdataResult}; -pub use output::{output, OutputParams}; -pub use odf1::{odf1, Odf1Params, Odf1Output, Odf1Cache}; -pub use odfhst::odfhst; -pub use odfhyd::{ - odfhyd, OdfhydAtomicData, OdfhydConfig, OdfhydModelState, OdfhydOdfData, OdfhydParams, -}; -pub use odfmer::{odfmer, OdfmerAtomicData, OdfmerModelState, OdfmerParams}; -pub use odffr::{odffr, OdffrParams, OdffrAtomicData, OdffrModelData, OdffrOutputState}; -pub use odfhys::{odfhys_simplified, odfhys_full, OdfhysParams}; -pub use pfcno::pfcno; -pub use pffe::pffe; -pub use pfheav::{pfheav_pure, PfheavParams, PfheavOutput}; -pub use prd::prd; -pub use prdini::prdini; -pub use pzeval::{pzeval_pure, PzevalConfig, PzevalParams, PzevalOutput, PzevalDepthResult, - format_pzeval_header, format_pzeval_line, format_convective_flux_header}; -pub use prchan::{prchan, PrchanParams, PrchanOutput, format_change_report}; -pub use princ::{princ_pure, PrincParams, PrincOutput, PrincTransResult, PrincDepthResult, - format_princ_header, format_princ_line}; -pub use prsent::{prsent, PrsentParams, PrsentOutput, ThermTables}; -pub use profil::{profil, ProfilParams}; -pub use profsp::{profsp, ProfspParams}; -pub use pfni::pfni; -pub use pzert::pzert; -pub use pzevld::pzevld; -pub use pfspec::pfspec; -pub use pgset::{pgset, PgsetParams, PgsetOutput, MDEPTH}; -pub use psolve::psolve; -pub use quartc::quartc; -pub use reflev::reflev; -pub use quit::{quit, quit_error}; -pub use raph::raph; -pub use ratmal::ratmal; -pub use readbf::{readbf, readbf_from_file, readbf_to_cursor, ReadbfOutput}; -pub use rdatax::{rdatax_pure, read_transition, compute_cross_sections, RdataxParams, RdataxOutput, TransitionData, TransitionInputData, ProcessedTransition, MTRX}; -pub use rechck::{rechck_pure, RechckParams, RechckOutput, RechckDepthResult, format_rechck_header, format_rechck_line}; -pub use russel::{russel, RusselParams, RusselOutput, MoleculeData, MAX_ELEM, MAX_MOL}; -pub use ratmat::{ratmat, RatmatParams, RatmatOutput}; -pub use rates1::{ - rates1_pure, Rates1Config, Rates1FreqParams, Rates1ModelState, Rates1Output, Rates1Params, - Rates1TransParams, Opacf1Result, -}; -pub use ratsp1::{ - ratsp1, Ratsp1Config, Ratsp1ModelState, Ratsp1Output, -}; -pub use rayleigh::{ - rayleigh, rayleigh_h2_cross_section, rayleigh_h_cross_section, rayleigh_he_cross_section, - RayleighParams, RayleighResult, -}; -pub use rayset::rayset; -pub use reiman::reiman; -pub use rhoeos::{rhoeos, RhoeosParams, RhoeosOutput}; -pub use rhsgen::{rhsgen, RhsgenConfig, RhsgenParams, RhsgenFreqData, RhsgenOutput}; -pub use rhonen::{rhonen_pure, RhonenParams, RhonenOutput}; -pub use rteang::{rteang, RteangOutput, RteangParams}; -pub use rte_sc::rte_sc; -pub use rtefe2::rtefe2; -pub use rteint::{ - rteint, RteIntConfig, RteIntModelState, RteIntFreqParams, RteIntPhysics, - RteIntOpacity, RteIntFlux, RteIntOutput, RteIntAngles, -}; -pub use rtedf1::{rtedf1, Rtedf1AliState, Rtedf1ModelState, Rtedf1Params}; -pub use rtedf2::rtedf2; -pub use rtecf0::rtecf0; -pub use rtecf1::rtecf1; -pub use rtecmc::rtecmc; -pub use rtecmu::{ - rtecmu, RtecmuConfig, RtecmuModelState, RtecmuOutput, RtecmuWork, -}; -pub use rtecom::rtecom; -pub use rtesol::rtesol; -pub use rosstd::{rosstd_contribute, rosstd_evaluate, RosstdContributeParams, RosstdEvaluateParams, RosstdEvaluateOutput}; -pub use rossop::{rossop, RossopConfig, RossopParams, RossopModelState, RossopOutput, compute_hopf, compute_temperature}; -pub use radpre::{ - radpre_pure, radpre_accumulate_frequency, RadpreConfig, RadpreModelState, - RadpreFreqParamsMut, RadpreAliParamsMut, RadpreRadField, RadpreOutputStateMut, RadpreOutput, -}; -pub use radtot::{radtot, radtot_pure, RadtotParams, RadtotModelState, RadtotResult}; -pub use rybchn::{rybchn_pure, RybchnConfig, RybchnParams, RybchnOutput}; -pub use rybsol::{RybmtxWork, RybsolConfig, RybsolParams, RybsolOutput, rybsol_pure}; -pub use rybmat::{rybmat, RybmatParams, RybmatResult}; -pub use rybene::{rybene, RybeneConfig, RybeneParams, RybeneMatrix, RybeneOutput}; -pub use rybheq::{rybheq, RybheqConfig, RybheqParams, RybheqOutput}; -pub use sabolf::{sabolf_pure, SabolfParams, SabolfOutput}; -pub use sbfch::sbfch; -pub use sbfhe1::sbfhe1; -pub use sbfhmi::sbfhmi; -pub use sbfhmi_old::sbfhmi_old; -pub use sbfoh::sbfoh; -pub use setdrt::setdrt; -pub use sghe12::sghe12; -pub use sgmer::{sgmer0, sgmer1, sgmerd}; -pub use sigmar::sigmar; -pub use sigave::{sigave_from_data, sigave_pure, SigaveParams, SigaveOutput}; -pub use sigk::{sigk, SigkParams}; -pub use state::{ - state_pure, StateParams, StateOutput, - get_ionization_potential, get_atomic_mass, get_solar_abundance, - get_max_ionization, get_element_symbol, -}; -pub use sffhmi::sffhmi; -pub use sffhmi_add::sffhmi_add; -pub use spsigk::spsigk; -pub use tabint::{tabint, IntCff, OpacTable, TabintParams}; -pub use taufr1::{taufr1, Taufr1Params, Taufr1Result}; -pub use stark0::stark0; -pub use starka::starka; -pub use steqeq::{steqeq_pure, SteqeqParams, SteqeqOutput, SteqeqConfig, MAX_LEVEL}; -pub use temcor::{temcor_pure, TemcorConfig, TemcorParams, TemcorOutput, TemcorDepthResult, - format_temcor_line}; -pub use temper::{temper_pure, TemperConfig, TemperParams, TemperOutput, PrsauxData, FlxauxData, FactrsData}; -pub use szirc::szirc; -pub use switch::{switch_init, switch_update, SwitchInitParams, SwitchUpdateParams, SwitchOutput, format_crsw_message}; -pub use tiopf::tiopf; -pub use timing::{timing, TimingParams, TimingOutput, TimingMode, format_timing_message, reset_timer}; -pub use tlocal::{ - tlocal, TlocalConfig, TlocalFactrs, TlocalFlxaux, TlocalModelState, TlocalParams, -}; -pub use tdpini::tdpini; -pub use traini::traini; -pub use trmdrt::{trmdrt, TrmdrtParams, TrmdrtOutput}; -pub use trmder::{trmder, TrmderConfig, TrmderParams, TrmderOutput}; -pub use tridag::tridag; -pub use ubeta::ubeta; -pub use verner::verner; -pub use vern16::vern16; -pub use vern18::vern18; -pub use vern20::vern20; -pub use vern26::vern26; -pub use visini::{visini, VisiniParams, VisiniOutput}; -pub use voigt::voigt; -pub use voigte::voigte; -pub use wn::wn; -pub use wnstor::wnstor; -pub use xk2dop::xk2dop; -pub use ylintp::ylintp; -pub use zmrho::zmrho; +// 重新导出所有公共项以保持向后兼容 +pub use ali::*; +pub use atomic::*; +pub use continuum::*; +pub use convection::*; +pub use eos::*; +pub use hydrogen::*; +pub use interpolation::*; +pub use io::*; +pub use odf::*; +pub use opacity::*; +pub use partition::*; +pub use population::*; +pub use radiative::*; +pub use rates::*; +pub use solvers::*; +pub use special::*; +pub use temperature::*; +pub use utils::*; diff --git a/src/tlusty/math/odf/mod.rs b/src/tlusty/math/odf/mod.rs new file mode 100644 index 0000000..725ade7 --- /dev/null +++ b/src/tlusty/math/odf/mod.rs @@ -0,0 +1,15 @@ +//! odf module + +mod odf1; +mod odffr; +mod odfhst; +mod odfhyd; +mod odfhys; +mod odfmer; + +pub use odf1::*; +pub use odffr::*; +pub use odfhst::*; +pub use odfhyd::*; +pub use odfhys::*; +pub use odfmer::*; diff --git a/src/tlusty/math/odf1.rs b/src/tlusty/math/odf/odf1.rs similarity index 98% rename from src/tlusty/math/odf1.rs rename to src/tlusty/math/odf/odf1.rs index a7eba66..4882f97 100644 --- a/src/tlusty/math/odf1.rs +++ b/src/tlusty/math/odf/odf1.rs @@ -20,11 +20,11 @@ use crate::tlusty::state::constants::{CAS, H, HALF, UN}; use crate::tlusty::state::model::{ModPar, StrAux}; use crate::tlusty::state::odfpar::{OdfCtr, OdfMod, OdfStk, OdfFrq}; use crate::tlusty::state::{MFREQ, MFRO, NLMX, MDEPTH}; -use crate::tlusty::math::divstr::divstr; -use crate::tlusty::math::dwnfr::dwnfr; -use crate::tlusty::math::odfhst::odfhst; -use crate::tlusty::math::sigk::{sigk, SigkParams}; -use crate::tlusty::math::topbas::OpData; +use crate::tlusty::math::divstr; +use crate::tlusty::math::dwnfr; +use crate::tlusty::math::odfhst; +use crate::tlusty::math::{sigk, SigkParams}; +use crate::tlusty::math::OpData; // ============================================================================ // 常量 @@ -380,7 +380,7 @@ mod tests { use crate::tlusty::state::config::InpPar; use crate::tlusty::state::model::{ModPar, StrAux}; use crate::tlusty::state::odfpar::{OdfCtr, OdfMod, OdfStk, OdfFrq}; - use crate::tlusty::math::topbas::OpData; + use crate::tlusty::math::OpData; fn create_test_params<'a>( atomic: &'a AtomicData, diff --git a/src/tlusty/math/odffr.rs b/src/tlusty/math/odf/odffr.rs similarity index 100% rename from src/tlusty/math/odffr.rs rename to src/tlusty/math/odf/odffr.rs diff --git a/src/tlusty/math/odfhst.rs b/src/tlusty/math/odf/odfhst.rs similarity index 100% rename from src/tlusty/math/odfhst.rs rename to src/tlusty/math/odf/odfhst.rs diff --git a/src/tlusty/math/odfhyd.rs b/src/tlusty/math/odf/odfhyd.rs similarity index 98% rename from src/tlusty/math/odfhyd.rs rename to src/tlusty/math/odf/odfhyd.rs index c07df42..7184a9f 100644 --- a/src/tlusty/math/odfhyd.rs +++ b/src/tlusty/math/odf/odfhyd.rs @@ -4,9 +4,9 @@ //! //! 计算氢线系列的不透明度分布函数。 -use super::divstr::divstr; -use super::indexx::indexx; -use super::odfhst::odfhst; +use crate::tlusty::math::divstr; +use crate::tlusty::math::indexx; +use crate::tlusty::math::odfhst; use crate::tlusty::state::constants::{HALF, TWO, UN}; use crate::tlusty::state::model::StrAux; diff --git a/src/tlusty/math/odfhys.rs b/src/tlusty/math/odf/odfhys.rs similarity index 99% rename from src/tlusty/math/odfhys.rs rename to src/tlusty/math/odf/odfhys.rs index 5d74d95..f0c8c46 100644 --- a/src/tlusty/math/odfhys.rs +++ b/src/tlusty/math/odf/odfhys.rs @@ -5,7 +5,7 @@ //! //! 注意:此模块是 ODF 处理的核心模块,涉及频率网格设置和 Stark 展宽参数计算。 -use crate::tlusty::math::stark0::stark0; +use crate::tlusty::math::stark0; use crate::tlusty::state::atomic::{IonPar, LevPar, TraPar}; use crate::tlusty::state::config::BasNum; use crate::tlusty::state::constants::{NLMX, MFRO}; diff --git a/src/tlusty/math/odfmer.rs b/src/tlusty/math/odf/odfmer.rs similarity index 98% rename from src/tlusty/math/odfmer.rs rename to src/tlusty/math/odf/odfmer.rs index f5e4bb5..e6dd05d 100644 --- a/src/tlusty/math/odfmer.rs +++ b/src/tlusty/math/odf/odfmer.rs @@ -4,7 +4,7 @@ //! //! 计算合并态超线的 ODF(仅当温度变化足够大时更新)。 -use super::odfhyd::{odfhyd, OdfhydAtomicData, OdfhydConfig, OdfhydModelState, OdfhydOdfData, OdfhydParams}; +use crate::tlusty::math::{odfhyd, OdfhydAtomicData, OdfhydConfig, OdfhydModelState, OdfhydOdfData, OdfhydParams}; /// 温度变化阈值 const CHTL: f64 = 1e-3; diff --git a/src/tlusty/math/allard.rs b/src/tlusty/math/opacity/allard.rs similarity index 100% rename from src/tlusty/math/allard.rs rename to src/tlusty/math/opacity/allard.rs diff --git a/src/tlusty/math/allardt.rs b/src/tlusty/math/opacity/allardt.rs similarity index 100% rename from src/tlusty/math/allardt.rs rename to src/tlusty/math/opacity/allardt.rs diff --git a/src/tlusty/math/cia_h2h.rs b/src/tlusty/math/opacity/cia_h2h.rs similarity index 99% rename from src/tlusty/math/cia_h2h.rs rename to src/tlusty/math/opacity/cia_h2h.rs index 3be2f41..1205b91 100644 --- a/src/tlusty/math/cia_h2h.rs +++ b/src/tlusty/math/opacity/cia_h2h.rs @@ -4,7 +4,7 @@ //! //! 数据来源:TURBOSPEC -use super::locate::locate; +use crate::tlusty::math::locate; /// Amagat 常数 (particles/cm³ at STP) const AMAGAT: f64 = 2.6867774e19; diff --git a/src/tlusty/math/cia_h2h2.rs b/src/tlusty/math/opacity/cia_h2h2.rs similarity index 99% rename from src/tlusty/math/cia_h2h2.rs rename to src/tlusty/math/opacity/cia_h2h2.rs index bf525ae..6dd23ff 100644 --- a/src/tlusty/math/cia_h2h2.rs +++ b/src/tlusty/math/opacity/cia_h2h2.rs @@ -4,7 +4,7 @@ //! //! 数据来源:Borysow A., Jorgensen U.G., Fu Y. 2001, JQSRT 68, 235 -use super::locate::locate; +use crate::tlusty::math::locate; /// Amagat 常数 (particles/cm³ at STP) const AMAGAT: f64 = 2.6867774e19; diff --git a/src/tlusty/math/cia_h2he.rs b/src/tlusty/math/opacity/cia_h2he.rs similarity index 99% rename from src/tlusty/math/cia_h2he.rs rename to src/tlusty/math/opacity/cia_h2he.rs index 1b5e7f4..c604e88 100644 --- a/src/tlusty/math/cia_h2he.rs +++ b/src/tlusty/math/opacity/cia_h2he.rs @@ -5,7 +5,7 @@ //! 数据来源:Jorgensen U.G., Hammer D., Borysow A., Falkesgaard J., 2000, //! Astronomy & Astrophysics 361, 283 -use super::locate::locate; +use crate::tlusty::math::locate; /// Amagat 常数 (particles/cm³ at STP) const AMAGAT: f64 = 2.6867774e19; diff --git a/src/tlusty/math/cia_hhe.rs b/src/tlusty/math/opacity/cia_hhe.rs similarity index 99% rename from src/tlusty/math/cia_hhe.rs rename to src/tlusty/math/opacity/cia_hhe.rs index ae0c36f..04b0ec4 100644 --- a/src/tlusty/math/cia_hhe.rs +++ b/src/tlusty/math/opacity/cia_hhe.rs @@ -4,7 +4,7 @@ //! //! 数据来源:Gustafsson M., Frommhold L. 2001, ApJ 546, 1168 -use super::locate::locate; +use crate::tlusty::math::locate; /// Amagat 常数 (particles/cm³ at STP) const AMAGAT: f64 = 2.6867774e19; diff --git a/src/tlusty/math/compt0.rs b/src/tlusty/math/opacity/compt0.rs similarity index 100% rename from src/tlusty/math/compt0.rs rename to src/tlusty/math/opacity/compt0.rs diff --git a/src/tlusty/math/corrwm.rs b/src/tlusty/math/opacity/corrwm.rs similarity index 99% rename from src/tlusty/math/corrwm.rs rename to src/tlusty/math/opacity/corrwm.rs index 214dc4a..2e6d4a1 100644 --- a/src/tlusty/math/corrwm.rs +++ b/src/tlusty/math/opacity/corrwm.rs @@ -4,7 +4,7 @@ //! 处理各种频率点处理标志,特别是与"减法权重"相关的标志(仅在非重叠模式下)。 use crate::tlusty::io::{FortranWriter, Result}; -use crate::tlusty::math::quit::quit; +use crate::tlusty::math::quit; use crate::tlusty::state::atomic::TraPar; use crate::tlusty::state::config::BasNum; use crate::tlusty::state::constants::{BN, MFREX, PI4H}; diff --git a/src/tlusty/math/cspec.rs b/src/tlusty/math/opacity/cspec.rs similarity index 100% rename from src/tlusty/math/cspec.rs rename to src/tlusty/math/opacity/cspec.rs diff --git a/src/tlusty/math/dopgam.rs b/src/tlusty/math/opacity/dopgam.rs similarity index 100% rename from src/tlusty/math/dopgam.rs rename to src/tlusty/math/opacity/dopgam.rs diff --git a/src/tlusty/math/dwnfr.rs b/src/tlusty/math/opacity/dwnfr.rs similarity index 100% rename from src/tlusty/math/dwnfr.rs rename to src/tlusty/math/opacity/dwnfr.rs diff --git a/src/tlusty/math/dwnfr0.rs b/src/tlusty/math/opacity/dwnfr0.rs similarity index 100% rename from src/tlusty/math/dwnfr0.rs rename to src/tlusty/math/opacity/dwnfr0.rs diff --git a/src/tlusty/math/dwnfr1.rs b/src/tlusty/math/opacity/dwnfr1.rs similarity index 100% rename from src/tlusty/math/dwnfr1.rs rename to src/tlusty/math/opacity/dwnfr1.rs diff --git a/src/tlusty/math/gvdw.rs b/src/tlusty/math/opacity/gvdw.rs similarity index 100% rename from src/tlusty/math/gvdw.rs rename to src/tlusty/math/opacity/gvdw.rs diff --git a/src/tlusty/math/inifrc.rs b/src/tlusty/math/opacity/inifrc.rs similarity index 99% rename from src/tlusty/math/inifrc.rs rename to src/tlusty/math/opacity/inifrc.rs index a5584c5..75bbc15 100644 --- a/src/tlusty/math/inifrc.rs +++ b/src/tlusty/math/opacity/inifrc.rs @@ -14,7 +14,7 @@ //! - `ialiex = 0`: 设置频率,全部使用 ALI //! - `ialiex = 1`: 修改 IJALI 以处理显式频率 -use crate::tlusty::math::indexx::indexx; +use crate::tlusty::math::indexx; use crate::tlusty::state::constants::{H, HALF, MFREQ, MFREQC, MLEVEL, UN}; /// INIFRC 输入参数 diff --git a/src/tlusty/math/inifrs.rs b/src/tlusty/math/opacity/inifrs.rs similarity index 99% rename from src/tlusty/math/inifrs.rs rename to src/tlusty/math/opacity/inifrs.rs index 0d2b730..de138f2 100644 --- a/src/tlusty/math/inifrs.rs +++ b/src/tlusty/math/opacity/inifrs.rs @@ -4,7 +4,7 @@ //! //! 此模块设置频率网格用于不透明度采样模式。 -use super::indexx::indexx; +use crate::tlusty::math::indexx; use crate::tlusty::state::constants::{ BOLK, H, HMASS, MATOM, MFREQ, MFREQC, MFREQL, MFREQP, MLEVEL, MTRANS, TWO, UN, HALF, }; diff --git a/src/tlusty/math/inifrt.rs b/src/tlusty/math/opacity/inifrt.rs similarity index 99% rename from src/tlusty/math/inifrt.rs rename to src/tlusty/math/opacity/inifrt.rs index 5063259..56a3fcd 100644 --- a/src/tlusty/math/inifrt.rs +++ b/src/tlusty/math/opacity/inifrt.rs @@ -4,7 +4,7 @@ //! //! 设置连续谱频率网格,包括电离限附近的频率点。 -use super::indexx::indexx; +use crate::tlusty::math::indexx; use crate::tlusty::state::constants::{H, HALF, MFREQC, MLEVEL, UN}; // 数学常数 diff --git a/src/tlusty/math/inilam.rs b/src/tlusty/math/opacity/inilam.rs similarity index 100% rename from src/tlusty/math/inilam.rs rename to src/tlusty/math/opacity/inilam.rs diff --git a/src/tlusty/math/inkul.rs b/src/tlusty/math/opacity/inkul.rs similarity index 100% rename from src/tlusty/math/inkul.rs rename to src/tlusty/math/opacity/inkul.rs diff --git a/src/tlusty/math/inpdis.rs b/src/tlusty/math/opacity/inpdis.rs similarity index 99% rename from src/tlusty/math/inpdis.rs rename to src/tlusty/math/opacity/inpdis.rs index 7c83462..6c03244 100644 --- a/src/tlusty/math/inpdis.rs +++ b/src/tlusty/math/opacity/inpdis.rs @@ -9,9 +9,9 @@ //! - 有效温度和引力参数设置 use crate::tlusty::io::{FortranWriter, Result}; -use crate::tlusty::math::column::{column, ColumnParams}; -use crate::tlusty::math::grcor::grcor; -use crate::tlusty::math::sigmar::sigmar; +use crate::tlusty::math::{column, ColumnParams}; +use crate::tlusty::math::grcor; +use crate::tlusty::math::sigmar; use crate::tlusty::state::constants::{SIG4P, TWO}; // 物理常数 diff --git a/src/tlusty/math/lemini.rs b/src/tlusty/math/opacity/lemini.rs similarity index 100% rename from src/tlusty/math/lemini.rs rename to src/tlusty/math/opacity/lemini.rs diff --git a/src/tlusty/math/levgrp.rs b/src/tlusty/math/opacity/levgrp.rs similarity index 100% rename from src/tlusty/math/levgrp.rs rename to src/tlusty/math/opacity/levgrp.rs diff --git a/src/tlusty/math/levset.rs b/src/tlusty/math/opacity/levset.rs similarity index 100% rename from src/tlusty/math/levset.rs rename to src/tlusty/math/opacity/levset.rs diff --git a/src/tlusty/math/levsol.rs b/src/tlusty/math/opacity/levsol.rs similarity index 99% rename from src/tlusty/math/levsol.rs rename to src/tlusty/math/opacity/levsol.rs index b7ad315..ac3f878 100644 --- a/src/tlusty/math/levsol.rs +++ b/src/tlusty/math/opacity/levsol.rs @@ -4,7 +4,7 @@ //! //! 通过求解速率方程得到新的能级占据数。 -use crate::tlusty::math::lineqs::lineqs_nr; +use crate::tlusty::math::lineqs_nr; use crate::tlusty::state::atomic::AtoPar; use crate::tlusty::state::config::{BasNum, InpPar}; use crate::tlusty::state::constants::MLEVEL; diff --git a/src/tlusty/math/linpro.rs b/src/tlusty/math/opacity/linpro.rs similarity index 98% rename from src/tlusty/math/linpro.rs rename to src/tlusty/math/opacity/linpro.rs index 1de051a..7a8926f 100644 --- a/src/tlusty/math/linpro.rs +++ b/src/tlusty/math/opacity/linpro.rs @@ -8,8 +8,8 @@ //! - 支持多种轮廓类型:Doppler, Voigt, Stark, 特殊轮廓 //! - 深度依赖或深度无关模式 -use super::profsp::profsp; -use super::voigt::voigt; +use crate::tlusty::math::profsp; +use crate::tlusty::math::voigt; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::model::ModelState; use crate::tlusty::state::constants::*; @@ -195,7 +195,7 @@ pub fn linpro(params: &LinproParams) -> LinproOutput { _ if ip >= 10 => { // 特殊轮廓 (PROFSP) for ij in ij0..=ij1.min(params.freq.len() - 1) { - let profsp_params = super::profsp::ProfspParams { + let profsp_params = crate::tlusty::math::ProfspParams { fr: params.freq[ij], dop, itr, diff --git a/src/tlusty/math/linsel.rs b/src/tlusty/math/opacity/linsel.rs similarity index 98% rename from src/tlusty/math/linsel.rs rename to src/tlusty/math/opacity/linsel.rs index 2cb1b81..994c837 100644 --- a/src/tlusty/math/linsel.rs +++ b/src/tlusty/math/opacity/linsel.rs @@ -12,10 +12,10 @@ //! - `STRL1` (默认 0.001): 弱线阈值 //! - `STRL2` (默认 0.02): 中等线阈值 -use super::opacf1::{opacf1, Opacf1Config, Opacf1ModelState, Opacf1AtomicParams, Opacf1FreqParams, Opacf1Precomputed, Opacf1Output}; -use super::rtefr1::{rtefr1, Rtefr1Params, Rtefr1ModelState}; -use super::opaini::{opaini, OpainiParams, OpainiOutput}; -use super::quit::quit; +use crate::tlusty::math::{opacf1, Opacf1Config, Opacf1ModelState, Opacf1AtomicParams, Opacf1FreqParams, Opacf1Precomputed, Opacf1Output}; +use crate::tlusty::math::{rtefr1, Rtefr1Params, Rtefr1ModelState}; +use crate::tlusty::math::{opaini, OpainiParams, OpainiOutput}; +use crate::tlusty::math::quit; // ============================================================================ // 常量 diff --git a/src/tlusty/math/linspl.rs b/src/tlusty/math/opacity/linspl.rs similarity index 99% rename from src/tlusty/math/linspl.rs rename to src/tlusty/math/opacity/linspl.rs index 4a01daa..42a535f 100644 --- a/src/tlusty/math/linspl.rs +++ b/src/tlusty/math/opacity/linspl.rs @@ -4,7 +4,7 @@ //! //! 类似于采样模式中使用的 LINSET。 -use super::profil::{profil, ProfilParams}; +use crate::tlusty::math::{profil, ProfilParams}; // ============================================================================ // 常量 diff --git a/src/tlusty/math/meanop.rs b/src/tlusty/math/opacity/meanop.rs similarity index 100% rename from src/tlusty/math/meanop.rs rename to src/tlusty/math/opacity/meanop.rs diff --git a/src/tlusty/math/meanopt.rs b/src/tlusty/math/opacity/meanopt.rs similarity index 96% rename from src/tlusty/math/meanopt.rs rename to src/tlusty/math/opacity/meanopt.rs index e349ff8..e575af9 100644 --- a/src/tlusty/math/meanopt.rs +++ b/src/tlusty/math/opacity/meanopt.rs @@ -5,7 +5,7 @@ //! 通过调用 OPCTAB 动态计算每个频率点的吸收和散射系数, //! 然后计算 Rosseland 和 Planck 平均不透明度。 -use super::opctab::{opctab, OpctabOutput}; +use crate::tlusty::math::{opctab, OpctabOutput}; use crate::tlusty::state::constants::{HK, UN}; /// MEANOPT 输入参数 @@ -23,7 +23,7 @@ pub struct MeanoptParams<'a> { /// 选项表标志 (<0: 添加电子散射) pub ioptab: i32, /// Rayleigh 参数 (当 ifrayl > 0 时需要) - pub rayleigh_params: Option<&'a super::rayleigh::RayleighParams<'a>>, + pub rayleigh_params: Option<&'a crate::tlusty::math::RayleighParams<'a>>, } /// MEANOPT 模型状态 @@ -62,8 +62,8 @@ pub struct MeanoptOutput { pub fn meanopt( params: &MeanoptParams, model: &MeanoptModelState, - opctab_table: &super::opctab::OpctabTableData, - opctab_model: &mut super::opctab::OpctabModelState, + opctab_table: &crate::tlusty::math::OpctabTableData, + opctab_model: &mut crate::tlusty::math::OpctabModelState, ) -> MeanoptOutput { let t = params.t; let hkt = HK / t; @@ -83,7 +83,7 @@ pub fn meanopt( let dplan = plan * hkt * fr * ex * e1; // 调用 OPCTAB 获取吸收和散射系数 - let opctab_params = super::opctab::OpctabParams { + let opctab_params = crate::tlusty::math::OpctabParams { fr, ij: ij + 1, // 1-indexed id: params.id, diff --git a/src/tlusty/math/opacity/mod.rs b/src/tlusty/math/opacity/mod.rs new file mode 100644 index 0000000..b90e6c9 --- /dev/null +++ b/src/tlusty/math/opacity/mod.rs @@ -0,0 +1,83 @@ +//! opacity module + +mod allard; +mod allardt; +mod cia_h2h; +mod cia_h2h2; +mod cia_h2he; +mod cia_hhe; +mod compt0; +mod corrwm; +mod cspec; +mod dopgam; +mod dwnfr; +mod dwnfr0; +mod dwnfr1; +mod gvdw; +mod inifrc; +mod inifrs; +mod inifrt; +mod inilam; +mod inkul; +mod inpdis; +mod lemini; +mod levgrp; +mod levset; +mod levsol; +mod linpro; +mod linsel; +mod linspl; +mod meanop; +mod meanopt; +mod prd; +mod prdini; +mod profil; +mod profsp; +mod quasim; +mod rayleigh; +mod rayset; +mod reflev; +mod reiman; +mod stark0; +mod starka; + +pub use allard::*; +pub use allardt::*; +pub use cia_h2h::*; +pub use cia_h2h2::*; +pub use cia_h2he::*; +pub use cia_hhe::*; +pub use compt0::*; +pub use corrwm::*; +pub use cspec::*; +pub use dopgam::*; +pub use dwnfr::*; +pub use dwnfr0::*; +pub use dwnfr1::*; +pub use gvdw::*; +pub use inifrc::*; +pub use inifrs::*; +pub use inifrt::*; +pub use inilam::*; +pub use inkul::*; +pub use inpdis::*; +pub use lemini::*; +pub use levgrp::*; +pub use levset::*; +pub use levsol::*; +pub use linpro::*; +pub use linsel::*; +pub use linspl::*; +pub use meanop::*; +pub use meanopt::*; +pub use prd::*; +pub use prdini::*; +pub use profil::*; +pub use profsp::*; +pub use quasim::*; +pub use rayleigh::*; +pub use rayset::*; +pub use reflev::*; +pub use reiman::*; +pub use stark0::*; +pub use starka::*; diff --git a/src/tlusty/math/prd.rs b/src/tlusty/math/opacity/prd.rs similarity index 99% rename from src/tlusty/math/prd.rs rename to src/tlusty/math/opacity/prd.rs index 94b4c86..2279eb4 100644 --- a/src/tlusty/math/prd.rs +++ b/src/tlusty/math/opacity/prd.rs @@ -4,7 +4,7 @@ //! //! 在 PRD 情况下修改线发射系数和散射系数。 -use super::gami::gami; +use crate::tlusty::math::gami; use crate::tlusty::state::constants::{TWO, UN}; // 物理常量 diff --git a/src/tlusty/math/prdini.rs b/src/tlusty/math/opacity/prdini.rs similarity index 100% rename from src/tlusty/math/prdini.rs rename to src/tlusty/math/opacity/prdini.rs diff --git a/src/tlusty/math/profil.rs b/src/tlusty/math/opacity/profil.rs similarity index 97% rename from src/tlusty/math/profil.rs rename to src/tlusty/math/opacity/profil.rs index 6f8754a..a99357f 100644 --- a/src/tlusty/math/profil.rs +++ b/src/tlusty/math/opacity/profil.rs @@ -4,6 +4,7 @@ //! //! 计算归一化到 1 的标准吸收轮廓。 +use crate::tlusty::math::{voigt, divstr}; use crate::tlusty::state::constants::{TWO, UN}; // ============================================================================ @@ -129,7 +130,7 @@ pub fn profil(params: &ProfilParams) -> f64 { // ================================================================ // Voigt 轮廓 // ================================================================ - super::voigt(v, params.a) * PISQ1 + voigt(v, params.a) * PISQ1 } else if ipa == 2 { // ================================================================ // Stark (+ Doppler) 轮廓 (氢线) @@ -188,7 +189,7 @@ pub fn profil(params: &ProfilParams) -> f64 { let betad = params.dop * dbeta; // DIVSTR - 计算 Stark 分割点 - let (adh, divh) = super::divstr(betad, izz as i32); + let (adh, divh) = divstr(betad, izz as i32); // BETA = DBETA * |FR - FR0| let beta = dbeta * (params.fr - params.fr0[params.itr - 1]).abs(); @@ -278,7 +279,7 @@ mod tests { let result = profil(¶ms); // Voigt 轮廓在线心应为 voigt(0, a) / sqrt(pi) - let expected = super::super::voigt(0.0, params.a) * PISQ1; + let expected = crate::tlusty::math::voigt(0.0, params.a) * PISQ1; assert!((result - expected).abs() / expected < 1e-10); } @@ -345,7 +346,7 @@ mod tests { let result = profil(¶ms); - let expected = super::super::voigt(0.0, params.a) * PISQ1; + let expected = crate::tlusty::math::voigt(0.0, params.a) * PISQ1; assert!((result - expected).abs() / expected < 1e-10); } diff --git a/src/tlusty/math/profsp.rs b/src/tlusty/math/opacity/profsp.rs similarity index 98% rename from src/tlusty/math/profsp.rs rename to src/tlusty/math/opacity/profsp.rs index afd6bed..f05095d 100644 --- a/src/tlusty/math/profsp.rs +++ b/src/tlusty/math/opacity/profsp.rs @@ -8,9 +8,9 @@ //! - 基于 Klaus Werner 公式 A.3.4 //! - 归一化到单位 -use super::sabolf::{sabolf_pure, SabolfParams, SabolfOutput}; -use super::ubeta::ubeta; -use super::voigt::voigt; +use crate::tlusty::math::{sabolf_pure, SabolfParams, SabolfOutput}; +use crate::tlusty::math::ubeta; +use crate::tlusty::math::voigt; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::model::ModelState; diff --git a/src/tlusty/math/quasim.rs b/src/tlusty/math/opacity/quasim.rs similarity index 99% rename from src/tlusty/math/quasim.rs rename to src/tlusty/math/opacity/quasim.rs index 9a487d8..e4551d5 100644 --- a/src/tlusty/math/quasim.rs +++ b/src/tlusty/math/opacity/quasim.rs @@ -4,7 +4,7 @@ //! //! 计算氢线的准分子不透明度轮廓,基于 ALLARD 等人的数据表。 -use crate::tlusty::math::allard::allard; +use crate::tlusty::math::allard; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::config::BasNum; use crate::tlusty::state::model::ModelState; diff --git a/src/tlusty/math/rayleigh.rs b/src/tlusty/math/opacity/rayleigh.rs similarity index 100% rename from src/tlusty/math/rayleigh.rs rename to src/tlusty/math/opacity/rayleigh.rs diff --git a/src/tlusty/math/rayset.rs b/src/tlusty/math/opacity/rayset.rs similarity index 100% rename from src/tlusty/math/rayset.rs rename to src/tlusty/math/opacity/rayset.rs diff --git a/src/tlusty/math/reflev.rs b/src/tlusty/math/opacity/reflev.rs similarity index 100% rename from src/tlusty/math/reflev.rs rename to src/tlusty/math/opacity/reflev.rs diff --git a/src/tlusty/math/reiman.rs b/src/tlusty/math/opacity/reiman.rs similarity index 100% rename from src/tlusty/math/reiman.rs rename to src/tlusty/math/opacity/reiman.rs diff --git a/src/tlusty/math/stark0.rs b/src/tlusty/math/opacity/stark0.rs similarity index 100% rename from src/tlusty/math/stark0.rs rename to src/tlusty/math/opacity/stark0.rs diff --git a/src/tlusty/math/starka.rs b/src/tlusty/math/opacity/starka.rs similarity index 100% rename from src/tlusty/math/starka.rs rename to src/tlusty/math/opacity/starka.rs diff --git a/src/tlusty/math/carbon.rs b/src/tlusty/math/partition/carbon.rs similarity index 100% rename from src/tlusty/math/carbon.rs rename to src/tlusty/math/partition/carbon.rs diff --git a/src/tlusty/math/ceh12.rs b/src/tlusty/math/partition/ceh12.rs similarity index 100% rename from src/tlusty/math/ceh12.rs rename to src/tlusty/math/partition/ceh12.rs diff --git a/src/tlusty/math/partition/mod.rs b/src/tlusty/math/partition/mod.rs new file mode 100644 index 0000000..a6d337d --- /dev/null +++ b/src/tlusty/math/partition/mod.rs @@ -0,0 +1,25 @@ +//! partition module + +mod carbon; +mod ceh12; +mod mpartf; +mod partf; +mod pfcno; +mod pffe; +mod pfheav; +mod pfni; +mod pfspec; +mod sghe12; +mod tiopf; + +pub use carbon::*; +pub use ceh12::*; +pub use mpartf::*; +pub use partf::*; +pub use pfcno::*; +pub use pffe::*; +pub use pfheav::*; +pub use pfni::*; +pub use pfspec::*; +pub use sghe12::*; +pub use tiopf::*; diff --git a/src/tlusty/math/mpartf.rs b/src/tlusty/math/partition/mpartf.rs similarity index 100% rename from src/tlusty/math/mpartf.rs rename to src/tlusty/math/partition/mpartf.rs diff --git a/src/tlusty/math/partf.rs b/src/tlusty/math/partition/partf.rs similarity index 98% rename from src/tlusty/math/partf.rs rename to src/tlusty/math/partition/partf.rs index 3101444..fdd9a60 100644 --- a/src/tlusty/math/partf.rs +++ b/src/tlusty/math/partition/partf.rs @@ -394,7 +394,7 @@ fn partf_standard(params: &PartfParams) -> PartfOutput { /// 用户自定义配分函数 fn partf_user_defined(params: &PartfParams) -> PartfOutput { // 调用 PFSPEC - use super::pfspec::pfspec; + use crate::tlusty::math::pfspec; let (u, dut, dun) = pfspec(params.iat, params.izi, params.t, params.ane); PartfOutput { u, dut, dun } @@ -403,7 +403,7 @@ fn partf_user_defined(params: &PartfParams) -> PartfOutput { /// Opacity Project 配分函数 fn partf_opacity_project(params: &PartfParams) -> PartfOutput { // 调用 OPFRAC - use super::opfrac::{opfrac_pure, OpfracParams, PfOptB}; + use crate::tlusty::math::{opfrac_pure, OpfracParams, PfOptB}; let opfrac_params = OpfracParams { iat: params.iat, @@ -425,7 +425,7 @@ fn partf_opacity_project(params: &PartfParams) -> PartfOutput { /// Fe 配分函数 fn partf_fe(params: &PartfParams) -> PartfOutput { // 调用 PFFE - use super::pffe::pffe; + use crate::tlusty::math::pffe; let (u, dut, dun) = pffe(params.izi, params.t, params.ane); PartfOutput { u, dut, dun } @@ -434,7 +434,7 @@ fn partf_fe(params: &PartfParams) -> PartfOutput { /// Ni 配分函数 fn partf_ni(params: &PartfParams) -> PartfOutput { // 调用 PFNI - use super::pfni::pfni; + use crate::tlusty::math::pfni; let (u, dut, dun) = pfni(params.izi, params.t); PartfOutput { u, dut, dun } @@ -443,7 +443,7 @@ fn partf_ni(params: &PartfParams) -> PartfOutput { /// 重元素配分函数 (Z > 30) fn partf_heavy(params: &PartfParams) -> PartfOutput { // 调用 PFHEAV - use super::pfheav::{pfheav_pure, PfheavParams}; + use crate::tlusty::math::{pfheav_pure, PfheavParams}; let pfheav_params = PfheavParams { iiz: params.iat, @@ -464,7 +464,7 @@ fn partf_heavy(params: &PartfParams) -> PartfOutput { /// CNO 高电离级配分函数 fn partf_cno(iat: i32, izi: i32, t: f64, ane: f64) -> PartfOutput { // 调用 PFCNO - use super::pfcno::pfcno; + use crate::tlusty::math::pfcno; let pf = pfcno(iat as usize, izi as usize, t, ane); PartfOutput { diff --git a/src/tlusty/math/pfcno.rs b/src/tlusty/math/partition/pfcno.rs similarity index 100% rename from src/tlusty/math/pfcno.rs rename to src/tlusty/math/partition/pfcno.rs diff --git a/src/tlusty/math/pffe.rs b/src/tlusty/math/partition/pffe.rs similarity index 100% rename from src/tlusty/math/pffe.rs rename to src/tlusty/math/partition/pffe.rs diff --git a/src/tlusty/math/pfheav.rs b/src/tlusty/math/partition/pfheav.rs similarity index 100% rename from src/tlusty/math/pfheav.rs rename to src/tlusty/math/partition/pfheav.rs diff --git a/src/tlusty/math/pfni.rs b/src/tlusty/math/partition/pfni.rs similarity index 100% rename from src/tlusty/math/pfni.rs rename to src/tlusty/math/partition/pfni.rs diff --git a/src/tlusty/math/pfspec.rs b/src/tlusty/math/partition/pfspec.rs similarity index 100% rename from src/tlusty/math/pfspec.rs rename to src/tlusty/math/partition/pfspec.rs diff --git a/src/tlusty/math/sghe12.rs b/src/tlusty/math/partition/sghe12.rs similarity index 100% rename from src/tlusty/math/sghe12.rs rename to src/tlusty/math/partition/sghe12.rs diff --git a/src/tlusty/math/tiopf.rs b/src/tlusty/math/partition/tiopf.rs similarity index 100% rename from src/tlusty/math/tiopf.rs rename to src/tlusty/math/partition/tiopf.rs diff --git a/src/tlusty/math/bpop.rs b/src/tlusty/math/population/bpop.rs similarity index 96% rename from src/tlusty/math/bpop.rs rename to src/tlusty/math/population/bpop.rs index 1662483..e39721d 100644 --- a/src/tlusty/math/bpop.rs +++ b/src/tlusty/math/population/bpop.rs @@ -31,7 +31,7 @@ use crate::tlusty::state::iterat::IterControl; use crate::tlusty::state::model::ModelState; use crate::tlusty::state::alipar::FixAlp; -use super::matinv; +use crate::tlusty::math::matinv; // ============================================================================ // 输入/输出结构体 @@ -127,13 +127,13 @@ pub fn bpop( if !lte && ifpopr == 5 && ipslte == 0 { // 调用 RATMAT 获取速率矩阵 let mut iifor = atomic.levpar.iifor.clone(); - let mut ratmat_params = super::ratmat::RatmatParams { + let mut ratmat_params = crate::tlusty::math::RatmatParams { id, iical: &mut iifor, imode: 0, }; - let ratmat_output = super::ratmat::ratmat( + let ratmat_output = crate::tlusty::math::ratmat( &mut ratmat_params, config, atomic, @@ -162,7 +162,7 @@ pub fn bpop( } let nlvfor = nlevel; - super::levsol::levsol( + crate::tlusty::math::levsol( &mut a_flat, &mut b_flat, &mut popp, @@ -238,13 +238,13 @@ pub fn bpop( // ================================================================ // Fortran: CALL RATMAT(ID,IIEXP,0,ESEMAT,BESE) let mut iical = atomic.levpar.iiexp.clone(); - let mut ratmat_params = super::ratmat::RatmatParams { + let mut ratmat_params = crate::tlusty::math::RatmatParams { id, iical: &mut iical, imode: 0, }; - let ratmat_output = super::ratmat::ratmat( + let ratmat_output = crate::tlusty::math::ratmat( &mut ratmat_params, config, atomic, @@ -299,7 +299,7 @@ pub fn bpop( // 注意:BPOPE 需要完整的参数,这里简化处理 // 调用 BPOPF - let bpopf_params = super::bpopf::BpopfParams { + let bpopf_params = crate::tlusty::math::BpopfParams { nfreqe, inse, inre: config.matkey.inre, @@ -310,7 +310,7 @@ pub fn bpop( id, crsw: &model.modpar.alab, }; - super::bpopf::bpopf(&bpopf_params, arrays, fixalp, bpocom); + crate::tlusty::math::bpopf(&bpopf_params, arrays, fixalp, bpocom); } } diff --git a/src/tlusty/math/bpopc.rs b/src/tlusty/math/population/bpopc.rs similarity index 99% rename from src/tlusty/math/bpopc.rs rename to src/tlusty/math/population/bpopc.rs index 884e677..832efa2 100644 --- a/src/tlusty/math/bpopc.rs +++ b/src/tlusty/math/population/bpopc.rs @@ -15,7 +15,7 @@ //! - APM = (占据数向量) * (dAJ/dN) use crate::tlusty::state::constants::*; -use crate::tlusty::math::state::{state_pure, StateParams, StateOutput}; +use crate::tlusty::math::{state_pure, StateParams, StateOutput}; // ============================================================================ // 输入参数结构体 diff --git a/src/tlusty/math/bpope.rs b/src/tlusty/math/population/bpope.rs similarity index 100% rename from src/tlusty/math/bpope.rs rename to src/tlusty/math/population/bpope.rs diff --git a/src/tlusty/math/bpopf.rs b/src/tlusty/math/population/bpopf.rs similarity index 100% rename from src/tlusty/math/bpopf.rs rename to src/tlusty/math/population/bpopf.rs diff --git a/src/tlusty/math/bpopt.rs b/src/tlusty/math/population/bpopt.rs similarity index 100% rename from src/tlusty/math/bpopt.rs rename to src/tlusty/math/population/bpopt.rs diff --git a/src/tlusty/math/butler.rs b/src/tlusty/math/population/butler.rs similarity index 100% rename from src/tlusty/math/butler.rs rename to src/tlusty/math/population/butler.rs diff --git a/src/tlusty/math/population/mod.rs b/src/tlusty/math/population/mod.rs new file mode 100644 index 0000000..a8acfaf --- /dev/null +++ b/src/tlusty/math/population/mod.rs @@ -0,0 +1,17 @@ +//! population module + +mod bpop; +mod bpopc; +mod bpope; +mod bpopf; +mod bpopt; +mod butler; +mod newpop; + +pub use bpop::*; +pub use bpopc::*; +pub use bpope::*; +pub use bpopf::*; +pub use bpopt::*; +pub use butler::*; +pub use newpop::*; diff --git a/src/tlusty/math/newpop.rs b/src/tlusty/math/population/newpop.rs similarity index 100% rename from src/tlusty/math/newpop.rs rename to src/tlusty/math/population/newpop.rs diff --git a/src/tlusty/math/coolrt.rs b/src/tlusty/math/radiative/coolrt.rs similarity index 100% rename from src/tlusty/math/coolrt.rs rename to src/tlusty/math/radiative/coolrt.rs diff --git a/src/tlusty/math/radiative/mod.rs b/src/tlusty/math/radiative/mod.rs new file mode 100644 index 0000000..3b2bad0 --- /dev/null +++ b/src/tlusty/math/radiative/mod.rs @@ -0,0 +1,39 @@ +//! radiative module + +mod coolrt; +mod radpre; +mod radtot; +mod rte_sc; +mod rteang; +mod rtecf0; +mod rtecf1; +mod rtecmc; +mod rtecmu; +mod rtecom; +mod rtedf1; +mod rtedf2; +mod rtefe2; +mod rtefr1; +mod rteint; +mod rtesol; +mod trmder; +mod trmdrt; + +pub use coolrt::*; +pub use radpre::*; +pub use radtot::*; +pub use rte_sc::*; +pub use rteang::*; +pub use rtecf0::*; +pub use rtecf1::*; +pub use rtecmc::*; +pub use rtecmu::*; +pub use rtecom::*; +pub use rtedf1::*; +pub use rtedf2::*; +pub use rtefe2::*; +pub use rtefr1::*; +pub use rteint::*; +pub use rtesol::*; +pub use trmder::*; +pub use trmdrt::*; diff --git a/src/tlusty/math/radpre.rs b/src/tlusty/math/radiative/radpre.rs similarity index 99% rename from src/tlusty/math/radpre.rs rename to src/tlusty/math/radiative/radpre.rs index f11112c..1df5bd2 100644 --- a/src/tlusty/math/radpre.rs +++ b/src/tlusty/math/radiative/radpre.rs @@ -6,8 +6,8 @@ //! 使用深度相关准则进行频率筛选。 use crate::tlusty::state::constants::{BOLK, HALF, MDEPTH, MFREQ, MLEVEL, MTRANS}; -use super::indexx::indexx; -use super::quit::quit; +use crate::tlusty::math::indexx; +use crate::tlusty::math::quit; // ============================================================================ // 常量定义 diff --git a/src/tlusty/math/radtot.rs b/src/tlusty/math/radiative/radtot.rs similarity index 100% rename from src/tlusty/math/radtot.rs rename to src/tlusty/math/radiative/radtot.rs diff --git a/src/tlusty/math/rte_sc.rs b/src/tlusty/math/radiative/rte_sc.rs similarity index 100% rename from src/tlusty/math/rte_sc.rs rename to src/tlusty/math/radiative/rte_sc.rs diff --git a/src/tlusty/math/rteang.rs b/src/tlusty/math/radiative/rteang.rs similarity index 99% rename from src/tlusty/math/rteang.rs rename to src/tlusty/math/radiative/rteang.rs index 12aec27..a088af6 100644 --- a/src/tlusty/math/rteang.rs +++ b/src/tlusty/math/radiative/rteang.rs @@ -2,7 +2,7 @@ //! //! 重构自 TLUSTY `RTEANG.f`。 -use super::gauleg; +use crate::tlusty::math::gauleg; /// RTEANG 的输入参数。 pub struct RteangParams { diff --git a/src/tlusty/math/rtecf0.rs b/src/tlusty/math/radiative/rtecf0.rs similarity index 100% rename from src/tlusty/math/rtecf0.rs rename to src/tlusty/math/radiative/rtecf0.rs diff --git a/src/tlusty/math/rtecf1.rs b/src/tlusty/math/radiative/rtecf1.rs similarity index 99% rename from src/tlusty/math/rtecf1.rs rename to src/tlusty/math/radiative/rtecf1.rs index 476689c..a69e27e 100644 --- a/src/tlusty/math/rtecf1.rs +++ b/src/tlusty/math/radiative/rtecf1.rs @@ -12,9 +12,9 @@ use crate::tlusty::state::constants::{HALF, HK, UN, TWO}; use crate::tlusty::state::iterat::IterControl; use crate::tlusty::state::model::ModelState; -use super::rtecf0::rtecf0; -use super::rtefe2::rtefe2; -use super::rtesol::rtesol; +use crate::tlusty::math::rtecf0; +use crate::tlusty::math::rtefe2; +use crate::tlusty::math::rtesol; /// 六分之一常数 const SIXTH: f64 = 1.0 / 6.0; diff --git a/src/tlusty/math/rtecmc.rs b/src/tlusty/math/radiative/rtecmc.rs similarity index 99% rename from src/tlusty/math/rtecmc.rs rename to src/tlusty/math/radiative/rtecmc.rs index f2be528..26afd63 100644 --- a/src/tlusty/math/rtecmc.rs +++ b/src/tlusty/math/radiative/rtecmc.rs @@ -9,7 +9,7 @@ use crate::tlusty::state::config::TlustyConfig; use crate::tlusty::state::constants::{MDEPTH, MFREQ, UN}; use crate::tlusty::state::model::ModelState; -use super::matinv::matinv; +use crate::tlusty::math::matinv; /// MDEPTC = MDEPTH (Compton 散射用深度) const MDEPTC: usize = MDEPTH; diff --git a/src/tlusty/math/rtecmu.rs b/src/tlusty/math/radiative/rtecmu.rs similarity index 99% rename from src/tlusty/math/rtecmu.rs rename to src/tlusty/math/radiative/rtecmu.rs index 9ecc112..074c769 100644 --- a/src/tlusty/math/rtecmu.rs +++ b/src/tlusty/math/radiative/rtecmu.rs @@ -6,8 +6,8 @@ //! 假设其他频率的辐射强度已知,使用高斯积分对角度进行积分。 use crate::tlusty::state::constants::{HALF, HK, SIGE, SIG4P, TWO, UN, XCON, YCON, BN, MDEPTH, MFREQ, MMU}; -use super::gauleg; -use super::rtesol; +use crate::tlusty::math::gauleg; +use crate::tlusty::math::rtesol; // ============================================================================ // 参数结构体 diff --git a/src/tlusty/math/rtecom.rs b/src/tlusty/math/radiative/rtecom.rs similarity index 99% rename from src/tlusty/math/rtecom.rs rename to src/tlusty/math/radiative/rtecom.rs index 3e2f96a..bfad17d 100644 --- a/src/tlusty/math/rtecom.rs +++ b/src/tlusty/math/radiative/rtecom.rs @@ -11,10 +11,10 @@ use crate::tlusty::state::constants::{MDEPTH, MFREQ, UN}; use crate::tlusty::state::iterat::IterControl; use crate::tlusty::state::model::ModelState; -use super::opacf1::opacf1; -use super::rtecf0::rtecf0; -use super::rtecf1::rtecf1; -use super::rtecmc::rtecmc; +use crate::tlusty::math::opacf1; +use crate::tlusty::math::rtecf0; +use crate::tlusty::math::rtecf1; +use crate::tlusty::math::rtecmc; /// 求解带康普顿散射的辐射转移方程。 /// diff --git a/src/tlusty/math/rtedf1.rs b/src/tlusty/math/radiative/rtedf1.rs similarity index 100% rename from src/tlusty/math/rtedf1.rs rename to src/tlusty/math/radiative/rtedf1.rs diff --git a/src/tlusty/math/rtedf2.rs b/src/tlusty/math/radiative/rtedf2.rs similarity index 100% rename from src/tlusty/math/rtedf2.rs rename to src/tlusty/math/radiative/rtedf2.rs diff --git a/src/tlusty/math/rtefe2.rs b/src/tlusty/math/radiative/rtefe2.rs similarity index 100% rename from src/tlusty/math/rtefe2.rs rename to src/tlusty/math/radiative/rtefe2.rs diff --git a/src/tlusty/math/rtefr1.rs b/src/tlusty/math/radiative/rtefr1.rs similarity index 99% rename from src/tlusty/math/rtefr1.rs rename to src/tlusty/math/radiative/rtefr1.rs index 602a64b..0bf7e2d 100644 --- a/src/tlusty/math/rtefr1.rs +++ b/src/tlusty/math/radiative/rtefr1.rs @@ -12,9 +12,9 @@ //! - ISPLIN = 3: 改进的 Feautrier 方案 (Rybicki & Hummer 1991) use crate::tlusty::state::constants::{BN, HALF, HK, MDEPTH, TWO, UN}; -use super::matinv::matinv; -use super::minv3::minv3; -use super::rtesol::rtesol; +use crate::tlusty::math::matinv; +use crate::tlusty::math::minv3; +use crate::tlusty::math::rtesol; /// 常量定义 const SIXTH: f64 = 1.0 / 6.0; @@ -947,21 +947,21 @@ fn rtedf1_dispatch(ij: usize, params: &Rtefr1Params, model: &mut Rtefr1ModelStat // 由于 RTEDF1 已经实现,这里只是占位符 // 实际实现需要将参数转换为 RTEDF1 需要的格式 let _ = (ij, params, model); - // super::rtedf1::rtedf1(...); + // crate::tlusty::math::rtedf1(...); } /// RTEDF2 调度函数 (简化版) fn rtedf2_dispatch(ij: usize, params: &Rtefr1Params, model: &mut Rtefr1ModelState) { // 这里应该调用实际的 rtedf2 函数 let _ = (ij, params, model); - // super::rtedf2::rtedf2(...); + // crate::tlusty::math::rtedf2(...); } /// RTECF1 调度函数 (简化版) fn rtecf1_dispatch(ij: usize, params: &Rtefr1Params, model: &mut Rtefr1ModelState) { // 这里应该调用实际的 rtecf1 函数 let _ = (ij, params, model); - // super::rtecf1::rtecf1(...); + // crate::tlusty::math::rtecf1(...); } // 注意: RTEFR1 原始代码中有一个调试输出块 (write to unit 97) diff --git a/src/tlusty/math/rteint.rs b/src/tlusty/math/radiative/rteint.rs similarity index 99% rename from src/tlusty/math/rteint.rs rename to src/tlusty/math/radiative/rteint.rs index a3c4059..6fbde3f 100644 --- a/src/tlusty/math/rteint.rs +++ b/src/tlusty/math/radiative/rteint.rs @@ -197,7 +197,7 @@ fn init_angles(nmu: usize) -> RteIntAngles { fn matinv(a: &mut [f64], n: usize, _mmax: usize) { // 调用已实现的 matinv 模块 // 将 1D slice 转换为 2D 矩阵表示 - crate::tlusty::math::matinv::matinv(a, n); + crate::tlusty::math::matinv(a, n); } // ============================================================================ diff --git a/src/tlusty/math/rtesol.rs b/src/tlusty/math/radiative/rtesol.rs similarity index 100% rename from src/tlusty/math/rtesol.rs rename to src/tlusty/math/radiative/rtesol.rs diff --git a/src/tlusty/math/trmder.rs b/src/tlusty/math/radiative/trmder.rs similarity index 99% rename from src/tlusty/math/trmder.rs rename to src/tlusty/math/radiative/trmder.rs index 20b9ef3..ba6ea10 100644 --- a/src/tlusty/math/trmder.rs +++ b/src/tlusty/math/radiative/trmder.rs @@ -15,8 +15,8 @@ //! 2. 调用 ELDENS 计算密度、能量和熵 //! 3. 使用有限差分计算导数 -use super::eldens::{eldens_pure, EldensConfig, EldensParams}; -use crate::tlusty::math::state::StateParams; +use crate::tlusty::math::{eldens_pure, EldensConfig, EldensParams}; +use crate::tlusty::math::StateParams; use crate::tlusty::state::constants::{BOLK, HMASS, UN}; // ============================================================================ diff --git a/src/tlusty/math/trmdrt.rs b/src/tlusty/math/radiative/trmdrt.rs similarity index 99% rename from src/tlusty/math/trmdrt.rs rename to src/tlusty/math/radiative/trmdrt.rs index bbc51ac..5f46bb1 100644 --- a/src/tlusty/math/trmdrt.rs +++ b/src/tlusty/math/radiative/trmdrt.rs @@ -16,7 +16,7 @@ //! 2. 在密度和温度点附近做数值微分 //! 3. 计算各种热力学量 -use super::{prsent, rhoeos, PrsentParams, RhoeosParams, ThermTables}; +use crate::tlusty::math::{prsent, rhoeos, PrsentParams, RhoeosParams, ThermTables}; /// 气体常数 R (erg/K/mol) const RCON: f64 = 8.31434e7; diff --git a/src/tlusty/math/rates/mod.rs b/src/tlusty/math/rates/mod.rs new file mode 100644 index 0000000..6785d27 --- /dev/null +++ b/src/tlusty/math/rates/mod.rs @@ -0,0 +1,11 @@ +//! rates module + +mod rates1; +mod ratmal; +mod ratmat; +mod ratsp1; + +pub use rates1::*; +pub use ratmal::*; +pub use ratmat::*; +pub use ratsp1::*; diff --git a/src/tlusty/math/rates1.rs b/src/tlusty/math/rates/rates1.rs similarity index 100% rename from src/tlusty/math/rates1.rs rename to src/tlusty/math/rates/rates1.rs diff --git a/src/tlusty/math/ratmal.rs b/src/tlusty/math/rates/ratmal.rs similarity index 100% rename from src/tlusty/math/ratmal.rs rename to src/tlusty/math/rates/ratmal.rs diff --git a/src/tlusty/math/ratmat.rs b/src/tlusty/math/rates/ratmat.rs similarity index 99% rename from src/tlusty/math/ratmat.rs rename to src/tlusty/math/rates/ratmat.rs index da5f925..a25db21 100644 --- a/src/tlusty/math/ratmat.rs +++ b/src/tlusty/math/rates/ratmat.rs @@ -8,7 +8,7 @@ //! //! 参考:Mihalas, 1978, pp.138-139 -use crate::tlusty::math::reflev::reflev; +use crate::tlusty::math::reflev; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::config::TlustyConfig; use crate::tlusty::state::constants::{HK, MLEVEL, UN}; diff --git a/src/tlusty/math/ratsp1.rs b/src/tlusty/math/rates/ratsp1.rs similarity index 100% rename from src/tlusty/math/ratsp1.rs rename to src/tlusty/math/rates/ratsp1.rs diff --git a/src/tlusty/math/accel2.rs b/src/tlusty/math/solvers/accel2.rs similarity index 100% rename from src/tlusty/math/accel2.rs rename to src/tlusty/math/solvers/accel2.rs diff --git a/src/tlusty/math/accelp.rs b/src/tlusty/math/solvers/accelp.rs similarity index 100% rename from src/tlusty/math/accelp.rs rename to src/tlusty/math/solvers/accelp.rs diff --git a/src/tlusty/math/cubic.rs b/src/tlusty/math/solvers/cubic.rs similarity index 100% rename from src/tlusty/math/cubic.rs rename to src/tlusty/math/solvers/cubic.rs diff --git a/src/tlusty/math/indexx.rs b/src/tlusty/math/solvers/indexx.rs similarity index 100% rename from src/tlusty/math/indexx.rs rename to src/tlusty/math/solvers/indexx.rs diff --git a/src/tlusty/math/laguer.rs b/src/tlusty/math/solvers/laguer.rs similarity index 100% rename from src/tlusty/math/laguer.rs rename to src/tlusty/math/solvers/laguer.rs diff --git a/src/tlusty/math/lineqs.rs b/src/tlusty/math/solvers/lineqs.rs similarity index 100% rename from src/tlusty/math/lineqs.rs rename to src/tlusty/math/solvers/lineqs.rs diff --git a/src/tlusty/math/matcon.rs b/src/tlusty/math/solvers/matcon.rs similarity index 99% rename from src/tlusty/math/matcon.rs rename to src/tlusty/math/solvers/matcon.rs index 547cd6a..877d0d4 100644 --- a/src/tlusty/math/matcon.rs +++ b/src/tlusty/math/solvers/matcon.rs @@ -7,7 +7,7 @@ //! - 修改能量平衡行 (NRE) 和新的 DELTA 行 (NDEL) //! - 参考 Grenfell, Astr.Ap. 20, 293 (1972) -use crate::tlusty::math::convec::{convec, ConvecConfig, ConvecOutput, ConvecParams}; +use crate::tlusty::math::{convec, ConvecConfig, ConvecOutput, ConvecParams}; use crate::tlusty::state::constants::{BOLK, HALF, UN}; /// MATCON 配置参数 diff --git a/src/tlusty/math/matgen.rs b/src/tlusty/math/solvers/matgen.rs similarity index 100% rename from src/tlusty/math/matgen.rs rename to src/tlusty/math/solvers/matgen.rs diff --git a/src/tlusty/math/matinv.rs b/src/tlusty/math/solvers/matinv.rs similarity index 100% rename from src/tlusty/math/matinv.rs rename to src/tlusty/math/solvers/matinv.rs diff --git a/src/tlusty/math/minv3.rs b/src/tlusty/math/solvers/minv3.rs similarity index 100% rename from src/tlusty/math/minv3.rs rename to src/tlusty/math/solvers/minv3.rs diff --git a/src/tlusty/math/solvers/mod.rs b/src/tlusty/math/solvers/mod.rs new file mode 100644 index 0000000..3a73998 --- /dev/null +++ b/src/tlusty/math/solvers/mod.rs @@ -0,0 +1,49 @@ +//! solvers module + +mod accel2; +mod accelp; +mod cubic; +mod indexx; +mod laguer; +mod lineqs; +mod matcon; +mod matgen; +mod matinv; +mod minv3; +mod psolve; +mod quartc; +mod raph; +mod rhsgen; +mod rybchn; +mod rybene; +mod rybheq; +mod rybmat; +mod rybsol; +mod solve; +mod solves; +mod tridag; +mod ubeta; + +pub use accel2::*; +pub use accelp::*; +pub use cubic::*; +pub use indexx::*; +pub use laguer::*; +pub use lineqs::*; +pub use matcon::*; +pub use matgen::*; +pub use matinv::*; +pub use minv3::*; +pub use psolve::*; +pub use quartc::*; +pub use raph::*; +pub use rhsgen::*; +pub use rybchn::*; +pub use rybene::*; +pub use rybheq::*; +pub use rybmat::*; +pub use rybsol::*; +pub use solve::*; +pub use solves::*; +pub use tridag::*; +pub use ubeta::*; diff --git a/src/tlusty/math/psolve.rs b/src/tlusty/math/solvers/psolve.rs similarity index 100% rename from src/tlusty/math/psolve.rs rename to src/tlusty/math/solvers/psolve.rs diff --git a/src/tlusty/math/quartc.rs b/src/tlusty/math/solvers/quartc.rs similarity index 100% rename from src/tlusty/math/quartc.rs rename to src/tlusty/math/solvers/quartc.rs diff --git a/src/tlusty/math/raph.rs b/src/tlusty/math/solvers/raph.rs similarity index 100% rename from src/tlusty/math/raph.rs rename to src/tlusty/math/solvers/raph.rs diff --git a/src/tlusty/math/rhsgen.rs b/src/tlusty/math/solvers/rhsgen.rs similarity index 99% rename from src/tlusty/math/rhsgen.rs rename to src/tlusty/math/solvers/rhsgen.rs index 2707657..8b804c1 100644 --- a/src/tlusty/math/rhsgen.rs +++ b/src/tlusty/math/solvers/rhsgen.rs @@ -9,7 +9,7 @@ //! - 电荷守恒 //! - 对流贡献 -use crate::tlusty::math::convec::{convec, ConvecConfig, ConvecParams}; +use crate::tlusty::math::{convec, ConvecConfig, ConvecParams}; use crate::tlusty::state::constants::{BOLK, HALF, UN}; /// 常量 diff --git a/src/tlusty/math/rybchn.rs b/src/tlusty/math/solvers/rybchn.rs similarity index 98% rename from src/tlusty/math/rybchn.rs rename to src/tlusty/math/solvers/rybchn.rs index 2f076ce..775d29f 100644 --- a/src/tlusty/math/rybchn.rs +++ b/src/tlusty/math/solvers/rybchn.rs @@ -8,12 +8,12 @@ //! - 使用 ELDENS 计算电子密度 //! - 使用 PGSET 迭代计算气体压力 -use crate::tlusty::math::eldens::{eldens_pure, EldensConfig, EldensOutput, EldensParams}; -use crate::tlusty::math::pgset::{pgset, PgsetParams, PgsetOutput}; +use crate::tlusty::math::{eldens_pure, EldensConfig, EldensOutput, EldensParams}; +use crate::tlusty::math::{pgset, PgsetParams, PgsetOutput}; use crate::tlusty::state::constants::{BOLK, HALF, TWO, UN}; /// 最大深度点数(从 pgset 导入) -use super::pgset::MDEPTH; +use crate::tlusty::math::MDEPTH; /// RYBCHN 配置参数 #[derive(Debug, Clone)] diff --git a/src/tlusty/math/rybene.rs b/src/tlusty/math/solvers/rybene.rs similarity index 99% rename from src/tlusty/math/rybene.rs rename to src/tlusty/math/solvers/rybene.rs index 715e28f..8f119dc 100644 --- a/src/tlusty/math/rybene.rs +++ b/src/tlusty/math/solvers/rybene.rs @@ -7,7 +7,7 @@ //! - 补充对流对能量方程的贡献 //! - 使用 Rybicki 形式的矩阵结构 -use crate::tlusty::math::convec::{convec, ConvecConfig, ConvecParams}; +use crate::tlusty::math::{convec, ConvecConfig, ConvecParams}; use crate::tlusty::state::constants::{HALF, UN}; /// RYBENE 配置参数 diff --git a/src/tlusty/math/rybheq.rs b/src/tlusty/math/solvers/rybheq.rs similarity index 99% rename from src/tlusty/math/rybheq.rs rename to src/tlusty/math/solvers/rybheq.rs index adf952c..924eaa7 100644 --- a/src/tlusty/math/rybheq.rs +++ b/src/tlusty/math/solvers/rybheq.rs @@ -7,7 +7,7 @@ //! - 更新密度和电子密度分布 //! - 支持恒星大气和盘两种模式 -use crate::tlusty::math::erfcx::erfcx; +use crate::tlusty::math::erfcx; use crate::tlusty::state::constants::{HALF, PCK, TWO, UN}; // ============================================================================ diff --git a/src/tlusty/math/rybmat.rs b/src/tlusty/math/solvers/rybmat.rs similarity index 100% rename from src/tlusty/math/rybmat.rs rename to src/tlusty/math/solvers/rybmat.rs diff --git a/src/tlusty/math/rybsol.rs b/src/tlusty/math/solvers/rybsol.rs similarity index 99% rename from src/tlusty/math/rybsol.rs rename to src/tlusty/math/solvers/rybsol.rs index 3bf4bf0..efc5f68 100644 --- a/src/tlusty/math/rybsol.rs +++ b/src/tlusty/math/solvers/rybsol.rs @@ -8,8 +8,8 @@ //! - 构建并求解线性方程组 //! - 更新温度和布居数分布 -use super::lineqs::lineqs; -use super::tridag::tridag; +use crate::tlusty::math::lineqs; +use crate::tlusty::math::tridag; use crate::tlusty::state::constants::{MDEPTH, MLEVEL, UN}; // ============================================================================ diff --git a/src/tlusty/math/solve.rs b/src/tlusty/math/solvers/solve.rs similarity index 100% rename from src/tlusty/math/solve.rs rename to src/tlusty/math/solvers/solve.rs diff --git a/src/tlusty/math/solves.rs b/src/tlusty/math/solvers/solves.rs similarity index 100% rename from src/tlusty/math/solves.rs rename to src/tlusty/math/solvers/solves.rs diff --git a/src/tlusty/math/tridag.rs b/src/tlusty/math/solvers/tridag.rs similarity index 100% rename from src/tlusty/math/tridag.rs rename to src/tlusty/math/solvers/tridag.rs diff --git a/src/tlusty/math/ubeta.rs b/src/tlusty/math/solvers/ubeta.rs similarity index 100% rename from src/tlusty/math/ubeta.rs rename to src/tlusty/math/solvers/ubeta.rs diff --git a/src/tlusty/math/erfcx.rs b/src/tlusty/math/special/erfcx.rs similarity index 100% rename from src/tlusty/math/erfcx.rs rename to src/tlusty/math/special/erfcx.rs diff --git a/src/tlusty/math/expint.rs b/src/tlusty/math/special/expint.rs similarity index 100% rename from src/tlusty/math/expint.rs rename to src/tlusty/math/special/expint.rs diff --git a/src/tlusty/math/expo.rs b/src/tlusty/math/special/expo.rs similarity index 100% rename from src/tlusty/math/expo.rs rename to src/tlusty/math/special/expo.rs diff --git a/src/tlusty/math/gami.rs b/src/tlusty/math/special/gami.rs similarity index 100% rename from src/tlusty/math/gami.rs rename to src/tlusty/math/special/gami.rs diff --git a/src/tlusty/math/gamsp.rs b/src/tlusty/math/special/gamsp.rs similarity index 100% rename from src/tlusty/math/gamsp.rs rename to src/tlusty/math/special/gamsp.rs diff --git a/src/tlusty/math/gauleg.rs b/src/tlusty/math/special/gauleg.rs similarity index 100% rename from src/tlusty/math/gauleg.rs rename to src/tlusty/math/special/gauleg.rs diff --git a/src/tlusty/math/gaunt.rs b/src/tlusty/math/special/gaunt.rs similarity index 100% rename from src/tlusty/math/gaunt.rs rename to src/tlusty/math/special/gaunt.rs diff --git a/src/tlusty/math/special/mod.rs b/src/tlusty/math/special/mod.rs new file mode 100644 index 0000000..9d3e24b --- /dev/null +++ b/src/tlusty/math/special/mod.rs @@ -0,0 +1,21 @@ +//! special module + +mod erfcx; +mod expint; +mod expo; +mod gami; +mod gamsp; +mod gauleg; +mod gaunt; +mod voigt; +mod voigte; + +pub use erfcx::*; +pub use expint::*; +pub use expo::*; +pub use gami::*; +pub use gamsp::*; +pub use gauleg::*; +pub use gaunt::*; +pub use voigt::*; +pub use voigte::*; diff --git a/src/tlusty/math/voigt.rs b/src/tlusty/math/special/voigt.rs similarity index 100% rename from src/tlusty/math/voigt.rs rename to src/tlusty/math/special/voigt.rs diff --git a/src/tlusty/math/voigte.rs b/src/tlusty/math/special/voigte.rs similarity index 100% rename from src/tlusty/math/voigte.rs rename to src/tlusty/math/special/voigte.rs diff --git a/src/tlusty/math/elcor.rs b/src/tlusty/math/temperature/elcor.rs similarity index 97% rename from src/tlusty/math/elcor.rs rename to src/tlusty/math/temperature/elcor.rs index 05e05cd..c39b098 100644 --- a/src/tlusty/math/elcor.rs +++ b/src/tlusty/math/temperature/elcor.rs @@ -7,9 +7,9 @@ //! - 使用迭代方法求解电荷守恒方程 //! - 与统计平衡方程耦合 -use crate::tlusty::math::moleq::{moleq_pure, MoleqOutput, MoleqParams}; -use crate::tlusty::math::state::{state_pure, StateOutput, StateParams}; -use crate::tlusty::math::steqeq::{steqeq_pure, SteqeqConfig, SteqeqParams}; +use crate::tlusty::math::{moleq_pure, MoleqOutput, MoleqParams}; +use crate::tlusty::math::{state_pure, StateOutput, StateParams}; +use crate::tlusty::math::{steqeq_pure, SteqeqConfig, SteqeqParams}; use crate::tlusty::state::constants::{HALF, MDEPTH, MLEVEL, UN}; /// ELCOR 配置参数 diff --git a/src/tlusty/math/grcor.rs b/src/tlusty/math/temperature/grcor.rs similarity index 100% rename from src/tlusty/math/grcor.rs rename to src/tlusty/math/temperature/grcor.rs diff --git a/src/tlusty/math/greyd.rs b/src/tlusty/math/temperature/greyd.rs similarity index 100% rename from src/tlusty/math/greyd.rs rename to src/tlusty/math/temperature/greyd.rs diff --git a/src/tlusty/math/lucy.rs b/src/tlusty/math/temperature/lucy.rs similarity index 100% rename from src/tlusty/math/lucy.rs rename to src/tlusty/math/temperature/lucy.rs diff --git a/src/tlusty/math/temperature/mod.rs b/src/tlusty/math/temperature/mod.rs new file mode 100644 index 0000000..5da225b --- /dev/null +++ b/src/tlusty/math/temperature/mod.rs @@ -0,0 +1,25 @@ +//! temperature module + +mod elcor; +mod grcor; +mod greyd; +mod lucy; +mod osccor; +mod rossop; +mod rosstd; +mod tdpini; +mod temcor; +mod temper; +mod tlocal; + +pub use elcor::*; +pub use grcor::*; +pub use greyd::*; +pub use lucy::*; +pub use osccor::*; +pub use rossop::*; +pub use rosstd::*; +pub use tdpini::*; +pub use temcor::*; +pub use temper::*; +pub use tlocal::*; diff --git a/src/tlusty/math/osccor.rs b/src/tlusty/math/temperature/osccor.rs similarity index 100% rename from src/tlusty/math/osccor.rs rename to src/tlusty/math/temperature/osccor.rs diff --git a/src/tlusty/math/rossop.rs b/src/tlusty/math/temperature/rossop.rs similarity index 99% rename from src/tlusty/math/rossop.rs rename to src/tlusty/math/temperature/rossop.rs index 4fbccff..96ffc4e 100644 --- a/src/tlusty/math/rossop.rs +++ b/src/tlusty/math/temperature/rossop.rs @@ -14,7 +14,7 @@ //! - ioptab >= 0: 完整计算(WNSTOR, STEQEQ, OPACF0, MEANOP) //! - 否则: 使用 RHOEOS 和 MEANOPT -use super::eint; +use crate::tlusty::math::eint; use crate::tlusty::state::constants::BOLK; /// Hopf 函数多项式系数 (DATA A/.../) diff --git a/src/tlusty/math/rosstd.rs b/src/tlusty/math/temperature/rosstd.rs similarity index 100% rename from src/tlusty/math/rosstd.rs rename to src/tlusty/math/temperature/rosstd.rs diff --git a/src/tlusty/math/tdpini.rs b/src/tlusty/math/temperature/tdpini.rs similarity index 99% rename from src/tlusty/math/tdpini.rs rename to src/tlusty/math/temperature/tdpini.rs index 82b5ca0..e79a629 100644 --- a/src/tlusty/math/tdpini.rs +++ b/src/tlusty/math/temperature/tdpini.rs @@ -6,7 +6,7 @@ use crate::tlusty::state::config::BasNum; use crate::tlusty::state::constants::{HALF, H, HK, MDEPTH, UN}; use crate::tlusty::state::model::{CurOpa, GffPar, ModPar}; -use super::gfree0; +use crate::tlusty::math::gfree0; // ============================================================================ // TDPINI - 温度依赖量初始化 diff --git a/src/tlusty/math/temcor.rs b/src/tlusty/math/temperature/temcor.rs similarity index 100% rename from src/tlusty/math/temcor.rs rename to src/tlusty/math/temperature/temcor.rs diff --git a/src/tlusty/math/temper.rs b/src/tlusty/math/temperature/temper.rs similarity index 100% rename from src/tlusty/math/temper.rs rename to src/tlusty/math/temperature/temper.rs diff --git a/src/tlusty/math/tlocal.rs b/src/tlusty/math/temperature/tlocal.rs similarity index 99% rename from src/tlusty/math/tlocal.rs rename to src/tlusty/math/temperature/tlocal.rs index 16240b7..fd05100 100644 --- a/src/tlusty/math/tlocal.rs +++ b/src/tlusty/math/temperature/tlocal.rs @@ -4,7 +4,7 @@ //! //! 根据光学深度计算灰模型的局部温度。 -use super::quartc::quartc; +use crate::tlusty::math::quartc; use crate::tlusty::state::constants::{MDEPTH, UN}; /// TLOCAL 输入参数 diff --git a/src/tlusty/math/angset.rs b/src/tlusty/math/utils/angset.rs similarity index 98% rename from src/tlusty/math/angset.rs rename to src/tlusty/math/utils/angset.rs index da00a82..1f44c0c 100644 --- a/src/tlusty/math/angset.rs +++ b/src/tlusty/math/utils/angset.rs @@ -4,6 +4,7 @@ //! //! 设置角度点和角度相关量,用于处理 Compton 散射。 +use crate::tlusty::math::gauleg; use crate::tlusty::state::{Comptn, MMUC}; // ============================================================================ @@ -57,7 +58,7 @@ pub fn angset(comptn: &mut Comptn, nmuc_init: usize) { } // 在 [0, 1] 区间上设置 Gauss-Legendre 积分点 - let (amu0, wtmu0) = super::gauleg(ZERO, 1.0, nmuc0); + let (amu0, wtmu0) = gauleg(ZERO, 1.0, nmuc0); // 扩展到 [-1, 1] 区间 // Fortran: amuc(i) = -amu0(nmuc-i+1), amuc(i+nmuc) = amu0(i) diff --git a/src/tlusty/math/betah.rs b/src/tlusty/math/utils/betah.rs similarity index 100% rename from src/tlusty/math/betah.rs rename to src/tlusty/math/utils/betah.rs diff --git a/src/tlusty/math/bkhsgo.rs b/src/tlusty/math/utils/bkhsgo.rs similarity index 100% rename from src/tlusty/math/bkhsgo.rs rename to src/tlusty/math/utils/bkhsgo.rs diff --git a/src/tlusty/math/change.rs b/src/tlusty/math/utils/change.rs similarity index 99% rename from src/tlusty/math/change.rs rename to src/tlusty/math/utils/change.rs index 9a16b45..ce41a04 100644 --- a/src/tlusty/math/change.rs +++ b/src/tlusty/math/utils/change.rs @@ -7,7 +7,7 @@ //! - 支持多种模式来计算新能级的粒子数 //! - 使用 STEQEQ 计算 LTE 粒子数 -use crate::tlusty::math::steqeq::{steqeq_pure, SteqeqConfig, SteqeqParams, SteqeqOutput, MAX_LEVEL}; +use crate::tlusty::math::{steqeq_pure, SteqeqConfig, SteqeqParams, SteqeqOutput, MAX_LEVEL}; use crate::tlusty::state::constants::{BOLK, MDEPTH, MLEVEL, UN}; /// CHANGE 配置参数 diff --git a/src/tlusty/math/column.rs b/src/tlusty/math/utils/column.rs similarity index 100% rename from src/tlusty/math/column.rs rename to src/tlusty/math/utils/column.rs diff --git a/src/tlusty/math/comset.rs b/src/tlusty/math/utils/comset.rs similarity index 100% rename from src/tlusty/math/comset.rs rename to src/tlusty/math/utils/comset.rs diff --git a/src/tlusty/math/divstr.rs b/src/tlusty/math/utils/divstr.rs similarity index 100% rename from src/tlusty/math/divstr.rs rename to src/tlusty/math/utils/divstr.rs diff --git a/src/tlusty/math/dmder.rs b/src/tlusty/math/utils/dmder.rs similarity index 100% rename from src/tlusty/math/dmder.rs rename to src/tlusty/math/utils/dmder.rs diff --git a/src/tlusty/math/dmeval.rs b/src/tlusty/math/utils/dmeval.rs similarity index 99% rename from src/tlusty/math/dmeval.rs rename to src/tlusty/math/utils/dmeval.rs index 48f0495..f4a5e4e 100644 --- a/src/tlusty/math/dmeval.rs +++ b/src/tlusty/math/utils/dmeval.rs @@ -4,7 +4,7 @@ //! 当 z 标度是基本标度时,辅助 RESOLV 重新计算 m 标度。 use crate::tlusty::io::{FortranWriter, Result}; -use crate::tlusty::math::erfcx::erfcx; +use crate::tlusty::math::erfcx; use crate::tlusty::state::arrays::ComputeArrays; use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::config::TlustyConfig; diff --git a/src/tlusty/math/emat.rs b/src/tlusty/math/utils/emat.rs similarity index 100% rename from src/tlusty/math/emat.rs rename to src/tlusty/math/utils/emat.rs diff --git a/src/tlusty/math/getlal.rs b/src/tlusty/math/utils/getlal.rs similarity index 100% rename from src/tlusty/math/getlal.rs rename to src/tlusty/math/utils/getlal.rs diff --git a/src/tlusty/math/gomini.rs b/src/tlusty/math/utils/gomini.rs similarity index 100% rename from src/tlusty/math/gomini.rs rename to src/tlusty/math/utils/gomini.rs diff --git a/src/tlusty/math/gridp.rs b/src/tlusty/math/utils/gridp.rs similarity index 100% rename from src/tlusty/math/gridp.rs rename to src/tlusty/math/utils/gridp.rs diff --git a/src/tlusty/math/inicom.rs b/src/tlusty/math/utils/inicom.rs similarity index 100% rename from src/tlusty/math/inicom.rs rename to src/tlusty/math/utils/inicom.rs diff --git a/src/tlusty/math/irc.rs b/src/tlusty/math/utils/irc.rs similarity index 100% rename from src/tlusty/math/irc.rs rename to src/tlusty/math/utils/irc.rs diff --git a/src/tlusty/math/utils/mod.rs b/src/tlusty/math/utils/mod.rs new file mode 100644 index 0000000..e298782 --- /dev/null +++ b/src/tlusty/math/utils/mod.rs @@ -0,0 +1,59 @@ +//! utils module + +mod angset; +mod betah; +mod bkhsgo; +mod change; +mod column; +mod comset; +mod divstr; +mod dmder; +mod dmeval; +mod emat; +mod getlal; +mod gomini; +mod gridp; +mod inicom; +mod irc; +mod newdm; +mod newdmt; +mod pgset; +mod sabolf; +mod setdrt; +mod state; +mod switch; +mod topbas; +mod traini; +mod wn; +mod wnstor; +mod xk2dop; +mod zmrho; + +pub use angset::*; +pub use betah::*; +pub use bkhsgo::*; +pub use change::*; +pub use column::*; +pub use comset::*; +pub use divstr::*; +pub use dmder::*; +pub use dmeval::*; +pub use emat::*; +pub use getlal::*; +pub use gomini::*; +pub use gridp::*; +pub use inicom::*; +pub use irc::*; +pub use newdm::*; +pub use newdmt::*; +pub use pgset::*; +pub use sabolf::*; +pub use setdrt::*; +pub use state::*; +pub use switch::*; +pub use topbas::*; +pub use traini::*; +pub use wn::*; +pub use wnstor::*; +pub use xk2dop::*; +pub use zmrho::*; diff --git a/src/tlusty/math/newdm.rs b/src/tlusty/math/utils/newdm.rs similarity index 100% rename from src/tlusty/math/newdm.rs rename to src/tlusty/math/utils/newdm.rs diff --git a/src/tlusty/math/newdmt.rs b/src/tlusty/math/utils/newdmt.rs similarity index 99% rename from src/tlusty/math/newdmt.rs rename to src/tlusty/math/utils/newdmt.rs index ef6d96b..fc00a21 100644 --- a/src/tlusty/math/newdmt.rs +++ b/src/tlusty/math/utils/newdmt.rs @@ -7,8 +7,8 @@ //! 计算新的 m-scale(柱质量密度),基于新网格更好地表示温度变化。 //! 使用 GRIDP 函数找到最优网格点分布。 -use crate::tlusty::math::gridp::gridp; -use crate::tlusty::math::interp::interp; +use crate::tlusty::math::gridp; +use crate::tlusty::math::interp; use crate::tlusty::state::constants::{HALF, MDEPTH, TWO, UN}; // ============================================================================ diff --git a/src/tlusty/math/pgset.rs b/src/tlusty/math/utils/pgset.rs similarity index 99% rename from src/tlusty/math/pgset.rs rename to src/tlusty/math/utils/pgset.rs index f54c96c..0612b85 100644 --- a/src/tlusty/math/pgset.rs +++ b/src/tlusty/math/utils/pgset.rs @@ -4,7 +4,7 @@ //! //! 功能:迭代计算气体压力分布,使用三对角矩阵求解器。 -use crate::tlusty::math::tridag::tridag; +use crate::tlusty::math::tridag; /// 最大深度数(与 Fortran MDEPTH 一致) pub const MDEPTH: usize = 100; diff --git a/src/tlusty/math/sabolf.rs b/src/tlusty/math/utils/sabolf.rs similarity index 100% rename from src/tlusty/math/sabolf.rs rename to src/tlusty/math/utils/sabolf.rs diff --git a/src/tlusty/math/setdrt.rs b/src/tlusty/math/utils/setdrt.rs similarity index 100% rename from src/tlusty/math/setdrt.rs rename to src/tlusty/math/utils/setdrt.rs diff --git a/src/tlusty/math/state.rs b/src/tlusty/math/utils/state.rs similarity index 99% rename from src/tlusty/math/state.rs rename to src/tlusty/math/utils/state.rs index c0e183c..b9e2a28 100644 --- a/src/tlusty/math/state.rs +++ b/src/tlusty/math/utils/state.rs @@ -10,7 +10,7 @@ //! - MODE=3: 类似 MODE=2,但计算导数 use crate::tlusty::state::constants::*; -use crate::tlusty::math::partf::{partf_pure, PartfParams, PartfMode}; +use crate::tlusty::math::{partf_pure, PartfParams, PartfMode}; // ============================================================================ // 常量 diff --git a/src/tlusty/math/switch.rs b/src/tlusty/math/utils/switch.rs similarity index 100% rename from src/tlusty/math/switch.rs rename to src/tlusty/math/utils/switch.rs diff --git a/src/tlusty/math/topbas.rs b/src/tlusty/math/utils/topbas.rs similarity index 99% rename from src/tlusty/math/topbas.rs rename to src/tlusty/math/utils/topbas.rs index e6aa4e4..7f47ef1 100644 --- a/src/tlusty/math/topbas.rs +++ b/src/tlusty/math/utils/topbas.rs @@ -7,7 +7,7 @@ //! - 使用 Opacity Project (OP) 数据计算光致电离截面 //! - 在给定频率处进行对数插值 -use crate::tlusty::math::ylintp::ylintp; +use crate::tlusty::math::ylintp; // 常量 const MMAXOP: usize = 200; // OP 数据中最大能级数 diff --git a/src/tlusty/math/traini.rs b/src/tlusty/math/utils/traini.rs similarity index 100% rename from src/tlusty/math/traini.rs rename to src/tlusty/math/utils/traini.rs diff --git a/src/tlusty/math/wn.rs b/src/tlusty/math/utils/wn.rs similarity index 100% rename from src/tlusty/math/wn.rs rename to src/tlusty/math/utils/wn.rs diff --git a/src/tlusty/math/wnstor.rs b/src/tlusty/math/utils/wnstor.rs similarity index 99% rename from src/tlusty/math/wnstor.rs rename to src/tlusty/math/utils/wnstor.rs index dfddee1..ee41789 100644 --- a/src/tlusty/math/wnstor.rs +++ b/src/tlusty/math/utils/wnstor.rs @@ -4,7 +4,7 @@ //! //! 将氢能级的占据概率存储到 WNCOM 公共块中,以便后续使用。 -use crate::tlusty::math::wn::wn; +use crate::tlusty::math::wn; use crate::tlusty::state::constants::{MLEVEL, NLMX, UN}; /// 存储氢能级占据概率。 diff --git a/src/tlusty/math/xk2dop.rs b/src/tlusty/math/utils/xk2dop.rs similarity index 100% rename from src/tlusty/math/xk2dop.rs rename to src/tlusty/math/utils/xk2dop.rs diff --git a/src/tlusty/math/zmrho.rs b/src/tlusty/math/utils/zmrho.rs similarity index 100% rename from src/tlusty/math/zmrho.rs rename to src/tlusty/math/utils/zmrho.rs