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

Method test

SRC/convergenceTest/CTestRelativeNormDispIncr.cpp:111–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109
110
111int CTestRelativeNormDispIncr::test(void)
112{
113 // check to ensure the SOE has been set - this should not happen if the
114 // return from start() is checked
115 if (theSOE == 0) {
116 opserr << "WARNING: CTestRelativeNormDispIncr::test() - no SOE set.\n";
117 return -1;
118 }
119
120 // check to ensure the algo does invoke start() - this is needed otherwise
121 // may never get convergence later on in analysis!
122 if (currentIter == 0) {
123 opserr << "WARNING: CTestRelativeNormDispIncr::test() - start() was never invoked.\n";
124 return -2;
125 }
126
127 // get the X vector & determine it's norm & save the value in norms vector
128 const Vector &x = theSOE->getX();
129 double norm = x.pNorm(nType);
130 if (currentIter <= maxNumIter)
131 norms(currentIter-1) = norm;
132
133 // if first pass through .. set norm0
134 if (currentIter == 1) {
135 norm0 = norm;
136 }
137
138 // get ratio
139 if (norm0 != 0.0)
140 norm /= norm0;
141
142 // print the data if required
143 if (printFlag == 1) {
144 opserr << "CTestRelativeNormDispIncr::test() - iteration: " << currentIter;
145 opserr << " current Ratio (|dX|/|dX1|): " << norm << " (max: " << tol << ")\n";
146 }
147 if (printFlag == 4) {
148 opserr << "CTestRelativeNormDispIncr::test() - iteration: " << currentIter;
149 opserr << " current Ratio (|dX|/|dX1|): " << norm << " (max: " << tol << ")\n";
150 opserr << "\tNorm deltaX: " << norm << ", Norm deltaR: " << theSOE->getB().pNorm(nType) << endln;
151 opserr << "\tdeltaX: " << x << "\tdeltaR: " << theSOE->getB();
152 }
153
154 //
155 // check if the algorithm converged
156 //
157
158 // if converged - print & return ok
159 if (norm <= tol){
160
161 // do some printing first
162 if (printFlag != 0) {
163 if (printFlag == 1 || printFlag == 4)
164 opserr << endln;
165 else if (printFlag == 2 || printFlag == 6) {
166 opserr << "CTestRelativeNormDispIncr::test() - iteration: " << currentIter;
167 opserr << " current Ratio (|dX|/|dX1|): " << norm << " (max: " << tol << ")\n";
168 }

Callers

nothing calls this directly

Calls 3

getBMethod · 0.80
getXMethod · 0.45
pNormMethod · 0.45

Tested by

no test coverage detected