37 #include "I_DFTFamilyFunctions.hpp"
38 #include "TargetMatrix.hpp"
40 using namespace Mesquite;
67 const int tetInd[4][4] = {{0, 1, 2, 3}, {1, 2, 0, 3},
68 {2, 0, 1, 3}, {3, 2, 1, 0}};
69 const int hexInd[8][4] = {{0, 1, 3, 4}, {1, 2, 0, 5},
70 {2, 3, 1, 6}, {3, 0, 2, 7},
71 {4, 7, 5, 0}, {5, 4, 6, 1},
72 {6, 5, 7, 2}, {7, 6, 4, 3}};
86 for (i = 0; i < 3; ++
i) {
87 for (j = 0; j < 3; ++
j) {
97 if (!mValid)
return false;
110 for (i = 0; i < 4; ++
i) {
111 for (j = 0; j < 3; ++
j) {
119 if (!mValid)
return false;
129 for (i = 0; i < 4; ++
i) {
130 for (j = 0; j < 4; ++
j) {
139 if (!mValid)
return false;
149 for (i = 0; i < 8; ++
i) {
150 for (j = 0; j < 4; ++
j) {
159 if (!mValid)
return false;
200 const int tetInd[4][4] = {{0, 1, 2, 3}, {1, 2, 0, 3},
201 {2, 0, 1, 3}, {3, 2, 1, 0}};
202 const int hexInd[8][4] = {{0, 1, 3, 4}, {1, 2, 0, 5},
203 {2, 3, 1, 6}, {3, 0, 2, 7},
204 {4, 7, 5, 0}, {5, 4, 6, 1},
205 {6, 5, 7, 2}, {7, 6, 4, 3}};
228 for (i = 0; i < 3; ++
i) {
230 for (j = 0; j < 3; ++
j) {
232 if (vertices + v_i[tetInd[i][j]] == fv[0]) {
260 if (!mValid)
return false;
275 if (!mValid)
return false;
284 for (i = 0; i < 3; ++
i) {
288 for (i = 0; i < 3; ++
i) {
289 for (j = 0; j < 3; ++
j) {
300 if (!mValid)
return false;
302 for (j = 0; j < 3; ++
j) {
308 for (i = 0; i < 3; ++
i) {
316 for (i = 0; i < 3; ++
i) {
317 for (j = 0; j < nfv; ++
j) {
318 if (vertices + v_i[i] == fv[j]) {
340 for (i = 0; i < 4; ++
i) {
342 for (j = 0; j < 3; ++
j) {
344 if (vertices + v_i[hexInd[i][j]] == fv[0]) {
370 if (!mValid)
return false;
388 if (!mValid)
return false;
397 for (i = 0; i < 4; ++
i) {
401 for (i = 0; i < 4; ++
i) {
402 for (j = 0; j < 3; ++
j) {
411 if (!mValid)
return false;
413 for (j = 0; j < 3; ++
j) {
419 for (i = 0; i < 4; ++
i) {
427 for (i = 0; i < 4; ++
i) {
428 for (j = 0; j < nfv; ++
j) {
429 if (vertices + v_i[i] == fv[j]) {
444 for (i = 0; i < 4; ++
i) {
446 for (j = 0; j < 4; ++
j) {
448 if (vertices + v_i[tetInd[i][j]] == fv[0]) {
479 if (!mValid)
return false;
491 if (!mValid)
return false;
500 for (i = 0; i < 4; ++
i) {
504 for (i = 0; i < 4; ++
i) {
505 for (j = 0; j < 4; ++
j) {
514 if (!mValid)
return false;
517 for (j = 0; j < 4; ++
j) {
523 for (i = 0; i < 4; ++
i) {
531 for (i = 0; i < 4; ++
i) {
532 for (j = 0; j < nfv; ++
j) {
533 if (vertices + v_i[i] == fv[j]) {
548 for (i = 0; i < 8; ++
i) {
550 for (j = 0; j < 4; ++
j) {
552 if (vertices + v_i[hexInd[i][j]] == fv[0]) {
583 if (!mValid)
return false;
600 if (!mValid)
return false;
609 for (i = 0; i < 8; ++
i) {
613 for (i = 0; i < 8; ++
i) {
614 for (j = 0; j < 4; ++
j) {
623 if (!mValid)
return false;
626 for (j = 0; j < 4; ++
j) {
632 for (i = 0; i < 8; ++
i) {
640 for (i = 0; i < 8; ++
i) {
641 for (j = 0; j < nfv; ++
j) {
642 if (vertices + v_i[i] == fv[j]) {
685 const int tetInd[4][4] = {{0, 1, 2, 3}, {1, 2, 0, 3},
686 {2, 0, 1, 3}, {3, 2, 1, 0}};
687 const int hexInd[8][4] = {{0, 1, 3, 4}, {1, 2, 0, 5},
688 {2, 3, 1, 6}, {3, 0, 2, 7},
689 {4, 7, 5, 0}, {5, 4, 6, 1},
690 {6, 5, 7, 2}, {7, 6, 4, 3}};
695 int i,
j,
k, l, mVert;
710 for (i = 0; i < 3; ++
i) {
714 for (i = 0; i < 6; ++
i) {
728 for (i = 0; i < 3; ++
i) {
730 for (j = 0; j < 3; ++
j) {
732 if (vertices + v_i[tetInd[i][j]] == fv[0]) {
763 if (!mValid)
return false;
779 if (!mValid)
return false;
788 for (i = 0; i < 3; ++
i) {
789 if (vertices + v_i[i] == fv[0]) {
811 for (i = 0; i < 3; ++
i) {
812 for (j = 0; j < 3; ++
j) {
823 if (!mValid)
return false;
826 for (j = 0; j < 3; ++
j) {
831 for (j = 0; j < 3; ++
j) {
832 for (k = j; k < 3; ++
k) {
837 loc = 3*row - (row*(row+1)/2) + col;
841 loc = 3*col - (col*(col+1)/2) + row;
850 for (i = 0; i < 3; ++
i) {
854 for (i = 0; i < 6; ++
i) {
860 for (i = 0; i < 3; ++
i) {
861 if (vertices + v_i[i] == fv[j]) {
897 for (i = 0; i < 4; ++
i) {
901 for (i = 0; i < 10; ++
i) {
915 for (i = 0; i < 4; ++
i) {
917 for (j = 0; j < 3; ++
j) {
919 if (vertices + v_i[hexInd[i][j]] == fv[0]) {
949 if (!mValid)
return false;
968 if (!mValid)
return false;
977 for (i = 0; i < 4; ++
i) {
978 if (vertices + v_i[i] == fv[0]) {
1004 for (i = 0; i < 4; ++
i) {
1005 for (j = 0; j < 3; ++
j) {
1014 if (!mValid)
return false;
1017 for (j = 0; j < 3; ++
j) {
1022 for (j = 0; j < 3; ++
j) {
1023 for (k = j; k < 3; ++
k) {
1028 loc = 4*row - (row*(row+1)/2) + col;
1032 loc = 4*col - (col*(col+1)/2) + row;
1041 for (i = 0; i < 4; ++
i) {
1045 for (i = 0; i < 10; ++
i) {
1051 for (i = 0; i < 4; ++
i) {
1052 if (vertices + v_i[i] == fv[j]) {
1086 for (i = 0; i < 4; ++
i) {
1090 for (i = 0; i < 10; ++
i) {
1104 for (i = 0; i < 4; ++
i) {
1106 for (j = 0; j < 4; ++
j) {
1108 if (vertices + v_i[tetInd[i][j]] == fv[0]) {
1143 if (!mValid)
return false;
1156 if (!mValid)
return false;
1165 for (i = 0; i < 4; ++
i) {
1166 if (vertices + v_i[i] == fv[0]) {
1192 for (i = 0; i < 4; ++
i) {
1193 for (j = 0; j < 4; ++
j) {
1202 if (!mValid)
return false;
1206 for (j = 0; j < 4; ++
j) {
1211 for (j = 0; j < 4; ++
j) {
1212 for (k = j; k < 4; ++
k) {
1217 loc = 4*row - (row*(row+1)/2) + col;
1221 loc = 4*col - (col*(col+1)/2) + row;
1230 for (i = 0; i < 4; ++
i) {
1234 for (i = 0; i < 10; ++
i) {
1240 for (i = 0; i < 4; ++
i) {
1241 if (vertices + v_i[i] == fv[j]) {
1275 for (i = 0; i < 8; ++
i) {
1279 for (i = 0; i < 36; ++
i) {
1293 for (i = 0; i < 8; ++
i) {
1295 for (j = 0; j < 4; ++
j) {
1297 if (vertices + v_i[hexInd[i][j]] == fv[0]) {
1332 if (!mValid)
return false;
1350 if (!mValid)
return false;
1359 for (i = 0; i < 8; ++
i) {
1360 if (vertices + v_i[i] == fv[0]) {
1402 for (i = 0; i < 8; ++
i) {
1403 for (j = 0; j < 4; ++
j) {
1412 if (!mValid)
return false;
1416 for (j = 0; j < 4; ++
j) {
1421 for (j = 0; j < 4; ++
j) {
1422 for (k = j; k < 4; ++
k) {
1427 loc = 8*row - (row*(row+1)/2) + col;
1431 loc = 8*col - (col*(col+1)/2) + row;
1440 for (i = 0; i < 8; ++
i) {
1444 for (i = 0; i < 36; ++
i) {
1450 for (i = 0; i < 8; ++
i) {
1451 if (vertices + v_i[i] == fv[j]) {
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
static const double MSQ_ONE_THIRD
void zero()
Sets all entries to zero (more efficient than assignement).
bool h_gdft_3(double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
bool h_gdft_3_v0(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
CornerTag< TargetMatrix > targetMatrices
Target matrix data.
Used to hold the error state and return it to the application.
bool h_gdft_2_v1(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
bool g_gdft_2_v1(double &obj, Vector3D &g_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
Matrix3D transpose(const Matrix3D &A)
bool m_gdft_3(double &obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
requested functionality is not (yet) implemented
bool g_gdft_3_v2(double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
bool compute_element_analytical_hessian(PatchData &pd, MsqMeshEntity *e, MsqVertex *fv[], Vector3D g[], Matrix3D h[], int nfv, double &m, MsqError &err)
bool h_gdft_2_v0(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
bool g_gdft_3_v0(double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
bool g_gdft_3_v3(double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
bool h_gdft_2(double &obj, Vector3D g_obj[3], Matrix3D h_obj[6], const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
bool compute_element_analytical_gradient(PatchData &pd, MsqMeshEntity *e, MsqVertex *fv[], Vector3D g[], int nfv, double &m, MsqError &err)
Virtual function that computes the gradient of the QualityMetric analytically. The base class impleme...
void QR(Matrix3D &Q, Matrix3D &R, const Matrix3D &A)
msq_stdc::size_t vertex_count() const
Returns the number of vertices in this element, based on its element type.
double get_barrier_delta(MsqError &err)
Returns delta based on the minimum and maximum corner determinant over all elements in the patch This...
size_t get_element_index(MsqMeshEntity *element)
bool h_gdft_3_v2(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
bool h_gdft_3_v1(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
bool g_gdft_2_v2(double &obj, Vector3D &g_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
bool evaluate_element(PatchData &pd, MsqMeshEntity *e, double &m, MsqError &err)
Evaluate the metric for an element.
bool m_gdft_2(double &obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
const MsqVertex * get_vertex_array(MsqError &err) const
Returns a pointer to the start of the vertex array.
bool g_gdft_3_v1(double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
Class containing the target corner matrices for the context based smoothing.
EntityTopology get_element_type() const
Returns element type.
const msq_stdc::size_t * get_vertex_index_array() const
Very efficient retrieval of vertices indexes (corresponding to the PatchData vertex array)...
void inv(Matrix3D &Ainv, const Matrix3D &A)
bool g_gdft_2_v0(double &obj, Vector3D &g_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
bool h_gdft_2_v2(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
bool h_gdft_3_v3(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
void compute_corner_normals(Vector3D normals[], PatchData &pd, MsqError &err)
Uses a MeshDomain call-back function to compute the normal at the corner.
static const double MSQ_3RT_2_OVER_6RT_3
bool g_gdft_2(double &obj, Vector3D g_obj[3], const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
bool g_gdft_3(double &obj, Vector3D g_obj[4], const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)