readmesh.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 static char const Id[] = "$Id: readmesh.c 2962 2010-02-04 19:50:44Z scholz $\n\n";
00025 static char const Td[] = "$Today: " __FILE__ " " __DATE__ " " __TIME__ " $\n\n";
00026
00027 #include "magpario.h"
00028
00029 int ReadMesh(GridData *gdata)
00030 {
00031 MagparFunctionLogBegin;
00032
00033 PetscTruth flg;
00034 ierr = PetscOptionsGetString(PETSC_NULL,"-simName",gdata->simname,255,&flg);CHKERRQ(ierr);
00035 if (flg!=PETSC_TRUE)
00036 SETERRQ(PETSC_ERR_ARG_CORRUPT,"Option -simName not found!\n");
00037
00038 int meshtype;
00039 ierr = PetscOptionsGetInt(PETSC_NULL,"-meshtype",(PetscInt*)&meshtype,&flg);CHKERRQ(ierr);
00040 if (flg!=PETSC_TRUE) {
00041 meshtype=1;
00042 PetscPrintf(PETSC_COMM_WORLD,
00043 "Option -meshtype not found, using default value: %i\n",
00044 meshtype
00045 );
00046 }
00047
00048 ierr = PetscOptionsGetInt(PETSC_NULL,"-inp",(PetscInt*)&gdata->inp,&flg);CHKERRQ(ierr);
00049 if (flg!=PETSC_TRUE) {
00050 gdata->inp=1;
00051 PetscPrintf(PETSC_COMM_WORLD,
00052 "Option -inp not found, using default value: %i\n",
00053 gdata->inp
00054 );
00055 }
00056 ierr = MPI_Bcast(&gdata->inp,1,MPIU_SCALAR,0,PETSC_COMM_WORLD);CHKERRQ(ierr);
00057
00058
00059 gdata->vertxyz=NULL;
00060 gdata->elevert=NULL;
00061
00062 if (meshtype==0){
00063 ierr = ReadPatran(gdata);CHKERRQ(ierr);
00064 }
00065 else if (meshtype==1){
00066
00067 char fmesh[256];
00068 ierr = PetscSNPrintf(fmesh,255,"%s.inp",gdata->simname);CHKERRQ(ierr);
00069 ierr = ReadINP(gdata,fmesh,PETSC_NULL,0);CHKERRQ(ierr);
00070 }
00071 else {
00072 SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"-meshtype has illegal value!\n");
00073 }
00074
00075 MagparFunctionLogReturn(0);
00076 }
00077