Subversion Repositories OpenSees

Rev

Rev 3406 | Rev 3490 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3406 Rev 3408
Line 20... Line 20...
20
**   Terje Haukaas (haukaas@ce.berkeley.edu)                          **
20
**   Terje Haukaas (haukaas@ce.berkeley.edu)                          **
21
**   Armen Der Kiureghian (adk@ce.berkeley.edu)                       **
21
**   Armen Der Kiureghian (adk@ce.berkeley.edu)                       **
22
**                                                                    **
22
**                                                                    **
23
** ****************************************************************** */
23
** ****************************************************************** */
24
                                                                       
24
                                                                       
25
// $Revision: 1.40 $
-
 
26
// $Date: 2008-04-10 18:11:14 $
-
 
-
 
25
// $Revision: 1.41 $
-
 
26
// $Date: 2008-04-10 18:23:31 $
27
// $Source: /usr/local/cvs/OpenSees/SRC/reliability/tcl/TclReliabilityBuilder.cpp,v $
27
// $Source: /usr/local/cvs/OpenSees/SRC/reliability/tcl/TclReliabilityBuilder.cpp,v $
28
28
29
29
30
//
30
//
31
// Written by Terje Haukaas (haukaas@ce.berkeley.edu) 
31
// Written by Terje Haukaas (haukaas@ce.berkeley.edu) 
Line 8814... Line 8814...
8814
8814
8815
///getGammaFORM is not in K.F.
8815
///getGammaFORM is not in K.F.
8816
int
8816
int
8817
TclReliabilityModelBuilder_getGammaFORM(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
8817
TclReliabilityModelBuilder_getGammaFORM(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
8818
{
8818
{
8819
  if (argc < 3) {
-
 
-
 
8819
  if (argc < 2) {
8820
    opserr << "ERROR: Invalid number of arguments to getGammaFORM command." << endln;
8820
    opserr << "ERROR: Invalid number of arguments to getGammaFORM command." << endln;
8821
    return TCL_ERROR;
8821
    return TCL_ERROR;
8822
  }
8822
  }
8823
8823
8824
  int lsfTag, rvTag;
-
 
-
 
8824
  int lsfTag;
8825
  if (Tcl_GetInt(interp, argv[1], &lsfTag) != TCL_OK) {
8825
  if (Tcl_GetInt(interp, argv[1], &lsfTag) != TCL_OK) {
8826
    opserr << "WARNING gammaFORM lsfTag? rvTag? - could not read lsfTag\n";
8826
    opserr << "WARNING gammaFORM lsfTag? rvTag? - could not read lsfTag\n";
8827
    return TCL_ERROR;          
8827
    return TCL_ERROR;          
8828
  }  
-
 
8829
  if (Tcl_GetInt(interp, argv[2], &rvTag) != TCL_OK) {
-
 
8830
    opserr << "WARNING gammaFORM lsfTag? rvTag? - could not read rvTag\n";
-
 
8831
    return TCL_ERROR;          
-
 
8832
  }  
-
 
-
 
8828
  }
8833
8829
8834
  LimitStateFunction *theLSF =
8830
  LimitStateFunction *theLSF =
8835
    theReliabilityDomain->getLimitStateFunctionPtr(lsfTag);
8831
    theReliabilityDomain->getLimitStateFunctionPtr(lsfTag);
8836
-
 
-
 
8832
 
8837
  if (theLSF == 0) {
8833
  if (theLSF == 0) {
8838
    opserr << "WARNING gammaFORM LSF with tag " << lsfTag << " not found\n";
8834
    opserr << "WARNING gammaFORM LSF with tag " << lsfTag << " not found\n";
8839
    return TCL_ERROR;          
-
 
8840
  }
-
 
8841
-
 
8842
  RandomVariable *theRV =
-
 
8843
    theReliabilityDomain->getRandomVariablePtr(rvTag);
-
 
8844
-
 
8845
  if (theRV == 0) {
-
 
8846
    opserr << "WARNING gammaFORM RV with tag " << rvTag << " not found\n";
-
 
8847
    return TCL_ERROR;          
8835
    return TCL_ERROR;          
8848
  }
8836
  }
8849
8837
8850
  const Vector &gammaVec = theLSF->getFORM_gamma();
8838
  const Vector &gammaVec = theLSF->getFORM_gamma();
8851
  int index = theReliabilityDomain->getRandomVariableIndex(rvTag);
-
 
8852
  double gamma = gammaVec(index);
-
 
8853
-
 
-
 
8839
 
8854
  char buffer[40];
8840
  char buffer[40];
8855
  sprintf(buffer,"%35.20f",gamma);
-
 
8856
8841
8857
  Tcl_SetResult(interp, buffer, TCL_VOLATILE);
-
 
-
 
8842
  if (argc > 2) {
-
 
8843
    int rvTag;
-
 
8844
    if (Tcl_GetInt(interp, argv[2], &rvTag) != TCL_OK) {
-
 
8845
      opserr << "WARNING gammaFORM lsfTag? rvTag? - could not read rvTag\n";
-
 
8846
      return TCL_ERROR;        
-
 
8847
    }  
-
 
8848
   
-
 
8849
    RandomVariable *theRV =
-
 
8850
      theReliabilityDomain->getRandomVariablePtr(rvTag);
-
 
8851
   
-
 
8852
    if (theRV == 0) {
-
 
8853
      opserr << "WARNING gammaFORM RV with tag " << rvTag << " not found\n";
-
 
8854
      return TCL_ERROR;        
-
 
8855
    }
-
 
8856
 
-
 
8857
    int index = theReliabilityDomain->getRandomVariableIndex(rvTag);
-
 
8858
    double gamma = gammaVec(index);
-
 
8859
   
-
 
8860
    sprintf(buffer,"%35.20f",gamma);
-
 
8861
   
-
 
8862
    Tcl_SetResult(interp, buffer, TCL_VOLATILE);
-
 
8863
  }
-
 
8864
  else {
-
 
8865
    int nrv = gammaVec.Size();
-
 
8866
    for (int i = 0; i < nrv; i++) {
-
 
8867
      sprintf(buffer, "%35.20f ", gammaVec(i));
-
 
8868
      Tcl_AppendResult(interp, buffer, NULL);
-
 
8869
    }
-
 
8870
  }
8858
8871
8859
  return TCL_OK;
8872
  return TCL_OK;
8860
}
8873
}
8861
8874
8862
8875