Skip to content

Commit

Permalink
Eliminated old material testing commands
Browse files Browse the repository at this point in the history
The new commands in OpenSeesMaterialTestCommands.cpp replace the functionality of the ones in OpenSeesUniaxialMaterialCommands.cpp. Additionally, the old implementation was prone to error - it didn't create a copy of the uniaxial material, it actually changed the state of the original material.
  • Loading branch information
ambaker1 committed Jun 14, 2021
1 parent ba02a2b commit 94e9127
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 139 deletions.
6 changes: 0 additions & 6 deletions SRC/interpreter/OpenSeesCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,6 @@ class OpenSeesCommands

/* OpenSeesUniaxialMaterialCommands.cpp */
int OPS_UniaxialMaterial();
int OPS_testUniaxialMaterial();
int OPS_setStrain();
int OPS_getStrain();
int OPS_getStress();
int OPS_getTangent();
int OPS_getDampTangent();
int OPS_LimitCurve();

int OPS_hystereticBackbone();
Expand Down
4 changes: 4 additions & 0 deletions SRC/interpreter/OpenSeesMaterialTestCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// Created: 06/12
//
// Description: This file contains the material testing commands
// The test material is set with testUniaxialMaterial, testNDMaterial, or testSection
// The test strains/deformations are set with setStrain, or setTrialStrain and commitStrain
// The test state information is then queried with getStrain, getStress, getTangent, getDampTangent, and getResponse

#include <UniaxialMaterial.h>
#include <NDMaterial.h>
Expand All @@ -53,6 +56,7 @@ static UniaxialMaterial* theTestingUniaxialMaterial = 0;
static NDMaterial* theTestingNDMaterial = 0;
static SectionForceDeformation* theTestingSection = 0;

// Method to be invoked by wipe(), clears all test materials and resets the testType flag.
void OPS_clearAllTestMaterials(void)
{
testType = 0;
Expand Down
133 changes: 0 additions & 133 deletions SRC/interpreter/OpenSeesUniaxialMaterialCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,139 +439,6 @@ OPS_UniaxialMaterial()

}

int OPS_testUniaxialMaterial()
{
if (OPS_GetNumRemainingInputArgs() != 1) {
opserr<<"testUniaxialMaterial - You must provide a material tag.\n";
return -1;
}

int tag;
int numData = 1;
if (OPS_GetIntInput(&numData, &tag) < 0) {
opserr<<"invalid int value\n";
return -1;
}

UniaxialMaterial* mat =OPS_getUniaxialMaterial(tag);

if (mat == 0) {
opserr<<"testUniaxialMaterial - Material Not Found.\n";
return -1;
}

theTestingUniaxialMaterial = mat;

return 0;
}

int OPS_setStrain()
{
if (OPS_GetNumRemainingInputArgs() != 1) {
opserr<<"testUniaxialMaterial - You must provide a strain value.\n";
return -1;
}

UniaxialMaterial* material = theTestingUniaxialMaterial;

if (material == 0) {
opserr<<"setStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command.\n";
return -1;
}

double strain;
int numData = 1;
if (OPS_GetDoubleInput(&numData, &strain) < 0) {
opserr<<"invalid double value\n";
return -1;
}

material->setTrialStrain(strain);
material->commitState();

return 0;
}

int OPS_getStrain()
{
UniaxialMaterial* material = theTestingUniaxialMaterial;
if (material == 0) {
opserr<<"getStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command.\n";
return -1;
}

double strain = material->getStrain();

int numData = 1;

if (OPS_SetDoubleOutput(&numData, &strain, true) < 0) {
opserr<<"failed to set strain\n";
return -1;
}

return 0;
}

int OPS_getStress()
{
UniaxialMaterial* material = theTestingUniaxialMaterial;
if (material == 0) {
opserr<<"getStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command.\n";
return -1;
}

double stress = material->getStress();

int numData = 1;

if (OPS_SetDoubleOutput(&numData, &stress, true) < 0) {
opserr<<"failed to set stress\n";
return -1;
}

return 0;
}

int OPS_getTangent()
{
UniaxialMaterial* material = theTestingUniaxialMaterial;
if (material == 0) {
opserr<<"getStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command.\n";
return -1;
}

double tangent = material->getTangent();

int numData = 1;

if (OPS_SetDoubleOutput(&numData, &tangent, true) < 0) {
opserr<<"failed to set tangent\n";
return -1;
}

return 0;
}

int OPS_getDampTangent()
{
UniaxialMaterial* material = theTestingUniaxialMaterial;
if (material == 0) {
opserr<<"getStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command.\n";
return -1;
}

double tangent = material->getDampTangent();

int numData = 1;

if (OPS_SetDoubleOutput(&numData, &tangent, true) < 0) {
opserr<<"failed to set damp tangent\n";
return -1;
}

return 0;
}

void* OPS_RotationShearCurve();
void* OPS_ThreePointCurve();
void* OPS_ShearCurve();
Expand Down
1 change: 1 addition & 0 deletions Win64/proj/openSeesPy/OpenSeesPy.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesCrdTransfCommands.cpp" />
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesElementCommands.cpp" />
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesFrictionModelCommands.cpp" />
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesMaterialTestCommands.cpp" />
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesMiscCommands.cpp" />
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesNDMaterialCommands.cpp" />
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesOutputCommands.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions Win64/proj/openSeesPy/OpenSeesPy.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<ClCompile Include="..\..\..\SRC\reliability\domain\distributions\PythonRV.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SRC\interpreter\OpenSeesMaterialTestCommands.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\SRC\classTags.h">
Expand Down

0 comments on commit 94e9127

Please sign in to comment.