• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ASTNode_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main (void)
{
  cvodeSettings_t *options = CvodeSettings_createWithTime(10000, 1000);
  odeModel_t *odemodel = ODEModel_createFromFile("MAPK.xml");
  integratorInstance_t *ii = IntegratorInstance_create(odemodel, options);

  ASTNode_t *f = SBML_parseFormula("MAPK_PP");  
  ASTNode_t *f2 = SBML_parseFormula("MAPK + MAPK_P");  
  ASTNode_t *f3 = SBML_parseFormula("MAPK + MAPK_P + MAPK_PP");  
  cvodeData_t *data = IntegratorInstance_getData(ii);
  
  while( ! IntegratorInstance_timeCourseCompleted(ii) )
    if ( IntegratorInstance_integrateOneStep(ii ) )
    {
      printf("  active MAPK concentration at time %g:\t%7.3f\n",
	     IntegratorInstance_getTime(ii), evaluateAST(f, data));
      printf("inactive MAPK concentration at time %g:\t%7.3f\n",
	     IntegratorInstance_getTime(ii), evaluateAST(f2, data));
      printf("                                    total:\t%7.3f\n\n",
	     evaluateAST(f3, data));
    }
    else
      break;
  SolverError_dump();
  ODEModel_free(odemodel);
  IntegratorInstance_free(ii);
  ASTNode_free(f);
  ASTNode_free(f2);
  
  return (EXIT_SUCCESS);  
}
开发者ID:bareqsh,项目名称:SBML_odeSolver,代码行数:31,代码来源:evaluateast.c


示例2: IntegratorInstance_setVariableValue

SBML_ODESOLVER_API void IntegratorInstance_setVariableValue(integratorInstance_t *engine, variableIndex_t *vi, double value)
{

  int i, j;
  ASTNode_t *tmp;
  odeModel_t *om;
  cvodeData_t *data;
  cvodeSettings_t *opt;
  cvodeSolver_t *solver;

  om = engine->om;
  opt = engine->opt;
  data = engine->data;
  solver = engine->solver;

  data->value[vi->index] = value;

  if ( vi->index < om->neq ) {
    /* if (om->algebraic) ?? */
    IntegratorInstance_freeCVODESolverStructures(engine);
    solver->t0 = solver->t;
    IntegratorInstance_createCVODESolverStructures(engine);
  }
  else if ( vi->index >= om->neq+om->nass ) {
    /* optimize ODEs for evaluation */
    /*!!! will need adaptation to selected sens.analysis !!!*/
    for ( i=0; i<om->neq; i++ ) {
      if ( !opt->Sensitivity  || om->sensitivity ) {
	/* optimize each ODE: replace nconst and simplifyAST */
	tmp = copyAST(om->ode[i]);
	for ( j=0; j<om->nconst; j++ ) {
	  AST_replaceNameByValue(tmp,
				 om->names[om->neq+om->nass+j],
				 data->value[om->neq+om->nass+j]);
	}
	if ( data->ode[i] != NULL )
	  ASTNode_free(data->ode[i]);	
 	data->ode[i] = simplifyAST(tmp);
	ASTNode_free(tmp);
      }
      else {
	if ( data->ode[i] != NULL )
	  ASTNode_free(data->ode[i]);
	data->ode[i] = copyAST(om->ode[i]);
      }
    }
  }
}	
开发者ID:igemsoftware,项目名称:USTC-Software_2011,代码行数:48,代码来源:integratorInstance.c


示例3: START_TEST

END_TEST


START_TEST (test_FunctionDefinition_getArguments)
{
  const ASTNode_t *math; 

  ASTNode_t* math1 = SBML_parseFormula("lambda(x, y, x^y)");
  FunctionDefinition_setMath(FD, math1 );
  ASTNode_free(math1);

  fail_unless( FunctionDefinition_getNumArguments(FD) == 2 );


  math = FunctionDefinition_getArgument(FD, 0);

  fail_unless( math != NULL                        );
  fail_unless( ASTNode_isName(math)                );
  fail_unless( !strcmp(ASTNode_getName(math), "x") );
  fail_unless( ASTNode_getNumChildren(math) == 0   );

  math = FunctionDefinition_getArgument(FD, 1);

  fail_unless( math != NULL                        );
  fail_unless( ASTNode_isName(math)                );
  fail_unless( !strcmp(ASTNode_getName(math), "y") );
  fail_unless( ASTNode_getNumChildren(math) == 0   );

  fail_unless( FunctionDefinition_getArgument(FD, 0) ==
               FunctionDefinition_getArgumentByName(FD, "x") );

  fail_unless( FunctionDefinition_getArgument(FD, 1) ==
               FunctionDefinition_getArgumentByName(FD, "y") );
}
开发者ID:sn248,项目名称:Rcppsbml,代码行数:34,代码来源:TestFunctionDefinition.c


示例4: START_TEST

END_TEST


START_TEST (test_Rule_setMath1)
{
  ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
  ASTNode_t *a = ASTNode_create();
  ASTNode_t *b = ASTNode_create();
  ASTNode_setName(a, "a");
  ASTNode_setName(b, "b");
  ASTNode_addChild(math, a);
  ASTNode_addChild(math, b);
  char *formula;
  const ASTNode_t *math1;

  int i = Rule_setMath(R, math);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( Rule_isSetMath(R)   );

  math1 = Rule_getMath(R);
  fail_unless( math1 != NULL );

  formula = SBML_formulaToString(math1);
  fail_unless( formula != NULL );
  fail_unless( !strcmp(formula, "a * b") );

  ASTNode_free(math);
}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:29,代码来源:TestRule_newSetters.c


示例5: START_TEST

END_TEST

START_TEST (test_FormulaFormatter_multiOr)
{
  StringBuffer_t *sb = StringBuffer_create(42);
  char           *s  = StringBuffer_getBuffer(sb);
  ASTNode_t      *n  = ASTNode_create();
  ASTNode_t      *c  = ASTNode_create();

  ASTNode_setType(n, AST_LOGICAL_OR);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "or()"), NULL );

  ASTNode_setName(c, "x");
  ASTNode_addChild(n, c);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "or(x)"), NULL );
  safe_free(s);

  c = ASTNode_create();
  ASTNode_setName(c, "y");
  ASTNode_addChild(n, c);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "or(x, y)"), NULL );
  safe_free(s);

  c = ASTNode_create();
  ASTNode_setName(c, "z");
  ASTNode_addChild(n, c);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "or(x, y, z)"), NULL );
  safe_free(s);

  ASTNode_free(n);
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:35,代码来源:TestFormulaFormatter.c


示例6: START_TEST

END_TEST

START_TEST (test_FormulaFormatter_multiPlus)
{
  char           *s;
  ASTNode_t      *n  = ASTNode_create();
  ASTNode_t      *c  = ASTNode_create();

  ASTNode_setType(n, AST_PLUS);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "0"), NULL );
  safe_free(s);

  ASTNode_setName(c, "x");
  ASTNode_addChild(n, c);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "x"), NULL );
  safe_free(s);

  c = ASTNode_create();
  ASTNode_setName(c, "y");
  ASTNode_addChild(n, c);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "x + y"), NULL );
  safe_free(s);

  c = ASTNode_create();
  ASTNode_setName(c, "z");
  ASTNode_addChild(n, c);
  s = SBML_formulaToString(n);
  fail_unless( !strcmp(s, "x + y + z"), NULL );
  safe_free(s);

  ASTNode_free(n);
}
开发者ID:sn248,项目名称:Rcppsbml,代码行数:35,代码来源:TestFormulaFormatter.c


示例7: START_TEST

END_TEST


START_TEST (test_SBML_parseFormula_15)
{
  ASTNode_t *r = SBML_parseFormula("foo(1, bar)");
  ASTNode_t *c;


  fail_unless( ASTNode_getType(r) == AST_FUNCTION , NULL );
  fail_unless( !strcmp(ASTNode_getName(r), "foo") , NULL );
  fail_unless( ASTNode_getNumChildren(r) == 2     , NULL );

  c = ASTNode_getLeftChild(r);

  fail_unless( ASTNode_getType       (c) == AST_INTEGER, NULL );
  fail_unless( ASTNode_getInteger    (c) == 1, NULL );
  fail_unless( ASTNode_getNumChildren(c) == 0, NULL );

  c = ASTNode_getRightChild(r);

  fail_unless( ASTNode_getType(c) == AST_NAME     , NULL );
  fail_unless( !strcmp(ASTNode_getName(c), "bar") , NULL );
  fail_unless( ASTNode_getNumChildren(c) == 0     , NULL );

  ASTNode_free(r);
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:27,代码来源:TestFormulaParser.c


示例8: CvodeData_freeStructures

/* frees all internal stuff of cvodeData */
static void CvodeData_freeStructures(cvodeData_t * data)
{
  int i;

  if(data == NULL){
    return;
  }

  /* free sensitivity structure */
  if ( data->p != NULL )
    free(data->p);
  if ( data->sensitivity != NULL ) {
    for ( i=0; i<data->neq; i++ )
      free(data->sensitivity[i]);
    free(data->sensitivity);
  }
	   
  /* free results structure */
  CvodeResults_free(data->results);

  /* free current values array */
  free(data->value);
  
  /* free event trigger flags */
  free(data->trigger);
  
  /* free ODEs */
  for ( i=0; i<data->neq; i++ )
    ASTNode_free(data->ode[i]);
  free(data->ode);
}
开发者ID:igemsoftware,项目名称:USTC-Software_2011,代码行数:32,代码来源:cvodedata.c


示例9: START_TEST

END_TEST


START_TEST (test_Rule_setMath)
{
    ASTNode_t *math = SBML_parseFormula("1 + 1");


    Rule_setMath(R, math);

    fail_unless( Rule_getMath(R) != math );
    fail_unless( Rule_isSetMath(R) );

    /* Reflexive case (pathological) */
    Rule_setMath(R, (ASTNode_t *) Rule_getMath(R));
    fail_unless( Rule_getMath(R) != math );

    Rule_setMath(R, NULL);
    fail_unless( !Rule_isSetMath(R) );

    if (Rule_getMath(R) != NULL)
    {
        fail("Rule_setMath(R, NULL) did not clear ASTNode.");
    }
    ASTNode_free(math);
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:26,代码来源:TestRule.c


示例10: copied_AST_free

void copied_AST_free(copied_AST *ast) {
  unsigned int i;

  if (ast == NULL) {
    return;
  }

  for (i = 0; i < ast->num_of_copied_AST; i++) {
    ASTNode_free(ast->ast[i]);
  }
  free(ast);
}
开发者ID:yarden,项目名称:libsbmlsim,代码行数:12,代码来源:copied_AST.c


示例11: translateMathML

/**
 * Translates the given MathML into an infix formula.  The MathML must
 * contain no leading whitespace, but an XML header is optional.
 *
 * @return the infix formula as a string.  The caller owns the memory and
 * is responsible for freeing it.
 */
char *
translateMathML (const char* xml)
{
  char*           result;
  ASTNode_t*      math;

  math   = readMathMLFromString(xml);
  result = SBML_formulaToString(math);

  ASTNode_free(math);
  return result;
}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:19,代码来源:translateL3Math.c


示例12: START_TEST

END_TEST


START_TEST (test_Priority_setMath2)
{
  ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);

  int i = Priority_setMath(P, math);

  fail_unless( i == LIBSBML_INVALID_OBJECT);
  fail_unless( !Priority_isSetMath(P) );

  ASTNode_free(math);
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:14,代码来源:TestPriority.c


示例13: START_TEST

END_TEST


START_TEST (test_Constraint_setMath2)
{
  ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);

  int i = Constraint_setMath(C, math);

  fail_unless( i == LIBSBML_INVALID_OBJECT);
  fail_unless( !Constraint_isSetMath(C) );

  ASTNode_free(math);
}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:14,代码来源:TestConstraint_newSetters.c


示例14: START_TEST

END_TEST


START_TEST (test_EventAssignment_setMath2)
{
  ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);

  int i = EventAssignment_setMath(E, math);

  fail_unless( i == LIBSBML_INVALID_OBJECT);
  fail_unless( !EventAssignment_isSetMath(E) );

  ASTNode_free(math);
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:14,代码来源:TestEventAssignment_newSetters.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASTRA_ASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ ASSUME_LOCK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap