コード例 #1
0
void sciddicaTCADef()
{
	//cadef and rundef
	sciddicaT = calCADef2D (ROWS, COLS, CAL_VON_NEUMANN_NEIGHBORHOOD_2D, CAL_SPACE_TOROIDAL, CAL_NO_OPT);
	sciddicaT_simulation = calRunDef2D(sciddicaT, 1, CAL_RUN_LOOP, CAL_UPDATE_IMPLICIT);

	//put OpenCAL - OMP in unsafe state execution(to allow unsafe operation to be used)
	calSetUnsafe2D(sciddicaT);

	//add transition function's elementary processes
	calAddElementaryProcess2D(sciddicaT, sciddicaTFlowsComputation);
	calAddElementaryProcess2D(sciddicaT, sciddicaTWidthUpdate);

	//add substates
	Q.z = calAddSubstate2Dr(sciddicaT);
	Q.h = calAddSubstate2Dr(sciddicaT);
	Q.f[0] = calAddSubstate2Dr(sciddicaT);
	Q.f[1] = calAddSubstate2Dr(sciddicaT);
	Q.f[2] = calAddSubstate2Dr(sciddicaT);
	Q.f[3] = calAddSubstate2Dr(sciddicaT);

	//load configuration
	sciddicaTLoadConfig();

	//simulation run setup
	calRunAddInitFunc2D(sciddicaT_simulation, sciddicaTSimulationInit); calRunInitSimulation2D(sciddicaT_simulation);
	calRunAddSteeringFunc2D(sciddicaT_simulation, sciddicaTSteering);
	calRunAddStopConditionFunc2D(sciddicaT_simulation, sciddicaTSimulationStopCondition);
}
コード例 #2
0
void sciddicaTCADef()
{
	//cadef and rundef
	s3hex = calCADef2D (ROWS, COLS, CAL_HEXAGONAL_NEIGHBORHOOD_2D, CAL_SPACE_TOROIDAL, CAL_OPT_ACTIVE_CELLS);
	s3hexSimulation = calRunDef2D(s3hex, 1, CAL_RUN_LOOP, CAL_UPDATE_EXPLICIT);

	//add transition function's elementary processes
	calAddElementaryProcess2D(s3hex, s3hexErosion);
	calAddElementaryProcess2D(s3hex, s3hexFlowsComputation);
	calAddElementaryProcess2D(s3hex, s3hexRomoveInactiveCells);
	calAddElementaryProcess2D(s3hex, s3hexEnergyLoss);

	//add substates
	Q.z = calAddSingleLayerSubstate2Dr(s3hex);
	Q.d = calAddSingleLayerSubstate2Dr(s3hex);
	Q.s = calAddSingleLayerSubstate2Di(s3hex);
	Q.h = calAddSubstate2Dr(s3hex);
	Q.p = calAddSubstate2Dr(s3hex);

	//load configuration
	sciddicaTLoadConfig();

	//simulation run setup
	calRunAddInitFunc2D(s3hexSimulation, sciddicaTSimulationInit); calRunInitSimulation2D(s3hexSimulation);
	calRunAddGlobalTransitionFunc2D(s3hexSimulation, sciddicaTransitionFunction);
	calRunAddStopConditionFunc2D(s3hexSimulation, sciddicaTSimulationStopCondition);
}
コード例 #3
0
ファイル: cal2DRun.c プロジェクト: knotman90/opencal
void calRun2D(struct CALRun2D* simulation)
{
	CALbyte again;

	calRunInitSimulation2D(simulation);

	for (simulation->step = simulation->initial_step; (simulation->step <= simulation->final_step || simulation->final_step == CAL_RUN_LOOP); simulation->step++)
	{
		again = calRunCAStep2D(simulation);
		if (!again)
			break;
	}

	calRunFinalizeSimulation2D(simulation);
}
コード例 #4
0
void sciddicaTCADef()
{
  int n;
  CALbyte optimization_type = CAL_NO_OPT;

#ifdef ACTIVE_CELLS
  optimization_type = CAL_OPT_ACTIVE_CELLS;
#endif

  //cadef and rundef
  s3hex = calCADef2D (ROWS, COLS, CAL_HEXAGONAL_NEIGHBORHOOD_2D, CAL_SPACE_TOROIDAL, optimization_type);
	s3hexSimulation = calRunDef2D(s3hex, 1, CAL_RUN_LOOP, CAL_UPDATE_IMPLICIT);

	//put OpenCAL - OMP in unsafe state execution(to allow unsafe operation to be used)
	calSetUnsafe2D(s3hex);

	//add transition function's elementary processes
    calAddElementaryProcess2D(s3hex, s3hexErosion);
    calAddElementaryProcess2D(s3hex, s3hexFlowsComputation);
    calAddElementaryProcess2D(s3hex, s3hexWidthAndPotentialUpdate);
    calAddElementaryProcess2D(s3hex, s3hexClearOutflows);
    calAddElementaryProcess2D(s3hex, s3hexEnergyLoss);
    calAddElementaryProcess2D(s3hex, s3hexRomoveInactiveCells);

	//add substates
	Q.z = calAddSingleLayerSubstate2Dr(s3hex);
	Q.d = calAddSingleLayerSubstate2Dr(s3hex);
	Q.s = calAddSingleLayerSubstate2Di(s3hex);
	Q.h = calAddSubstate2Dr(s3hex);
	Q.p = calAddSubstate2Dr(s3hex);
    for (n=0; n<s3hex->sizeof_X; n++)
      {
        Q.fh[n] = calAddSubstate2Dr(s3hex);
        Q.fp[n] = calAddSubstate2Dr(s3hex);
      }

	//load configuration
	sciddicaTLoadConfig();

	//simulation run setup
	calRunAddInitFunc2D(s3hexSimulation, sciddicaTSimulationInit); calRunInitSimulation2D(s3hexSimulation);
	calRunAddStopConditionFunc2D(s3hexSimulation, sciddicaTSimulationStopCondition);
}