40 #include "PatchDataUser.hpp"
41 #include "MeshSet.hpp"
42 #include "MsqTimer.hpp"
43 #include "TargetMatrix.hpp"
45 using namespace Mesquite;
65 for (
size_t i=0;
i<num_elements; ++
i) {
69 for (
size_t j=0;
j<num_corners; ++
j) {
70 if (
det(matrices[
j]) <= 0 ) {
71 MSQ_SETERR(err)(
"A Target matrix has a non-positive determinant. "
72 "Please review your target calculator.",
89 Matrix3D tmp_tri, tmp_quad, tmp_tet, tmp_hex;
95 for (
size_t i=0;
i<num_elements; ++
i) {
101 matrices[0] = tmp_tri;
102 matrices[1] = tmp_tri;
103 matrices[2] = tmp_tri;
106 matrices[0] = tmp_quad;
107 matrices[1] = tmp_quad;
108 matrices[2] = tmp_quad;
109 matrices[3] = tmp_quad;
112 matrices[0] = tmp_tet;
113 matrices[1] = tmp_tet;
114 matrices[2] = tmp_tet;
115 matrices[3] = tmp_tet;
118 matrices[0] = tmp_hex;
119 matrices[1] = tmp_hex;
120 matrices[2] = tmp_hex;
121 matrices[3] = tmp_hex;
122 matrices[4] = tmp_hex;
123 matrices[5] = tmp_hex;
124 matrices[6] = tmp_hex;
125 matrices[7] = tmp_hex;
159 for (
size_t i=0;
i<num_elements; ++
i) {
160 int nve = elems[
i].vertex_count();
161 assert( nve = elems_ref[
i].vertex_count() );
180 Matrix3D tmp_tri, tmp_quad, tmp_tet, tmp_hex;
185 for (i=0; i<3; ++
i) W_k[i] = tmp_tri;
188 for (i=0; i<4; ++
i) W_k[i] = tmp_quad;
191 for (i=0; i<4; ++
i) W_k[i] = tmp_tet;
194 for (i=0; i<8; ++
i) W_k[i] = tmp_hex;
218 Vector3D a1(A[0][0], A[1][0], A[2][0]);
219 Vector3D a2(A[0][1], A[1][1], A[2][1]);
220 Vector3D a3(A[0][2], A[1][2], A[2][2]);
224 double a1_x_a2_norm = a1_x_a2.
length();
229 double a1_norm_inv = 1./a1_norm;
230 double a1_x_a2_norm_inv = 1./a1_x_a2_norm;
231 if (!finite(a1_norm_inv) || !finite(a1_x_a2_norm_inv)) {
236 v1 = a1_norm_inv * a1;
237 v2 = ((-(a1%a2) * a1) + (a1_norm*a1_norm)*a2) * a1_norm_inv * a1_x_a2_norm_inv;
238 v3 = a1_x_a2_norm_inv * a1_x_a2;
248 {
return "Target Calculator"; }
void compute_default_target_matrices(PatchData &pd, MsqError &err)
Compute the default "isotropic" target matrices that are often used in the computation of reference-b...
virtual AlgorithmType get_algorithm_type()
Return the algorithm type (to avoid RTTI use).
virtual msq_std::string get_name()
Returns the algorithm name.
CornerTag< TargetMatrix > targetMatrices
Target matrix data.
Used to hold the error state and return it to the application.
PatchDataParameters & get_all_parameters()
Returns the PatchDataParameters object.
void compute_guide_matrices(enum guide_type type, PatchData &ref_pd, size_t elem_ind, Matrix3D A[], int num, MsqError &err)
Computes the guide corner matrices A for a given element index in the reference patch.
requested functionality is not (yet) implemented
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...
Matrix3D compute_V_3D(const Matrix3D &A, MsqError &err)
const int MSQ_MAX_NUM_VERT_PER_ENT
static void initialize_default_target_matrices(Matrix3D &tri_M3D, Matrix3D &quad_M3D, Matrix3D &tet_M3D, Matrix3D &hex_M3D)
size_t num_elements() const
number of elements in the Patch.
void compute_reference_corner_matrices(PatchData &pd, MsqError &err)
Compute the corner matrices for the reference mesh refMesh.
msq_stdc::size_t vertex_count() const
Returns the number of vertices in this element, based on its element type.
#define MSQ_CHKERR(err)
Mesquite's Error Checking macro.
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
double column_length(int i) const
returns the column length – i is 0-based.
PatchData::PatchType get_patch_type()
Returns the Patch Type.
size_t num_vertices() const
number of vertices in the patch.
void compute_target_matrices_and_check_det(PatchData &pd, MsqError &err)
This function wraps compute_target_matrices and checks that the determinant of each target is positiv...
double det(const Matrix3D &A)
void set_column(int j, const Vector3D &c)
Sets column j (0, 1 or 2) to Vector3D c.
PatchData * get_global_patch()
Returns the Global Patch.
Class containing the target corner matrices for the context based smoothing.
EntityTopology get_element_type() const
Returns element type.
object is in an invalid state
#define MSQ_FUNCTION_TIMER(NAME)
const MsqMeshEntity * get_element_array(MsqError &err) const
Returns a pointer to the start of the element array.
void compute_corner_matrices(PatchData &pd, Matrix3D A[], int num_m3d, MsqError &err)
Compute matrices which column are the vectors issued from a corner.
void reset_reference_meshset(MsqError &err)
Reset the reference mesh so it starts from the first vertex again.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
The MeshSet class stores one or more Mesquite::Mesh pointers and manages access to the mesh informati...
void reset(MsqError &err)
Resets the MeshSet object so that get_next_patch() will restart its iterations at the first vertex...
bool get_next_patch(PatchData &pd, PatchDataUser *pd_user, MsqError &err)
Gets the next PatchData.
virtual void compute_target_matrices(PatchData &pd, MsqError &err)=0
This function provides the corner matrices for all elements on the Patch.
virtual double loop_over_mesh(MeshSet &ms, MsqError &err)
This is the "run" function of PatchDataUser. It can do anything really.