| 101 | |
| 102 | |
| 103 | int |
| 104 | SystemAnalysis::initialize() |
| 105 | { |
| 106 | // Initial declarations |
| 107 | double beta; |
| 108 | NormalRV uRV(1, 0.0, 1.0); |
| 109 | |
| 110 | if (strlen(betaFile) > 1 && strlen(rhoFile) > 1) { |
| 111 | // read data for beta and rho from file, do not take from reliability domain |
| 112 | ifstream inputBeta( betaFile, ios::in ); |
| 113 | if (!inputBeta) { |
| 114 | opserr << "SystemAnalysis::initialize ERROR - could not open beta file " << betaFile << endln; |
| 115 | return -1; |
| 116 | } |
| 117 | ifstream inputRho( rhoFile, ios::in ); |
| 118 | if (!inputRho) { |
| 119 | opserr << "SystemAnalysis::initialize ERROR - could not open rho file " << rhoFile << endln; |
| 120 | return -1; |
| 121 | } |
| 122 | |
| 123 | numLsf = 0; |
| 124 | while (inputBeta >> beta) |
| 125 | numLsf++; |
| 126 | inputBeta.clear(); |
| 127 | inputBeta.seekg(0); |
| 128 | |
| 129 | // allocate arrays |
| 130 | allBetas = new Vector(numLsf); |
| 131 | allPf1s = new Vector(numLsf); |
| 132 | rhos = new Matrix(numLsf,numLsf); |
| 133 | |
| 134 | // read data from file into arrays |
| 135 | for (int i=0; i < numLsf; i++ ) { |
| 136 | inputBeta >> (*allBetas)(i); |
| 137 | (*allPf1s)(i) = 1.0 - uRV.getCDFvalue( (*allBetas)(i) ); |
| 138 | |
| 139 | for (int j=0; j < numLsf; j++ ) { |
| 140 | if (!inputRho.eof() ) |
| 141 | inputRho >> (*rhos)(i,j); |
| 142 | else { |
| 143 | opserr << "SystemAnalysis::initialize ERROR - rho file does not contain the same data size as the beta file" |
| 144 | << endln; |
| 145 | return -1; |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | inputBeta.close(); |
| 151 | inputRho.close(); |
| 152 | |
| 153 | } else { |
| 154 | // proceed with reliability domain data, requires previous FORM analysis objects |
| 155 | |
| 156 | // Number of limit-state functions |
| 157 | numLsf = theReliabilityDomain->getNumberOfLimitStateFunctions(); |
| 158 | |
| 159 | // Number of random variables |
| 160 | int numRV = theReliabilityDomain->getNumberOfRandomVariables(); |
nothing calls this directly
no test coverage detected