Subversion Repositories OpenSees

Rev

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

Rev 1160 Rev 1271
Line 9... Line 9...
9
#include <YS_Section2D01.h>
9
#include <YS_Section2D01.h>
10
#include <YS_Section2D02.h>
10
#include <YS_Section2D02.h>
11
11
12
static void printCommand(int argc, char **argv)
12
static void printCommand(int argc, char **argv)
13
{
13
{
14
  cerr << "Input command: ";
-
 
-
 
14
  opserr << "Input command: ";
15
  for (int i=0; i<argc; i++)
15
  for (int i=0; i<argc; i++)
16
    cerr << argv[i] << " ";
-
 
17
  cerr << endl;
-
 
-
 
16
    opserr << argv[i] << " ";
-
 
17
  opserr << endln;
18
}
18
}
19
19
20
SectionForceDeformation*
20
SectionForceDeformation*
21
TclModelBuilderYS_SectionCommand(ClientData clienData, Tcl_Interp *interp, int argc,
21
TclModelBuilderYS_SectionCommand(ClientData clienData, Tcl_Interp *interp, int argc,
22
                                 char **argv, TclModelBuilder *theBuilder)
22
                                 char **argv, TclModelBuilder *theBuilder)
23
{
23
{
24
  if (argc < 3) {
24
  if (argc < 3) {
25
    cerr << "WARNING insufficient number of arguments\n";
-
 
-
 
25
    opserr << "WARNING insufficient number of arguments\n";
26
    printCommand(argc, argv);
26
    printCommand(argc, argv);
27
    return 0;
27
    return 0;
28
  }
28
  }
29
 
29
 
30
  int tag;
30
  int tag;
31
  if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) {
31
  if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) {
32
    cerr << "WARNING invalid section tag\n";
-
 
-
 
32
    opserr << "WARNING invalid section tag\n";
33
    printCommand(argc, argv);
33
    printCommand(argc, argv);
34
    return 0;
34
    return 0;
35
  }
35
  }
36
 
36
 
37
  SectionForceDeformation *theModel = 0;
37
  SectionForceDeformation *theModel = 0;
38
38
39
  if (strcmp(argv[1],"YS_Section2D01") == 0 ||
39
  if (strcmp(argv[1],"YS_Section2D01") == 0 ||
40
      strcmp(argv[1],"YS_Section2d01") == 0) {
40
      strcmp(argv[1],"YS_Section2d01") == 0) {
41
41
42
    if (argc < 7) {
42
    if (argc < 7) {
43
      cerr << "WARNING invalid number of arguments\n";
-
 
-
 
43
      opserr << "WARNING invalid number of arguments\n";
44
      printCommand(argc,argv);
44
      printCommand(argc,argv);
45
      cerr << "Want: section YS_Section2D01 tag? E? A? Iz? ysTag? <algo?>" << endl;
-
 
-
 
45
      opserr << "Want: section YS_Section2D01 tag? E? A? Iz? ysTag? <algo?>" << endln;
46
      return 0;
46
      return 0;
47
    }
47
    }
48
48
49
    int algo, ysTag;
49
    int algo, ysTag;
50
    double E, A, Iz;  
50
    double E, A, Iz;  
51
    int indx = 3;
51
    int indx = 3;
52
 
52
 
53
    if (Tcl_GetDouble (interp, argv[indx++], &E) != TCL_OK) {
53
    if (Tcl_GetDouble (interp, argv[indx++], &E) != TCL_OK) {
54
      cerr << "WARNING invalid E" << endl;
-
 
55
      cerr << " section: " << tag << endl;
-
 
-
 
54
      opserr << "WARNING invalid E" << endln;
-
 
55
      opserr << " section: " << tag << endln;
56
      return 0;
56
      return 0;
57
    }
57
    }
58
 
58
 
59
    if (Tcl_GetDouble (interp, argv[indx++], &A) != TCL_OK) {
59
    if (Tcl_GetDouble (interp, argv[indx++], &A) != TCL_OK) {
60
      cerr << "WARNING invalid A" << endl;
-
 
61
      cerr << " section: " << tag << endl;
-
 
-
 
60
      opserr << "WARNING invalid A" << endln;
-
 
61
      opserr << " section: " << tag << endln;
62
      return 0;
62
      return 0;
63
    }
63
    }
64
 
64
 
65
    if (Tcl_GetDouble (interp, argv[indx++], &Iz) != TCL_OK) {
65
    if (Tcl_GetDouble (interp, argv[indx++], &Iz) != TCL_OK) {
66
      cerr << "WARNING invalid Iz" << endl;
-
 
67
      cerr << " section: " << tag << endl;
-
 
-
 
66
      opserr << "WARNING invalid Iz" << endln;
-
 
67
      opserr << " section: " << tag << endln;
68
      return 0;
68
      return 0;
69
    }
69
    }
70
70
71
    if (Tcl_GetInt (interp, argv[indx++], &ysTag) != TCL_OK) {
71
    if (Tcl_GetInt (interp, argv[indx++], &ysTag) != TCL_OK) {
72
      cerr << "WARNING invalid ysTag" << endl;
-
 
73
      cerr << " section: " << tag << endl;
-
 
-
 
72
      opserr << "WARNING invalid ysTag" << endln;
-
 
73
      opserr << " section: " << tag << endln;
74
      return 0;
74
      return 0;
75
    }
75
    }
76
   
76
   
77
    YieldSurface_BC *ys = theBuilder->getYieldSurface_BC(ysTag);
77
    YieldSurface_BC *ys = theBuilder->getYieldSurface_BC(ysTag);
78
78
79
    if (ys == 0) {
79
    if (ys == 0) {
80
      cerr << "WARNING yield surface does not exist\n";
-
 
81
      cerr << "yieldSurface: " << ysTag;
-
 
82
      cerr << "\nsection YieldSurface: " << tag << endl;
-
 
-
 
80
      opserr << "WARNING yield surface does not exist\n";
-
 
81
      opserr << "yieldSurface: " << ysTag;
-
 
82
      opserr << "\nsection YieldSurface: " << tag << endln;
83
      return 0;
83
      return 0;
84
    }
84
    }
85
85
86
    bool useKr = true;
86
    bool useKr = true;
87
    if(argc > indx) {
87
    if(argc > indx) {
88
      if (Tcl_GetInt(interp, argv[indx++], &algo) != TCL_OK) {
88
      if (Tcl_GetInt(interp, argv[indx++], &algo) != TCL_OK) {
89
        cerr << "WARNING invalid algo" << endl;
-
 
90
        cerr << " section: " << tag << endl;
-
 
-
 
89
        opserr << "WARNING invalid algo" << endln;
-
 
90
        opserr << " section: " << tag << endln;
91
        return 0;
91
        return 0;
92
      }
92
      }
93
      if(algo == 0)
93
      if(algo == 0)
94
        useKr = false;
94
        useKr = false;
95
    }
95
    }
Line 99... Line 99...
99
99
100
  else if (strcmp(argv[1],"YS_Section2D02") == 0 ||
100
  else if (strcmp(argv[1],"YS_Section2D02") == 0 ||
101
           strcmp(argv[1],"YS_Section2d02") == 0) {
101
           strcmp(argv[1],"YS_Section2d02") == 0) {
102
102
103
    if (argc < 8) {
103
    if (argc < 8) {
104
      cerr << "WARNING invalid number of arguments\n";
-
 
-
 
104
      opserr << "WARNING invalid number of arguments\n";
105
      printCommand(argc,argv);
105
      printCommand(argc,argv);
106
      cerr << "Want: section YS_Section2D01 tag? E? A? Iz? maxPlastRot? ysTag? <algo?>" << endl;
-
 
-
 
106
      opserr << "Want: section YS_Section2D01 tag? E? A? Iz? maxPlastRot? ysTag? <algo?>" << endln;
107
      return 0;
107
      return 0;
108
    }
108
    }
109
109
110
    int algo, ysTag;
110
    int algo, ysTag;
111
    double E, A, Iz, maxPlstkRot;    
111
    double E, A, Iz, maxPlstkRot;    
112
    int indx = 3;
112
    int indx = 3;
113
   
113
   
114
    if (Tcl_GetDouble (interp, argv[indx++], &E) != TCL_OK) {
114
    if (Tcl_GetDouble (interp, argv[indx++], &E) != TCL_OK) {
115
      cerr << "WARNING invalid E" << endl;
-
 
116
      cerr << " section: " << tag << endl;
-
 
-
 
115
      opserr << "WARNING invalid E" << endln;
-
 
116
      opserr << " section: " << tag << endln;
117
      return 0;
117
      return 0;
118
    }
118
    }
119
   
119
   
120
    if (Tcl_GetDouble (interp, argv[indx++], &A) != TCL_OK) {
120
    if (Tcl_GetDouble (interp, argv[indx++], &A) != TCL_OK) {
121
      cerr << "WARNING invalid A" << endl;
-
 
122
      cerr << " section: " << tag << endl;
-
 
-
 
121
      opserr << "WARNING invalid A" << endln;
-
 
122
      opserr << " section: " << tag << endln;
123
      return 0;
123
      return 0;
124
    }
124
    }
125
   
125
   
126
    if (Tcl_GetDouble (interp, argv[indx++], &Iz) != TCL_OK) {
126
    if (Tcl_GetDouble (interp, argv[indx++], &Iz) != TCL_OK) {
127
      cerr << "WARNING invalid Iz" << endl;
-
 
128
      cerr << " section: " << tag << endl;
-
 
-
 
127
      opserr << "WARNING invalid Iz" << endln;
-
 
128
      opserr << " section: " << tag << endln;
129
      return 0;
129
      return 0;
130
    }
130
    }
131
   
131
   
132
    if (Tcl_GetDouble (interp, argv[indx++], &maxPlstkRot) != TCL_OK) {
132
    if (Tcl_GetDouble (interp, argv[indx++], &maxPlstkRot) != TCL_OK) {
133
      cerr << "WARNING maxPlstkRot " << endl;
-
 
134
      cerr << " section: " << tag << endl;
-
 
-
 
133
      opserr << "WARNING maxPlstkRot " << endln;
-
 
134
      opserr << " section: " << tag << endln;
135
      return 0;
135
      return 0;
136
    }
136
    }
137
137
138
    if (Tcl_GetInt (interp, argv[indx++], &ysTag) != TCL_OK) {
138
    if (Tcl_GetInt (interp, argv[indx++], &ysTag) != TCL_OK) {
139
      cerr << "WARNING invalid ysTag" << endl;
-
 
140
      cerr << " section: " << tag << endl;
-
 
-
 
139
      opserr << "WARNING invalid ysTag" << endln;
-
 
140
      opserr << " section: " << tag << endln;
141
      return 0;
141
      return 0;
142
    }
142
    }
143
143
144
    YieldSurface_BC *ys = theBuilder->getYieldSurface_BC(ysTag);
144
    YieldSurface_BC *ys = theBuilder->getYieldSurface_BC(ysTag);
145
145
146
    if (ys == 0) {
146
    if (ys == 0) {
147
      cerr << "WARNING yield surface does not exist\n";
-
 
148
      cerr << "yieldSurface: " << ysTag;
-
 
149
      cerr << "\nsection YieldSurface: " << tag << endl;
-
 
-
 
147
      opserr << "WARNING yield surface does not exist\n";
-
 
148
      opserr << "yieldSurface: " << ysTag;
-
 
149
      opserr << "\nsection YieldSurface: " << tag << endln;
150
      return 0;
150
      return 0;
151
    }
151
    }
152
152
153
    bool useKr = true;
153
    bool useKr = true;
154
    if(argc > indx) {
154
    if(argc > indx) {
155
      if (Tcl_GetInt(interp, argv[indx++], &algo) != TCL_OK) {
155
      if (Tcl_GetInt(interp, argv[indx++], &algo) != TCL_OK) {
156
        cerr << "WARNING invalid algo" << endl;
-
 
157
        cerr << " section: " << tag << endl;
-
 
-
 
156
        opserr << "WARNING invalid algo" << endln;
-
 
157
        opserr << " section: " << tag << endln;
158
        return 0;
158
        return 0;
159
      }
159
      }
160
      if(algo == 0)
160
      if(algo == 0)
161
        useKr = false;
161
        useKr = false;
162
    }
162
    }