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; } }