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

Method analyze

SRC/reliability/analysis/analysis/ImportanceSamplingAnalysis.cpp:95–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95int
96ImportanceSamplingAnalysis::analyze(void)
97{
98
99 // Alert the user that the simulation analysis has started
100 opserr << "ImportanceSampling Analysis is running ... " << endln;
101
102 // Declaration of some of the data used in the algorithm
103 double gFunctionValue;
104 int result, I, seed = 1;
105 long int k = 1;
106 double det_covariance, phi, h, q;
107 int numRV = theReliabilityDomain->getNumberOfRandomVariables();
108 int numParam = theOpenSeesDomain->getNumParameters();
109 int numLsf = theReliabilityDomain->getNumberOfLimitStateFunctions();
110
111 Vector x(numRV);
112 Vector z(numRV);
113 Vector u(numRV);
114 Vector randomArray(numRV);
115 static NormalRV aStdNormRV(1,0.0,1.0);
116 bool failureHasOccured = false;
117
118 det_covariance = pow(samplingStdv, numRV);
119
120
121 // Pre-compute some factors to minimize computations inside simulation loop
122 static const double twopi = 2.0*acos(-1.0);
123 double factor1 = 1.0 / ( pow(twopi,0.5*numRV));
124 //double factor2 = 1.0 / ( pow(twopi,0.5*numRV) * sqrt(det_covariance) );
125 double factor2 = factor1 / sqrt(det_covariance);
126
127
128 Vector sum_q(numLsf);
129 Vector sum_q_squared(numLsf);
130 double var_qbar;
131 double pfIn;
132 double CovIn;
133 char restartFileName[256];
134 sprintf(restartFileName,"%s_%s","restart",fileName);
135
136
137 if (analysisTypeTag == 1) {
138 // Possible read data from file if this is a restart simulation
139 if (printFlag == 2) {
140 ifstream inputFile( restartFileName, ios::in );
141 inputFile >> k;
142 inputFile >> seed;
143 if (k == 1 && seed == 1) {
144 }
145 else {
146 for (int i=1; i<=numLsf; i++) {
147 inputFile >> pfIn;
148 if (pfIn > 0.0) {
149 failureHasOccured = true;
150 }
151 inputFile >> CovIn;
152 sum_q(i-1) = pfIn*k;

Callers

nothing calls this directly

Tested by

no test coverage detected