00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 #include <limits.h>
00005 #include "couptop.h"
00006 #include "globalc.h"
00007 #include "gtopology.h"
00008 #include "element.h"
00009 #include "elementc.h"
00010
00011
00012 couptop::couptop (void)
00013 {
00014 ne=0;
00015 elements=NULL;
00016 }
00017
00018 couptop::~couptop (void)
00019 {
00020 delete [] elements;
00021 }
00022
00023 void couptop::read (XFILE *in)
00024 {
00025 long i,j;
00026
00027 if ((Cp->tprob==par_coupl_mech_trans) || (Cp->tprob==growing_par_coupl_mech_trans)){
00028
00029 }
00030
00031 if (Cp->tprob==fully_coupled_mech_trans){
00032
00033 xfscanf (in,"%ld",&ne);
00034
00035 if (Mesprt==1) fprintf (stdout,"\n number of elements %ld",ne);
00036 elements = new elementc [ne];
00037
00038 for (i=0;i<ne;i++){
00039 j=ne+1;
00040 xfscanf (in,"%ld",&j);
00041 if (j<1)
00042 fprintf (stderr,"\n\n element number in function couptop::read is less than 1.\n");
00043 if (j>ne){
00044 fprintf (stderr,"\n\n element number in function couptop::read is");
00045 fprintf (stderr,"\n greater than total number of elements.\n");
00046 }
00047 elements[j-1].read (in);
00048 }
00049 }
00050 }
00051
00052 long couptop::mesh_check(void)
00053 {
00054 long i,j,err=0;
00055 double fabx,faby,fabz;
00056
00057
00058 if(Mt->nn != Tt->nn){
00059 err = 1;
00060 fprintf (stdout,"\n\n Different number of nodes in mefel and trfel input file \n\n");
00061 return err;
00062 }
00063
00064 for(i=0;i<Mt->nn;i++){
00065 fabx = Gtm->gnodes[i].x - Gtt->gnodes[i].x;
00066 faby = Gtm->gnodes[i].y - Gtt->gnodes[i].y;
00067 fabz = Gtm->gnodes[i].z - Gtt->gnodes[i].z;
00068
00069 if(fabs(fabx) >= 1.0e-4){
00070 err = 2;
00071 fprintf (stdout,"\n\n Different x coordinates in node number %ld\n\n",i+1);
00072 return err;
00073 }
00074 if(fabs(faby) >= 1.0e-4){
00075 err = 3;
00076 fprintf (stdout,"\n\n Different y coordinates in node number %ld\n\n",i+1);
00077 return err;
00078 }
00079 if(fabs(fabz) >= 1.0e-4){
00080 err = 4;
00081 fprintf (stdout,"\n\n Different z coordinates in node number %ld\n\n",i+1);
00082 return err;
00083 }
00084 }
00085
00086
00087 for(i=0;i<Tt->ne;i++){
00088 for(j=0;j<Gtt->gelements[i].nne;j++){
00089 if((Gtt->gelements[i].nodes[j]) != (Gtm->gelements[i].nodes[j])){
00090 fprintf (stdout,"\n\n Different node conectivities in element number %ld, node number %ld",i+1,j+1);
00091 fprintf (stdout,"\n Trfel node number %ld, Mefel node number %ld\n\n",Gtt->gelements[i].nodes[j]+1,Gtm->gelements[i].nodes[j]+1);
00092 err = 5;
00093 return err;
00094 }
00095 }
00096 }
00097
00098 return err;
00099 }
00100
00101
00102
00103
00104
00105
00106
00107
00108 elemtypec couptop::give_elem_type (long eid)
00109 {
00110 return (elements[eid].te);
00111 }
00112
00113
00114
00115
00116
00117
00118 long couptop::give_ndofn (long nid)
00119 {
00120 return Gtu->give_ndofn (nid);
00121 }
00122
00123
00124
00125
00126
00127
00128
00129
00130 long couptop::give_ndofe (long eid)
00131 {
00132 long ndofe;
00133 elemtypec te;
00134
00135 te = give_elem_type (eid);
00136
00137 switch (te){
00138 case coupbar:{ ndofe=Cbar->tndofe; break; }
00139 case coupquad:{ ndofe=Cquad->tndofe; break; }
00140 case coupaxiquad:{ ndofe=Caxiq->tndofe; break; }
00141 case couphex:{ ndofe=Chex->tndofe; break; }
00142 default:{
00143 fprintf (stderr,"\n\n unknown element type is required in function");
00144 fprintf (stderr,"\n transtop::give_ndofe (file %s, line %d).\n",__FILE__,__LINE__);
00145 }
00146 }
00147 return ndofe;
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170 long couptop::give_upper_tnip (long eid)
00171 {
00172 long nip;
00173 elemtypec te;
00174
00175 te = give_elem_type (eid);
00176
00177 switch (te){
00178 case coupbar:{ nip=Cbar->tnipu; break; }
00179 case coupquad:{ nip=Cquad->tnipu; break; }
00180 case coupaxiquad:{ nip=Caxiq->tnipu; break; }
00181 case couphex:{ nip=Chex->tnipu; break; }
00182 default:{
00183 fprintf (stderr,"\n\n unknown element type is required in function");
00184 fprintf (stderr,"\n couptop::give_upper_nip (file %s, line %d).\n",__FILE__,__LINE__);
00185 }
00186 }
00187 return nip;
00188 }
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 long couptop::give_lower_tnip (long eid)
00199 {
00200 long nip;
00201 elemtypec te;
00202
00203 te = give_elem_type (eid);
00204
00205 switch (te){
00206 case coupbar:{ nip=Cbar->tnipl; break; }
00207 case coupquad:{ nip=Cquad->tnipl; break; }
00208 case coupaxiquad:{ nip=Caxiq->tnipl; break; }
00209 case couphex:{ nip=Chex->tnipl; break; }
00210 default:{
00211 fprintf (stderr,"\n\n unknown element type is required in function");
00212 fprintf (stderr,"\n couptop::give_upper_nip (file %s, line %d).\n",__FILE__,__LINE__);
00213 }
00214 }
00215 return nip;
00216 }
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 long couptop::give_upper_nip (long eid,long ri,long ci)
00229 {
00230 long nip;
00231 elemtypec te;
00232
00233 te = give_elem_type (eid);
00234
00235 switch (te){
00236 case coupbar:{ nip=Cbar->nipu[ri][ci]; break; }
00237 case coupquad:{ nip=Cquad->nipu[ri][ci]; break; }
00238 case coupaxiquad:{ nip=Caxiq->nipu[ri][ci]; break; }
00239 case couphex:{ nip=Chex->nipu[ri][ci]; break; }
00240 default:{
00241 fprintf (stderr,"\n\n unknown element type is required in function");
00242 fprintf (stderr,"\n couptop::give_upper_nip (file %s, line %d).\n",__FILE__,__LINE__);
00243 }
00244 }
00245 return nip;
00246 }
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 long couptop::give_lower_nip (long eid,long ri,long ci)
00257 {
00258 long nip;
00259 elemtypec te;
00260
00261 te = give_elem_type (eid);
00262
00263 switch (te){
00264 case coupbar:{ nip=Cbar->nipl[ri][ci]; break; }
00265 case coupquad:{ nip=Cquad->nipl[ri][ci]; break; }
00266 case coupaxiquad:{ nip=Caxiq->nipl[ri][ci]; break; }
00267 case couphex:{ nip=Chex->nipl[ri][ci]; break; }
00268 default:{
00269 fprintf (stderr,"\n\n unknown element type is required in function");
00270 fprintf (stderr,"\n couptop::give_lower_nip (file %s, line %d).\n",__FILE__,__LINE__);
00271 }
00272 }
00273 return nip;
00274 }
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284 void couptop::give_elemnodes (long eid,ivector &nodes)
00285 {
00286 Gtu->give_nodes (eid,nodes);
00287 }
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297 void couptop::give_code_numbers (long eid,long *cn)
00298 {
00299 Gtu->give_code_numbers (eid,cn);
00300 }
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310 void couptop::give_node_coord2d (vector &x,vector &y,long eid)
00311 {
00312 Gtu->give_node_coord2d (x,y,eid);
00313 }
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323 void couptop::give_node_coord2dxz (vector &x,vector &z,long eid)
00324 {
00325 Gtu->give_node_coord2dxz (x,z,eid);
00326 }
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336 void couptop::give_node_coord3d (vector &x,vector &y,vector &z,long eid)
00337 {
00338 Gtu->give_node_coord3d (x,y,z,eid);
00339 }
00340
00341
00342
00343
00344
00345
00346
00347
00348 long couptop::give_mnb (long eid)
00349 {
00350 long mnb;
00351 elemtypec te;
00352
00353 te = give_elem_type (eid);
00354
00355 switch (te){
00356
00357 case coupbar:{ mnb=Cbar->mnb; break; }
00358 case coupquad:{ mnb=Cquad->mnb; break; }
00359 case coupaxiquad:{ mnb=Caxiq->mnb; break; }
00360 case couphex:{ mnb=Chex->mnb; break; }
00361 default:{
00362 fprintf (stderr,"\n\n unknown element type is required in function give_nb (file %s, line %d).\n",__FILE__,__LINE__);
00363 }
00364 }
00365 return mnb;
00366 }
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398 long couptop::give_mncomp (long eid)
00399 {
00400 long mncomp;
00401 elemtypec te;
00402
00403 te = give_elem_type (eid);
00404
00405 switch (te){
00406 case coupbar:{ mncomp=Cbar->tnmcomp; break; }
00407 case coupquad:{ mncomp=Cquad->tnmcomp; break; }
00408 case coupaxiquad:{ mncomp=Caxiq->tnmcomp; break; }
00409 case couphex:{ mncomp=Chex->tnmcomp; break; }
00410 default:{
00411 fprintf (stderr,"\n\n unknown element type is required in function give_ncomp (file %s, line %d).\n",__FILE__,__LINE__);
00412 }
00413 }
00414 return mncomp;
00415 }
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437 strastrestate couptop::give_mssst (long eid,long bi)
00438 {
00439 strastrestate mssst;
00440
00441 mssst = Mt->give_ssst (eid,bi);
00442 return mssst;
00443 }