MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / printElement

Function printElement

SRC/tcl/commands.cpp:2217–2274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2215
2216
2217int
2218printElement(ClientData clientData, Tcl_Interp *interp, int argc,
2219 TCL_Char **argv, OPS_Stream &output)
2220{
2221 int flag = 0; // default flag sent to a nodes Print() method
2222 int eleArg = 0;
2223
2224 // if just 'print <filename> node' print all the nodes - no flag
2225 if (argc == 0) {
2226 ElementIter &theElements = theDomain.getElements();
2227 Element *theElement;
2228 while ((theElement = theElements()) != 0)
2229 theElement->Print(output);
2230 return TCL_OK;
2231 }
2232
2233 // if 'print <filename> Element flag int <int int ..>' get the flag
2234 if ((strcmp(argv[0],"flag") == 0) ||
2235 (strcmp(argv[0],"-flag")) == 0) { // get the specified flag
2236 if (argc < 2) {
2237 opserr << "WARNING print <filename> ele <flag int> no int specified \n";
2238 return TCL_ERROR;
2239 }
2240 if (Tcl_GetInt(interp, argv[1], &flag) != TCL_OK) {
2241 opserr << "WARNING print ele failed to get integer flag: \n";
2242 opserr << argv[eleArg] << endln;
2243 return TCL_ERROR;
2244 }
2245 eleArg += 2;
2246 }
2247
2248 // now print the Elements with the specified flag, 0 by default
2249 if (argc == eleArg) {
2250 ElementIter &theElements = theDomain.getElements();
2251 Element *theElement;
2252 while ((theElement = theElements()) != 0)
2253 theElement->Print(output, flag);
2254 return TCL_OK;
2255 } else {
2256
2257 // otherwise print out the specified nodes i j k .. with flag
2258 int numEle = argc-eleArg;
2259 ID *theEle = new ID(numEle);
2260 for (int i= 0; i<numEle; i++) {
2261 int eleTag;
2262 if (Tcl_GetInt(interp, argv[i+eleArg], &eleTag) != TCL_OK) {
2263 opserr << "WARNING print ele failed to get integer: " << argv[i] << endln;
2264 return TCL_ERROR;
2265 }
2266 (*theEle)(i) = eleTag;
2267 }
2268
2269 theDomain.Print(output, 0, theEle, flag);
2270 delete theEle;
2271 }
2272
2273 return TCL_OK;
2274}

Callers 1

printModelFunction · 0.70

Calls 2

getElementsMethod · 0.45
PrintMethod · 0.45

Tested by

no test coverage detected