void printFields(cfrt_classfile *c) { int i; fprintf(stderr, " Field count: %d\n", c->fields_count); for (i = 0; i < c->fields_count; i++) { fprintf(stderr, " Field #%d:\n", i); printFieldInfo(c->fields + i, stderr); } }
void getStepInfo(struct OCT **firstoct, struct RUNPARAMS *param, struct CPUINFO *cpu){ param->physical_state->sfr=0; param->physical_state->Nsn=0; param->physical_state->src=0; double pre_mstar=(cpu->nsteps>0)? param->physical_state->mstar:0; param->physical_state->mstar=0; #ifdef TESTCOSMO double prev_t =(cpu->nsteps>0)? param->physical_state->t:0; param->physical_state->t = param->cosmo->tphy; double dt_yr = param->cosmo->tphy - prev_t; #endif // TESTCOSMO int i; for (i=0;i<param->out_grid->n_field_tot; i++){ if (param->out_grid->field_state_stat[i]){ initFieldInfo(&(param->physical_state->field[i]), param->physical_state->field[i].bin_min, param->physical_state->field[i].bin_max); } } int level; for(level=param->lcoarse;level<=param->lmax;level++){ struct OCT *nextoct=firstoct[level-1]; double vweight=POW(0.5,3*level); // volume d'une cellule de niveau level do{ if(nextoct==NULL) continue; struct OCT *curoct=nextoct; nextoct=curoct->next; if(curoct->cpu!=cpu->rank) continue;// ne pas compter les quantites des cellules de bord param->physical_state->max_level=level; int icell; for(icell=0;icell<8;icell++) { struct CELL *curcell = &curoct->cell[icell]; if( curcell->child==NULL){ //------------------------------------------------------------------------------------------------// //------------------------------------------------------------------------------------------------// for (i=0;i<param->out_grid->n_field_tot; i++){ if (param->out_grid->field_state_stat[i]){ getFieldInfo(&(param->physical_state->field[i]),assign_grid_field(i,curcell),vweight); } } #ifdef WRAD int igrp; for(igrp=0;igrp<NGRP;igrp++){ param->physical_state->src+=curcell->rfield.src[igrp]*vweight; } #endif // WRAD #ifdef STARS struct PART *curp; struct PART *nexp=curcell->phead; do{ if(nexp==NULL) continue; curp=nexp; nexp=curp->next; if(curp->isStar){ param->physical_state->mstar += curp->mass; if(curp->isStar==5||(curp->isStar==7||curp->isStar==8)){ param->physical_state->Nsn++; } } }while(nexp!=NULL); #endif // STARS //------------------------------------------------------------------------------------------------// //------------------------------------------------------------------------------------------------// } } }while(nextoct!=NULL); } #ifdef WMPI for (i=0;i<param->out_grid->n_field_tot; i++){ if (param->out_grid->field_state_stat[i]){ comFieldInfo(cpu,&(param->physical_state->field[i])); } } MPI_Allreduce(MPI_IN_PLACE,¶m->physical_state->src, 1,MPI_DOUBLE,MPI_SUM,cpu->comm); MPI_Allreduce(MPI_IN_PLACE,¶m->physical_state->max_level,1,MPI_INT, MPI_MAX,cpu->comm); MPI_Allreduce(MPI_IN_PLACE,¶m->physical_state->Nsn, 1,MPI_INT, MPI_MAX,cpu->comm); MPI_Allreduce(MPI_IN_PLACE,¶m->physical_state->mstar, 1,MPI_DOUBLE,MPI_SUM,cpu->comm); #endif #ifdef TESTCOSMO double dm_M0 = (param->physical_state->mstar - pre_mstar)*param->unit.unit_mass/SOLAR_MASS; #endif // TESTCOSMO for (i=0;i<param->out_grid->n_field_tot; i++){ if (param->out_grid->field_state_stat[i]){ setSigmaFieldInfo(&(param->physical_state->field[i])); } } int debug=0; if (debug){ int i; for (i=0;i<param->out_grid->n_field_tot; i++){ if (param->out_grid->field_state_stat[i]){ printFieldInfo(&(param->physical_state->field[i])); } } } #ifdef TESTCOSMO REAL h=param->cosmo->H0/100.; REAL l= param->unit.unit_l/(1e6*PARSEC)*h; REAL V_Mpc = POW(l,3); param->physical_state->sfr = dm_M0/dt_yr/V_Mpc; #endif // TESTCOSMO }