| 87 | } |
| 88 | |
| 89 | int MonteCarloResponseAnalysis::analyze(){ |
| 90 | |
| 91 | |
| 92 | opserr << "Monte Carlo Response Analysis is running ... " << endln; |
| 93 | |
| 94 | |
| 95 | int result; |
| 96 | int kk = 0; |
| 97 | bool isFirstSimulation = true; |
| 98 | //int seed = 1; |
| 99 | if (printFlag ==2) { |
| 100 | |
| 101 | // check whether the restart file '_restart.tmp' exist, (this file is wrote by openSees only, not by user) |
| 102 | // if yes, read data;{ success reading: set values above; otherwise: do noting} |
| 103 | // if no, create file '_restart.tmp' |
| 104 | // data format: seed numOfGFunEvaluations |
| 105 | |
| 106 | ifstream inputFile( "_restart.tmp", ios::in ); |
| 107 | if (!inputFile) { |
| 108 | // file doesn't exist; so it's safe to create it and write to it |
| 109 | |
| 110 | } |
| 111 | else { |
| 112 | inputFile >> seed; |
| 113 | inputFile >> kk; |
| 114 | inputFile.close(); |
| 115 | isFirstSimulation = false; |
| 116 | } |
| 117 | |
| 118 | } |
| 119 | |
| 120 | int numRV = theReliabilityDomain->getNumberOfRandomVariables(); |
| 121 | |
| 122 | Vector x(numRV); |
| 123 | |
| 124 | Vector u(numRV); |
| 125 | Vector randomArray(numRV); |
| 126 | |
| 127 | ofstream *outputFile = 0; |
| 128 | |
| 129 | |
| 130 | |
| 131 | // Prepare output file |
| 132 | ofstream resultsOutputFile( fileName, ios::out ); |
| 133 | |
| 134 | |
| 135 | |
| 136 | while( kk< numberOfSimulations){ // && govCov>targetCOV || k<=2) ) { |
| 137 | |
| 138 | // Keep the user posted |
| 139 | if (printFlag == 1 || printFlag == 2) { |
| 140 | opserr << "Sample #" << kk << ":" << endln; |
| 141 | // resultsOutputFile<< "Sample #" << kk << ":" << endln; |
| 142 | |
| 143 | } |
| 144 | |
| 145 | |
| 146 | // Create array of standard normal random numbers |
nothing calls this directly
no test coverage detected