void appendFile(FILE* graveur, Fichier* queue){ FILE* lecteur = ouvrirLecture(queue); unsigned long tailleFichier = fsize(queue); unsigned long nbrDivisions = tailleFichier/TAILLE_BUFFER; TabOfChar* buffer = newTabOfChar(TAILLE_BUFFER); TabOfChar* reste = newTabOfChar(tailleFichier % TAILLE_BUFFER); for (unsigned long i = 0; i<nbrDivisions; i++) { readFlux(lecteur, buffer); writeFlux(graveur, buffer); } readFlux(lecteur, reste); writeFlux(graveur, reste); terminateTableau((Tableau*) buffer); terminateTableau((Tableau*) reste); fclose(lecteur); }
int main(int argc, char *argv[]) { bool_t analyze_output, equilibria_only; int niter, nact; Atom *atom; Molecule *molecule; /* --- Read input data and initialize -- -------------- */ setOptions(argc, argv); getCPU(0, TIME_START, NULL); SetFPEtraps(); readInput(); spectrum.updateJ = TRUE; getCPU(1, TIME_START, NULL); readAtmos(&atmos, &geometry); if (atmos.Stokes) Bproject(); fillMesh(&geometry); readAtomicModels(); readMolecularModels(); SortLambda(); getBoundary(&atmos, &geometry); Background(analyze_output=TRUE, equilibria_only=FALSE); getProfiles(); initSolution(); initScatter(); getCPU(1, TIME_POLL, "Total initialize"); /* --- Solve radiative transfer for active ingredients -- --------- */ Iterate(input.NmaxIter, input.iterLimit); adjustStokesMode(atom); niter = 0; while (niter < input.NmaxScatter) { if (solveSpectrum(FALSE, FALSE) <= input.iterLimit) break; niter++; } /* --- Write output files -- ------------------ */ getCPU(1, TIME_START, NULL); writeInput(); writeAtmos(&atmos); writeGeometry(&geometry); writeSpectrum(&spectrum); writeFlux(FLUX_DOT_OUT); for (nact = 0; nact < atmos.Nactiveatom; nact++) { atom = atmos.activeatoms[nact]; writeAtom(atom); writePopulations(atom); writeRadRate(atom); writeCollisionRate(atom); writeDamping(atom); } for (nact = 0; nact < atmos.Nactivemol; nact++) { molecule = atmos.activemols[nact]; writeMolPops(molecule); } writeOpacity(); getCPU(1, TIME_POLL, "Write output"); printTotalCPU(); }