Location: Metabolic Component Library @ 38fe44af096f / CellML-source / CellMLTools / src / componentlibrary / CISIntegrator.java

Author:
Randall Britten <r.britten@auckland.ac.nz>
Date:
2013-04-17 15:40:27+12:00
Desc:
Trivial whitespace changes, and moved import to be adjacent to peer import.
Permanent Source URI:
https://models.cellml.org/w/matthiaskoenig/MetabolicComponentLibrary/rawfile/38fe44af096fb53d9b250091fe0563b33b5f778f/CellML-source/CellMLTools/src/componentlibrary/CISIntegrator.java

package componentlibrary;

/** Perform the integration of a CellML model via CIS. */
public class CISIntegrator {
	
	
	public static void main(String args[]){
		 
		printf("# Creating integration service...\n");
		  iface::cellml_services::CellMLIntegrationService* cis =
		    CreateIntegrationService();
		
		  ret = ODEMain(cis, mod, argc, argv);
		  
		  iface::cellml_services::ODESolverCompiledModel* ccm = NULL;
		  try
		  {
		    printf("# Compiling model...\n");
		    ccm = cis->compileModelODE(mod);
		  }
		  catch (iface::cellml_api::CellMLException& ce)
		  {
		    std::wstring err = cis->lastError();
		    printf("Caught a CellMLException while compiling model: %S\n", err.c_str());
		    return -1;
		  }
		  catch (...)
		  {
		    printf("Unexpected exception calling compileModel!\n");
		    // this is a leak, but it should also never happen :)
		    return -1;
		  }

		  printf("# Creating run...\n");
		  iface::cellml_services::ODESolverRun* cir =
		    cis->createODEIntegrationRun(ccm);

		  TestProgressObserver* tpo = new TestProgressObserver(ccm);
		  cir->setProgressObserver(tpo);
		  tpo->release_ref();

		  ProcessKeywords(argc, argv, cir);

		#ifdef ENABLE_FIND_NUMERIC_ERRORS
		  feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW);
		#endif

		  cir->start();
		  cir->release_ref();
		  ccm->release_ref();

		  while (!gFinished)
		    sleep(1);

		  if (gSleepTime)
		    sleep(gSleepTime);

		  return 0;
		  
	
	}
	
}