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

Function OPS_Truss2D

DEVELOPER/element/cpp/Truss2D.cpp:60–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58static int numMyTruss = 0;
59
60OPS_Export void *
61OPS_Truss2D()
62{
63 // print out a message about who wrote this element & any copyright info wanted
64 if (numMyTruss == 0) {
65 opserr << "Truss2D element - Written by fmk UC Berkeley Copyright 2008 - Use at your Own Peril\n";
66 numMyTruss++;
67 }
68
69 Element *theTruss = 0;
70
71 int numRemainingArgs = OPS_GetNumRemainingInputArgs();
72 if (numRemainingArgs == 0) { // parallel processing
73 theTruss = new Truss2D();
74 return theTruss;
75 }
76
77 if (numRemainingArgs != 5) {
78 opserr << "ERROR - Truss2D not enough args provided, want: element Truss2D tag? iNode? jNode? Area? matTag?\n";
79 numMyTruss++;
80 }
81
82 // get the id and end nodes
83 int iData[4];
84 double dData[1];
85 int numData;
86
87 numData = 3;
88 if (OPS_GetIntInput(&numData, iData) != 0) {
89 opserr << "WARNING invalid element data\n";
90 return 0;
91 }
92
93 int eleTag = iData[0];
94
95 numData = 1;
96 if (OPS_GetDoubleInput(&numData, dData) != 0) {
97 opserr << "WARNING error reading element area for element" << eleTag << endln;
98 return 0;
99 }
100
101 numData = 1;
102 if (OPS_GetIntInput(&numData, &iData[3]) != 0) {
103 opserr << "WARNING error reading element material tag for element " << eleTag << endln;
104 return 0;
105 }
106
107 int matID = iData[3];
108 UniaxialMaterial *theMaterial = OPS_GetUniaxialMaterial(matID);
109
110 if (theMaterial == 0) {
111 opserr << "WARNING material with tag " << matID << "not found for element " << eleTag << endln;
112 return 0;
113 }
114
115 // now create the truss and add it to the Domain
116
117 theTruss = new Truss2D(eleTag, iData[1], iData[2], *theMaterial, dData[0]);

Callers

nothing calls this directly

Calls 4

OPS_GetIntInputFunction · 0.50
OPS_GetDoubleInputFunction · 0.50
OPS_GetUniaxialMaterialFunction · 0.50

Tested by

no test coverage detected