当前位置: 首页>>代码示例>>C++>>正文


C++ Boundary::setId方法代码示例

本文整理汇总了C++中Boundary::setId方法的典型用法代码示例。如果您正苦于以下问题:C++ Boundary::setId方法的具体用法?C++ Boundary::setId怎么用?C++ Boundary::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Boundary的用法示例。


在下文中一共展示了Boundary::setId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: writeSpatialSBML

void writeSpatialSBML() 
{
  // SBMLNamespaces of SBML Level 3 Version 1 with 'req' Version 1
  // then add 'spatial' package namespace.
  SpatialPkgNamespaces sbmlns(3,1,1);

  // create the L3V1 document with spatial package
  SBMLDocument document(&sbmlns);	


  // set 'required' attribute on document for 'spatial' and 'req' packages to 'T'??
  SBMLDocumentPlugin* dplugin;
  dplugin = static_cast<SBMLDocumentPlugin*>(document.getPlugin("spatial"));
  dplugin->setRequired(true);

  // create the Model 
  Model *model = document.createModel();
  model-> setId("trial_spatial");
  model-> setName("trial_spatial");

  // create the Compartments
  Compartment* compartment = model->createCompartment();
  compartment->setId("cytosol");
  compartment->setConstant(true);

  // create the Species
  Species* species1 = model->createSpecies();
  species1->setId("ATPc");
  species1->setCompartment("cytosol");
  species1->setInitialConcentration(1.0);
  species1->setHasOnlySubstanceUnits(false);
  species1->setBoundaryCondition(false);
  species1->setConstant(false);
  // spatial package extension to species.
  SpatialSpeciesPlugin* srplugin;
  srplugin = static_cast<SpatialSpeciesPlugin*>(species1->getPlugin("spatial"));
  srplugin->setIsSpatial(true);

  // add parameter for diff coeff of species1
  Parameter* paramSp = model->createParameter();
  paramSp->setId(species1->getId()+"_dc");
  paramSp->setValue(1.0);
  // spatial package extension to parameter.
  SpatialParameterPlugin* pplugin;
  pplugin = static_cast<SpatialParameterPlugin*>(paramSp->getPlugin("spatial"));
  DiffusionCoefficient* diffCoeff = pplugin->createDiffusionCoefficient();
  diffCoeff->setVariable(species1->getId());
  diffCoeff->setType(SPATIAL_DIFFUSIONKIND_ANISOTROPIC);
  CoordinateReference* coordRef = diffCoeff->createCoordinateReference();
  coordRef->setCoordinate(SPATIAL_COORDINATEKIND_CARTESIAN_X);  
  // add parameter for adv coeff of species1
  paramSp = model->createParameter();
  paramSp->setId(species1->getId()+"_ac");
  paramSp->setValue(1.5);
  // spatial package extension to parameter.
  pplugin = static_cast<SpatialParameterPlugin*>(paramSp->getPlugin("spatial"));
  AdvectionCoefficient* advCoeff = pplugin->createAdvectionCoefficient();
  advCoeff->setVariable(species1->getId());
  advCoeff->setCoordinate(SPATIAL_COORDINATEKIND_CARTESIAN_X);
  // add parameter for boundary condition of species1
  paramSp = model->createParameter();
  paramSp->setId(species1->getId()+"_bc");
  paramSp->setValue(2.0);
  // spatial package extension to parameter.
  pplugin = static_cast<SpatialParameterPlugin*>(paramSp->getPlugin("spatial"));
  BoundaryCondition* boundCon = pplugin->createBoundaryCondition();
  boundCon->setVariable(species1->getId());  
  boundCon->setType(SPATIAL_BOUNDARYKIND_DIRICHLET);
  boundCon->setCoordinateBoundary("Xmin");

  Species* species2 = model->createSpecies();
  species2->setId("ADPc");
  species2->setCompartment("cytosol");
  species2->setInitialConcentration(1);
  species2->setHasOnlySubstanceUnits(false);
  species2->setBoundaryCondition(false);
  species2->setConstant(false);
  srplugin = static_cast<SpatialSpeciesPlugin*>(species2->getPlugin("spatial"));
  srplugin->setIsSpatial(true);

  Reaction* reaction = model->createReaction();
  reaction->setId("rxn1");
  reaction->setReversible(false);
  reaction->setFast(false);
  reaction->setCompartment("cytosol");
  SpatialReactionPlugin* rplugin = static_cast<SpatialReactionPlugin*>(reaction->getPlugin("spatial"));
  rplugin->setIsLocal(true);

  //
  // Get a SpatialModelPlugin object plugged in the model 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.
  //
  SpatialModelPlugin* mplugin;
  mplugin = static_cast<SpatialModelPlugin*>(model->getPlugin("spatial"));

  //
  // Creates a geometry object via SpatialModelPlugin object.
//.........这里部分代码省略.........
开发者ID:kirichoi,项目名称:roadrunner,代码行数:101,代码来源:example1.cpp


注:本文中的Boundary::setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。