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

Author:
Randall Britten <r.britten@auckland.ac.nz>
Date:
2013-04-17 15:30:14+12:00
Desc:
To "clone" an imported component, the top level import element needs to be duplicated, not just the component reference within an existing import. The rationale is that all connections within a top-level import are kept intact, as dictated by the encapsulation in the imported model.
Permanent Source URI:
https://staging.physiomeproject.org/w/matthiaskoenig/MetabolicComponentLibrary/rawfile/702b54b45018b04ef1bc074677379dc20d983234/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;
		  
	
	}
	
}