|
From: <fbe...@us...> - 2014-09-25 13:40:30
|
Revision: 21157
http://sourceforge.net/p/sbml/code/21157
Author: fbergmann
Date: 2014-09-25 13:40:13 +0000 (Thu, 25 Sep 2014)
Log Message:
-----------
- first version of dyn package (L3V1 only)
Added Paths:
-----------
branches/libsbml-experimental/dyn-package.cmake
branches/libsbml-experimental/examples/c++/dyn/
branches/libsbml-experimental/examples/c++/dyn/CMakeLists.txt
branches/libsbml-experimental/examples/c++/dyn/dyn_example1.cpp
branches/libsbml-experimental/examples/c++/dyn/dyn_example2.cpp
branches/libsbml-experimental/examples/dyn-package.cmake
branches/libsbml-experimental/examples/python/dyn/
branches/libsbml-experimental/examples/python/dyn/dyn_example1.py
branches/libsbml-experimental/examples/python/dyn/dyn_example2.py
branches/libsbml-experimental/examples/sample-models/dyn/
branches/libsbml-experimental/examples/sample-models/dyn/dyn_example1.xml
branches/libsbml-experimental/examples/sample-models/dyn/dyn_example2.xml
branches/libsbml-experimental/src/bindings/csharp/local-downcast-extension-dyn.i
branches/libsbml-experimental/src/bindings/csharp/local-downcast-namespaces-dyn.i
branches/libsbml-experimental/src/bindings/csharp/local-packages-dyn.i
branches/libsbml-experimental/src/bindings/java/local-downcast-extension-dyn.i
branches/libsbml-experimental/src/bindings/java/local-downcast-namespaces-dyn.i
branches/libsbml-experimental/src/bindings/java/local-packages-dyn.i
branches/libsbml-experimental/src/bindings/perl/local-downcast-extension-dyn.cpp
branches/libsbml-experimental/src/bindings/perl/local-downcast-namespaces-dyn.cpp
branches/libsbml-experimental/src/bindings/perl/local-downcast-packages-dyn.cpp
branches/libsbml-experimental/src/bindings/perl/local-downcast-plugins-dyn.cpp
branches/libsbml-experimental/src/bindings/perl/local-dyn.i
branches/libsbml-experimental/src/bindings/python/local-downcast-extension-dyn.cpp
branches/libsbml-experimental/src/bindings/python/local-downcast-namespaces-dyn.cpp
branches/libsbml-experimental/src/bindings/python/local-downcast-packages-dyn.cpp
branches/libsbml-experimental/src/bindings/python/local-downcast-plugins-dyn.cpp
branches/libsbml-experimental/src/bindings/python/local-dyn.i
branches/libsbml-experimental/src/bindings/r/local-downcast-extension-dyn.cpp
branches/libsbml-experimental/src/bindings/r/local-downcast-namespaces-dyn.cpp
branches/libsbml-experimental/src/bindings/r/local-downcast-packages-dyn.cpp
branches/libsbml-experimental/src/bindings/r/local-downcast-plugins-dyn.cpp
branches/libsbml-experimental/src/bindings/r/local-dyn.i
branches/libsbml-experimental/src/bindings/ruby/local-downcast-extension-dyn.cpp
branches/libsbml-experimental/src/bindings/ruby/local-downcast-namespaces-dyn.cpp
branches/libsbml-experimental/src/bindings/ruby/local-downcast-packages-dyn.cpp
branches/libsbml-experimental/src/bindings/ruby/local-downcast-plugins-dyn.cpp
branches/libsbml-experimental/src/bindings/ruby/local-dyn.i
branches/libsbml-experimental/src/bindings/swig/dyn-package.h
branches/libsbml-experimental/src/bindings/swig/dyn-package.i
branches/libsbml-experimental/src/dyn-package.cmake
branches/libsbml-experimental/src/sbml/packages/dyn/
branches/libsbml-experimental/src/sbml/packages/dyn/common/
branches/libsbml-experimental/src/sbml/packages/dyn/common/DynExtensionTypes.h
branches/libsbml-experimental/src/sbml/packages/dyn/common/dynfwd.h
branches/libsbml-experimental/src/sbml/packages/dyn/extension/
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynCompartmentPlugin.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynCompartmentPlugin.h
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynEventPlugin.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynEventPlugin.h
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynExtension.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynExtension.h
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynSBMLDocumentPlugin.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynSBMLDocumentPlugin.h
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynSBasePlugin.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/extension/DynSBasePlugin.h
branches/libsbml-experimental/src/sbml/packages/dyn/sbml/
branches/libsbml-experimental/src/sbml/packages/dyn/sbml/DynElement.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/sbml/DynElement.h
branches/libsbml-experimental/src/sbml/packages/dyn/sbml/SpatialComponent.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/sbml/SpatialComponent.h
branches/libsbml-experimental/src/sbml/packages/dyn/validator/
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynConsistencyValidator.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynConsistencyValidator.h
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynIdentifierConsistencyValidator.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynIdentifierConsistencyValidator.h
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynSBMLError.h
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynSBMLError.txt
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynSBMLErrorTable.h
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynValidator.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/validator/DynValidator.h
branches/libsbml-experimental/src/sbml/packages/dyn/validator/constraints/
branches/libsbml-experimental/src/sbml/packages/dyn/validator/constraints/DynConsistencyConstraints.cpp
branches/libsbml-experimental/src/sbml/packages/dyn/validator/constraints/DynIdentifierConsistencyConstraints.cpp
branches/libsbml-experimental/src/sbml/packages/dyn-register.cxx
branches/libsbml-experimental/src/sbml/packages/dyn-register.h
Added: branches/libsbml-experimental/dyn-package.cmake
===================================================================
--- branches/libsbml-experimental/dyn-package.cmake (rev 0)
+++ branches/libsbml-experimental/dyn-package.cmake 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,48 @@
+#################################################################################
+#
+# @file: dyn-package.cmake
+# @brief: CMake configuration for L3 Dyn package
+# @author: Generated by autocreate code
+#
+# <!--------------------------------------------------------------------------
+# This file is part of libSBML. Please visit http://sbml.org for more
+# information about SBML, and the latest version of libSBML.
+#
+# Copyright (C) 2013-2014 jointly by the following organizations:
+# 1. California Institute of Technology, Pasadena, CA, USA
+# 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+# 3. University of Heidelberg, Heidelberg, Germany
+#
+# Copyright (C) 2009-2013 jointly by the following organizations:
+# 1. California Institute of Technology, Pasadena, CA, USA
+# 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+#
+# Copyright (C) 2006-2008 by the California Institute of Technology,
+# Pasadena, CA, USA
+#
+# Copyright (C) 2002-2005 jointly by the following organizations:
+# 1. California Institute of Technology, Pasadena, CA, USA
+# 2. Japan Science and Technology Agency, Japan
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation. A copy of the license agreement is provided
+# in the file named "LICENSE.txt" included with this software distribution
+# and also available online as http://sbml.org/software/libsbml/license.html
+# ------------------------------------------------------------------------ -->
+#
+
+option(ENABLE_DYN "Enable libSBML support for the SBML Level 3 Dynamic Structures ('dyn') package" OFF)
+
+
+
+# provide summary status =
+list(APPEND LIBSBML_PACKAGE_SUMMARY "SBML 'dyn' package = ${ENABLE_DYN}")
+
+if (ENABLE_DYN )
+ add_definitions(-DUSE_DYN)
+ set(LIBSBML_PACKAGE_INCLUDES ${LIBSBML_PACKAGE_INCLUDES} "LIBSBML_HAS_PACKAGE_DYN")
+ list(APPEND SWIG_EXTRA_ARGS -DUSE_DYN)
+ list(APPEND SWIG_SWIGDOCDEFINES --define USE_DYN)
+endif()
+
Added: branches/libsbml-experimental/examples/c++/dyn/CMakeLists.txt
===================================================================
--- branches/libsbml-experimental/examples/c++/dyn/CMakeLists.txt (rev 0)
+++ branches/libsbml-experimental/examples/c++/dyn/CMakeLists.txt 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,71 @@
+## @file CMakeLists.txt
+## @brief CMake build script for example programs
+## @author Frank T. Bergmann
+##
+## <!--------------------------------------------------------------------------
+## This file is part of libSBML. Please visit http://sbml.org for more
+## information about SBML, and the latest version of libSBML.
+##
+## Copyright (C) 2013-2014 jointly by the following organizations:
+## 1. California Institute of Technology, Pasadena, CA, USA
+## 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+## 3. University of Heidelberg, Heidelberg, Germany
+##
+## Copyright (C) 2009-2013 jointly by the following organizations:
+## 1. California Institute of Technology, Pasadena, CA, USA
+## 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+##
+## Copyright (C) 2006-2008 by the California Institute of Technology,
+## Pasadena, CA, USA
+##
+## Copyright (C) 2002-2005 jointly by the following organizations:
+## 1. California Institute of Technology, Pasadena, CA, USA
+## 2. Japan Science and Technology Agency, Japan
+##
+## This library is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation. A copy of the license agreement is provided
+## in the file named "LICENSE.txt" included with this software distribution
+## and also available online as http://sbml.org/software/libsbml/license.html
+## ------------------------------------------------------------------------ -->
+
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(BEFORE ${LIBSBML_ROOT_SOURCE_DIR}/src)
+include_directories(${LIBSBML_ROOT_SOURCE_DIR}/include)
+include_directories(BEFORE ${LIBSBML_ROOT_BINARY_DIR}/src)
+
+
+if (EXTRA_INCLUDE_DIRS)
+include_directories(${EXTRA_INCLUDE_DIRS})
+endif(EXTRA_INCLUDE_DIRS)
+
+foreach(example
+
+ dyn_example1
+ dyn_example2
+
+)
+ add_executable(example_dyn_cpp_${example} ${example}.cpp ../util.c)
+ set_target_properties(example_dyn_cpp_${example} PROPERTIES OUTPUT_NAME ${example})
+ target_link_libraries(example_dyn_cpp_${example} ${LIBSBML_LIBRARY}-static)
+
+ if (WITH_LIBXML)
+ target_link_libraries(example_dyn_cpp_${example} ${LIBXML_LIBRARY} ${EXTRA_LIBS})
+ endif()
+
+ if (WITH_ZLIB)
+ target_link_libraries(example_dyn_cpp_${example} ${LIBZ_LIBRARY})
+ endif(WITH_ZLIB)
+ if (WITH_BZIP2)
+ target_link_libraries(example_dyn_cpp_${example} ${LIBBZ_LIBRARY})
+ endif(WITH_BZIP2)
+
+endforeach()
+
+# install c++ examples
+file(GLOB cpp_samples "${CMAKE_CURRENT_SOURCE_DIR}/*.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
+install(FILES ${cpp_samples} DESTINATION ${MISC_PREFIX}examples/c++/dyn)
+
Added: branches/libsbml-experimental/examples/c++/dyn/dyn_example1.cpp
===================================================================
--- branches/libsbml-experimental/examples/c++/dyn/dyn_example1.cpp (rev 0)
+++ branches/libsbml-experimental/examples/c++/dyn/dyn_example1.cpp 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,213 @@
+/**
+ * @file dyn_example1.cpp
+ * @brief SBML DYN example
+ * @author Frank T. Bergmann
+ *
+ * <!--------------------------------------------------------------------------
+ * This sample program is distributed under a different license than the rest
+ * of libSBML. This program uses the open-source MIT license, as follows:
+ *
+ * Copyright (c) 2013-2014 by the California Institute of Technology
+ * (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK)
+ * and the University of Heidelberg (Germany), with support from the National
+ * Institutes of Health (USA) under grant R01GM070923. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Neither the name of the California Institute of Technology (Caltech), nor
+ * of the European Bioinformatics Institute (EMBL-EBI), nor of the University
+ * of Heidelberg, nor the names of any contributors, may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * ------------------------------------------------------------------------ -->
+ */
+
+#include <sbml/SBMLTypes.h>
+#include <sbml/packages/dyn/common/DynExtensionTypes.h>
+
+LIBSBML_CPP_NAMESPACE_USE
+
+int main(int argc,char** argv)
+{
+
+ DynPkgNamespaces sbmlns;
+
+ // create the document
+
+ SBMLDocument *document = new SBMLDocument(&sbmlns);
+ document->setPackageRequired("dyn", true);
+
+ // create the Model
+
+ Model* model=document->createModel();
+ model->setId("singleCell");
+
+ // create the Compartment
+
+ Compartment* compartment = model->createCompartment();
+ compartment->setId("Extracellular");
+ compartment->setConstant(true);
+ compartment->setSize(8000000);
+ compartment->setSpatialDimensions(3.0);
+
+ compartment = model->createCompartment();
+ compartment->setId("PlasmaMembrane");
+ compartment->setConstant(true);
+ compartment->setSize(314);
+ compartment->setSpatialDimensions(2.0);
+
+ compartment = model->createCompartment();
+ compartment->setId("Cytosol");
+ compartment->setConstant(true);
+ compartment->setSize(523);
+ compartment->setSpatialDimensions(3.0);
+
+ // create the Species
+
+ Species* species = model->createSpecies();
+ species->setId("C_EC");
+ species->setCompartment("Extracellular");
+ species->setBoundaryCondition(false);
+ species->setConstant(false);
+ species->setHasOnlySubstanceUnits(false);
+
+ species = model->createSpecies();
+ species->setId("RTR_M");
+ species->setCompartment("PlasmaMembrane");
+ species->setBoundaryCondition(false);
+ species->setConstant(false);
+ species->setHasOnlySubstanceUnits(false);
+
+ species = model->createSpecies();
+ species->setId("RCC_M");
+ species->setCompartment("PlasmaMembrane");
+ species->setBoundaryCondition(false);
+ species->setConstant(false);
+ species->setHasOnlySubstanceUnits(false);
+
+ species = model->createSpecies();
+ species->setId("A_C");
+ species->setCompartment("Cytosol");
+ species->setBoundaryCondition(false);
+ species->setConstant(false);
+ species->setHasOnlySubstanceUnits(false);
+
+ species = model->createSpecies();
+ species->setId("AA_C");
+ species->setCompartment("Cytosol");
+ species->setBoundaryCondition(false);
+ species->setConstant(false);
+ species->setHasOnlySubstanceUnits(false);
+
+ // create Parameters
+
+ Parameter* param = model->createParameter();
+ param->initDefaults();
+ param->setId("S");
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("T");
+
+ // create the Reactions
+
+ Reaction* reaction = model->createReaction();
+ reaction->setId("r1");
+ reaction->setReversible(true);
+ reaction->setFast(false);
+ reaction->setCompartment("Extracellular");
+
+ SpeciesReference* reactant = reaction->createReactant();
+ reactant->setSpecies("RTR_M");
+ reactant->setStoichiometry(1);
+ reactant->setConstant(true);
+
+ reactant = reaction->createReactant();
+ reactant->setSpecies("C_EC");
+ reactant->setStoichiometry(1);
+ reactant->setConstant(true);
+
+ SpeciesReference* product = reaction->createProduct();
+ product->setSpecies("RCC_M");
+ product->setStoichiometry(1);
+ product->setConstant(true);
+
+ reaction = model->createReaction();
+ reaction->setId("r2");
+ reaction->setReversible(true);
+ reaction->setFast(false);
+ reaction->setCompartment("Cytosol");
+
+ reactant = reaction->createReactant();
+ reactant->setSpecies("A_C");
+ reactant->setStoichiometry(1);
+ reactant->setConstant(true);
+
+ product = reaction->createProduct();
+ product->setSpecies("AA_C");
+ product->setStoichiometry(1);
+ product->setConstant(true);
+
+ SimpleSpeciesReference* modifier = reaction->createModifier();
+ modifier->setSpecies("RCC_M");
+
+ // Create Event
+
+ Event* event = model->createEvent();
+ event->setUseValuesFromTriggerTime(true);
+
+ Trigger* trigger = event->createTrigger();
+ trigger->setInitialValue(false);
+ trigger->setPersistent(true);
+ trigger->setMath(SBML_parseFormula("lt(AA_C, T)"));
+
+ //
+ // Get a DynEventPlugin object plugged in the event object.
+ //
+ // The type of the returned value of SBase::getPlugin() function is
+ // SBasePlugin*, and thus the value needs to be casted for the
+ // corresponding derived class.
+ //
+ DynEventPlugin* eplugin
+ = static_cast<DynEventPlugin*>(event->getPlugin("dyn"));
+
+ eplugin->setApplyToAll(true);
+ eplugin->setCboTerm("http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDeath");
+
+ event = model->createEvent();
+ event->setUseValuesFromTriggerTime(true);
+
+ trigger = event->createTrigger();
+ trigger->setInitialValue(false);
+ trigger->setPersistent(true);
+ trigger->setMath(SBML_parseFormula("lt(AA_C, S)"));
+
+ eplugin = static_cast<DynEventPlugin*>(event->getPlugin("dyn"));
+
+ eplugin->setApplyToAll(true);
+ eplugin->setCboTerm("http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDevision");
+
+ document->checkConsistency();
+
+ if (document->getNumErrors(LIBSBML_SEV_ERROR) > 0)
+ document->printErrors();
+
+ writeSBML(document,"dyn_example1.xml");
+ delete document;
+}
Added: branches/libsbml-experimental/examples/c++/dyn/dyn_example2.cpp
===================================================================
--- branches/libsbml-experimental/examples/c++/dyn/dyn_example2.cpp (rev 0)
+++ branches/libsbml-experimental/examples/c++/dyn/dyn_example2.cpp 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,296 @@
+/**
+ * @file dyn_example2.cpp
+ * @brief SBML DYN example
+ * @author Frank T. Bergmann
+ *
+ * <!--------------------------------------------------------------------------
+ * This sample program is distributed under a different license than the rest
+ * of libSBML. This program uses the open-source MIT license, as follows:
+ *
+ * Copyright (c) 2013-2014 by the California Institute of Technology
+ * (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK)
+ * and the University of Heidelberg (Germany), with support from the National
+ * Institutes of Health (USA) under grant R01GM070923. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Neither the name of the California Institute of Technology (Caltech), nor
+ * of the European Bioinformatics Institute (EMBL-EBI), nor of the University
+ * of Heidelberg, nor the names of any contributors, may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * ------------------------------------------------------------------------ -->
+ */
+
+#include <sbml/SBMLTypes.h>
+#include <sbml/packages/dyn/common/DynExtensionTypes.h>
+#include <sbml/packages/comp/common/CompExtensionTypes.h>
+
+LIBSBML_CPP_NAMESPACE_USE
+
+int main(int argc,char** argv)
+{
+
+ DynPkgNamespaces sbmlns;
+ sbmlns.addPackageNamespace("comp", 1, "comp");
+
+ // create the document
+
+ SBMLDocument *document = new SBMLDocument(&sbmlns);
+ document->setPackageRequired("dyn", true);
+ document->setPackageRequired("comp", true);
+
+ // create the Model
+
+ Model* model=document->createModel();
+ model->setId("grid2x2");
+
+ // create the Compartment
+
+ Compartment* compartment = model->createCompartment();
+ compartment->setId("Loc1");
+ compartment->setConstant(false);
+ compartment->setSize(1);
+ compartment->setSpatialDimensions(2.0);
+
+ DynCompartmentPlugin* cplugin =
+ static_cast<DynCompartmentPlugin*>(compartment->getPlugin("dyn"));
+
+ SpatialComponent* component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+ component->setVariable("q1_X");
+
+ component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+ component->setVariable("q1_Y");
+
+ CompSBasePlugin* compPlugin =
+ static_cast<CompSBasePlugin*>(compartment->getPlugin("comp"));
+
+ ReplacedElement* relement = compPlugin->createReplacedElement();
+ relement->setIdRef("C");
+ relement->setSubmodelRef("GRID_1_1_cell");
+
+ compartment = model->createCompartment();
+ compartment->setId("Loc2");
+ compartment->setConstant(false);
+ compartment->setSize(1);
+ compartment->setSpatialDimensions(2.0);
+
+ cplugin =
+ static_cast<DynCompartmentPlugin*>(compartment->getPlugin("dyn"));
+
+ component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+ component->setVariable("q2_X");
+
+ component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+ component->setVariable("q2_Y");
+
+ compPlugin =
+ static_cast<CompSBasePlugin*>(compartment->getPlugin("comp"));
+
+ relement = compPlugin->createReplacedElement();
+ relement->setIdRef("C");
+ relement->setSubmodelRef("GRID_1_2_cell");
+
+ compartment = model->createCompartment();
+ compartment->setId("Loc3");
+ compartment->setConstant(false);
+ compartment->setSize(1);
+ compartment->setSpatialDimensions(2.0);
+
+ cplugin =
+ static_cast<DynCompartmentPlugin*>(compartment->getPlugin("dyn"));
+
+ component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+ component->setVariable("q3_X");
+
+ component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+ component->setVariable("q3_Y");
+
+ compPlugin =
+ static_cast<CompSBasePlugin*>(compartment->getPlugin("comp"));
+
+ relement = compPlugin->createReplacedElement();
+ relement->setIdRef("C");
+ relement->setSubmodelRef("GRID_2_1_cell");
+
+ compartment = model->createCompartment();
+ compartment->setId("Loc4");
+ compartment->setConstant(false);
+ compartment->setSize(1);
+ compartment->setSpatialDimensions(2.0);
+
+ cplugin =
+ static_cast<DynCompartmentPlugin*>(compartment->getPlugin("dyn"));
+
+ component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+ component->setVariable("q4_X");
+
+ component = cplugin->createSpatialComponent();
+ component->setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+ component->setVariable("q4_Y");
+
+ compPlugin =
+ static_cast<CompSBasePlugin*>(compartment->getPlugin("comp"));
+
+ relement = compPlugin->createReplacedElement();
+ relement->setIdRef("C");
+ relement->setSubmodelRef("GRID_2_2_cell");
+
+ // create Parameters
+
+ Parameter* param = model->createParameter();
+ param->initDefaults();
+ param->setId("q1_X");
+ param->setValue(1);
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("q1_Y");
+ param->setValue(1);
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("q2_X");
+ param->setValue(2);
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("q2_Y");
+ param->setValue(1);
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("q3_X");
+ param->setValue(1);
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("q3_Y");
+ param->setValue(2);
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("q4_X");
+ param->setValue(2);
+
+ param = model->createParameter();
+ param->initDefaults();
+ param->setId("q4_Y");
+ param->setValue(2);
+
+ // create SubModels
+
+ CompModelPlugin* mplugin =
+ static_cast<CompModelPlugin*>(model->getPlugin("comp"));
+
+ Submodel* submodel = mplugin->createSubmodel();
+ submodel->setId("GRID_1_1_cell");
+ submodel->setModelRef("Cell");
+
+ submodel = mplugin->createSubmodel();
+ submodel->setId("GRID_1_2_cell");
+ submodel->setModelRef("Cell");
+
+ submodel = mplugin->createSubmodel();
+ submodel->setId("GRID_2_1_cell");
+ submodel->setModelRef("Cell");
+
+ submodel = mplugin->createSubmodel();
+ submodel->setId("GRID_2_2_cell");
+ submodel->setModelRef("Cell");
+
+ // create the ModelDefinition
+
+ CompSBMLDocumentPlugin* dplugin =
+ static_cast<CompSBMLDocumentPlugin*>(document->getPlugin("comp"));
+
+ ModelDefinition* mdef = dplugin->createModelDefinition();
+ mdef->setId("Cell");
+
+ compartment = mdef->createCompartment();
+ compartment->initDefaults();
+ compartment->setId("C");
+ compartment->setSpatialDimensions(2.0);
+ compartment->setSize(1.0);
+
+ Species* species = mdef->createSpecies();
+ species->setId("R");
+ species->setCompartment("C");
+ species->setHasOnlySubstanceUnits(false);
+ species->setBoundaryCondition(false);
+ species->setConstant(false);
+
+ species = mdef->createSpecies();
+ species->setId("S");
+ species->setCompartment("C");
+ species->setHasOnlySubstanceUnits(false);
+ species->setBoundaryCondition(false);
+ species->setConstant(false);
+
+ Reaction* reaction = mdef->createReaction();
+ reaction->setId("Degradation_R");
+ reaction->setReversible(false);
+ reaction->setFast(false);
+ reaction->setCompartment("C");
+
+ SpeciesReference* reactant = reaction->createReactant();
+ reactant->setSpecies("R");
+ reactant->setStoichiometry(1);
+ reactant->setConstant(true);
+
+ reaction = mdef->createReaction();
+ reaction->setId("Degradation_S");
+ reaction->setReversible(false);
+ reaction->setFast(false);
+ reaction->setCompartment("C");
+
+ reactant = reaction->createReactant();
+ reactant->setSpecies("S");
+ reactant->setStoichiometry(1);
+ reactant->setConstant(true);
+ document->checkConsistency();
+
+ Event* event = mdef->createEvent();
+ event->setId("event0");
+ event->setUseValuesFromTriggerTime(false);
+
+ DynEventPlugin* eplugin =
+ static_cast<DynEventPlugin*>(event->getPlugin("dyn"));
+ eplugin->setApplyToAll(true);
+ eplugin->setCboTerm("http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDivision");
+
+ Trigger* trigger = event->createTrigger();
+ trigger->setInitialValue(false);
+ trigger->setPersistent(false);
+ trigger->setMath(SBML_parseFormula("true"));
+
+ if (document->getNumErrors(LIBSBML_SEV_ERROR) > 0)
+ document->printErrors();
+
+ writeSBML(document,"dyn_example2.xml");
+ delete document;
+
+}
Added: branches/libsbml-experimental/examples/dyn-package.cmake
===================================================================
--- branches/libsbml-experimental/examples/dyn-package.cmake (rev 0)
+++ branches/libsbml-experimental/examples/dyn-package.cmake 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,75 @@
+###############################################################################
+#
+# Description : CMake macros for SBML Dynamical Strucures package
+# Original author(s): Frank Bergmann <fbe...@ca...>
+# Organization : California Institute of Technology
+#
+# This file is part of libSBML. Please visit http://sbml.org for more
+# information about SBML, and the latest version of libSBML.
+#
+# Copyright (C) 2013-2014 jointly by the following organizations:
+# 1. California Institute of Technology, Pasadena, CA, USA
+# 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+# 3. University of Heidelberg, Heidelberg, Germany
+#
+# Copyright (C) 2009-2013 jointly by the following organizations:
+# 1. California Institute of Technology, Pasadena, CA, USA
+# 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+#
+# Copyright (C) 2006-2008 by the California Institute of Technology,
+# Pasadena, CA, USA
+#
+# Copyright (C) 2002-2005 jointly by the following organizations:
+# 1. California Institute of Technology, Pasadena, CA, USA
+# 2. Japan Science and Technology Agency, Japan
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation. A copy of the license agreement is provided
+# in the file named "LICENSE.txt" included with this software distribution
+# and also available online as http://sbml.org/software/libsbml/license.html
+#
+###############################################################################
+
+if (ENABLE_DYN)
+ #add_subdirectory(c/dyn)
+ add_subdirectory(c++/dyn)
+
+ #if(WITH_CSHARP)
+ # add_subdirectory(csharp/dyn)
+ #endif(WITH_CSHARP)
+ #
+ #if(WITH_JAVA)
+ # add_subdirectory(java/dyn)
+ #endif(WITH_JAVA)
+
+
+ if(WITH_PERL)
+ # install perl examples
+ file(GLOB perl_dyn_samples "${CMAKE_CURRENT_SOURCE_DIR}/perl/dyn/*.pl"
+ "${CMAKE_CURRENT_SOURCE_DIR}/perl/dyn/README.txt")
+ install(FILES ${perl_dyn_samples} DESTINATION ${MISC_PREFIX}examples/perl/dyn)
+ endif()
+
+ if (WITH_PYTHON)
+ # install python examples
+ file(GLOB python_dyn_samples "${CMAKE_CURRENT_SOURCE_DIR}/python/dyn/*.py"
+ "${CMAKE_CURRENT_SOURCE_DIR}/python/dyn/README.txt")
+ install(FILES ${python_dyn_samples} DESTINATION ${MISC_PREFIX}examples/python/dyn)
+ endif()
+
+ if(WITH_RUBY)
+ # install ruby examples
+ file(GLOB ruby_dyn_samples "${CMAKE_CURRENT_SOURCE_DIR}/ruby/dyn/*.rb"
+ "${CMAKE_CURRENT_SOURCE_DIR}/ruby/dyn/README.txt")
+ install(FILES ${ruby_dyn_samples} DESTINATION ${MISC_PREFIX}examples/ruby/dyn)
+ endif()
+
+ if (WITH_R)
+ # install r examples
+ file(GLOB r_dyn_samples "${CMAKE_CURRENT_SOURCE_DIR}/r/dyn/*.R"
+ "${CMAKE_CURRENT_SOURCE_DIR}/r/dyn/README.txt")
+ install(FILES ${r_dyn_samples} DESTINATION ${MISC_PREFIX}examples/r/dyn)
+ endif()
+
+endif(ENABLE_DYN)
Added: branches/libsbml-experimental/examples/python/dyn/dyn_example1.py
===================================================================
--- branches/libsbml-experimental/examples/python/dyn/dyn_example1.py (rev 0)
+++ branches/libsbml-experimental/examples/python/dyn/dyn_example1.py 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,201 @@
+#
+# @file dyn_example1.py
+# @brief SBML DYN example
+# @author Frank T. Bergmann
+#
+# <!--------------------------------------------------------------------------
+# This sample program is distributed under a different license than the rest
+# of libSBML. This program uses the open-source MIT license, as follows:
+#
+# Copyright (c) 2013-2014 by the California Institute of Technology
+# (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK)
+# and the University of Heidelberg (Germany), with support from the National
+# Institutes of Health (USA) under grant R01GM070923. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+# Neither the name of the California Institute of Technology (Caltech), nor
+# of the European Bioinformatics Institute (EMBL-EBI), nor of the University
+# of Heidelberg, nor the names of any contributors, may be used to endorse
+# or promote products derived from this software without specific prior
+# written permission.
+# ------------------------------------------------------------------------ -.
+#
+
+from libsbml import *
+
+sbmlns = DynPkgNamespaces();
+
+# create the document
+
+document = SBMLDocument(sbmlns);
+document.setPackageRequired("dyn", True);
+
+# create the Model
+
+model=document.createModel();
+model.setId("singleCell");
+
+# create the Compartment
+
+compartment = model.createCompartment();
+compartment.setId("Extracellular");
+compartment.setConstant(True);
+compartment.setSize(8000000);
+compartment.setSpatialDimensions(3.0);
+
+compartment = model.createCompartment();
+compartment.setId("PlasmaMembrane");
+compartment.setConstant(True);
+compartment.setSize(314);
+compartment.setSpatialDimensions(2.0);
+
+compartment = model.createCompartment();
+compartment.setId("Cytosol");
+compartment.setConstant(True);
+compartment.setSize(523);
+compartment.setSpatialDimensions(3.0);
+
+# create the Species
+
+species = model.createSpecies();
+species.setId("C_EC");
+species.setCompartment("Extracellular");
+species.setBoundaryCondition(False);
+species.setConstant(False);
+species.setHasOnlySubstanceUnits(False);
+
+species = model.createSpecies();
+species.setId("RTR_M");
+species.setCompartment("PlasmaMembrane");
+species.setBoundaryCondition(False);
+species.setConstant(False);
+species.setHasOnlySubstanceUnits(False);
+
+species = model.createSpecies();
+species.setId("RCC_M");
+species.setCompartment("PlasmaMembrane");
+species.setBoundaryCondition(False);
+species.setConstant(False);
+species.setHasOnlySubstanceUnits(False);
+
+species = model.createSpecies();
+species.setId("A_C");
+species.setCompartment("Cytosol");
+species.setBoundaryCondition(False);
+species.setConstant(False);
+species.setHasOnlySubstanceUnits(False);
+
+species = model.createSpecies();
+species.setId("AA_C");
+species.setCompartment("Cytosol");
+species.setBoundaryCondition(False);
+species.setConstant(False);
+species.setHasOnlySubstanceUnits(False);
+
+# create Parameters
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("S");
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("T");
+
+# create the Reactions
+
+reaction = model.createReaction();
+reaction.setId("r1");
+reaction.setReversible(True);
+reaction.setFast(False);
+reaction.setCompartment("Extracellular");
+
+reactant = reaction.createReactant();
+reactant.setSpecies("RTR_M");
+reactant.setStoichiometry(1);
+reactant.setConstant(True);
+
+reactant = reaction.createReactant();
+reactant.setSpecies("C_EC");
+reactant.setStoichiometry(1);
+reactant.setConstant(True);
+
+product = reaction.createProduct();
+product.setSpecies("RCC_M");
+product.setStoichiometry(1);
+product.setConstant(True);
+
+reaction = model.createReaction();
+reaction.setId("r2");
+reaction.setReversible(True);
+reaction.setFast(False);
+reaction.setCompartment("Cytosol");
+
+reactant = reaction.createReactant();
+reactant.setSpecies("A_C");
+reactant.setStoichiometry(1);
+reactant.setConstant(True);
+
+product = reaction.createProduct();
+product.setSpecies("AA_C");
+product.setStoichiometry(1);
+product.setConstant(True);
+
+modifier = reaction.createModifier();
+modifier.setSpecies("RCC_M");
+
+# Create Event
+
+event = model.createEvent();
+event.setUseValuesFromTriggerTime(True);
+
+trigger = event.createTrigger();
+trigger.setInitialValue(False);
+trigger.setPersistent(True);
+trigger.setMath(parseFormula("lt(AA_C, T)"));
+
+#
+# Get a DynEventPlugin object plugged in the event object.
+#
+eplugin = event.getPlugin("dyn");
+
+eplugin.setApplyToAll(True);
+eplugin.setCboTerm("http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDeath");
+
+event = model.createEvent();
+event.setUseValuesFromTriggerTime(True);
+
+trigger = event.createTrigger();
+trigger.setInitialValue(False);
+trigger.setPersistent(True);
+trigger.setMath(parseFormula("lt(AA_C, S)"));
+
+eplugin = event.getPlugin("dyn");
+
+eplugin.setApplyToAll(True);
+eplugin.setCboTerm("http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDevision");
+
+document.checkConsistency();
+
+if (document.getNumErrors(LIBSBML_SEV_ERROR) > 0):
+ document.printErrors();
+
+writeSBML(document,"dyn_example1.xml");
+
Added: branches/libsbml-experimental/examples/python/dyn/dyn_example2.py
===================================================================
--- branches/libsbml-experimental/examples/python/dyn/dyn_example2.py (rev 0)
+++ branches/libsbml-experimental/examples/python/dyn/dyn_example2.py 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,275 @@
+#
+# @file dyn_example2.py
+# @brief SBML DYN example
+# @author Frank T. Bergmann
+#
+# <!--------------------------------------------------------------------------
+# This sample program is distributed under a different license than the rest
+# of libSBML. This program uses the open-source MIT license, as follows:
+#
+# Copyright (c) 2013-2014 by the California Institute of Technology
+# (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK)
+# and the University of Heidelberg (Germany), with support from the National
+# Institutes of Health (USA) under grant R01GM070923. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+# Neither the name of the California Institute of Technology (Caltech), nor
+# of the European Bioinformatics Institute (EMBL-EBI), nor of the University
+# of Heidelberg, nor the names of any contributors, may be used to endorse
+# or promote products derived from this software without specific prior
+# written permission.
+# ------------------------------------------------------------------------ -.
+#
+
+from libsbml import *
+
+sbmlns = DynPkgNamespaces()
+sbmlns.addPackageNamespace("comp", 1, "comp");
+
+# create the document
+
+document = SBMLDocument(sbmlns);
+document.setPackageRequired("dyn", True);
+document.setPackageRequired("comp", True);
+
+# create the Model
+
+model=document.createModel();
+model.setId("grid2x2");
+
+# create the Compartment
+
+compartment = model.createCompartment();
+compartment.setId("Loc1");
+compartment.setConstant(False);
+compartment.setSize(1);
+compartment.setSpatialDimensions(2.0);
+
+cplugin = compartment.getPlugin("dyn")
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+component.setVariable("q1_X");
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+component.setVariable("q1_Y");
+
+compPlugin = compartment.getPlugin("comp")
+
+relement = compPlugin.createReplacedElement();
+relement.setIdRef("C");
+relement.setSubmodelRef("GRID_1_1_cell");
+
+compartment = model.createCompartment();
+compartment.setId("Loc2");
+compartment.setConstant(False);
+compartment.setSize(1);
+compartment.setSpatialDimensions(2.0);
+
+cplugin = compartment.getPlugin("dyn");
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+component.setVariable("q2_X");
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+component.setVariable("q2_Y");
+
+compPlugin = compartment.getPlugin("comp");
+
+relement = compPlugin.createReplacedElement();
+relement.setIdRef("C");
+relement.setSubmodelRef("GRID_1_2_cell");
+
+compartment = model.createCompartment();
+compartment.setId("Loc3");
+compartment.setConstant(False);
+compartment.setSize(1);
+compartment.setSpatialDimensions(2.0);
+
+cplugin = compartment.getPlugin("dyn");
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+component.setVariable("q3_X");
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+component.setVariable("q3_Y");
+
+compPlugin = compartment.getPlugin("comp");
+
+relement = compPlugin.createReplacedElement();
+relement.setIdRef("C");
+relement.setSubmodelRef("GRID_2_1_cell");
+
+compartment = model.createCompartment();
+compartment.setId("Loc4");
+compartment.setConstant(False);
+compartment.setSize(1);
+compartment.setSpatialDimensions(2.0);
+
+cplugin = compartment.getPlugin("dyn");
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANX);
+component.setVariable("q4_X");
+
+component = cplugin.createSpatialComponent();
+component.setSpatialIndex(DYN_SPATIALKIND_CARTESIANY);
+component.setVariable("q4_Y");
+
+compPlugin = compartment.getPlugin("comp");
+
+relement = compPlugin.createReplacedElement();
+relement.setIdRef("C");
+relement.setSubmodelRef("GRID_2_2_cell");
+
+# create Parameters
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q1_X");
+param.setValue(1);
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q1_Y");
+param.setValue(1);
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q2_X");
+param.setValue(2);
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q2_Y");
+param.setValue(1);
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q3_X");
+param.setValue(1);
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q3_Y");
+param.setValue(2);
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q4_X");
+param.setValue(2);
+
+param = model.createParameter();
+param.initDefaults();
+param.setId("q4_Y");
+param.setValue(2);
+
+# create SubModels
+
+mplugin = model.getPlugin("comp");
+
+submodel = mplugin.createSubmodel();
+submodel.setId("GRID_1_1_cell");
+submodel.setModelRef("Cell");
+
+submodel = mplugin.createSubmodel();
+submodel.setId("GRID_1_2_cell");
+submodel.setModelRef("Cell");
+
+submodel = mplugin.createSubmodel();
+submodel.setId("GRID_2_1_cell");
+submodel.setModelRef("Cell");
+
+submodel = mplugin.createSubmodel();
+submodel.setId("GRID_2_2_cell");
+submodel.setModelRef("Cell");
+
+# create the ModelDefinition
+
+dplugin = document.getPlugin("comp");
+
+mdef = dplugin.createModelDefinition();
+mdef.setId("Cell");
+
+compartment = mdef.createCompartment();
+compartment.initDefaults();
+compartment.setId("C");
+compartment.setSpatialDimensions(2.0);
+compartment.setSize(1.0);
+
+species = mdef.createSpecies();
+species.setId("R");
+species.setCompartment("C");
+species.setHasOnlySubstanceUnits(False);
+species.setBoundaryCondition(False);
+species.setConstant(False);
+
+species = mdef.createSpecies();
+species.setId("S");
+species.setCompartment("C");
+species.setHasOnlySubstanceUnits(False);
+species.setBoundaryCondition(False);
+species.setConstant(False);
+
+reaction = mdef.createReaction();
+reaction.setId("Degradation_R");
+reaction.setReversible(False);
+reaction.setFast(False);
+reaction.setCompartment("C");
+
+reactant = reaction.createReactant();
+reactant.setSpecies("R");
+reactant.setStoichiometry(1);
+reactant.setConstant(True);
+
+reaction = mdef.createReaction();
+reaction.setId("Degradation_S");
+reaction.setReversible(False);
+reaction.setFast(False);
+reaction.setCompartment("C");
+
+reactant = reaction.createReactant();
+reactant.setSpecies("S");
+reactant.setStoichiometry(1);
+reactant.setConstant(True);
+document.checkConsistency();
+
+event = mdef.createEvent();
+event.setId("event0");
+event.setUseValuesFromTriggerTime(False);
+
+eplugin = event.getPlugin("dyn");
+eplugin.setApplyToAll(True);
+eplugin.setCboTerm("http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDivision");
+
+trigger = event.createTrigger();
+trigger.setInitialValue(False);
+trigger.setPersistent(False);
+trigger.setMath(parseFormula("True"));
+
+if (document.getNumErrors(LIBSBML_SEV_ERROR) > 0):
+ document.printErrors();
+
+writeSBML(document,"dyn_example2.xml");
Added: branches/libsbml-experimental/examples/sample-models/dyn/dyn_example1.xml
===================================================================
--- branches/libsbml-experimental/examples/sample-models/dyn/dyn_example1.xml (rev 0)
+++ branches/libsbml-experimental/examples/sample-models/dyn/dyn_example1.xml 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:dyn="http://www.sbml.org/sbml/level3/version1/dyn/version1" level="3" version="1" dyn:required="true">
+ <model id="singleCell">
+ <listOfCompartments>
+ <compartment id="Extracellular" spatialDimensions="3" size="8000000" constant="true"/>
+ <compartment id="PlasmaMembrane" spatialDimensions="2" size="314" constant="true"/>
+ <compartment id="Cytosol" spatialDimensions="3" size="523" constant="true"/>
+ </listOfCompartments>
+ <listOfSpecies>
+ <species id="C_EC" compartment="Extracellular" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
+ <species id="RTR_M" compartment="PlasmaMembrane" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
+ <species id="RCC_M" compartment="PlasmaMembrane" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
+ <species id="A_C" compartment="Cytosol" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
+ <species id="AA_C" compartment="Cytosol" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
+ </listOfSpecies>
+ <listOfParameters>
+ <parameter id="S" constant="true"/>
+ <parameter id="T" constant="true"/>
+ </listOfParameters>
+ <listOfReactions>
+ <reaction id="r1" reversible="true" fast="false" compartment="Extracellular">
+ <listOfReactants>
+ <speciesReference species="RTR_M" stoichiometry="1" constant="true"/>
+ <speciesReference species="C_EC" stoichiometry="1" constant="true"/>
+ </listOfReactants>
+ <listOfProducts>
+ <speciesReference species="RCC_M" stoichiometry="1" constant="true"/>
+ </listOfProducts>
+ </reaction>
+ <reaction id="r2" reversible="true" fast="false" compartment="Cytosol">
+ <listOfReactants>
+ <speciesReference species="A_C" stoichiometry="1" constant="true"/>
+ </listOfReactants>
+ <listOfProducts>
+ <speciesReference species="AA_C" stoichiometry="1" constant="true"/>
+ </listOfProducts>
+ <listOfModifiers>
+ <modifierSpeciesReference species="RCC_M"/>
+ </listOfModifiers>
+ </reaction>
+ </listOfReactions>
+ <listOfEvents>
+ <event useValuesFromTriggerTime="true" dyn:cboTerm="http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDeath" dyn:applyToAll="true">
+ <trigger initialValue="false" persistent="true">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <apply>
+ <lt/>
+ <ci> AA_C </ci>
+ <ci> T </ci>
+ </apply>
+ </math>
+ </trigger>
+ </event>
+ <event useValuesFromTriggerTime="true" dyn:cboTerm="http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDevision" dyn:applyToAll="true">
+ <trigger initialValue="false" persistent="true">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <apply>
+ <lt/>
+ <ci> AA_C </ci>
+ <ci> S </ci>
+ </apply>
+ </math>
+ </trigger>
+ </event>
+ </listOfEvents>
+ </model>
+</sbml>
Added: branches/libsbml-experimental/examples/sample-models/dyn/dyn_example2.xml
===================================================================
--- branches/libsbml-experimental/examples/sample-models/dyn/dyn_example2.xml (rev 0)
+++ branches/libsbml-experimental/examples/sample-models/dyn/dyn_example2.xml 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:dyn="http://www.sbml.org/sbml/level3/version1/dyn/version1" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" level="3" version="1" dyn:required="true" comp:required="true">
+ <model id="grid2x2">
+ <listOfCompartments>
+ <compartment id="Loc1" spatialDimensions="2" size="1" constant="false">
+ <dyn:listOfSpatialComponents>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianX" dyn:variable="q1_X"/>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianY" dyn:variable="q1_Y"/>
+ </dyn:listOfSpatialComponents>
+ <comp:listOfReplacedElements>
+ <comp:replacedElement comp:idRef="C" comp:submodelRef="GRID_1_1_cell"/>
+ </comp:listOfReplacedElements>
+ </compartment>
+ <compartment id="Loc2" spatialDimensions="2" size="1" constant="false">
+ <dyn:listOfSpatialComponents>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianX" dyn:variable="q2_X"/>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianY" dyn:variable="q2_Y"/>
+ </dyn:listOfSpatialComponents>
+ <comp:listOfReplacedElements>
+ <comp:replacedElement comp:idRef="C" comp:submodelRef="GRID_1_2_cell"/>
+ </comp:listOfReplacedElements>
+ </compartment>
+ <compartment id="Loc3" spatialDimensions="2" size="1" constant="false">
+ <dyn:listOfSpatialComponents>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianX" dyn:variable="q3_X"/>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianY" dyn:variable="q3_Y"/>
+ </dyn:listOfSpatialComponents>
+ <comp:listOfReplacedElements>
+ <comp:replacedElement comp:idRef="C" comp:submodelRef="GRID_2_1_cell"/>
+ </comp:listOfReplacedElements>
+ </compartment>
+ <compartment id="Loc4" spatialDimensions="2" size="1" constant="false">
+ <dyn:listOfSpatialComponents>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianX" dyn:variable="q4_X"/>
+ <dyn:spatialComponent dyn:spatialIndex="cartesianY" dyn:variable="q4_Y"/>
+ </dyn:listOfSpatialComponents>
+ <comp:listOfReplacedElements>
+ <comp:replacedElement comp:idRef="C" comp:submodelRef="GRID_2_2_cell"/>
+ </comp:listOfReplacedElements>
+ </compartment>
+ </listOfCompartments>
+ <listOfParameters>
+ <parameter id="q1_X" value="1" constant="true"/>
+ <parameter id="q1_Y" value="1" constant="true"/>
+ <parameter id="q2_X" value="2" constant="true"/>
+ <parameter id="q2_Y" value="1" constant="true"/>
+ <parameter id="q3_X" value="1" constant="true"/>
+ <parameter id="q3_Y" value="2" constant="true"/>
+ <parameter id="q4_X" value="2" constant="true"/>
+ <parameter id="q4_Y" value="2" constant="true"/>
+ </listOfParameters>
+ <comp:listOfSubmodels>
+ <comp:submodel comp:id="GRID_1_1_cell" comp:modelRef="Cell"/>
+ <comp:submodel comp:id="GRID_1_2_cell" comp:modelRef="Cell"/>
+ <comp:submodel comp:id="GRID_2_1_cell" comp:modelRef="Cell"/>
+ <comp:submodel comp:id="GRID_2_2_cell" comp:modelRef="Cell"/>
+ </comp:listOfSubmodels>
+ </model>
+ <comp:listOfModelDefinitions>
+ <comp:modelDefinition id="Cell">
+ <listOfCompartments>
+ <compartment id="C" spatialDimensions="2" size="1" units="litre" constant="true"/>
+ </listOfCompartments>
+ <listOfSpecies>
+ <species id="R" compartment="C" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
+ <species id="S" compartment="C" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
+ </listOfSpecies>
+ <listOfReactions>
+ <reaction id="Degradation_R" reversible="false" fast="false" compartment="C">
+ <listOfReactants>
+ <speciesReference species="R" stoichiometry="1" constant="true"/>
+ </listOfReactants>
+ </reaction>
+ <reaction id="Degradation_S" reversible="false" fast="false" compartment="C">
+ <listOfReactants>
+ <speciesReference species="S" stoichiometry="1" constant="true"/>
+ </listOfReactants>
+ </reaction>
+ </listOfReactions>
+ <listOfEvents>
+ <event id="event0" useValuesFromTriggerTime="false" dyn:cboTerm="http://cbo.biocomplexity.indiana.edu/svn/cbo/trunk/CBO_1_0.owl#CellDivision" dyn:applyToAll="true">
+ <trigger initialValue="false" persistent="false">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <true/>
+ </math>
+ </trigger>
+ </event>
+ </listOfEvents>
+ </comp:modelDefinition>
+ </comp:listOfModelDefinitions>
+</sbml>
Added: branches/libsbml-experimental/src/bindings/csharp/local-downcast-extension-dyn.i
===================================================================
--- branches/libsbml-experimental/src/bindings/csharp/local-downcast-extension-dyn.i (rev 0)
+++ branches/libsbml-experimental/src/bindings/csharp/local-downcast-extension-dyn.i 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,14 @@
+/**
+ * casting to most specific SBMLExtension object
+ */
+
+#ifdef USE_DYN
+%pragma(csharp) modulecode =
+%{
+ if (pkgName == "dyn")
+ {
+ return new DynExtension(cPtr, owner);
+ }
+%}
+#endif /* USE_DYN */
+
Added: branches/libsbml-experimental/src/bindings/csharp/local-downcast-namespaces-dyn.i
===================================================================
--- branches/libsbml-experimental/src/bindings/csharp/local-downcast-namespaces-dyn.i (rev 0)
+++ branches/libsbml-experimental/src/bindings/csharp/local-downcast-namespaces-dyn.i 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,14 @@
+/**
+ * casting to most specific SBMLNamespaces object
+ */
+
+#ifdef USE_DYN
+%pragma(csharp) modulecode =
+%{
+ if (ns.hasURI(DynExtension.getXmlnsL3V1V1()))
+ {
+ return new DynPkgNamespaces(cPtr, owner);
+ }
+%}
+#endif /* USE_DYN */
+
Added: branches/libsbml-experimental/src/bindings/csharp/local-packages-dyn.i
===================================================================
--- branches/libsbml-experimental/src/bindings/csharp/local-packages-dyn.i (rev 0)
+++ branches/libsbml-experimental/src/bindings/csharp/local-packages-dyn.i 2014-09-25 13:40:13 UTC (rev 21157)
@@ -0,0 +1,111 @@
+/**
+ * @file: local-packages-dyn.i
+ * @brief: Implementation of the dyn class
+ * @author: SBMLTeam
+ *
+ * <!--------------------------------------------------------------------------
+ * This file is part of libSBML. Please visit http://sbml.org for more
+ * information about SBML, and the latest version of libSBML.
+ *
+ * Copyright (C) 2013-2014 jointly by the following organizations:
+ * 1. California Institute of Technology, Pasadena, CA, USA
+ * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+ * 3. University of Heidelberg, Heidelberg, Germany
+ *
+ * Copyright (C) 2009-2013 jointly by the following organizations:
+ * 1. California Institute of Technology, Pasadena, CA, USA
+ * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
+ *
+ * Copyright (C) 2006-2008 by the California Institute of Technology,
+ * Pasadena, CA, USA
+ *
+ * Copyright (C) 2002-2005 jointly by the following organizations:
+ * 1. California Institute of Technology, Pasadena, CA, USA
+ * 2. Japan Science and Technology Agency, Japan
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation. A copy of the license agreement is provided
+ * in the file named "LICENSE.txt" included with this software distribution
+ * and also available online as http://sbml.org/software/libsbml/license.html
+ * ------------------------------------------------------------------------ -->
+ */
+#ifdef USE_DYN
+/**
+ * Adds DownCastBase(long cPtr, boolean owner) method for the dyn package extension
+ */
+%typemap(cscode) DynExtension
+%{
+ public override SBasePlugin DowncastSBasePlugin(IntPtr cPtr, bool owner)
+ {
+ if (cPtr.Equals(IntPtr.Zero)) return null;
+
+ SBasePlugin sbp = new SBasePlugin(cPtr, false);
+ SBase sb = sbp.getParentSBMLObject();
+
+ switch( sb.getTypeCode() )
+ {
+ case (int) libs...
[truncated message content] |