36 #include <boost/multi_array.hpp>
58 void NodeOpti::CalcMinJac()
60 m_minJac = numeric_limits<double>::max();
61 map<LibUtilities::ShapeType, vector<ElUtilSharedPtr> >
::iterator typeIt;
62 for (typeIt = m_data.begin(); typeIt != m_data.end(); typeIt++)
64 for (
int i = 0; i < typeIt->second.size(); i++)
66 m_minJac = min(m_minJac, typeIt->second[i]->GetMinJac());
72 22, NodeOpti2D2D::create,
"2D2D");
74 void NodeOpti2D2D::Optimise()
77 NekDouble currentW = GetFunctional<2>(minJacNew);
81 if (m_grad[0] * m_grad[0] + m_grad[1] * m_grad[1] > gradTol())
96 m_grad[2] += 1e-6 - val;
97 m_grad[4] += 1e-6 - val;
100 sk[0] = -1.0 / (m_grad[2] * m_grad[4] - m_grad[3] * m_grad[3]) *
101 (m_grad[4] * m_grad[0] - m_grad[3] * m_grad[1]);
102 sk[1] = -1.0 / (m_grad[2] * m_grad[4] - m_grad[3] * m_grad[3]) *
103 (m_grad[2] * m_grad[1] - m_grad[3] * m_grad[0]);
106 NekDouble pg = (m_grad[0] * sk[0] + m_grad[1] * sk[1]);
110 while (alpha > alphaTol())
113 m_node->m_x = xc + alpha * sk[0];
114 m_node->m_y = yc + alpha * sk[1];
116 newVal = GetFunctional<2>(minJacNew,
false);
119 if (newVal <= currentW + c1() * (alpha * pg))
140 m_minJac = minJacNew;
151 m_res->val = max(sqrt((m_node->m_x - xc) * (m_node->m_x - xc) +
152 (m_node->m_y - yc) * (m_node->m_y - yc)),
158 m_res->func += newVal;
163 33, NodeOpti3D3D::create,
"3D3D");
165 void NodeOpti3D3D::Optimise()
168 NekDouble currentW = GetFunctional<3>(minJacNew);
171 if (m_grad[0] * m_grad[0] + m_grad[1] * m_grad[1] + m_grad[2] * m_grad[2] >
188 m_grad[3] += 1e-6 - val;
189 m_grad[6] += 1e-6 - val;
190 m_grad[8] += 1e-6 - val;
195 m_grad[3] * (m_grad[6] * m_grad[8] - m_grad[7] * m_grad[7]) -
196 m_grad[4] * (m_grad[4] * m_grad[8] - m_grad[5] * m_grad[7]) +
197 m_grad[5] * (m_grad[4] * m_grad[7] - m_grad[5] * m_grad[6]);
199 sk[0] = m_grad[0] * (m_grad[6] * m_grad[8] - m_grad[7] * m_grad[7]) +
200 m_grad[1] * (m_grad[5] * m_grad[7] - m_grad[4] * m_grad[8]) +
201 m_grad[2] * (m_grad[4] * m_grad[7] - m_grad[3] * m_grad[7]);
202 sk[1] = m_grad[0] * (m_grad[7] * m_grad[5] - m_grad[4] * m_grad[5]) +
203 m_grad[1] * (m_grad[3] * m_grad[8] - m_grad[5] * m_grad[5]) +
204 m_grad[2] * (m_grad[4] * m_grad[5] - m_grad[3] * m_grad[7]);
205 sk[2] = m_grad[0] * (m_grad[4] * m_grad[7] - m_grad[6] * m_grad[5]) +
206 m_grad[1] * (m_grad[4] * m_grad[5] - m_grad[3] * m_grad[7]) +
207 m_grad[2] * (m_grad[3] * m_grad[6] - m_grad[4] * m_grad[4]);
216 (m_grad[0] * sk[0] + m_grad[1] * sk[1] + m_grad[2] * sk[2]);
221 while (alpha > alphaTol())
224 m_node->m_x = xc + alpha * sk[0];
225 m_node->m_y = yc + alpha * sk[1];
226 m_node->m_z = zc + alpha * sk[2];
228 newVal = GetFunctional<3>(minJacNew,
false);
233 if (newVal <= currentW + c1() * alpha * pg)
254 m_minJac = minJacNew;
265 m_res->val = max(sqrt((m_node->m_x - xc) * (m_node->m_x - xc) +
266 (m_node->m_y - yc) * (m_node->m_y - yc) +
267 (m_node->m_z - zc) * (m_node->m_z - zc)),
272 m_res->func += newVal;
NodeOptiFactory & GetNodeOptiFactory()
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
Provides a generic Factory class.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.