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

Function OPS_sensitivityAlgorithm

SRC/interpreter/OpenSeesCommands.cpp:3801–3838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3799}
3800
3801int OPS_sensitivityAlgorithm()
3802{
3803 if (cmds == 0) return 0;
3804
3805 int analysisTypeTag = 1;
3806 Integrator* theIntegrator = 0;
3807 if(cmds->getStaticIntegrator() != 0) {
3808 theIntegrator = cmds->getStaticIntegrator();
3809 } else if(cmds->getTransientIntegrator() != 0) {
3810 theIntegrator = cmds->getTransientIntegrator();
3811 }
3812
3813 // 1: compute at each step (default); 2: compute by command;
3814 if (OPS_GetNumRemainingInputArgs() < 1) {
3815 opserr << "ERROR: Wrong number of parameters to sensitivity algorithm." << "\n";
3816 return -1;
3817 }
3818 if (theIntegrator == 0) {
3819 opserr << "The integrator needs to be instantiated before " << "\n"
3820 << " setting sensitivity algorithm." << "\n";
3821 return -1;
3822 }
3823
3824 const char* type = OPS_GetString();
3825 if (strcmp(type,"-computeAtEachStep") == 0)
3826 analysisTypeTag = 1;
3827 else if (strcmp(type,"-computeByCommand") == 0)
3828 analysisTypeTag = 2;
3829 else {
3830 opserr << "Unknown sensitivity algorithm option: " << type << "\n";
3831 return -1;
3832 }
3833
3834 theIntegrator->setComputeType(analysisTypeTag);
3835 theIntegrator->activateSensitivityKey();
3836
3837 return 0;
3838}
3839// Sensitivity:END /////////////////////////////////////////////

Callers 2

Calls 6

OPS_GetStringFunction · 0.70
getStaticIntegratorMethod · 0.45
setComputeTypeMethod · 0.45

Tested by

no test coverage detected