Skip to content

Commit

Permalink
fmk - fixing code, references cannot be null
Browse files Browse the repository at this point in the history
  • Loading branch information
fmckenna committed Nov 15, 2021
1 parent fc93ed4 commit 8b724ba
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 108 deletions.
4 changes: 2 additions & 2 deletions SRC/coordTransformation/CorotCrdTransf2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ nodeIPtr(0), nodeJPtr(0), L(0), Ln(0), ub(3), ubcommit(3), ubpr(3),
nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
{
// check rigid joint offset for node I
if (&rigJntOffsetI == 0 || rigJntOffsetI.Size() != 2 )
if (rigJntOffsetI.Size() != 2 )
{
opserr << "CorotCrdTransf2d::CorotCrdTransf2d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 2\n";
Expand All @@ -113,7 +113,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
nodeIOffset = rigJntOffsetI;

// check rigid joint offset for node J
if (&rigJntOffsetJ == 0 || rigJntOffsetJ.Size() != 2 )
if (rigJntOffsetJ.Size() != 2 )
{
opserr << "CorotCrdTransf2d::CorotCrdTransf2d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 2\n";
Expand Down
4 changes: 2 additions & 2 deletions SRC/coordTransformation/CorotCrdTransf3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
vAxis = vecInLocXZPlane;

// check rigid joint offset for node I
if (&rigJntOffsetI == 0 || rigJntOffsetI.Size() != 3 )
if (rigJntOffsetI.Size() != 3 )
{
opserr << "CorotCrdTransf3d::CorotCrdTransf3d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 3\n";
Expand All @@ -123,7 +123,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
nodeIOffset = rigJntOffsetI;

// check rigid joint offset for node J
if (&rigJntOffsetJ == 0 || rigJntOffsetJ.Size() != 3 )
if (rigJntOffsetJ.Size() != 3 )
{
opserr << "CorotCrdTransf3d::CorotCrdTransf3d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 3\n";
Expand Down
4 changes: 2 additions & 2 deletions SRC/coordTransformation/CorotCrdTransfWarping2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ nodeIPtr(0), nodeJPtr(0), L(0), Ln(0), ub(5), ubcommit(5), ubpr(5),
nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
{
// check rigid joint offset for node I
if (&rigJntOffsetI == 0 || rigJntOffsetI.Size() != 2 )
if (rigJntOffsetI.Size() != 2 )
{
opserr << "CorotCrdTransfWarping2d::CorotCrdTransfWarping2d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 2\n";
Expand All @@ -85,7 +85,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
nodeIOffset = rigJntOffsetI;

// check rigid joint offset for node J
if (&rigJntOffsetJ == 0 || rigJntOffsetJ.Size() != 2 )
if (rigJntOffsetJ.Size() != 2 )
{
opserr << "CorotCrdTransfWarping2d::CorotCrdTransfWarping2d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 2\n";
Expand Down
4 changes: 2 additions & 2 deletions SRC/coordTransformation/CorotCrdTransfWarping3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
else
vAxis = vecInLocXZPlane;
// check rigid joint offset for node I
if (&rigJntOffsetI == 0 || rigJntOffsetI.Size() != 3 )
if (rigJntOffsetI.Size() != 3 )
{
opserr << "CorotCrdTransfWarping3d::CorotCrdTransfWarping3d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 3\n";
Expand All @@ -130,7 +130,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
nodeIOffset = rigJntOffsetI;

// check rigid joint offset for node J
if (&rigJntOffsetJ == 0 || rigJntOffsetJ.Size() != 3 )
if (rigJntOffsetJ.Size() != 3 )
{
opserr << "CorotCrdTransfWarping3d::CorotCrdTransfWarping3d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 3\n";
Expand Down
4 changes: 2 additions & 2 deletions SRC/coordTransformation/LinearCrdTransf2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ cosTheta(0), sinTheta(0), L(0),
nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
{
// check rigid joint offset for node I
if (&rigJntOffset1 == 0 || rigJntOffset1.Size() != 2 ) {
if (rigJntOffset1.Size() != 2 ) {
opserr << "LinearCrdTransf2d::LinearCrdTransf2d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 2\n";
}
Expand All @@ -110,7 +110,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
}

// check rigid joint offset for node J
if (&rigJntOffset2 == 0 || rigJntOffset2.Size() != 2 ) {
if (rigJntOffset2.Size() != 2 ) {
opserr << "LinearCrdTransf2d::LinearCrdTransf2d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 2\n";
}
Expand Down
4 changes: 2 additions & 2 deletions SRC/coordTransformation/LinearCrdTransf3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
R[2][2] = vecInLocXZPlane(2);

// check rigid joint offset for node I
if (&rigJntOffset1 == 0 || rigJntOffset1.Size() != 3 ) {
if (rigJntOffset1.Size() != 3 ) {
opserr << "LinearCrdTransf3d::LinearCrdTransf3d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 3\n";
}
Expand All @@ -129,7 +129,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
}

// check rigid joint offset for node J
if (&rigJntOffset2 == 0 || rigJntOffset2.Size() != 3 ) {
if (rigJntOffset2.Size() != 3 ) {
opserr << "LinearCrdTransf3d::LinearCrdTransf3d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 3\n";
}
Expand Down
4 changes: 2 additions & 2 deletions SRC/coordTransformation/PDeltaCrdTransf2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ PDeltaCrdTransf2d::PDeltaCrdTransf2d(int tag,
nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
{
// check rigid joint offset for node I
if (&rigJntOffset1 == 0 || rigJntOffset1.Size() != 2 ) {
if (rigJntOffset1.Size() != 2 ) {
opserr << "PDeltaCrdTransf2d::PDeltaCrdTransf2d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 2\n";
}
Expand All @@ -109,7 +109,7 @@ PDeltaCrdTransf2d::PDeltaCrdTransf2d(int tag,
}

// check rigid joint offset for node J
if (&rigJntOffset2 == 0 || rigJntOffset2.Size() != 2 ) {
if (rigJntOffset2.Size() != 2 ) {
opserr << "PDeltaCrdTransf2d::PDeltaCrdTransf2d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 2\n";
}
Expand Down
4 changes: 2 additions & 2 deletions SRC/coordTransformation/PDeltaCrdTransf3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
R[2][2] = vecInLocXZPlane(2);

// check rigid joint offset for node I
if (&rigJntOffset1 == 0 || rigJntOffset1.Size() != 3 ) {
if (rigJntOffset1.Size() != 3 ) {
opserr << "PDeltaCrdTransf3d::PDeltaCrdTransf3d: Invalid rigid joint offset vector for node I\n";
opserr << "Size must be 3\n";
}
Expand All @@ -130,7 +130,7 @@ nodeIInitialDisp(0), nodeJInitialDisp(0), initialDispChecked(false)
}

// check rigid joint offset for node J
if (&rigJntOffset2 == 0 || rigJntOffset2.Size() != 3 ) {
if (rigJntOffset2.Size() != 3 ) {
opserr << "PDeltaCrdTransf3d::PDeltaCrdTransf3d: Invalid rigid joint offset vector for node J\n";
opserr << "Size must be 3\n";
}
Expand Down
93 changes: 1 addition & 92 deletions SRC/reliability/domain/functionEvaluator/FunctionEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,97 +460,6 @@ FunctionEvaluator::evaluateG(const Vector &x)
int result = this->tokenizeSpecials( theExpression, theLimitStateFunction->getParameters() );
////////////////////////////////////////////////////////////
// From here to next line of slashes should go away -- MHS
//
// See comments regarding new LSF syntax in components/LimitStateFunction.cpp -- KRM
/*
// Initial declarations
int i;
double fileValue = 0.0;
char buf[500]="";
char tclAssignment[500]="";
char tempchar[100]="";
char temp[120];
char separators[5] = "}{";
char *dollarSign = "$";
char *underscore = "_";
char lsf_forTokenizing[500];
strcpy(lsf_forTokenizing,theExpression);
opserr << "Gfun x: " << x;
// Set values of basic random variables and file quantities
// (Other quantities will have to be set by specific implementations of this class)
char *tokenPtr = strtok( lsf_forTokenizing, separators);
while ( tokenPtr != NULL ) {
// Copy the token pointer over to a temporary storage
strcpy(tempchar,tokenPtr);
if ( strncmp(tokenPtr, "x",1) == 0) {
int rvNum;
sscanf(tempchar,"x_%i",&rvNum);
int index = theReliabilityDomain->getRandomVariableIndex(rvNum);
sprintf(tclAssignment , "set x_%d %35.20f", rvNum, x(index) );
Tcl_Eval( theTclInterp, tclAssignment);
}
else if ( strncmp(tokenPtr, "file",4) == 0) {
int rowNum = 0;
int colNum = 0;
char fileName[256];
sscanf(tempchar,"file_%s",fileName);
int rowloc = strcspn(fileName,"_");
char rowstr[10] = "";
int rowcnt = 0;
for (i=rowloc+1; fileName[i]!='\0'; i++) {
rowstr[rowcnt] = fileName[i];
rowcnt++;
}
rowstr[rowcnt] = '\0';
sscanf(rowstr,"%i_%i",&rowNum,&colNum);
fileName[rowloc] = '\0';
ifstream inputFile(fileName,ios::in);
if (!inputFile) {
opserr << "Could not open file with quantities for limit-state function." << endln;
}
for (i=1; i<rowNum; i++) {
// requires limits, just skips the lines that are not needed
inputFile.ignore(INT_MAX,'\n');
}
for (i=1; i<=colNum; i++) {
inputFile >> temp;
}
// check for error in stream
if ( inputFile.fail() ) {
opserr << "ERROR: Could not find quantity (" << rowNum << ", " << colNum
<< ") in performance function file." << endln;
fileValue = 0.0;
} else {
fileValue = atof(temp);
//opserr << "Found quantity (" << rowNum << ", " << colNum << ") = " << fileValue << endln;
}
inputFile.close();
sprintf(tclAssignment , "set file_%s_%d_%d %35.20f",fileName,rowNum,colNum,fileValue);
if (Tcl_Eval(theTclInterp, tclAssignment) == TCL_ERROR) {
opserr << "ERROR FunctionEvaluator -- Tcl_Eval returned error in limit state function" << endln;
return -1;
}
}
tokenPtr = strtok( NULL, separators);
}
////////////////////////////////////////////////////////////
//char tclAssign[200];
//sprintf(tclAssign, "puts [info vars]");
//Tcl_Eval(theTclInterp, tclAssign);
Expand Down Expand Up @@ -647,4 +556,4 @@ void FunctionEvaluator::setPerformFuncCoeffIter(PerformanceFunctionCoefficientIt
{
}
*/
*/

0 comments on commit 8b724ba

Please sign in to comment.