예제 #1
0
FString UGame::GetGameString(FString Name, FString DefaultValue) const
{
	return GetNamedVar( GameStrings, Name, DefaultValue );
}
예제 #2
0
float UGame::GetGameFloat(FString Name, float DefaultValue) const
{
	return GetNamedVar( GameFloats, Name, DefaultValue );
}
예제 #3
0
int32 UGame::GetGameInt(FString Name, int32 DefaultValue) const
{
	return GetNamedVar( GameInts, Name, DefaultValue );
}
예제 #4
0
bool UGame::GetGameFlag( FString Name, bool bDefaultValue ) const
{
	return GetNamedVar( GameFlags, Name, bDefaultValue );
}
예제 #5
0
void WorkersLoop(int startupflags)
{
  double theta;
  long daytime, newtinc;
  Entity et;
  Vector sunpos;
  VarDesc *v;
  int i, j, k;
  char varname[80];
  while (1)  {
    switch (GetCommand())  {
    case DO_TIME_STEP :
      if (plausible)  {
	daytime = ((int)(timeofday*3600.)+actime) % 86400;
	ActualiseValuesInTime(actime);	/* Actualise Border values */
	for (et = maxentity; et--; )
	  CalculateLayerAverage(g[et], pstat, avg+et*nz);
	SetAvgMountains();
	CalcMeanHydrostaticPressure();
	InterpolateToFaces();			/* Interpolate wind speeds from center to faces */
	InterpolateToCenter(-1., pressuretype == NONHYDROSTATIC);
	if (tstart == actime)  Continuity();
	CheckTimeStep(&tinc, &chemtinc, 0.8);
	if (pressuretype == NONHYDROSTATIC)
	  ApplyBuoyancy(tinc);			/* Calculate Buoyancy */
	if (pressuretype != NOPRESSURE)  {		/* Calc wind acceleration */
	  switch (pressuretype)  {			/* Calculate Pressure field */
	  case HYDROSTATIC    : CalcHydrostaticPressure(); break;
	  case NONHYDROSTATIC : SolveForPressure(tinc); break;
	  }
	  ApplyPressure(tinc);
	}
	Continuity();				/* Mass conservation */
	InterpolateToCenter(1., pressuretype == NONHYDROSTATIC);
	if (coriolistype != NOCORIOLIS)  ApplyCoriolis(tinc);
	if (filtertype != NO_FILTER)  {
	  SetBoundary(WWIND+1);   /* Set Boundary for Wind only */
	  switch (filtertype)  {
	  case PEPPER_FILTER :
	    for (i = nz; i--; )
	      for (et = HUMIDITY; et--; )
		ApplyFilter(g[et]+i*layer, pstat+i*layer, spatialfilter);
	    break;
	  case SHAPIRO_FILTER :
	    for (i = nz; i--; )
	      for (et = HUMIDITY; et--; )
		ShapiroFilter(g[et]+i*layer, pstat+i*layer, 3, spatialfilter);
	    break;
	  case DIFFUSION_FILTER :
	    for (i = nz; i--; )
	      for (et = HUMIDITY; et--; )
		ShapiroFilter(g[et]+i*layer, pstat+i*layer, 1, spatialfilter);
	    break;
	  }
	}
	SetBoundary(WWIND+1);
	CheckTimeStep(&newtinc, &chemtinc, 1.);
	if (newtinc < tinc)  {
	  tinc = newtinc;
	}
	chemtinc = (chemtime <= actime ? chemtinc : 0);
	if (advection || windadvection)
	  switch (advectiontype)  {
	  case MPDATA_A : Advect(tinc, chemtinc); break;
	  case PPM_A    : PPM_Transport(tinc, chemtinc, smiord); break;
	  }
	if (dampinglayer)  DampTop();
	if (groundinterface || shortwaveradiation)  {
	  GroundInterface(timeofday + (double)actime / 3600., dayofyear, tinc, &sunpos);
	  sunelevation = (sunpos.z > 0. ? 57.29578 * asin(sunpos.z) : 0.);
	}
	if (cloudwater)  CloudPhysics();
	if (turbtype == TTTT)  {
	  if (groundinterface)
	    CalcGroundTurbulence(tinc);
	  CalcTransilientTurbulence(tinc);
	}
	else if (turbtype == KEPS_T)  {
	  CalcKEpsilon(tinc);
	  if (groundinterface)
	    CalcGroundTurbulence(tinc);
	  CalcKTurb(tinc, chemtinc);
	}
	Emit(tinc);
	Deposit(tinc);
	if (!(radiationtype && shortwaveradiation) &&
	    // When using the two-stream module, ChemicalTimeStep
	    // mus be called from within ShortWaveRadiation!
	    nsubs && actime % tchem == 0)  ChemicalTimeStep(tchem, &sunpos);
	SetBoundary(chemtinc ? maxentity : SUBS);
    
	// Call ModuleManager
	McInterface::modmanager.DoCalc(actime+tinc);

	actime += tinc; chemtime += chemtinc;
	if (dumpnow || (dumptime && (actime % dumptime == 0)))  {
	  MakeAFullDump();
	  dumpnow = 0;
	}
      }  /* if (plausible) */
      SendStatus(plausible);
      break;
    case SENDGRIDVAL :
      pvm_upkint((int *)&et, 1, 1);
      pvm_upkint(&i, 1, 1);
      pvm_upkint(&j, 1, 1);
      pvm_upkint(&k, 1, 1);
      pvm_initsend(PvmDataRaw);
      pvm_pkdouble(g[et]+i*row+j+k*layer, 1, 1);
      pvm_send(myparent, VALUES);
      break;
    case SENDMESHVAL :
      pvm_upkstr(varname);
      v = GetNamedVar(varname);
      pvm_upkint(&i, 1, 1);
      pvm_upkint(&j, 1, 1);
      pvm_upkint(&k, 1, 1);
      pvm_initsend(PvmDataRaw);
      if (v->storetype == PROC_VAL)  {
	theta = v->v.proc(k, i, j, v);
	pvm_pkdouble(&theta, 1, 1);
      }
      else
	pvm_pkdouble(GetNamedVar(varname)->v.d+i*row+j+k*layer, 1, 1);
      pvm_send(myparent, VALUES);
      break;
    case SENDGRID :
      pvm_upkint((int *)&et, 1, 1);
      SendMeshToMaster(g[et], 0, ALL_DIM);
      break;
    case SENDMESH :
      pvm_upkstr(varname);
      v = GetNamedVar(varname);
      if (v->storetype == PROC_VAL)  {
	for (k = nz; k--; )
	  for (i = nx+1; i--; )
	    for (j = ny+1; j--; )
	      flux[0][i*row+j+k*layer] = v->v.proc(k, i, j, v);
	SendMeshToMaster(flux[0], 0, v->dims);
	memset(flux[0], 0, mesh * sizeof(double));
      }
      else
	SendMeshToMaster(v->v.d, 0, v->dims);
      break;
    case SENDGROUND :
      SendGroundToMaster();
      break;
    case EXIT :
      pvm_exit();
      exit (0);
    }
  }
}
예제 #6
0
void RecvBorderTime(void)
{
  BorderTimeDesc *bt, *last = NULL;
  char varname[80];
  int nbt, mem, i, dff;
  bordertime = NULL;
  pvm_upkint(&nbt, 1, 1);
  while (nbt--)  {
    bt = (BorderTimeDesc *)malloc(sizeof(BorderTimeDesc));
    pvm_upkint((int *)&bt->vartype, 1, 1);
    pvm_upkint((int *)&bt->section, 1, 1);
    pvm_upkint(&bt->bigdim, 1, 1);
    pvm_upkint(&bt->ntime, 1, 1);
    pvm_upkint(&bt->itime, 1, 1);
    pvm_upkint(&bt->cdfid, 1, 1);
    pvm_upkint(&bt->vid, 1, 1);
    pvm_upkstr(varname);
    pvm_upkint((int *)&bt->actualvar.v.et, 1, 1);
    pvm_upkushort(&bt->actualvar.dims, 1, 1);
    pvm_upkint((int *)&bt->actualvar.storetype, 1, 1);
    pvm_upkint(&bt->actualvar.id, 1, 1);
    pvm_upkint(&bt->actualvar.ncoord, 1, 1);
    pvm_upkint((int *)&bt->nextvar.v.et, 1, 1);
    pvm_upkushort(&bt->nextvar.dims, 1, 1);
    pvm_upkint((int *)&bt->nextvar.storetype, 1, 1);
    bt->timetable = (long *)malloc(bt->ntime * sizeof(long));
    pvm_upklong(bt->timetable, bt->ntime, 1);
    pvm_upkuint((uint *)bt->coords, 4, 1);
    for (i = 0; i < 4; i++)  {
      pvm_upkint(&dff, 1, 1);
      bt->dimptr[i] = bt->coords + dff;
    }
    switch (bt->section)  {
      case NORTH_BORDER :
            bt->actualvar.v.d = northborder + GetNamedVar(varname)->v.et*nz*xrow;
	    break;
      case SOUTH_BORDER :
            bt->actualvar.v.d = southborder + GetNamedVar(varname)->v.et*nz*xrow;
	    break;
      case WEST_BORDER  :
            bt->actualvar.v.d = westborder + GetNamedVar(varname)->v.et*nz*row;
	    break;
      case EAST_BORDER  :
            bt->actualvar.v.d = eastborder + GetNamedVar(varname)->v.et*nz*row;
	    break;
      case EMISSIONS    :
            bt->actualvar.v.d = GetEmVarWithID(bt->actualvar.id)->v.d;
	    break;
      default	        :
            bt->actualvar.v = GetNamedVar(varname)->v;
            break;
    }
    switch (bt->vartype)  {
      case XWALL_VAR :
	 mem = xrow*nz;
	 break;
      case WALL_VAR :
	 mem = row*nz;
	 break;
      case LAYER_VAR :
      case GROUND_VAR :
	 mem = layer;
	 break;
      case PROFILE_VAR :
	 mem = nz;
	 break;
      case MESH_VAR :
	 mem = mesh;
	 break;
      case COORD_VAR :
	 mem = bt->actualvar.ncoord;
	 break;
    }
    bt->actualdata.d = bt->actualvar.v.d;
    bt->nextdata = (double *)calloc(mem, sizeof(double));
    bt->nextvar.v.d = bt->nextdata;
    bt->nextvar.ncoord = bt->actualvar.ncoord;
    *(bordertime ? &last->next : &bordertime) = bt;
    last = bt;
  } 
  if (last)  last->next = NULL;
}