00001 /* 00002 Last changed Time-stamp: <2005-12-16 01:01:58 raim> 00003 $Id: processAST.h,v 1.9 2005/12/16 01:25:09 raimc Exp $ 00004 */ 00005 /* 00006 * 00007 * This library is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU Lesser General Public License as published 00009 * by the Free Software Foundation; either version 2.1 of the License, or 00010 * any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF 00014 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and 00015 * documentation provided hereunder is on an "as is" basis, and the 00016 * authors have no obligations to provide maintenance, support, 00017 * updates, enhancements or modifications. In no event shall the 00018 * authors be liable to any party for direct, indirect, special, 00019 * incidental or consequential damages, including lost profits, arising 00020 * out of the use of this software and its documentation, even if the 00021 * authors have been advised of the possibility of such damage. See 00022 * the GNU Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this library; if not, write to the Free Software Foundation, 00026 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00027 * 00028 * The original code contained here was initially developed by: 00029 * 00030 * Rainer Machne 00031 * 00032 * Contributor(s): 00033 * Stefan Müller 00034 */ 00035 00036 #ifndef _PROCESSAST_H_ 00037 #define _PROCESSAST_H_ 00038 00039 /* libSBML header files */ 00040 #include <sbml/SBMLTypes.h> 00041 00042 /* own header files */ 00043 #include "sbmlsolver/cvodedata.h" 00044 #include "sbmlsolver/exportdefs.h" 00045 00046 #define MySQR(x) ((x)*(x)) 00047 #define MySQRT(x) pow((x),(.5)) 00048 /* Helper Macros to get the second or the third child 00049 of an Abstract Syntax Tree */ 00050 #define child(x,y) ASTNode_getChild(x,y) 00051 #define child2(x,y,z) ASTNode_getChild(ASTNode_getChild(x,y),z) 00052 #define child3(x,y,z,w) ASTNode_getChild(ASTNode_getChild(ASTNode_getChild(x,y),z),w) 00053 00054 00055 #ifdef __cplusplus 00056 extern "C" { 00057 #endif 00058 00059 SBML_ODESOLVER_API double evaluateAST(ASTNode_t *n, cvodeData_t *data); 00060 SBML_ODESOLVER_API ASTNode_t *differentiateAST(ASTNode_t *f, char*x); 00061 SBML_ODESOLVER_API ASTNode_t *AST_simplify(ASTNode_t *f); 00062 SBML_ODESOLVER_API void setUserDefinedFunction(double(*udf)(char*, int, double*)); 00063 SBML_ODESOLVER_API ASTNode_t *copyAST(const ASTNode_t *f); 00064 SBML_ODESOLVER_API ASTNode_t *determinantNAST(ASTNode_t ***A, int N); 00065 00066 #ifdef __cplusplus 00067 } 00068 #endif 00069 00070 ASTNode_t *indexAST(const ASTNode_t *f, int nvalues, char ** names); 00071 SBML_ODESOLVER_API ASTNode_t *simplifyAST(ASTNode_t *f); 00072 00073 #endif 00074 00075 /* End of file */