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


C++ SBMLConverter类代码示例

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


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

示例1: TestFlattenedUnknownValidateNoStrip

SBMLDocument* TestFlattenedUnknownValidateNoStrip(string file1, string file2)
{
  string filename(TestDataDirectory);
  
  ConversionProperties props;
  
  props.addOption("flatten comp");
  props.addOption("basePath", filename);
  props.addOption("performValidation", true);
  props.addOption("stripUnflattenablePackages", false);
  props.addOption("abortIfUnflattenable", "none");

  SBMLConverter* converter = 
    SBMLConverterRegistry::getInstance().getConverterFor(props);
  
  // load document
  string cfile = filename + file1;  
  SBMLDocument* doc = readSBMLFromFile(cfile.c_str());

  // fail if there is no model (readSBMLFromFile always returns a valid document)
  fail_unless(doc->getModel() != NULL);

  converter->setDocument(doc);
  int result = converter->convert();

  // fail if conversion was not valid
  fail_unless(result == LIBSBML_OPERATION_SUCCESS);

  string newModel = writeSBMLToStdString(doc);

  string ffile = filename + file2;
  SBMLDocument* fdoc = readSBMLFromFile(ffile.c_str());
  string flatModel = writeSBMLToStdString(fdoc);
  
  fail_unless(flatModel == newModel);

  delete fdoc;
  delete converter;

  return doc;
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:41,代码来源:TestCompFlatteningUnknownPackageRefs.cpp

示例2: START_TEST

END_TEST


START_TEST(test_comp_flatten_abort_reqd_only_6)
{
  ConversionProperties* props = new ConversionProperties();
  
  props->addOption("flatten comp");
  
  props->addOption("stripUnflattenablePackages", false);

  SBMLConverter* converter = 
    SBMLConverterRegistry::getInstance().getConverterFor(*props);
  
  // load document
  string dir(TestDataDirectory);
  string fileName = dir + "unknown1.xml";  
  SBMLDocument* doc = readSBMLFromFile(fileName.c_str());

  // fail if there is no model 
  //(but we have the unrecognised package error)
  fail_unless(doc->getNumErrors() == 1);
  fail_unless(doc->getModel() != NULL);
  fail_unless(doc->getErrorLog()->contains(UnrequiredPackagePresent) == true);

  converter->setDocument(doc);
  int result = converter->convert();

  fail_unless( result == LIBSBML_OPERATION_SUCCESS);

  string newModel = writeSBMLToString(doc);

  string ffile = dir + "unknown1_flat_stay.xml";
  SBMLDocument* fdoc = readSBMLFromFile(ffile.c_str());
  string flatModel = writeSBMLToString(fdoc);
  fail_unless(flatModel == newModel);

  delete doc;
  delete fdoc;
  delete converter;
}
开发者ID:TheCoSMoCompany,项目名称:biopredyn,代码行数:41,代码来源:TestCompFlatteningNewFlags.cpp

示例3: START_TEST

END_TEST

START_TEST (test_conversion_registry_getByIndex)
{

  int numConverters = SBMLConverterRegistry::getInstance().getNumConverters();

  for (int i = 0; i < numConverters; i++)
  {
    SBMLConverter *converter = SBMLConverterRegistry::getInstance().getConverterByIndex(i);

    fail_unless(converter != NULL);
    fail_unless(converter->getDefaultProperties().hasOption("none") == false);
    
    ConversionProperties props = converter->getDefaultProperties();

    
    delete converter;
  }


}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:22,代码来源:TestSBMLConverterRegistry.cpp

示例4: main

int main(int argc,char** argv)
{
  bool leavePorts = false;
  if (argc < 3)
  {
    cout << usage << endl;
    return 1;
  }
  else if (argc == 3)
  {
    if ( string("-p") == string(argv[1]) )
    {
      cout << usage << endl;
      return 1;
    }       
  }

  int  argIndex = 1;
  
  if ( string("-p") == string(argv[1]) )
  {
    leavePorts = true;
    ++argIndex;
  }     

  if (SBMLExtensionRegistry::isPackageEnabled("comp") == false)
  {
    cerr << "The version of libsbml being used does not have the comp"
      << " package code enabled" << endl;
    return 1;
  }

  const char* inputFile   = argv[argIndex];
  const char* outputFile  = argv[argIndex+1];

  SBMLDocument* document = readSBML(inputFile);

  if (document->getNumErrors() > 0)
  {
    cerr << "Encountered the following SBML errors:" << endl;
    document->printErrors(cerr);
    return 1;
  }

  ConversionProperties* props = new ConversionProperties();
  
  props->addOption("flatten comp");
  props->addOption("leavePorts", leavePorts);

  SBMLConverter* converter = 
             SBMLConverterRegistry::getInstance().getConverterFor(*props);
  

  converter->setDocument(document);
  
  int result = converter->convert();

  if (result != LIBSBML_OPERATION_SUCCESS)
  {
    cerr << "Conversion failed\n";
    document->printErrors();
  }

  writeSBML(document, outputFile);

}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:66,代码来源:flattenModel.cpp


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