Skip to content

Commit

Permalink
Merge pull request #415 from mhscott/fbc2d
Browse files Browse the repository at this point in the history
Making static class variables arrays instead of pointers
  • Loading branch information
mhscott committed Aug 6, 2020
2 parents 8c7ebb6 + 99644f4 commit 2ed5f03
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
46 changes: 23 additions & 23 deletions SRC/element/forceBeamColumn/ForceBeamColumn2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ Matrix ForceBeamColumn2d::theMatrix(6,6);
Vector ForceBeamColumn2d::theVector(6);
double ForceBeamColumn2d::workArea[200];

Vector *ForceBeamColumn2d::vsSubdivide = 0;
Matrix *ForceBeamColumn2d::fsSubdivide = 0;
Vector *ForceBeamColumn2d::SsrSubdivide = 0;
Vector ForceBeamColumn2d::vsSubdivide[maxNumSections];
Matrix ForceBeamColumn2d::fsSubdivide[maxNumSections];
Vector ForceBeamColumn2d::SsrSubdivide[maxNumSections];

void* OPS_ForceBeamColumn2d()
{
Expand Down Expand Up @@ -424,16 +424,16 @@ ForceBeamColumn2d::ForceBeamColumn2d():
theNodes[0] = 0;
theNodes[1] = 0;

if (vsSubdivide == 0)
vsSubdivide = new Vector [maxNumSections];
if (fsSubdivide == 0)
fsSubdivide = new Matrix [maxNumSections];
if (SsrSubdivide == 0)
SsrSubdivide = new Vector [maxNumSections];
if (!vsSubdivide || !fsSubdivide || !SsrSubdivide) {
opserr << "ForceBeamColumn2d::ForceBeamColumn2d() -- failed to allocate Subdivide arrays";
exit(-1);
}
// if (vsSubdivide == 0)
// vsSubdivide = new Vector [maxNumSections];
//if (fsSubdivide == 0)
// fsSubdivide = new Matrix [maxNumSections];
//if (SsrSubdivide == 0)
// SsrSubdivide = new Vector [maxNumSections];
//if (!vsSubdivide || !fsSubdivide || !SsrSubdivide) {
// opserr << "ForceBeamColumn2d::ForceBeamColumn2d() -- failed to allocate Subdivide arrays";
// exit(-1);
//}
}

// constructor which takes the unique element tag, sections,
Expand Down Expand Up @@ -477,16 +477,16 @@ ForceBeamColumn2d::ForceBeamColumn2d (int tag, int nodeI, int nodeJ,

this->setSectionPointers(numSec, sec);

if (vsSubdivide == 0)
vsSubdivide = new Vector [maxNumSections];
if (fsSubdivide == 0)
fsSubdivide = new Matrix [maxNumSections];
if (SsrSubdivide == 0)
SsrSubdivide = new Vector [maxNumSections];
if (!vsSubdivide || !fsSubdivide || !SsrSubdivide) {
opserr << "ForceBeamColumn2d::ForceBeamColumn2d() -- failed to allocate Subdivide arrays";
exit(-1);
}
//if (vsSubdivide == 0)
// vsSubdivide = new Vector [maxNumSections];
//if (fsSubdivide == 0)
// fsSubdivide = new Matrix [maxNumSections];
//if (SsrSubdivide == 0)
// SsrSubdivide = new Vector [maxNumSections];
//if (!vsSubdivide || !fsSubdivide || !SsrSubdivide) {
// opserr << "ForceBeamColumn2d::ForceBeamColumn2d() -- failed to allocate Subdivide arrays";
// exit(-1);
//}
}

// ~ForceBeamColumn2d():
Expand Down
6 changes: 3 additions & 3 deletions SRC/element/forceBeamColumn/ForceBeamColumn2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ class ForceBeamColumn2d: public Element
// following are added for subdivision of displacement increment
int maxSubdivisions; // maximum number of subdivisons of dv for local iterations

static Vector *vsSubdivide;
static Vector *SsrSubdivide;
static Matrix *fsSubdivide;
static Vector vsSubdivide[];
static Vector SsrSubdivide[];
static Matrix fsSubdivide[];
//static int maxNumSections;

// AddingSensitivity:BEGIN //////////////////////////////////////////
Expand Down

0 comments on commit 2ed5f03

Please sign in to comment.