Skip to content

Commit

Permalink
Merge pull request #629 from mhscott/hystereticParameter
Browse files Browse the repository at this point in the history
Adding set/updateParameter
  • Loading branch information
mhscott committed Jul 28, 2021
2 parents ae30917 + c065a1c commit 6082540
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 2 deletions.
111 changes: 109 additions & 2 deletions SRC/material/uniaxial/HystereticMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@
// degraded unloading stiffness based on maximum ductility. This
// is a modified implementation of Hyster2.f90 by Filippou.
#include <stdlib.h>
#include <HystereticMaterial.h>
#include <OPS_Globals.h>
#include <math.h>
#include <float.h>

#include <HystereticMaterial.h>
#include <Channel.h>
#include <Information.h>
#include <Parameter.h>

#include <OPS_Globals.h>
#include <elementAPI.h>

void *
Expand Down Expand Up @@ -685,6 +688,110 @@ HystereticMaterial::Print(OPS_Stream &s, int flag)
}
}

int
HystereticMaterial::setParameter(const char **argv, int argc, Parameter &param)
{
if (strcmp(argv[0],"mom1p") == 0 || strcmp(argv[0],"fy") == 0 || strcmp(argv[0],"Fy") == 0) {
param.setValue(mom1p);
return param.addObject(1, this);
}
if (strcmp(argv[0],"rot1p") == 0) {
param.setValue(rot1p);
return param.addObject(2, this);
}
if (strcmp(argv[0],"mom2p") == 0) {
param.setValue(mom2p);
return param.addObject(3, this);
}
if (strcmp(argv[0],"rot2p") == 0) {
param.setValue(rot2p);
return param.addObject(4, this);
}
if (strcmp(argv[0],"mom3p") == 0) {
param.setValue(mom3p);
return param.addObject(5, this);
}
if (strcmp(argv[0],"rot3p") == 0) {
param.setValue(rot3p);
return param.addObject(6, this);
}
if (strcmp(argv[0],"mom1n") == 0) {
param.setValue(mom1n);
return param.addObject(7, this);
}
if (strcmp(argv[0],"rot1n") == 0) {
param.setValue(rot1n);
return param.addObject(8, this);
}
if (strcmp(argv[0],"mom2n") == 0) {
param.setValue(mom2n);
return param.addObject(9, this);
}
if (strcmp(argv[0],"rot2n") == 0) {
param.setValue(rot2n);
return param.addObject(10, this);
}
if (strcmp(argv[0],"mom3n") == 0) {
param.setValue(mom3n);
return param.addObject(11, this);
}
if (strcmp(argv[0],"rot3n") == 0) {
param.setValue(rot3n);
return param.addObject(12, this);
}

return -1;
}

int
HystereticMaterial::updateParameter(int parameterID, Information &info)
{
switch (parameterID) {
case -1:
return -1;
case 1:
this->mom1p = info.theDouble;
break;
case 2:
this->rot1p = info.theDouble;
break;
case 3:
this->mom2p = info.theDouble;
break;
case 4:
this->rot2p = info.theDouble;
break;
case 5:
this->mom3p = info.theDouble;
break;
case 6:
this->rot3p = info.theDouble;
break;
case 7:
this->mom1n = info.theDouble;
break;
case 8:
this->rot1n = info.theDouble;
break;
case 9:
this->mom2n = info.theDouble;
break;
case 10:
this->rot2n = info.theDouble;
break;
case 11:
this->mom3n = info.theDouble;
break;
case 12:
this->rot3n = info.theDouble;
break;
default:
return -1;
}

return 0;
}

void
HystereticMaterial::setEnvelope(void)
{
Expand Down
4 changes: 4 additions & 0 deletions SRC/material/uniaxial/HystereticMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ class HystereticMaterial : public UniaxialMaterial
FEM_ObjectBroker &theBroker);

void Print(OPS_Stream &s, int flag =0);

int setParameter(const char **argv, int argc, Parameter &param);
int updateParameter(int parameterID, Information &info);

//by SAJalali
double getEnergy() { return CenergyD; }

Expand Down

0 comments on commit 6082540

Please sign in to comment.