45 namespace NekMeshUtils
59 for (
int i = 0; i < ti.num_elements(); i++)
63 ti[i] = (xi[i] - ui[i]) / J(i, 0);
67 ti[i] = (xi[i] - li[i]) / J(i, 0);
71 ti[i] = numeric_limits<double>::max();
80 DNekMat d(xi.num_elements(), 1);
81 for (
int i = 0; i < xi.num_elements(); i++)
83 if (fabs(ti[i]) < 1E-10)
89 d(i, 0) = -1.0 * J(i, 0);
95 for (
int i = 0; i < xci.num_elements(); i++)
97 if (xi[i] + d(i, 0) < li[i])
105 xci[i] = xi[i] + d(i, 0);
108 if (xi[i] + d(i, 0) > ui[i])
116 xci[i] = xi[i] + d(i, 0);
120 DNekMat Z(xci.num_elements(), xci.num_elements(), 0.0);
123 for (
int i = 0; i < xci.num_elements(); i++)
126 if (it != Fset.end())
132 DNekMat dx(xci.num_elements(), 1, 0.0);
133 for (
int i = 0; i < xci.num_elements(); i++)
135 dx(i, 0) = xci[i] - xi[i];
143 for (it = Fset.begin(); it != Fset.end(); it++)
146 if (li[i] - xci[i] > alpha * du(i, 0))
148 alpha = min(alpha, (li[i] - xci[i]) / du(i, 0));
150 else if (ui[i] - xci[i] < alpha * du(i, 0))
152 alpha = min(alpha, (ui[i] - xci[i]) / du(i, 0));
159 for (
int i = 0; i < xci.num_elements(); i++)
164 xibar[i] = xci[i] + grad(i, 0);
172 Vmath::Vsub(xci.num_elements(), &xibar[0], 1, &xi[0], 1, &dk[0], 1);
177 for (
int i = 0; i < dk.num_elements(); i++)
179 c += 1E-4 * J(i, 0) * dk[i];
180 r += J(i, 0) * dk[i];
208 for (
int i = 0; i < xi.num_elements(); i++)
210 tst[i] = xi[i] + lam * dk[i];
218 for (
int i = 0; i < dk.num_elements(); i++)
220 l += jn(i, 0) * dk[i];
223 }
while (fn > fo + c || fabs(l) > 1.0 * fabs(r));
232 DNekMat s(dk.num_elements(), 1, 0.0);
233 for (
int i = 0; i < dk.num_elements(); i++)
235 s(i, 0) = lam * dk[i];
246 for (
int i = 0; i < dk.num_elements(); i++)
248 ynorm += y(i, 0) * y(i, 0);
251 if (d3(0, 0) > 2.2E-16 * ynorm)
253 B = B + y * yT * (1.0 / d1(0, 0)) - B * s * sT * B * (1.0 / d2(0, 0));
254 H = H + (d3(0, 0) + n1(0, 0)) / d3(0, 0) / d3(0, 0) * s * sT -
255 1.0 / d3(0, 0) * (H * y * sT + s * yT * H);
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< OptiObj > OptiObjSharedPtr
bool BGFSUpdate(OptiObjSharedPtr opti, DNekMat &J, DNekMat &B, DNekMat &H)