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

📄 print_problemstructure.c

📁 cfd求解器使用与gmsh网格的求解
💻 C
📖 第 1 页 / 共 4 页
字号:
		((struct IntegrationMethod *) 		 List_Pointer(Problem->IntegrationMethod, 			      PQT->IntegrationMethodIndex))->Name) ;	  if(PQT->JacobianMethodIndex > 0)	    Msg(CHECK, "                    Jacobian %s ;\n", 		((struct JacobianMethod *)		 List_Pointer(Problem->JacobianMethod, 			      PQT->JacobianMethodIndex))->Name) ;	  	}	Msg(CHECK, "          } } }\n") ;  Msg(CHECK, "      }\n") ;      }      Msg(CHECK, "    }\n") ;    }    Msg(CHECK, "  }\n") ;  }  Msg(CHECK, "\n}");  Msg(CHECK, "\n") ;  GetDP_End ;}/* ------------------------------------------------------- *//*  -->  P r i n t _ P o s t O p e r a t i o n             *//* ------------------------------------------------------- *//* This routine prints into a string buffer: check Pos_Interactive.c   to understand why */char * Print_PostSubOperation(struct Problem *Problem,			      struct PostProcessing *PP,			      struct PostSubOperation *PSO){  int  i;  char tmp[256], *out;  out = (char*)Malloc(1000*sizeof(char));  switch (PSO->Type) {  case POP_PRINT :    sprintf(out, "Print[%s",	    ((struct PostQuantity *)	     List_Pointer(PP->PostQuantity, PSO->PostQuantityIndex[0]))->Name) ;        if(PSO->PostQuantitySupport[0] >= 0){      sprintf(tmp, "[%s]",	      ((struct Group *)	       List_Pointer(Problem->Group, PSO->PostQuantitySupport[0]))->Name) ;      strcat(out,tmp);    }        if(PSO->PostQuantityIndex[1] >= 0) {      sprintf(tmp, " %s %s",	      Get_StringForDefine(PostSubOperation_CombinationType, PSO->CombinationType),	      ((struct PostQuantity *)	       List_Pointer(PP->PostQuantity, PSO->PostQuantityIndex[1]))->Name) ;      strcat(out,tmp);      if(PSO->PostQuantitySupport[1] >= 0){	sprintf(tmp, "[%s]",		((struct Group *)		 List_Pointer(Problem->Group, PSO->PostQuantitySupport[1]))->Name) ;	strcat(out,tmp);      }    }        switch (PSO->SubType) {    case PRINT_ONREGION :      if (PSO->Case.OnRegion.RegionIndex >=0)	sprintf(tmp, ", OnRegion %s",		((struct Group *)		 List_Pointer(Problem->Group,			      PSO->Case.OnRegion.RegionIndex))->Name ) ;      else	sprintf(tmp, ", OnGlobal") ;      break ;    case PRINT_ONELEMENTSOF :      sprintf(tmp, ", OnElementsOf %s",	      ((struct Group *)	       List_Pointer(Problem->Group,			    PSO->Case.OnRegion.RegionIndex))->Name ) ;      break ;    case PRINT_ONGRID :      sprintf(tmp, ", OnGrid %s",	      ((struct Group *)	       List_Pointer(Problem->Group,			    PSO->Case.OnRegion.RegionIndex))->Name ) ;      break ;    case PRINT_ONGRID_0D :      sprintf(tmp, ", OnPoint {%.10g,%.10g,%.10g}",	      PSO->Case.OnGrid.x[0], PSO->Case.OnGrid.y[0],	      PSO->Case.OnGrid.z[0]) ;      break ;    case PRINT_ONGRID_1D :      sprintf(tmp, ", OnLine {{%.10g,%.10g,%.10g}{%.10g,%.10g,%.10g}} {%d}",	      PSO->Case.OnGrid.x[0], PSO->Case.OnGrid.y[0],	      PSO->Case.OnGrid.z[0],	      PSO->Case.OnGrid.x[1], PSO->Case.OnGrid.y[1],	      PSO->Case.OnGrid.z[1], PSO->Case.OnGrid.n[0]) ;      break ;    case PRINT_ONGRID_2D :      sprintf(tmp, ", OnPlane {{%.10g,%.10g,%.10g}{%.10g,%.10g,%.10g}"	      "{%.10g,%.10g,%.10g}} {%d,%d}",	      PSO->Case.OnGrid.x[0], PSO->Case.OnGrid.y[0],	      PSO->Case.OnGrid.z[0],	      PSO->Case.OnGrid.x[1], PSO->Case.OnGrid.y[1],	      PSO->Case.OnGrid.z[1],	      PSO->Case.OnGrid.x[2], PSO->Case.OnGrid.y[2],	      PSO->Case.OnGrid.z[2],	      PSO->Case.OnGrid.n[0], PSO->Case.OnGrid.n[1]) ;      break ;    default : /* parametric grid, ... */      strcpy(out, "");      return out;      break ;    }    strcat(out,tmp);    break;  default : /* POP_EXPRESSION, POP_GROUP, etc. */    strcpy(out, "");    return out;    break;     }  if(PSO->Depth != 1){    sprintf(tmp, ", Depth %d", PSO->Depth) ;    strcat(out,tmp);  }  if(PSO->Skin) strcat(out,", Skin");  if(PSO->NoNewLine) strcat(out,", NoNewLine");  if(PSO->Smoothing){    sprintf(tmp, ", Smoothing %d", PSO->Smoothing) ;    strcat(out,tmp);  }  if(PSO->Dimension != _ALL){    sprintf(tmp, ", Dimension %d", PSO->Dimension) ;    strcat(out,tmp);  }    if(PSO->HarmonicToTime > 1){    sprintf(tmp, ", HarmonicToTime %d", PSO->HarmonicToTime) ;    strcat(out,tmp);  }    if(PSO->Sort){    sprintf(tmp, ", Sort %s",	    Get_StringForDefine(PostSubOperation_SortType, PSO->Adapt));    strcat(out,tmp);  }  if(PSO->Adapt){    sprintf(tmp, ", Adapt %s",	    Get_StringForDefine(PostSubOperation_AdaptationType, PSO->Adapt));    strcat(out,tmp);  }  if(PSO->Target >= 0){    sprintf(tmp, ", Target %g", PSO->Target) ;    strcat(out,tmp);  }  if(PSO->Iso){    if(PSO->Iso < 0){      strcat(out, ", Iso {") ;      for(i=0 ; i<List_Nbr(PSO->Iso_L) ; i++){	if(i!=List_Nbr(PSO->Iso_L)-1) sprintf(tmp, "%g,", *(double*)List_Pointer(PSO->Iso_L,i)) ;	else sprintf(tmp, "%g}", *(double*)List_Pointer(PSO->Iso_L,i)) ;	strcat(out,tmp);      }    }    else{      sprintf(tmp, ", Iso %d", PSO->Iso) ;      strcat(out,tmp);    }  }  /* todo: time steps, frequencies, values, changeofcoord, ... */  sprintf(tmp, ", Format %s",	  Get_StringForDefine(PostSubOperation_Format, PSO->Format));  strcat(out,tmp);  if(PSO->FileOut){    sprintf(tmp, ", File %s\"%s\"", 	    (PSO->CatFile==2)?">> ":(PSO->CatFile==1)?"> ":"", PSO->FileOut) ;    strcat(out,tmp);  }  sprintf(tmp, "]") ;  strcat(out,tmp);  return out;}void  Print_PostOperation(struct Problem  * Problem) {  struct PostProcessing  * PP ;    struct PostOperation     *PO ;  struct PostSubOperation  *PSO ;  int   i, Nbr, k, Nbrk ;  char *str;  GetDP_Begin("Print_PostOperation");  Nbr = List_Nbr(Problem->PostOperation) ;  Msg(CHECK, "PostOperation {  /* nbr = %d */\n", Nbr);  Msg(CHECK, "\n") ;  for (i = 0 ; i < Nbr ; i++) {    PO = (struct PostOperation*)List_Pointer(Problem->PostOperation, i) ;    PP = (struct PostProcessing*)List_Pointer(Problem->PostProcessing, 					      PO->PostProcessingIndex) ;    Msg(CHECK, "  { Name %s ; NameOfPostProcessing %s ;\n", PO->Name, PP->Name) ;    Msg(CHECK, "    Operation {\n");    Nbrk = List_Nbr(PO->PostSubOperation) ;    for (k = 0 ; k < Nbrk ; k++) {      PSO = (struct PostSubOperation*)List_Pointer(PO->PostSubOperation, k) ;      Msg(CHECK, "      %s ;\n", str=Print_PostSubOperation(Problem, PP, PSO));      Free(str);    }    Msg(CHECK, "    }\n ");    Msg(CHECK, " }\n") ;  }  Msg(CHECK, "\n");   Msg(CHECK, "}\n") ;  GetDP_End ;}/* ------------------------------------------------------------------------ *//*  P r i n t _ P r o b l e m S t r u c t u r e                             *//* ------------------------------------------------------------------------ */void  Print_Constant();int Print_Object(int ichoice, struct Problem * Problem){  switch (ichoice) {  case  0 : Print_Constant      () ;  break ;  case  1 : Print_Group         (Problem) ;  break ;  case  2 : Print_Expression    (Problem) ;  break ;  case  3 : Print_Constraint    (Problem) ;  break ;  case  4 : Print_Jacobian      (Problem) ;  break ;  case  5 : Print_Integration   (Problem) ;  break ;  case  6 : Print_FunctionSpace (Problem) ;  break ;  case  7 : Print_Formulation   (Problem) ;  break ;  case  8 : Print_Resolution    (Problem) ;  break ;  case  9 : Print_PostProcessing(Problem) ;  break ;  case 10 : Print_PostOperation (Problem) ;  break ;  default : return 1;  }  return 0;}void  Print_ProblemStructure(struct Problem  * Problem) {  char buff[128];  int  ichoice;  GetDP_Begin("Print_ProblemStructure");  while (1) {    Msg(INFO, "Checking") ;    Msg(CHECK, "(1) Group                (2) Function\n") ;     Msg(CHECK, "(3) Constraint           (4) Jacobian\n") ;    Msg(CHECK, "(5) Integration          (6) FunctionSpace\n") ;    Msg(CHECK, "(7) Formulation          (8) Resolution\n") ;    Msg(CHECK, "(9) PostProcessing      (10) PostOperation\n") ;    Msg(CHECK, "(0) Quit\n") ;     Msg(CHECK, "Choice: ") ;    fgets(buff, 128, stdin);    ichoice = atoi(buff);    if(Print_Object(ichoice?ichoice:-1, Problem)){      Msg(CHECK, "E n d C h e c k i n g\n") ;      GetDP_End ;    }  }  GetDP_End ;}/* ------------------------------------------------------- *//*  P r i n t _ L i s t R e s o l u t i o n                *//* ------------------------------------------------------- */void  Print_ListResolution(int choose, struct Problem  * Problem) {  struct Resolution *RE ;  int    i, Nbr, ichoice = 0 ;  char   buff[128];  GetDP_Begin("Print_ListResolution");  if((Nbr = List_Nbr(Problem->Resolution))){    if(Flag_LRES < 0){      ichoice = - Flag_LRES ;    }    else{      Msg(INFO, "Available Resolutions") ;      for (i = 0 ; i < Nbr ; i++) {	RE = (struct Resolution*)List_Pointer(Problem->Resolution, i) ;	Msg(CHECK, "(%d) %s\n", i+1, RE->Name) ;	if(Flag_SOCKET > 0)	  Gmsh_SendString(Flag_SOCKET, GMSH_CLIENT_OPTION_1, RE->Name);      }      if(choose){	Msg(CHECK, "Choice: ") ;	fgets(buff, 128, stdin);	ichoice = atoi(buff);      }    }    if(ichoice > 0 && ichoice < Nbr+1){      RE = (struct Resolution*)List_Pointer(Problem->Resolution, ichoice-1) ;      Name_Resolution = RE->Name ;     }    else if(choose)      Msg(GERROR, "Unknown Resolution") ;  }  else    Msg(WARNING, "No Resolution available") ;  GetDP_End ;}/* ------------------------------------------------------- *//*  P r i n t _ L i s t P o s t P r o c e s s i n g        *//* ------------------------------------------------------- */void  Print_ListPostProcessing(int choose, struct Problem  * Problem) {  struct PostProcessing *PP ;  int    i, Nbr, ichoice = 0 ;  char   buff[128];  GetDP_Begin("Print_ListPostProcessing");  if((Nbr = List_Nbr(Problem->PostProcessing))){    Msg(INFO, "Available PostProcessings") ;    for (i = 0 ; i < Nbr ; i++) {      PP = (struct PostProcessing*)List_Pointer(Problem->PostProcessing, i) ;      Msg(CHECK, "(%d) %s\n", i+1, PP->Name) ;    }    if(choose){      Msg(CHECK, "Choice: ") ;      fgets(buff, 128, stdin);      ichoice = atoi(buff);    }    if(ichoice > 0 && ichoice < Nbr+1){      PP = (struct PostProcessing*)List_Pointer(Problem->PostProcessing, ichoice-1) ;      Name_PostProcessing[0] = PP->Name ;      Name_PostProcessing[1] = NULL ;    }    else if(choose)      Msg(GERROR, "Unknown PostProcessing") ;  }  else    Msg(WARNING, "No PostProcessing available") ;  GetDP_End ;}/* ------------------------------------------------------- *//*  P r i n t _ L i s t P o s t O p e r a t i o n          *//* ------------------------------------------------------- */void  Print_ListPostOperation(int choose, struct Problem  * Problem) {  struct PostOperation *PO ;  int    i, Nbr, ichoice = 0 ;  char   buff[128];  GetDP_Begin("Print_ListPostOperation");  if((Nbr = List_Nbr(Problem->PostOperation))){    if(Flag_LPOS < 0){      ichoice = - Flag_LPOS ;    }    else{      Msg(INFO, "Available PostOperations") ;      for (i = 0 ; i < Nbr ; i++) {	PO = (struct PostOperation*)List_Pointer(Problem->PostOperation, i) ;	Msg(CHECK, "(%d) %s\n", i+1, PO->Name) ;	if(Flag_SOCKET > 0)	  Gmsh_SendString(Flag_SOCKET, GMSH_CLIENT_OPTION_2, PO->Name);      }      if(choose){	Msg(CHECK, "Choice: ") ;	fgets(buff, 128, stdin);	ichoice = atoi(buff);      }    }    if(ichoice > 0 && ichoice < Nbr+1){      PO = (struct PostOperation*)List_Pointer(Problem->PostOperation, ichoice-1) ;      Name_PostOperation[0] = PO->Name ;      Name_PostOperation[1] = NULL ;    }    else if(choose)      Msg(GERROR, "Unknown PostOperation") ;  }  else    Msg(WARNING, "No PostOperation available");      GetDP_End ;}

⌨️ 快捷键说明

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