void Core_LoadCallback(void * reserved)
{
	ResetGlobals ();

	OBSESerializationInterface* intfc = &g_OBSESerializationInterface;
	UInt32 type, version, length;

	while (intfc->GetNextRecordInfo(&type, &version, &length))
	{
		switch (type)
		{
		case 'STVS':
		case 'STVR':
		case 'STVE':
		case 'ARVS':
		case 'ARVR':
		case 'ARVE':
		case 'MODS':	
			break;		// processed during preload
		case 'GLOB':
			ReadGlobals (intfc, length);
			break;
		default:
			_MESSAGE("Unhandled chunk type in LoadCallback: %d", type);
			continue;
		}
	}
}
Example #2
0
Globals::Globals(int action) {
  // Constructor assings stringIDs and automatically reads from the input file.

  // set simulation path to that from the Output class.
  path = Output.path;

  // copy the string path to a character array
  strcpy(cpath, path.c_str());

  // Yes, currently action is redundant.
  if (action) SetDefault();
  else {
    SetDefault();

    // Append variable IDs to all global variables, then add them to variable list.
    // Variables require a string ID so the correct variable can be matched to that
    // being read from input.in.

    // All variables described in globals.h

    // Please keep *all* string ID's in lower case.
    radius.SetStringID("radius");
    allGlobals.push_back(&radius);

    angVel.SetStringID("angular velocity");
    allGlobals.push_back(&angVel);

    loveK2.SetStringID("k2");
    allGlobals.push_back(&loveK2);

    loveH2.SetStringID("h2");
    allGlobals.push_back(&loveH2);

    loveReduct.SetStringID("love reduction factor");
    allGlobals.push_back(&loveReduct);

    h.SetStringID("ocean thickness");
    allGlobals.push_back(&h);

    g.SetStringID("surface gravity");
    allGlobals.push_back(&g);

    a.SetStringID("semimajor axis");
    allGlobals.push_back(&a);

    e.SetStringID("eccentricity");
    allGlobals.push_back(&e);

    theta.SetStringID("obliquity");
    allGlobals.push_back(&theta);

    timeStep.SetStringID("time step");
    allGlobals.push_back(&timeStep);

    converge.SetStringID("converge");
    allGlobals.push_back(&converge);

    alpha.SetStringID("friction coefficient");
    allGlobals.push_back(&alpha);

		l_max.SetStringID("sh degree");
		allGlobals.push_back(&l_max);

    dLat.SetStringID("latitude spacing");
    allGlobals.push_back(&dLat);

    dLon.SetStringID("longitude spacing");
    allGlobals.push_back(&dLon);

    period.SetStringID("orbital period");
    allGlobals.push_back(&period);

    endTime.SetStringID("simulation end time");
    allGlobals.push_back(&endTime);

    potential.SetStringID("potential");
    allGlobals.push_back(&potential);

    friction.SetStringID("friction type");
    allGlobals.push_back(&friction);

    init.SetStringID("initial conditions");
    allGlobals.push_back(&init);

    diss.SetStringID("avg dissipation output");
    allGlobals.push_back(&diss);

    kinetic.SetStringID("kinetic output");
    allGlobals.push_back(&kinetic);

    work.SetStringID("work flux output");
    allGlobals.push_back(&work);

    field_displacement_output.SetStringID("displacement output");
    allGlobals.push_back(&field_displacement_output);

    field_velocity_output.SetStringID("velocity output");
    allGlobals.push_back(&field_velocity_output);

    field_diss_output.SetStringID("dissipation output");
    allGlobals.push_back(&field_diss_output);

    sh_coeff_output.SetStringID("sh coefficient output");
    allGlobals.push_back(&sh_coeff_output);

    outputTime.SetStringID("output time");
    allGlobals.push_back(&outputTime);

    ReadGlobals(); //Read globals from input.in file
  }

  // Print out all constants to output.txt
  OutputConsts();

  // Convert end time from units of orbital period to seconds.
  endTime.SetValue(endTime.Value()*period.Value());

  // identify friction type and select the corresponding enum value.
  if (friction.Value() == "LINEAR") fric_type = LINEAR;
  else if (friction.Value() == "QUADRATIC") fric_type = QUADRATIC;
  else {
    outstring << "No friction type found." << std::endl;
    Output.Write(ERR_MESSAGE, &outstring);
    Output.TerminateODIS();
  }
};