00001 #include <string.h>
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004 #include "probdescc.h"
00005 #include "globalc.h"
00006 #include "gmatrix.h"
00007 #include "intools.h"
00008
00009
00010
00011 probdescc::probdescc (void)
00012 {
00013 kwdsw = nokwd;
00014
00015 niilnr=0; errnr=0.0;
00016 alpha=0.0; time=0.0;
00017 zero = 1.0e-20;
00018
00019
00020 lbb = notdeflbb;
00021
00022 path = filename = suffix = NULL;
00023
00024 savemode=1;
00025
00026
00027 cleanmatrix = (coupcleanmatrices) 0;
00028
00029
00030 fcsolv = (coupsolver) 0;
00031
00032
00033 restype = (residuumtype) 0;
00034
00035
00036 ssle = new slesolv();
00037 }
00038
00039 probdescc::~probdescc (void)
00040 {
00041 delete [] path; delete [] filename; delete [] name; delete [] suffix;
00042 }
00043
00044
00045
00046
00047
00048
00049
00050
00051 void probdescc::read (XFILE *in)
00052 {
00053 char str_tmp[1001];
00054 const char *pkwd;
00055
00056
00057 xfscanf (in," %a",name);
00058
00059 xfscanf (in," %a",str_tmp);
00060
00061 pkwd = strstrcis(str_tmp, "-kwd=");
00062 if (pkwd)
00063 {
00064
00065 memset(minfile, 0, 1001*sizeof(*minfile));
00066 strncpy (minfile, str_tmp, (strchr(str_tmp,' ')-str_tmp)/sizeof(char));
00067 Mp->kwdsw = pkwd_sw(-1);
00068 sscanf(pkwd+5, "%d", (int *)&Mp->kwdsw);
00069 if ((Mp->kwdsw < 0) || (Mp->kwdsw > 4))
00070 {
00071 fflush(stdout);
00072 fprintf(stderr, "\n\nError - unknown -kwd value %d is obtained\n\n", Mp->kwdsw);
00073 abort();
00074 }
00075 }
00076 else
00077 {
00078 strcpy (minfile, str_tmp);
00079 Mp->kwdsw = nokwd;
00080 }
00081
00082
00083 xfscanf (in," %a",str_tmp);
00084
00085 pkwd = strstrcis(str_tmp, "-kwd=");
00086 if (pkwd)
00087 {
00088 memset(tinfile, 0, 1001*sizeof(*tinfile));
00089
00090 strncpy (tinfile, str_tmp, (strchr(str_tmp,' ')-str_tmp)/sizeof(char));
00091 Tp->kwdsw = pkwd_sw(-1);
00092 sscanf(pkwd+5, "%d", (int *)&Tp->kwdsw);
00093 if ((Tp->kwdsw < 0) || (Tp->kwdsw > 4))
00094 {
00095 fflush(stdout);
00096 fprintf(stderr, "\n\nError - unknown -kwd value %d is obtained\n\n", Mp->kwdsw);
00097 abort();
00098 }
00099 }
00100 else
00101 {
00102 strcpy (tinfile, str_tmp);
00103 Tp->kwdsw = nokwd;
00104 }
00105
00106
00107 Mesprc=0;
00108 xfscanf (in,"%k%ld","mesprc",&Mesprc);
00109 if (Mesprc==1) fprintf (stdout,"\n detail information will be printed\n");
00110 else fprintf (stdout,"\n only important messages will be printed\n");
00111
00112
00113 xfscanf (in,"%k%m","problemtype",&problemtypec_kwdset,(int*)&tprob);
00114
00115 xfscanf (in,"%k%m","LBB",&ladbabuskabrezzi_kwdset,(int*)&lbb);
00116
00117 xfscanf (in,"%k%m","transmatter",&transmatterc_kwdset,(int*)&tmatt);
00118
00119 xfscanf (in,"%k%m","mednames",&mednamesc_kwdset,(int*)&mednam);
00120
00121 switch (tprob){
00122 case fully_coupled_mech_trans:{
00123
00124
00125
00126
00127 timecon.read (in);
00128
00129
00130 xfscanf (in,"%lf",&alpha);
00131
00132
00133
00134
00135 xfscanf (in,"%d",(int*)&tnlinsol);
00136 xfscanf (in,"%ld %lf",&niilnr,&errnr);
00137
00138
00139 xfscanf (in,"%k%m%k%m", "coupledsolver", &coupsolver_kwdset, (int*)&fcsolv, "resid_type", &residuumtype_kwdset, (int*)&restype);
00140
00141
00142
00143
00144 xfscanf (in,"%k%m%k%m","zeroordermat",&storagetype_kwdset,(int*)&tstord0,"firstordermat",&storagetype_kwdset,(int*)&tstord1);
00145
00146
00147 ssle->read (Gtu,in,Mesprc);
00148
00149 break;
00150 }
00151 case growing_par_coupl_mech_trans:
00152 case par_coupl_mech_trans:{
00153
00154
00155
00156
00157 timecon.read (in);
00158
00159
00160
00161
00162 xfscanf (in,"%k%m","nonlinsolvertype",&nonlinsolvertypec_kwdset,(int*)&tnlinsol);
00163
00164 xfscanf (in,"%ld %lf",&niilnr,&errnr);
00165
00166
00167 xfscanf (in,"%k%m","cleanmatrices",&coupcleanmatrices_kwdset,(int*)&cleanmatrix);
00168
00169
00170 Tp->nvs=1;
00171
00172 Tp->pnvs=1;
00173
00174 Tp->invs=1;
00175
00176
00177
00178 break;
00179 }
00180 default:{
00181 print_err("unknown problem type is required",__FILE__,__LINE__,__func__);
00182 abort ();
00183 }
00184 }
00185 }
00186
00187
00188
00189
00190
00191
00192
00193 void probdescc::print (FILE *out)
00194 {
00195
00196 fprintf (out, "%s\n", name);
00197
00198
00199 fprintf (out,"%s\n",minfile);
00200
00201
00202 fprintf (out,"%s\n",tinfile);
00203
00204
00205 fprintf (out,"%ld\n", Mesprc);
00206
00207
00208 fprintf (out,"%d", tprob);
00209
00210
00211 fprintf (out,"%d", lbb);
00212
00213
00214 fprintf (out," %d", tmatt);
00215
00216
00217 fprintf (out, " %d\n", mednam);
00218
00219 switch (tprob){
00220 case fully_coupled_mech_trans:{
00221
00222 timecon.print (out);
00223
00224 fprintf (out," %d",tnlinsol);
00225
00226 fprintf (out, " %lf \n", alpha);
00227
00228 fprintf (out," %ld %lf\n",niilnr,errnr);
00229
00230 fprintf (out," %d %d\n",fcsolv,restype);
00231
00232 fprintf (out," %d %d\n",tstord0,tstord1);
00233
00234 ssle->print (out);
00235
00236 fprintf (out,"\n");
00237
00238 break;
00239 }
00240
00241 case growing_par_coupl_mech_trans:
00242 case par_coupl_mech_trans:{
00243
00244 timecon.print (out);
00245
00246
00247 fprintf (out," %d",tnlinsol);
00248
00249 fprintf (out," %ld %lf\n",niilnr,errnr);
00250
00251 fprintf (out," %d\n",fcsolv);
00252
00253 break;
00254 }
00255
00256 default:{
00257 print_err("unknown problem type is required",__FILE__,__LINE__,__func__);
00258 }
00259 }
00260 }