00001 #include <stdlib.h>
00002 #include "timeswmat.h"
00003 #include "matrix.h"
00004 #include "vector.h"
00005 #include "global.h"
00006 #include "intpoints.h"
00007 #include "mechmat.h"
00008
00009
00010
00011
00012
00013
00014
00015
00016 timeswmat::timeswmat (void)
00017 {
00018 ncm = 0;
00019 gf = NULL;
00020 }
00021
00022
00023
00024
00025
00026
00027
00028
00029 timeswmat::~timeswmat (void)
00030 {
00031 delete [] gf;
00032 }
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 void timeswmat::read(XFILE* in)
00046 {
00047 long i;
00048 xfscanf(in, "%ld", &ncm);
00049 if (ncm < 2)
00050 {
00051 print_err("insufficient number of materials (%ld < 2) is required", __FILE__, __LINE__, __func__, ncm);
00052 abort();
00053 }
00054 gf = new gfunct[ncm];
00055 for (i=0; i < ncm; i++)
00056 {
00057 gf[i].read(in);
00058 }
00059 }
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 double timeswmat::give_actual_ym(long ipp, long im, long ido)
00075 {
00076 long i, j = 0;
00077 long ncompo = 0;
00078 double e;
00079
00080 for (i = 0; i < ncm; i++)
00081 {
00082 if (gf[i].getval(Mp->time))
00083 {
00084 e = Mm->give_actual_ym(ipp, im+1+i, ido+ncompo);
00085 j++;
00086 }
00087 ncompo += Mm->givencompeqother(ipp, im+1+i);
00088 }
00089 if (j > 1)
00090 {
00091 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00092 abort();
00093 }
00094 if (j == 0)
00095 {
00096 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00097 abort();
00098 }
00099 return e;
00100 }
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 double timeswmat::give_initial_ym(long ipp, long im, long ido)
00116 {
00117 long i, j = 0;
00118 long ncompo = 0;
00119 double e;
00120
00121 for (i = 0; i < ncm; i++)
00122 {
00123 if (gf[i].getval(Mp->time))
00124 {
00125 e = Mm->give_initial_ym(ipp, im+1+i, ido+ncompo);
00126 j++;
00127 }
00128 ncompo += Mm->givencompeqother(ipp, im+1+i);
00129 }
00130 if (j > 1)
00131 {
00132 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00133 abort();
00134 }
00135 if (j == 0)
00136 {
00137 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00138 abort();
00139 }
00140 return e;
00141 }
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 double timeswmat::give_actual_nu(long ipp, long im, long ido)
00157 {
00158 long i, j = 0;
00159 long ncompo = 0;
00160 double nu;
00161
00162 for (i = 0; i < ncm; i++)
00163 {
00164 if (gf[i].getval(Mp->time))
00165 {
00166 nu = Mm->give_actual_nu(ipp, im+1+i, ido+ncompo);
00167 j++;
00168 }
00169 ncompo += Mm->givencompeqother(ipp, im+1+i);
00170 }
00171 if (j > 1)
00172 {
00173 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00174 abort();
00175 }
00176 if (j == 0)
00177 {
00178 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00179 abort();
00180 }
00181 return nu;
00182 }
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 double timeswmat::give_actual_ft(long ipp, long im, long ido)
00198 {
00199 long i, j = 0;
00200 long ncompo = 0;
00201 double ft;
00202
00203 for (i = 0; i < ncm; i++)
00204 {
00205 if (gf[i].getval(Mp->time))
00206 {
00207 ft = Mm->give_actual_ft(ipp, im+1+i, ido+ncompo);
00208 j++;
00209 }
00210 ncompo += Mm->givencompeqother(ipp, im+1+i);
00211 }
00212 if (j > 1)
00213 {
00214 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00215 abort();
00216 }
00217 if (j == 0)
00218 {
00219 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00220 abort();
00221 }
00222 return ft;
00223 }
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 long timeswmat::givencompother (long ipp, long im)
00281 {
00282 long i;
00283 long ncompo = 0;
00284
00285 for (i = 0; i < ncm; i++)
00286 ncompo += Mm->givencompeqother(ipp, im+1+i);
00287
00288 return ncompo;
00289 }
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304 long timeswmat::givencompeqother (long ipp, long im)
00305 {
00306 long i;
00307 long ncompo = 0;
00308
00309 for (i = 0; i < ncm; i++)
00310 ncompo += Mm->givencompeqother(ipp, im+1+i);
00311
00312 return ncompo;
00313 }
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329 void timeswmat::matstiff (matrix &d,long ipp,long im, long ido)
00330 {
00331 long i, j = 0;
00332 long ncompo = 0;
00333
00334 for (i = 0; i < ncm; i++)
00335 {
00336 if (gf[i].getval(Mp->time))
00337 {
00338 Mm->matstiff(d, ipp, im+1+i, ido+ncompo);
00339 j++;
00340 }
00341 ncompo += Mm->givencompeqother(ipp, im+1+i);
00342 }
00343 if (j > 1)
00344 {
00345 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00346 abort();
00347 }
00348 if (j == 0)
00349 {
00350 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00351 abort();
00352 }
00353 }
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368 void timeswmat::nlstresses (long ipp, long im, long ido)
00369 {
00370 long i, j = 0;
00371 long ncompo = 0;
00372
00373 for (i = 0; i < ncm; i++)
00374 {
00375 if (gf[i].getval(Mp->time))
00376 {
00377 Mm->computenlstresses(ipp, im+1+i, ido+ncompo);
00378 j++;
00379 }
00380 ncompo += Mm->givencompeqother(ipp, im+1+i);
00381 }
00382 if (j > 1)
00383 {
00384 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00385 abort();
00386 }
00387 if (j == 0)
00388 {
00389 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00390 abort();
00391 }
00392 }
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407 void timeswmat::updateval (long ipp, long im, long ido)
00408 {
00409 long i, j = 0;
00410 long ncompo = 0;
00411
00412 for (i = 0; i < ncm; i++)
00413 {
00414 if (gf[i].getval(Mp->time))
00415 {
00416 Mm->updateipvalmat(ipp, im+1+i, ido+ncompo);
00417 j++;
00418 }
00419 ncompo += Mm->givencompeqother(ipp, im+1+i);
00420 }
00421 if (j > 1)
00422 {
00423 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00424 abort();
00425 }
00426 if (j == 0)
00427 {
00428 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00429 abort();
00430 }
00431 }
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447 void timeswmat::initvalues (long lcid, long ipp, long im, long ido)
00448 {
00449 long i, j = 0;
00450 long ncompo = 0;
00451
00452 for (i = 0; i < ncm; i++)
00453 {
00454 if (gf[i].getval(Mp->time))
00455 {
00456 Mm->initvalues(lcid, ipp, im+1+i, ido+ncompo);
00457 j++;
00458 }
00459 ncompo += Mm->givencompeqother(ipp, im+1+i);
00460 }
00461 if (j > 1)
00462 {
00463 print_err("number of simulateneously switched on materials is > 1", __FILE__, __LINE__, __func__);
00464 abort();
00465 }
00466 if (j == 0)
00467 {
00468 print_err("no material is switched on", __FILE__, __LINE__, __func__);
00469 abort();
00470 }
00471 }