Subversion Repositories OpenSees

Rev

Rev 717 | Rev 1231 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 717 Rev 1181
Line 16... Line 16...
16
**   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
16
**   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
17
**   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
17
**   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
18
**                                                                    **
18
**                                                                    **
19
** ****************************************************************** */
19
** ****************************************************************** */
20
                                                                       
20
                                                                       
21
// $Revision: 1.3 $
-
 
22
// $Date: 2001-11-26 22:53:53 $
-
 
-
 
21
// $Revision: 1.4 $
-
 
22
// $Date: 2002-12-05 22:20:39 $
23
// $Source: /usr/local/cvs/OpenSees/SRC/element/feap/fElement.cpp,v $
23
// $Source: /usr/local/cvs/OpenSees/SRC/element/feap/fElement.cpp,v $
24
                                                                       
24
                                                                       
25
                                                                       
25
                                                                       
26
// File: ~/element/fortran/fElement.C
26
// File: ~/element/fortran/fElement.C
27
// 
27
// 
Line 52... Line 52...
52
double *fElement::ul;
52
double *fElement::ul;
53
double *fElement::xl;
53
double *fElement::xl;
54
double *fElement::tl;
54
double *fElement::tl;
55
int    *fElement::ix;
55
int    *fElement::ix;
56
int    fElement::numfElements(0);
56
int    fElement::numfElements(0);
-
 
57
-
 
58
static double *work = 0;
-
 
59
static int sizeWork = 0;
57
60
58
#define MAX_NST 64
61
#define MAX_NST 64
59
62
60
// constructor:
63
// constructor:
61
//  responsible for allocating the necessary space needed by each object
64
//  responsible for allocating the necessary space needed by each object
Line 66... Line 69...
66
                   int sizeD, int NEN,
69
                   int sizeD, int NEN,
67
                   int NDM, int NDF,
70
                   int NDM, int NDF,
68
                   int numNh1, int numNh3)
71
                   int numNh1, int numNh3)
69
:Element(tag,classTag), nh1(numNh1), nh3(numNh3), h(0), eleType(EleType),
72
:Element(tag,classTag), nh1(numNh1), nh3(numNh3), h(0), eleType(EleType),
70
  theNodes(0), u(0), nen(NEN), ndf(NDF), ndm(NDM), d(0), data(0),
73
  theNodes(0), u(0), nen(NEN), ndf(NDF), ndm(NDM), d(0), data(0),
71
 connectedNodes(0),nrCount(0), theLoad(0)
-
 
-
 
74
 connectedNodes(0),nrCount(0), theLoad(0), Ki(0)
72
 
75
 
73
{
76
{
74
    // allocate space for h array
77
    // allocate space for h array
75
    if (nh1 < 0) nh1 = 0;
78
    if (nh1 < 0) nh1 = 0;
76
    if (nh3 < 0) nh3 = 0;
79
    if (nh3 < 0) nh3 = 0;
77
    if (nh1 != 0 || nh3 != 0) {
80
    if (nh1 != 0 || nh3 != 0) {
78
        int sizeH = 2*nh1 + nh3;
81
        int sizeH = 2*nh1 + nh3;
79
        h = new double[sizeH];
82
        h = new double[sizeH];
80
        if (h == 0) {
-
 
-
 
83
        if (sizeWork < sizeH) {
-
 
84
          if (work != 0)
-
 
85
            delete [] work;
-
 
86
          work = new double[sizeH];
-
 
87
          if (work == 0) {
-
 
88
            cerr << "FATAL: fElement::fElement() - eleTag: " << tag;
-
 
89
            cerr << " ran out of memory creating h of size " << 2*nh1+nh3 << endl;
-
 
90
            exit(-1);
-
 
91
          }        
-
 
92
          sizeWork = sizeH;
-
 
93
        }
-
 
94
        if (h == 0 || work == 0) {
81
            cerr << "FATAL: fElement::fElement() - eleTag: " << tag;
95
            cerr << "FATAL: fElement::fElement() - eleTag: " << tag;
82
            cerr << " ran out of memory creating h of size " << 2*nh1+nh3 << endl;
96
            cerr << " ran out of memory creating h of size " << 2*nh1+nh3 << endl;
83
            exit(-1);
97
            exit(-1);
84
        }          
98
        }          
85
        for (int i=0; i<sizeH; i++) h[i] = 0.0;
-
 
-
 
99
-
 
100
        for (int i=0; i<sizeH; i++)
-
 
101
          h[i] = 0.0;
86
    }
102
    }
-
 
103
87
    connectedNodes = new ID(NEN);
104
    connectedNodes = new ID(NEN);
88
    d = new double[sizeD];
105
    d = new double[sizeD];
89
    for (int i=0; i<sizeD; i++) d[i] = 0.0;
106
    for (int i=0; i<sizeD; i++) d[i] = 0.0;
90
    data = new Vector(d, sizeD);
107
    data = new Vector(d, sizeD);
91
108
Line 127... Line 144...
127
                   int EleType,
144
                   int EleType,
128
                   int sizeD, int NEN,
145
                   int sizeD, int NEN,
129
                   int NDM, int NDF, int iow)
146
                   int NDM, int NDF, int iow)
130
:Element(tag,classTag), nh1(0), nh3(0), h(0), eleType(EleType),
147
:Element(tag,classTag), nh1(0), nh3(0), h(0), eleType(EleType),
131
  theNodes(0), u(0), nen(NEN), ndf(NDF), ndm(NDM), d(0), data(0),
148
  theNodes(0), u(0), nen(NEN), ndf(NDF), ndm(NDM), d(0), data(0),
132
  connectedNodes(0), nrCount(0), theLoad(0)
-
 
-
 
149
 connectedNodes(0), nrCount(0), theLoad(0), Ki(0)
133
{
150
{
134
    connectedNodes = new ID(NEN);
151
    connectedNodes = new ID(NEN);
135
    d = new double[sizeD];
152
    d = new double[sizeD];
136
    data = new Vector(d, sizeD);
153
    data = new Vector(d, sizeD);
137
    if (d == 0 || data == 0) {
154
    if (d == 0 || data == 0) {
Line 142... Line 159...
142
    for (int i=0; i<sizeD; i++) d[i] = 0.0;    
159
    for (int i=0; i<sizeD; i++) d[i] = 0.0;    
143
160
144
    // invoke the elmt() routine with isw == 1 to read in the element data
161
    // invoke the elmt() routine with isw == 1 to read in the element data
145
    // and create room for the h array stuff needed by the element
162
    // and create room for the h array stuff needed by the element
146
    this->invokefInit(1, iow);
163
    this->invokefInit(1, iow);
-
 
164
147
    // allocate space for h array
165
    // allocate space for h array
148
    if (nh1 < 0) nh1 = 0;
166
    if (nh1 < 0) nh1 = 0;
149
    if (nh3 < 0) nh3 = 0;
167
    if (nh3 < 0) nh3 = 0;
150
    if (nh1 != 0 || nh3 != 0) {
168
    if (nh1 != 0 || nh3 != 0) {
151
        int sizeH = 2*nh1+nh3;
169
        int sizeH = 2*nh1+nh3;
152
        h = new double[sizeH];
170
        h = new double[sizeH];
153
        if (h == 0) {
-
 
-
 
171
        if (sizeWork < sizeH) {
-
 
172
          if (work != 0)
-
 
173
            delete [] work;
-
 
174
          work = new double[sizeH];
-
 
175
          if (work == 0) {
-
 
176
            cerr << "FATAL: fElement::fElement() - eleTag: " << tag;
-
 
177
            cerr << " ran out of memory creating h of size " << 2*nh1+nh3 << endl;
-
 
178
            exit(-1);
-
 
179
          }        
-
 
180
          sizeWork = sizeH;
-
 
181
        }
-
 
182
        if (h == 0 || work == 0) {
154
            cerr << "FATAL: fElement::fElement() - eleTag: " << this->getTag();
183
            cerr << "FATAL: fElement::fElement() - eleTag: " << this->getTag();
155
            cerr << " ran out of memory creating h of size " << sizeH << endl;
184
            cerr << " ran out of memory creating h of size " << sizeH << endl;
156
            exit(-1);
185
            exit(-1);
157
        }          
186
        }          
158
        else
187
        else
Line 195... Line 224...
195
//   invoked by a FEM_ObjectBroker - blank object that recvSelf needs
224
//   invoked by a FEM_ObjectBroker - blank object that recvSelf needs
196
//   to be invoked upon
225
//   to be invoked upon
197
fElement::fElement(int classTag)
226
fElement::fElement(int classTag)
198
:Element(0, classTag), nh1(0), nh3(0), h(0),
227
:Element(0, classTag), nh1(0), nh3(0), h(0),
199
 theNodes(0), u(0), nen(0), ndf(0), ndm(0), d(0), data(0), connectedNodes(0),
228
 theNodes(0), u(0), nen(0), ndf(0), ndm(0), d(0), data(0), connectedNodes(0),
200
 theLoad(0)
-
 
-
 
229
 theLoad(0), Ki(0)
201
{
230
{
202
    // does nothing
231
    // does nothing
203
}
232
}
204
233
205
//  destructor
234
//  destructor
Line 222... Line 251...
222
        delete  connectedNodes;
251
        delete  connectedNodes;
223
    if (d != 0)
252
    if (d != 0)
224
        delete [] d;
253
        delete [] d;
225
    if (theLoad != 0)
254
    if (theLoad != 0)
226
      delete theLoad;
255
      delete theLoad;
-
 
256
-
 
257
    if (Ki != 0)
-
 
258
      delete Ki;
227
259
228
    // if last element - clear up space allocated
260
    // if last element - clear up space allocated
229
261
230
    numfElements --;    
262
    numfElements --;    
231
    if (numfElements == 0) {
263
    if (numfElements == 0) {
Line 252... Line 284...
252
284
253
const ID &
285
const ID &
254
fElement::getExternalNodes(void)
286
fElement::getExternalNodes(void)
255
{
287
{
256
    return *connectedNodes;
288
    return *connectedNodes;
-
 
289
}
-
 
290
-
 
291
Node **
-
 
292
fElement::getNodePtrs(void)
-
 
293
{
-
 
294
    return theNodes;
257
}
295
}
258
296
259
int
297
int
260
fElement::getNumDOF(void)
298
fElement::getNumDOF(void)
261
{
299
{
Line 431... Line 469...
431
    return *(fElementM[nstR]);
469
    return *(fElementM[nstR]);
432
470
433
}
471
}
434
472
435
473
436
const Matrix &
-
 
437
fElement::getSecantStiff(void)
-
 
438
{
-
 
439
    // check for quick return
-
 
440
    if (nen == 0)
-
 
441
        return (*fElementM[0]);
-
 
442
   
-
 
443
    // get the current load factor
-
 
444
    Domain *theDomain=this->getDomain();
-
 
445
    double dm = theDomain->getCurrentTime();
-
 
446
   
-
 
447
    // set ctan, ior and iow
-
 
448
    double ctan[3];
-
 
449
    ctan[0] = 1.0; ctan[1] = 0.0; ctan[2] = 0.0;
-
 
450
    int ior = 0; int iow = 0;
-
 
451
   
-
 
452
    // call the ready routine to set ul, xl, tl and ix, NH1, NH2 and NH3
-
 
453
    int NH1, NH2, NH3;    
-
 
454
    int nstR = this->readyfRoutine(false);
-
 
455
   
-
 
456
    // zero the matrix
-
 
457
    fElementM[nstR]->Zero();    
-
 
458
   
-
 
459
    // invoke the fortran subroutine
-
 
460
    int isw = 3;
-
 
461
    int nstI = this->invokefRoutine(ior, iow, ctan, isw);
-
 
462
-
 
463
    // check nst is as determined in readyfRoutine()
-
 
464
    if (nstI != nstR) {
-
 
465
        cerr << "FATAL fElement::getTangentStiff() problems with incompatable nst";
-
 
466
        cerr << " ready: " << nstR << " invoke: " << nstI << endl;
-
 
467
        exit(-1);
-
 
468
    }
-
 
469
   
-
 
470
    // return the matrix
-
 
471
    return *(fElementM[nstR]);
-
 
472
}
-
 
473
   
-
 
474
const Matrix &
474
const Matrix &
475
fElement::getDamp(void)
475
fElement::getDamp(void)
476
{
476
{
477
    // check for quick return
477
    // check for quick return
478
    if (nen == 0)
478
    if (nen == 0)
Line 494... Line 494...
494
    // zero the matrix
494
    // zero the matrix
495
    fElementM[nstR]->Zero();    
495
    fElementM[nstR]->Zero();    
496
   
496
   
497
    // invoke the fortran subroutine
497
    // invoke the fortran subroutine
498
    int isw = 3; int nst = nen*ndf; int n = this->getTag();
498
    int isw = 3; int nst = nen*ndf; int n = this->getTag();
-
 
499
-
 
500
499
    int nstI = this->invokefRoutine(ior, iow, ctan, isw);
501
    int nstI = this->invokefRoutine(ior, iow, ctan, isw);
500
   
502
   
501
    // check nst is as determined in readyfRoutine()
503
    // check nst is as determined in readyfRoutine()
502
    if (nstI != nstR) {
504
    if (nstI != nstR) {
503
        cerr << "FATAL fElement::getTangentStiff() problems with incompatable nst";
505
        cerr << "FATAL fElement::getTangentStiff() problems with incompatable nst";
Line 686... Line 688...
686
688
687
689
688
int
690
int
689
fElement::sendSelf(int commitTag, Channel &theChannel)
691
fElement::sendSelf(int commitTag, Channel &theChannel)
690
{
692
{
691
    return 0;
-
 
-
 
693
  cerr << "fElement::sendSelf() - not yet implemented\n";
-
 
694
  return -1;
692
}
695
}
693
696
694
int
697
int
695
fElement::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
698
fElement::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
696
{
699
{
697
    return 0;
-
 
-
 
700
  cerr << "fElement::recvSelf() - not yet implemented\n";
-
 
701
  return -1;
698
}
702
}
699
703
700
704
701
int
705
int
702
fElement::displaySelf(Renderer &theViewer, int displayMode, float fact)
706
fElement::displaySelf(Renderer &theViewer, int displayMode, float fact)
Line 1000... Line 1004...
1000
1004
1001
    // increment the newton-raphson count -- needed for Prof. Fillipou's element
1005
    // increment the newton-raphson count -- needed for Prof. Fillipou's element
1002
    nrCount++;
1006
    nrCount++;
1003
   
1007
   
1004
    return 0;
1008
    return 0;
-
 
1009
}
-
 
1010
-
 
1011
-
 
1012
const Matrix &
-
 
1013
fElement::getInitialStiff(void)
-
 
1014
{
-
 
1015
  if (Ki == 0)
-
 
1016
    Ki = new Matrix(this->getTangentStiff());
-
 
1017
-
 
1018
  if (Ki == 0) {
-
 
1019
    cerr << "FATAL fElement::getInitialStiff() -";
-
 
1020
    cerr << "ran out of memory\n";
-
 
1021
    exit(-1);
-
 
1022
  }  
-
 
1023
   
-
 
1024
  return *Ki;
1005
}
1025
}
1006
1026
1007
1027
1008
1028
1009
1029