⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getdp.y

📁 cfd求解器使用与gmsh网格的求解
💻 Y
📖 第 1 页 / 共 5 页
字号:
%{/* $Id: GetDP.y,v 1.95 2006/03/10 18:09:23 geuzaine Exp $ *//* * Copyright (C) 1997-2006 P. Dular, C. Geuzaine * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. * * Please report all bugs and problems to <getdp@geuz.org>. * * Contributor(s): *   Ruth Sabariego *   Johan Gyselinck *//* Modifs a faire:   Patrick: definir des structures avec valeurs par defaut,   e.g. BasisFunction_D = ...  (dans un fichier a part).   Christophe: introduire les listes au sein des expressions (comme   c'est fait dans les expression-cst), afin de gerer les vecteurs,   tenseurs, etc., directement, et pas par l'intermediaire d'une   fonction de creation. */#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <math.h>#include <time.h>#include "Data_Passive.h"#include "Data_Active.h"#include "Data_DefineE.h"#include "Malloc.h"#include "Tools.h"#include "Init_Problem.h"#include "Print_ProblemStructure.h"#include "BF_Function.h"#include "Quadrature.h"#include "Cal_Value.h"#include "Parser.h"#include "Message.h"#include "Magic.h"void hack_fsetpos(void) ;void hack_fsetpos_printf(void) ;void Check_NameOfStructNotExist(char * Struct, List_T * List_L, void * data,				int (*fcmp)(const void *a, const void *b)) ;int  Add_Group(struct Group * Group_P, char * Name, int Flag_Plus, int Num_Index) ;int  Add_Group_2(struct Group * Group_P, char * Name, int Flag_Add, 		 int Flag_Plus, int Num_Index1, int Num_Index2) ;int  Num_Group(struct Group * Group_P, char * Name, int Num_Group) ;int  Add_Expression(struct Expression * Expression_P, char * Name, int Flag_Plus) ;void Pro_DefineQuantityIndex(List_T * WholeQuantity_L,int DefineQuantityIndexEqu,			     int * NbrQuantityIndex, int ** QuantityIndexTable,			     int ** QuantityTraceGroupIndexTable) ;void Pro_DefineQuantityIndex_1(List_T * WholeQuantity_L, int TraceGroupIndex) ;void Help(char *topic) ;int  Print_ListOfDouble(char *format, List_T *list, char *buffer) ;void yyerror(char *s) ;void vyyerror(char *fmt, ...) ;int  yylex();extern FILE            *yyin ;extern long int         yylinenum ;extern char             yyname[MAX_FILE_NAME_LENGTH], yyincludename[MAX_FILE_NAME_LENGTH] ;extern int              yycolnum, yyincludenum ;extern char            *yytext ;extern int                     ErrorLevel, InteractiveLevel ;extern struct Problem          Problem_S ;extern struct PostProcessing   InteractivePostProcessing_S ;extern struct PostSubOperation InteractivePostSubOperation_S ;extern int                     InteractiveCompute ;List_T  * ConstantTable_L, * ListDummy_L ;List_T  * ListOfInt_L, * ListOfTwoInt_L ;List_T  * ListOfPointer_L, * ListOfPointer2_L, * ListOfChar_L ;List_T  * Current_BasisFunction_L, * Current_SubSpace_L, * Current_GlobalQuantity_L ;List_T  * Current_WholeQuantity_L, * Current_System_L ;List_T  * Operation_L ;int      Nbr_Index, Flag_MultipleIndex, Flag1 ;List_T  * ListOfFormulation ;List_T  * ListOfBasisFunction, * ListOfEntityIndex ;List_T  * ListOfInt_Lnew ;int     * ListOfInt_P ;char     tmpstr[1024] ;int      i, j, k, l, FlagError ;int      Num_BasisFunction = 1 ;int      YaccLevel = 0 ;int      Type_TermOperator, Type_Function, Type_SuppList ;int      Quantity_TypeOperator, Quantity_Index ;int      Current_DofIndexInWholeQuantity, Last_DofIndexInWholeQuantity ;int      Current_NoDofIndexInWholeQuantity ;int      Current_System ;int      Nbr_Arguments ;int      Constraint_Index ;int      TypeOperatorDofInTrace, DefineQuantityIndexDofInTrace ;double   d ;time_t date_info;FILE* File;struct Constant  Constant_S, Constant1_S, Constant2_S ;struct Expression             Expression_S, * Expression_P ;struct ExpressionPerRegion      ExpressionPerRegion_S ;struct Group                  Group_S ;struct Constraint             Constraint_S, * Constraint_P ;struct ConstraintPerRegion      ConstraintPerRegion_S, * ConstraintPerRegion_P ;struct MultiConstraintPerRegion MultiConstraintPerRegion_S ;struct JacobianMethod         JacobianMethod_S ;struct JacobianCase             JacobianCase_S ;struct IntegrationMethod      IntegrationMethod_S ;struct IntegrationCase          IntegrationCase_S ;struct Quadrature               QuadratureCase_S ;struct FunctionSpace          FunctionSpace_S ;struct BasisFunction            BasisFunction_S ;void  (*FunctionDummy)();struct GlobalBasisFunction        GlobalBasisFunction_S ;struct SubSpace                 SubSpace_S ;struct GlobalQuantity           GlobalQuantity_S ;struct ConstraintInFS           ConstraintInFS_S ;struct Formulation            Formulation_S ;struct DefineQuantity           DefineQuantity_S ;struct EquationTerm             EquationTerm_S ;struct WholeQuantity            WholeQuantity_S, *WholeQuantity_P ;struct GlobalEquationTerm       GlobalEquationTerm_S ;struct Resolution             Resolution_S ;struct DefineSystem             DefineSystem_S ;struct Operation                Operation_S, * Operation_P ;struct ChangeOfState            ChangeOfState_S ;struct PostProcessing         PostProcessing_S ;struct PostQuantity             PostQuantity_S ;struct PostQuantityTerm           PostQuantityTerm_S ;struct PostOperation          PostOperation_S ;struct PostSubOperation         PostSubOperation_S ;#define MAX_RECUR_LOOPS 100static double x0, x1, step;static int ImbricatedLoop = 0, do_next;static fpos_t yyposImbricatedLoopsTab[MAX_RECUR_LOOPS];static int yylinenoImbricatedLoopsTab[MAX_RECUR_LOOPS];static double LoopControlVariablesTab[MAX_RECUR_LOOPS][3];static char *LoopControlVariablesNameTab[MAX_RECUR_LOOPS];%}/* ------------------------------------------------------------------ */%union {  char    *c ;  int     i ;  double  d ;  List_T  *l ;  struct TwoInt t ;}%token <i> tINT%token <d> tFLOAT%token <c> tSTRING tBIGSTR%type <i>  GroupRHS, GroupRHS_MultipleIndex, ReducedGroupRHS%type <i>  FunctionForGroup, SuppListTypeForGroup%type <i>  Expression, DefineDimension, MultipleIndex, Index%type <i>  ArgumentsForFunction, RecursiveListOfQuantity%type <i>  PostQuantitySupport%type <d>  FExpr, OneFExpr%type <l>  MultiFExpr, ListOfFExpr, RecursiveListOfFExpr, ParametersForFunction%type <l>  RecursiveListOfRegion%type <l>  ListOfRegion, ListOfRegionOrAll, SuppListOfRegion, IRegion%type <l>  ConstraintCases, IntegrationCases, QuadratureCases, JacobianCases%type <l>  BasisFunctions, SubSpaces, GlobalQuantities, ConstraintInFSs%type <l>  ListOfBasisFunction, RecursiveListOfBasisFunction%type <l>  ListOfBasisFunctionCoef, RecursiveListOfBasisFunctionCoef%type <l>  Equations, WholeQuantityExpression%type <l>  DefineSystems, Operation, ChangeOfStates%type <l>  ListOfFormulation, RecursiveListOfFormulation%type <l>  ListOfSystem, RecursiveListOfSystem%type <l>  PostQuantities, SubPostQuantities, PostSubOperations%type <c>  NameForFunction, CharExpr, StrCat, StringIndex, String__Index%type <t>  Quantity_Def/* ------------------------------------------------------------------ */%token  tEND tDOTS%token  tStrCat tSprintf tPrintf tRead%token  tFor tEndFor tIf tElse tEndIf%token  tFlag tHelp tCpu tCheck%token  tInclude%token  tConstant tList tListAlt tLinSpace tLogSpace tListFromFile%token  tDefineConstant  tPi  t0D  t1D  t2D  t3D %token  tExp tLog tLog10 tSqrt tSin tAsin tCos tAcos tTan%token    tAtan tAtan2 tSinh tCosh tTanh tFabs tFloor tCeil%token    tFmod tModulo tHypot %token    tSolidAngle tTrace tOrder tCrossProduct tDofValue%token    tMHTransform tMHJacNL%token  tGroup tDefineGroup tAll tInSupport tMovingBand2D%token  tDefineFunction%token  tConstraint%token    tRegion tSubRegion tRegionRef tSubRegionRef%token    tFilter tCoefficient tValue  tTimeFunction%token    tBranch  tNode  tLoop   tNameOfResolution%token  tJacobian%token      tCase%token  tIntegration%token  tFMMIntegration%token  tMatrix%token    tType tSubType tCriterion tGeoElement%token      tNumberOfPoints  tMaxNumberOfPoints%token        tNumberOfDivisions  tMaxNumberOfDivisions%token          tStoppingCriterion%token  tFunctionSpace%token    tName%token    tBasisFunction%token      tNameOfCoef  tFunction  tdFunction  tSubFunction tSubdFunction  tSupport  tEntity%token    tSubSpace  tNameOfBasisFunction%token    tGlobalQuantity%token      tEntityType tEntitySubType tNameOfConstraint%token  tFormulation%token    tQuantity%token        tNameOfSpace tIndexOfSystem %token        tSymmetry%token    tEquation%token        tGalerkin tdeRham tGlobalTerm tGlobalEquation tDiscreteGeometry%token          tDt tDtDof tDtDt tDtDtDof  tJacNL  tNeverDt  tDtNL  tAtAnteriorTimeStep%token          tIn%token          tFull_Matrix%token  tResolution%token    tDefineSystem%token      tNameOfFormulation  tNameOfMesh  tFrequency  tSolver%token      tOriginSystem  tDestinationSystem %token    tOperation  tOperationEnd%token      tSetTime tDTime tSetFrequency tFourierTransform tFourierTransformJ%token      tLanczos tEigenSolve tEigenSolveJac tPerturbation %token      tUpdate tUpdateConstraint tBreak %token      tEvaluate%token      tTimeLoopTheta%token        tTime0  tTimeMax  tDTime  tTheta%token      tTimeLoopNewmark%token        tBeta  tGamma%token      tIterativeLoop%token        tNbrMaxIteration  tRelaxationFactor%token      tIterativeTimeReduction%token        tDivisionCoefficient tChangeOfState%token      tChangeOfCoordinates tChangeOfCoordinates2 tSystemCommand%token      tGenerateFMMGroups%token      tGenerateOnly%token      tGenerateOnlyJac%token      tSolveJac_AdaptRelax %token      tSaveSolutionExtendedMH tSaveSolutionMHtoTime%token      tInit_MovingBand2D tMesh_MovingBand2D %token      tGenerate_MH_Moving tGenerate_MH_Moving_Separate tAdd_MH_Moving %token      tGenerateGroup tGenerateJacGroup%token      tSaveMesh%token      tDeformeMesh%token      tDummyFrequency%token  tPostProcessing%token      tNameOfSystem%token  tPostOperation  %token    tNameOfPostProcessing tUsingPost tAppend%token      tPlot tPrint tPrintGroup tEcho tWrite tAdapt%token        tOnGlobal tOnRegion tOnElementsOf%token        tOnGrid tOnSection tOnPoint tOnLine tOnPlane tOnBox%token        tWithArgument%token        tFile tDepth tDimension tComma tTimeStep tHarmonicToTime%token        tFormat tHeader tFooter tSkin tSmoothing%token        tTarget tSort tIso tNoNewLine tDecomposeInSimplex tChangeOfValues %token        tTimeLegend tFrequencyLegend tEigenvalueLegend%token        tEvaluationPoints tStore tLastTimeStepOnly%token        tStr, tDate/* ------------------------------------------------------------------ *//* Operators (with ascending priority): cf. C language                *//*                                                                    *//* Notes: - associativity (%left, %right)                             *//*        - UNARYPREC is a dummy terminal to resolve ambiguous cases  */ /*          for + and - (which exist in both unary and binary form)   *//* ------------------------------------------------------------------ */%right   tDEF%right   '?' tDOTS%left    tOR%left    tAND%left    tEQUAL tNOTEQUAL tAPPROXEQUAL%left    '<' tLESSOREQUAL  '>' tGREATEROREQUAL tLESSLESS tGREATERGREATER%left    '+' '-'%left    '*' '/' '%' tCROSSPRODUCT%right   '!' UNARYPREC%right   '^'%left    '(' ')' '[' ']' '.'%left    '#' '$' tSHOW/* ------------------------------------------------------------------ */%start Stats%%Stats :    { if (++YaccLevel == 1) {	ConstantTable_L = List_Create(20, 10, sizeof(struct Constant)) ;	ListDummy_L     = List_Create( 1, 1, sizeof(int)) ; /* Do not delete */	ListOfInt_L     = List_Create(20, 10, sizeof(int)) ;	ListOfTwoInt_L  = List_Create(20, 10, sizeof(struct TwoInt)) ;	ListOfPointer_L = List_Create(10, 10, sizeof(void *)) ;	ListOfPointer2_L= List_Create(10, 10, sizeof(void *)) ;	ListOfChar_L    = List_Create(128, 128, sizeof(char)) ;	ListOfFormulation       = List_Create(5,5, sizeof(int)) ;	ListOfBasisFunction     = List_Create(5,5, sizeof(List_T *)) ;	ListOfEntityIndex       = List_Create(5,5, sizeof(int)) ;      }    }    ProblemDefinitions    { if (--YaccLevel == 0) {	List_Delete(ListOfInt_L) ; List_Delete(ListOfTwoInt_L) ;  	List_Delete(ListOfPointer_L) ; List_Delete(ListOfPointer2_L) ; 	List_Delete(ListOfChar_L) ;	List_Delete(ListOfFormulation) ;	List_Delete(ListOfBasisFunction) ;	List_Delete(ListOfEntityIndex) ;      }    }  ; /* ------------------------------------------------------------------------ *//*  P r o b l e m                                                           *//* ------------------------------------------------------------------------ */ProblemDefinitions :    /* none */  | ProblemDefinitions    { Formulation_S.DefineQuantity = NULL ; }    ProblemDefinition  ;ProblemDefinition :    tGroup             '{' Groups             '}'  | tFunction          '{' Functions          '}'  | tConstraint        '{' Constraints        '}'  | tJacobian          '{' JacobianMethods    '}'  | tIntegration       '{' IntegrationMethods '}'  | tFunctionSpace     '{' FunctionSpaces     '}'  | tFormulation       '{' Formulations       '}'  | tResolution        '{' Resolutions        '}'  | tPostProcessing    '{' PostProcessings    '}'  | tPostOperation     '{' PostOperations     '}'  | SeparatePostOperation  | Affectation  | tInclude CharExpr    {                  strcpy(yyincludename, $2); yyincludenum++ ; return(0);    }  | Interactive  ;/* ------------------------------------------------------------------------ *//*  I n t e r a c t i v e                                                   *//* ------------------------------------------------------------------------ */Interactive :    tHelp tEND    { Help(NULL); }  | tHelp tPrint tEND    { Help("Print"); }  | tHelp tCheck tEND    { Help("Check"); }  | tHelp tLog tEND    { Help("Log"); }  | tHelp tCpu tEND    { Help("Log"); }  | tHelp tHelp tEND

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -