{"id":18810829,"url":"https://github.com/ecell/ecell3-python2cpp","last_synced_at":"2026-01-11T00:30:15.147Z","repository":{"id":10514367,"uuid":"12702419","full_name":"ecell/ecell3-python2cpp","owner":"ecell","description":"Python to C++ model translator for E-Cell 3","archived":false,"fork":false,"pushed_at":"2013-09-10T02:13:53.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-29T23:44:21.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mozilla-b2g/gaia","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ecell.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-09T13:43:12.000Z","updated_at":"2013-12-12T12:33:24.000Z","dependencies_parsed_at":"2022-09-22T19:52:35.344Z","dependency_job_id":null,"html_url":"https://github.com/ecell/ecell3-python2cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecell%2Fecell3-python2cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecell%2Fecell3-python2cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecell%2Fecell3-python2cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecell%2Fecell3-python2cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecell","download_url":"https://codeload.github.com/ecell/ecell3-python2cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239748254,"owners_count":19690232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T23:22:45.385Z","updated_at":"2026-01-11T00:30:15.099Z","avatar_url":"https://github.com/ecell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=================\necell3-python2cpp\n=================\n\nWhat's this?\n------------\n\nThis small program translates an E-Cell 3 model written in Python to the equivalent C++ code.\n\nThe source python code::\n\n    def buildModel( theSimulator ): \n        stepper_DE1 = theSimulator.createStepper(\"FixedODE1Stepper\", \"DE1\")\n        theSimulator.rootSystem.StepperID = \"DE1\"\n        Variable___SIZE = theSimulator.createEntity(\"Variable\", \"Variable:/:SIZE\")\n        Variable___SIZE.Value = 1e-18\n        Variable___S = theSimulator.createEntity(\"Variable\", \"Variable:/:S\")\n        Variable___S.Value = 1000000.0\n        Variable___P = theSimulator.createEntity(\"Variable\", \"Variable:/:P\")\n        Variable___P.Value = 0.0\n        Variable___E = theSimulator.createEntity(\"Variable\", \"Variable:/:E\")\n        Variable___E.Value = 1000.0\n        Process___E = theSimulator.createEntity(\"MichaelisUniUniFluxProcess\", \"Process:/:E\")\n        Process___E.VariableReferenceList = [[\"S0\", \":.:S\", \"-1\"], [\"P0\", \":.:P\", \"1\"], [\"C0\", \":.:E\", \"0\"]]\n        Process___E.KmS = \"1\"\n        Process___E.KcF = \"10\"\n    \n    buildModel( theSimulator )\n    \nThe resulting C++ code::\n\n    #include \u003cboost/scoped_ptr.hpp\u003e\n    #include \u003clibecs/libecs.hpp\u003e\n    #include \u003clibecs/Model.hpp\u003e\n    #include \u003clibecs/System.hpp\u003e\n    #include \u003clibecs/Process.hpp\u003e\n    #include \u003clibecs/Variable.hpp\u003e\n    #include \u003clibecs/Stepper.hpp\u003e\n    #include \u003ciostream\u003e\n    \n    void buildModel(libecs::Model\u0026 model)\n    {\n        libecs::Stepper* stepper_DE1 = model.createStepper(\"FixedODE1Stepper\", \"DE1\");\n        {\n        }\n        libecs::System* root = model.getRootSystem();\n        {\n            root-\u003eloadProperty(\"StepperID\", libecs::Polymorph(\"DE1\"));\n        }\n        libecs::Variable* P = reinterpret_cast\u003clibecs::Variable*\u003e(model.createEntity(\"Variable\", libecs::FullID(\"Variable:/:P\")));\n        {\n            P-\u003eloadProperty(\"Value\", libecs::Polymorph(static_cast\u003clibecs::Real\u003e(0.0)));\n        }\n        libecs::Variable* S = reinterpret_cast\u003clibecs::Variable*\u003e(model.createEntity(\"Variable\", libecs::FullID(\"Variable:/:S\")));\n        {\n            S-\u003eloadProperty(\"Value\", libecs::Polymorph(static_cast\u003clibecs::Real\u003e(1000000.0)));\n        }\n        libecs::Variable* v_E = reinterpret_cast\u003clibecs::Variable*\u003e(model.createEntity(\"Variable\", libecs::FullID(\"Variable:/:E\")));\n        {\n            v_E-\u003eloadProperty(\"Value\", libecs::Polymorph(static_cast\u003clibecs::Real\u003e(1000.0)));\n        }\n        libecs::Variable* SIZE = reinterpret_cast\u003clibecs::Variable*\u003e(model.createEntity(\"Variable\", libecs::FullID(\"Variable:/:SIZE\")));\n        {\n            SIZE-\u003eloadProperty(\"Value\", libecs::Polymorph(static_cast\u003clibecs::Real\u003e(1e-18)));\n        }\n        libecs::Process* p_E = reinterpret_cast\u003clibecs::Process*\u003e(model.createEntity(\"MichaelisUniUniFluxProcess\", libecs::FullID(\"Process:/:E\")));\n        {\n            p_E-\u003eloadProperty(\"KcF\", libecs::Polymorph(\"10\"));\n            p_E-\u003eloadProperty(\"KmS\", libecs::Polymorph(\"1\"));\n            p_E-\u003eregisterVariableReference(\"S0\", libecs::FullID(\":.:S\"), -1, false);\n            p_E-\u003eregisterVariableReference(\"P0\", libecs::FullID(\":.:P\"), 1, false);\n            p_E-\u003eregisterVariableReference(\"C0\", libecs::FullID(\":.:E\"), 0, false);\n        }\n    }\n    \n    int main()\n    {\n        typedef ModuleMaker\u003clibecs::EcsObject\u003e PropertiedObjectMaker;\n        struct RAII\n        {\n            RAII() { libecs::initialize(); }\n            ~RAII() { libecs::finalize(); }\n        } _;\n        boost::scoped_ptr\u003cPropertiedObjectMaker\u003e propertiedObjectMaker(libecs::createDefaultModuleMaker());\n        libecs::Model model(*propertiedObjectMaker);\n        \n        // initialize the model\n        {\n            const char* dmpath = getenv(\"ECELL3_DM_PATH\");\n            if ( dmpath )\n                model.setDMSearchPath(dmpath);\n        }\n        model.setup();\n        \n        // build the model\n        buildModel(model);\n        \n        // initialize the simulation state\n        model.initialize();\n        \n        // advance the simulation\n        {\n            libecs::Variable* const SIZE = reinterpret_cast\u003clibecs::Variable*\u003e(model.getEntity(libecs::FullID(\"Variable:/:SIZE\")));\n            libecs::Variable* const S = reinterpret_cast\u003clibecs::Variable*\u003e(model.getEntity(libecs::FullID(\"Variable:/:S\")));\n            libecs::Variable* const P = reinterpret_cast\u003clibecs::Variable*\u003e(model.getEntity(libecs::FullID(\"Variable:/:P\")));\n            libecs::Variable* const v_E = reinterpret_cast\u003clibecs::Variable*\u003e(model.getEntity(libecs::FullID(\"Variable:/:E\")));\n            for (int i = 0; i \u003c 10; ++i)\n            {\n                std::cout \u003c\u003c \"\u003c\u003ctime: \" \u003c\u003c model.getCurrentTime() \u003c\u003c \"\u003e\u003e\" \u003c\u003c std::endl;\n                std::cout \u003c\u003c \"Variable:/:SIZE\" \u003c\u003c \"=\" \u003c\u003c SIZE-\u003egetValue() \u003c\u003c std::endl;\n                std::cout \u003c\u003c \"Variable:/:S\" \u003c\u003c \"=\" \u003c\u003c S-\u003egetValue() \u003c\u003c std::endl;\n                std::cout \u003c\u003c \"Variable:/:P\" \u003c\u003c \"=\" \u003c\u003c P-\u003egetValue() \u003c\u003c std::endl;\n                std::cout \u003c\u003c \"Variable:/:E\" \u003c\u003c \"=\" \u003c\u003c v_E-\u003egetValue() \u003c\u003c std::endl;\n                model.step();\n            }\n        }\n    }\n\nUsage\n-----\n\n::\n\n    $ ecell3-python ecell3-python2cpp simple.py\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecell%2Fecell3-python2cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecell%2Fecell3-python2cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecell%2Fecell3-python2cpp/lists"}