Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TargetCalculator Class Referenceabstract

Base class that provides the interface for computing the target corner matrices used in the context based smoothing. More...

#include <TargetCalculator.hpp>

Inheritance diagram for TargetCalculator:
Collaboration diagram for TargetCalculator:

Public Types

enum  Lambda_type { REGULAR, AVERAGE, REGULAR, AVERAGE }
 
enum  guide_type {
  Ad, AK, A0, Ar,
  As, Ab, Ac, Ap,
  Ae, Af, Ax, Ad,
  AK, A0, Ar, As,
  Ab, Ac, Ap, Ae,
  Af, Ax
}
 
enum  Lambda_type { REGULAR, AVERAGE, REGULAR, AVERAGE }
 
enum  guide_type {
  Ad, AK, A0, Ar,
  As, Ab, Ac, Ap,
  Ae, Af, Ax, Ad,
  AK, A0, Ar, As,
  Ab, Ac, Ap, Ae,
  Af, Ax
}
 
- Public Types inherited from PatchDataUser
enum  AlgorithmType {
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR,
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR
}
 
enum  AlgorithmType {
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR,
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR
}
 

Public Member Functions

 TargetCalculator ()
 
virtual ~TargetCalculator ()
 virtual destructor ensures use of polymorphism during destruction More...
 
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. More...
 
Matrix3D compute_V_3D (const Matrix3D &A, MsqError &err)
 
Matrix3D compute_Q_3D (const Matrix3D &A, MsqError &err)
 
Matrix3D compute_Delta_3D (const Matrix3D &A, MsqError &err)
 
void compute_default_target_matrices (PatchData &pd, MsqError &err)
 Compute the default "isotropic" target matrices that are often used in the computation of reference-based target matrices. More...
 
void compute_reference_corner_matrices (PatchData &pd, MsqError &err)
 Compute the corner matrices for the reference mesh refMesh. More...
 
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 positive. More...
 
void reset_reference_meshset (MsqError &err)
 Reset the reference mesh so it starts from the first vertex again. More...
 
virtual void compute_target_matrices (PatchData &pd, MsqError &err)=0
 This function provides the corner matrices for all elements on the Patch. More...
 
virtual double loop_over_mesh (MeshSet &ms, MsqError &err)
 This is the "run" function of PatchDataUser. It can do anything really. More...
 
virtual msq_std::string get_name ()
 Returns the algorithm name. More...
 
virtual AlgorithmType get_algorithm_type ()
 Return the algorithm type (to avoid RTTI use). More...
 
 TargetCalculator ()
 
virtual ~TargetCalculator ()
 virtual destructor ensures use of polymorphism during destruction More...
 
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. More...
 
Matrix3D compute_V_3D (const Matrix3D &A, MsqError &err)
 
Matrix3D compute_Q_3D (const Matrix3D &A, MsqError &err)
 
Matrix3D compute_Delta_3D (const Matrix3D &A, MsqError &err)
 
void compute_default_target_matrices (PatchData &pd, MsqError &err)
 Compute the default "isotropic" target matrices that are often used in the computation of reference-based target matrices. More...
 
void compute_reference_corner_matrices (PatchData &pd, MsqError &err)
 Compute the corner matrices for the reference mesh refMesh. More...
 
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 positive. More...
 
void reset_reference_meshset (MsqError &err)
 Reset the reference mesh so it starts from the first vertex again. More...
 
virtual void compute_target_matrices (PatchData &pd, MsqError &err)=0
 This function provides the corner matrices for all elements on the Patch. More...
 
virtual double loop_over_mesh (MeshSet &ms, MsqError &err)
 This is the "run" function of PatchDataUser. It can do anything really. More...
 
virtual msq_std::string get_name ()
 Returns the algorithm name. More...
 
virtual AlgorithmType get_algorithm_type ()
 Return the algorithm type (to avoid RTTI use). More...
 
- Public Member Functions inherited from PatchDataUser
virtual ~PatchDataUser ()
 
virtual void set_patch_type (PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
 Sets the Patch Type. More...
 
PatchData::PatchType get_patch_type ()
 Returns the Patch Type. More...
 
int get_nb_layers (MsqError &err)
 Returns number of layers (if relevant for partition algorythm). More...
 
void add_culling_method (enum PatchData::culling_method cm)
 Sets on the culling method passed as argument. More...
 
void no_culling_method ()
 Sets off all culling methods. More...
 
void remove_culling_method (enum PatchData::culling_method cm)
 Sets off the culling method passed as argument. More...
 
long unsigned int get_culling_method_bits ()
 Returns the bitset containing culling methods flags. More...
 
void set_all_parameters (PatchDataParameters &params)
 
PatchDataParametersget_all_parameters ()
 Returns the PatchDataParameters object. More...
 
void set_global_patch (PatchData *pd, MsqError &err)
 Sets the Global Patch, so that it can be use by contiguoug PatchDataUser. More...
 
PatchDataget_global_patch ()
 Returns the Global Patch. More...
 
void no_global_patch ()
 Sets the Global Patch pointer to NULL. More...
 
virtual ~PatchDataUser ()
 
virtual void set_patch_type (PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
 Sets the Patch Type. More...
 
PatchData::PatchType get_patch_type ()
 Returns the Patch Type. More...
 
int get_nb_layers (MsqError &err)
 Returns number of layers (if relevant for partition algorythm). More...
 
void add_culling_method (enum PatchData::culling_method cm)
 Sets on the culling method passed as argument. More...
 
void no_culling_method ()
 Sets off all culling methods. More...
 
void remove_culling_method (enum PatchData::culling_method cm)
 Sets off the culling method passed as argument. More...
 
long unsigned int get_culling_method_bits ()
 Returns the bitset containing culling methods flags. More...
 
void set_all_parameters (PatchDataParameters &params)
 
PatchDataParametersget_all_parameters ()
 Returns the PatchDataParameters object. More...
 
void set_global_patch (PatchData *pd, MsqError &err)
 Sets the Global Patch, so that it can be use by contiguoug PatchDataUser. More...
 
PatchDataget_global_patch ()
 Returns the Global Patch. More...
 
void no_global_patch ()
 Sets the Global Patch pointer to NULL. More...
 

Static Public Member Functions

static void initialize_default_target_matrices (Matrix3D &tri_M3D, Matrix3D &quad_M3D, Matrix3D &tet_M3D, Matrix3D &hex_M3D)
 
static double compute_Lambda (const Matrix3D &A, MsqError &err)
 Note that this function is static, i.e. it can be used independently of an object. More...
 
static void initialize_default_target_matrices (Matrix3D &tri_M3D, Matrix3D &quad_M3D, Matrix3D &tet_M3D, Matrix3D &hex_M3D)
 
static double compute_Lambda (const Matrix3D &A, MsqError &err)
 

Protected Attributes

MeshSetrefMesh
 

Additional Inherited Members

- Protected Member Functions inherited from PatchDataUser
 PatchDataUser ()
 
 PatchDataUser ()
 

Detailed Description

Base class that provides the interface for computing the target corner matrices used in the context based smoothing.

To implement a concrete TargetCalculator, one inherits from this class and then overrides the compute_target_matrices function itself to provide corner matrices for all elements in the patch.

Note that an implementation is provided in TargetCalculator::compute_default_target_matrices for default target matrices often used in the computation of more complex, reference-based target matrices.

The target calculator is set on the QualityImprover. At runtime, it associates with each mesh corner (i.e. a corner of an element. Most of the time, one vertex corresponds to many corners.) with a TargetMatrix through an MsqTag mechanism available in the MsqMeshEntity class.

Definition at line 74 of file includeLinks/TargetCalculator.hpp.

Member Enumeration Documentation

enum guide_type
Enumerator
Ad 

Default Guide.

AK 

Conductivity Guide.

A0 

Initial Mesh Guide.

Ar 

Reference Mesh Guide.

As 

Locally-smoothed IM Guide.

Ab 

Bounding-box Guide.

Ac 

Geometric Curvature Guide.

Ap 

Parametric Guide.

Ae 

Error Indicator Guide.

Af 

Flux-based Guide.

Ax 

Solution Feature-based Guide.

Ad 

Default Guide.

AK 

Conductivity Guide.

A0 

Initial Mesh Guide.

Ar 

Reference Mesh Guide.

As 

Locally-smoothed IM Guide.

Ab 

Bounding-box Guide.

Ac 

Geometric Curvature Guide.

Ap 

Parametric Guide.

Ae 

Error Indicator Guide.

Af 

Flux-based Guide.

Ax 

Solution Feature-based Guide.

Definition at line 96 of file includeLinks/TargetCalculator.hpp.

enum guide_type
Enumerator
Ad 

Default Guide.

AK 

Conductivity Guide.

A0 

Initial Mesh Guide.

Ar 

Reference Mesh Guide.

As 

Locally-smoothed IM Guide.

Ab 

Bounding-box Guide.

Ac 

Geometric Curvature Guide.

Ap 

Parametric Guide.

Ae 

Error Indicator Guide.

Af 

Flux-based Guide.

Ax 

Solution Feature-based Guide.

Ad 

Default Guide.

AK 

Conductivity Guide.

A0 

Initial Mesh Guide.

Ar 

Reference Mesh Guide.

As 

Locally-smoothed IM Guide.

Ab 

Bounding-box Guide.

Ac 

Geometric Curvature Guide.

Ap 

Parametric Guide.

Ae 

Error Indicator Guide.

Af 

Flux-based Guide.

Ax 

Solution Feature-based Guide.

Definition at line 96 of file src/TargetCalculator/TargetCalculator.hpp.

Enumerator
REGULAR 

Each element has a lambda coefficient.

AVERAGE 

The Lambda coefficient is the average on the mesh.

REGULAR 

Each element has a lambda coefficient.

AVERAGE 

The Lambda coefficient is the average on the mesh.

Definition at line 90 of file src/TargetCalculator/TargetCalculator.hpp.

90  {
91  REGULAR,
92  AVERAGE
93  };
The Lambda coefficient is the average on the mesh.
Each element has a lambda coefficient.
Enumerator
REGULAR 

Each element has a lambda coefficient.

AVERAGE 

The Lambda coefficient is the average on the mesh.

REGULAR 

Each element has a lambda coefficient.

AVERAGE 

The Lambda coefficient is the average on the mesh.

Definition at line 90 of file includeLinks/TargetCalculator.hpp.

90  {
91  REGULAR,
92  AVERAGE
93  };
The Lambda coefficient is the average on the mesh.
Each element has a lambda coefficient.

Constructor & Destructor Documentation

TargetCalculator ( )
inline

Definition at line 78 of file includeLinks/TargetCalculator.hpp.

References PatchDataUser::get_all_parameters(), and PatchDataParameters::set_global_patch_type().

78  : refMesh(0)
PatchDataParameters & get_all_parameters()
Returns the PatchDataParameters object.

Here is the call graph for this function:

virtual ~TargetCalculator ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 82 of file includeLinks/TargetCalculator.hpp.

83  {};
TargetCalculator ( )
inline

Definition at line 78 of file src/TargetCalculator/TargetCalculator.hpp.

References PatchDataUser::get_all_parameters(), and PatchDataParameters::set_global_patch_type().

78  : refMesh(0)
PatchDataParameters & get_all_parameters()
Returns the PatchDataParameters object.

Here is the call graph for this function:

virtual ~TargetCalculator ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 82 of file src/TargetCalculator/TargetCalculator.hpp.

83  {};

Member Function Documentation

void compute_default_target_matrices ( PatchData pd,
MsqError err 
)

Compute the default "isotropic" target matrices that are often used in the computation of reference-based target matrices.

The resulting corner matrices are stored in tags on the elements of the PatchData.

Definition at line 81 of file TargetCalculator/TargetCalculator.cpp.

References PatchData::get_element_array(), MsqMeshEntity::get_element_type(), Mesquite::HEXAHEDRON, i, TargetCalculator::initialize_default_target_matrices(), MSQ_ERRRTN, MSQ_FUNCTION_TIMER, MSQ_SETERR, MsqError::NOT_IMPLEMENTED, PatchData::num_elements(), Mesquite::QUADRILATERAL, PatchData::targetMatrices, Mesquite::TETRAHEDRON, and Mesquite::TRIANGLE.

83 {
84  MSQ_FUNCTION_TIMER( "TargetCalculator::compute_default_target_matrices" );
85 
86  MsqMeshEntity* elems=pd.get_element_array(err); MSQ_ERRRTN(err);
87  size_t num_elements=pd.num_elements();
88 
89  Matrix3D tmp_tri, tmp_quad, tmp_tet, tmp_hex;
90  initialize_default_target_matrices(tmp_tri, tmp_quad, tmp_tet, tmp_hex);
91 
92  TargetMatrix matrices[8];
93 
94  // set the corner matrices to the correct value for each tag.
95  for (size_t i=0; i<num_elements; ++i) {
96 
97  EntityTopology type = elems[i].get_element_type();
98  switch (type)
99  {
100  case TRIANGLE:
101  matrices[0] = tmp_tri;
102  matrices[1] = tmp_tri;
103  matrices[2] = tmp_tri;
104  break;
105  case QUADRILATERAL:
106  matrices[0] = tmp_quad;
107  matrices[1] = tmp_quad;
108  matrices[2] = tmp_quad;
109  matrices[3] = tmp_quad;
110  break;
111  case TETRAHEDRON:
112  matrices[0] = tmp_tet;
113  matrices[1] = tmp_tet;
114  matrices[2] = tmp_tet;
115  matrices[3] = tmp_tet;
116  break;
117  case HEXAHEDRON:
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;
126  break;
127  default:
128  MSQ_SETERR(err)("Type not implemented.",MsqError::NOT_IMPLEMENTED);
129  return;
130  } //end switch
131 
132  pd.targetMatrices.set_element_corner_tags( &pd, i, matrices, err ); MSQ_ERRRTN(err);
133  } // end loop
134 }
CornerTag< TargetMatrix > targetMatrices
Target matrix data.
EntityTopology
Definition: Mesquite.hpp:92
requested functionality is not (yet) implemented
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
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.
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
Class containing the target corner matrices for the context based smoothing.
EntityTopology get_element_type() const
Returns element type.
const MsqMeshEntity * get_element_array(MsqError &err) const
Returns a pointer to the start of the element array.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

void compute_default_target_matrices ( PatchData pd,
MsqError err 
)

Compute the default "isotropic" target matrices that are often used in the computation of reference-based target matrices.

The resulting corner matrices are stored in tags on the elements of the PatchData.

Matrix3D compute_Delta_3D ( const Matrix3D A,
MsqError err 
)
Matrix3D compute_Delta_3D ( const Matrix3D A,
MsqError err 
)
inline

Definition at line 227 of file includeLinks/TargetCalculator.hpp.

References Mesquite::cbrt(), Matrix3D::column_length(), MsqError::INVALID_STATE, and MSQ_SETERR.

Referenced by LVQDTargetCalculator::compute_target_matrices().

228  {
229  double a1_norm = A.column_length(0);
230  double a2_norm = A.column_length(1);
231  double a3_norm = A.column_length(2);
232 
233  double nu = Mesquite::cbrt(a1_norm*a2_norm*a3_norm);
234  double fac = 1./nu ;
235  if (!finite(fac)) {
236  MSQ_SETERR(err)("Numerical error", MsqError::INVALID_STATE);
237  }
238 
239  Matrix3D Delta;
240 
241  Delta[0][0] = fac * a1_norm;
242  Delta[1][1] = fac * a2_norm;
243  Delta[2][2] = fac * a3_norm;
244 
245  return Delta;
246  }
rational * A
Definition: vinci_lass.c:67
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
object is in an invalid state
double cbrt(double d)
Definition: Mesquite.hpp:182

Here is the call graph for this function:

Here is the caller graph for this function:

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.

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.

Definition at line 168 of file TargetCalculator/TargetCalculator.cpp.

References TargetCalculator::A0, TargetCalculator::Ad, TargetCalculator::Ar, MsqMeshEntity::compute_corner_matrices(), PatchData::get_element_array(), MsqMeshEntity::get_element_type(), Mesquite::HEXAHEDRON, i, TargetCalculator::initialize_default_target_matrices(), MSQ_ERRRTN, MSQ_SETERR, MsqError::NOT_IMPLEMENTED, Mesquite::QUADRILATERAL, Mesquite::TETRAHEDRON, Mesquite::TRIANGLE, and MsqMeshEntity::vertex_count().

Referenced by WTargetCalculator::compute_target_matrices(), and LVQDTargetCalculator::compute_target_matrices().

170  {
171 
172 
173  MsqMeshEntity* elems = ref_pd.get_element_array(err); MSQ_ERRRTN(err);
174  size_t nve = elems[elem_ind].vertex_count();
175  int i;
176 
177  switch(type) {
178  case Ad:
179  {
180  Matrix3D tmp_tri, tmp_quad, tmp_tet, tmp_hex;
181  initialize_default_target_matrices(tmp_tri, tmp_quad, tmp_tet, tmp_hex);
182  EntityTopology elem_type = elems[elem_ind].get_element_type();
183  switch (elem_type) {
184  case TRIANGLE:
185  for (i=0; i<3; ++i) W_k[i] = tmp_tri;
186  break;
187  case QUADRILATERAL:
188  for (i=0; i<4; ++i) W_k[i] = tmp_quad;
189  break;
190  case TETRAHEDRON:
191  for (i=0; i<4; ++i) W_k[i] = tmp_tet;
192  break;
193  case HEXAHEDRON:
194  for (i=0; i<8; ++i) W_k[i] = tmp_hex;
195  break;
196  default:
197  MSQ_SETERR(err)("Element type not implemented.",MsqError::NOT_IMPLEMENTED);
198  return;
199  }
200  }
201  return;
202  case A0:
203  elems[elem_ind].compute_corner_matrices(ref_pd, W_k, nve, err); MSQ_ERRRTN(err);
204  return;
205  case Ar:
206  elems[elem_ind].compute_corner_matrices(ref_pd, W_k, nve, err); MSQ_ERRRTN(err);
207  return;
208  default:
209  MSQ_SETERR(err)("Element type not implemented.",MsqError::NOT_IMPLEMENTED);
210  return;
211  }
212 
213  }
EntityTopology
Definition: Mesquite.hpp:92
requested functionality is not (yet) implemented
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
static void initialize_default_target_matrices(Matrix3D &tri_M3D, Matrix3D &quad_M3D, Matrix3D &tet_M3D, Matrix3D &hex_M3D)
msq_stdc::size_t vertex_count() const
Returns the number of vertices in this element, based on its element type.
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
EntityTopology get_element_type() const
Returns element type.
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.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

static double compute_Lambda ( const Matrix3D A,
MsqError err 
)
static
double compute_Lambda ( const Matrix3D A,
MsqError err 
)
inlinestatic

Note that this function is static, i.e. it can be used independently of an object.

Definition at line 183 of file includeLinks/TargetCalculator.hpp.

References Mesquite::cbrt(), and Mesquite::det().

Referenced by LVQDTargetCalculator::compute_target_matrices(), and PatchData::get_average_Lambda_3d().

184  {
185  return Mesquite::cbrt(fabs(det(A)));
186  }
rational * A
Definition: vinci_lass.c:67
double det(const Matrix3D &A)
double cbrt(double d)
Definition: Mesquite.hpp:182

Here is the call graph for this function:

Here is the caller graph for this function:

Matrix3D compute_Q_3D ( const Matrix3D A,
MsqError err 
)
inline

Definition at line 191 of file includeLinks/TargetCalculator.hpp.

References Mesquite::cbrt(), Matrix3D::column_length(), Mesquite::det(), MsqError::INVALID_STATE, Vector3D::length(), and MSQ_SETERR.

Referenced by LVQDTargetCalculator::compute_target_matrices().

192  {
193  Vector3D a1(A[0][0], A[1][0], A[2][0]);
194  Vector3D a2(A[0][1], A[1][1], A[2][1]);
195  Vector3D a3(A[0][2], A[1][2], A[2][2]);
196 
197  double a1_norm = A.column_length(0);
198  double a2_norm = A.column_length(1);
199  double a3_norm = A.column_length(2);
200 
201  Vector3D a1_x_a2 = a1 * a2;
202  double a1_x_a2_norm = a1_x_a2.length();
203  Vector3D a1_x_a3 = a1 * a3;
204 
205  double nu = Mesquite::cbrt(a1_norm*a2_norm*a3_norm);
206  double det_A = det(A);
207  double fac = nu / Mesquite::cbrt(fabs(det_A));
208 
209  Matrix3D Q;
210 
211  Q[0][0] = fac * 1.;
212  Q[0][1] = fac * a1%a2 / (a1_norm*a2_norm);
213  Q[0][2] = fac * a1%a3 / (a1_norm*a3_norm);
214  Q[1][1] = fac * a1_x_a2_norm / (a1_norm*a2_norm);
215  Q[1][2] = fac * a1_x_a2 % a1_x_a3 / (a1_x_a2_norm * a1_norm * a3_norm);
216  Q[2][2] = fac * det_A / (a1_x_a2_norm*a3_norm);
217 
218  if (!finite(Q[0][0]) || !finite(Q[0][1]) || !finite(Q[0][2]) ||
219  !finite(Q[1][0]) || !finite(Q[1][2]) || !finite(Q[2][2])) {
220  MSQ_SETERR(err)("Numerical error", MsqError::INVALID_STATE);
221  }
222 
223  return Q;
224  }
rational * A
Definition: vinci_lass.c:67
NVec< 3, double > Vector3D
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
double det(const Matrix3D &A)
object is in an invalid state
double cbrt(double d)
Definition: Mesquite.hpp:182

Here is the call graph for this function:

Here is the caller graph for this function:

Matrix3D compute_Q_3D ( const Matrix3D A,
MsqError err 
)
void compute_reference_corner_matrices ( PatchData pd,
MsqError err 
)

Compute the corner matrices for the reference mesh refMesh.

The refMesh data member is set by the constructors of a concrete TargetCalculator that requires a reference mesh.

Definition at line 137 of file TargetCalculator/TargetCalculator.cpp.

References A, MsqMeshEntity::compute_corner_matrices(), PatchDataUser::get_all_parameters(), PatchData::get_element_array(), MeshSet::get_next_patch(), i, MsqError::INVALID_STATE, MSQ_ERRRTN, MSQ_FUNCTION_TIMER, Mesquite::MSQ_MAX_NUM_VERT_PER_ENT, MSQ_SETERR, PatchData::num_elements(), PatchData::num_vertices(), TargetCalculator::refMesh, and PatchData::targetMatrices.

139 {
140  MSQ_FUNCTION_TIMER( "TargetCalculator::compute_reference_corner_matrices" );
141 
142  PatchData ref_pd;
143  if (refMesh)
144  refMesh->get_next_patch(ref_pd, this->get_all_parameters(), err);
145  else
146  MSQ_SETERR(err)("No reference mesh", MsqError::INVALID_STATE);
147  MSQ_ERRRTN(err);
148 
149  // Make sure topology of ref_pd and pd are equal
150  size_t num_elements=pd.num_elements();
151  assert( num_elements == ref_pd.num_elements() );
152  size_t num_vertices=pd.num_vertices();
153  assert( num_vertices == ref_pd.num_vertices() );
154 
155  // Compute corner matrices for ref_pd and store in pd tags.
156  MsqMeshEntity* elems = pd.get_element_array(err);
157  MsqMeshEntity* elems_ref = ref_pd.get_element_array(err); MSQ_ERRRTN(err);
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() );
162  elems_ref[i].compute_corner_matrices(ref_pd, A, nve, err); MSQ_ERRRTN(err);
163  pd.targetMatrices.set_element_corner_tags( &pd, i, A, err ); MSQ_ERRRTN(err);
164  }
165 }
CornerTag< TargetMatrix > targetMatrices
Target matrix data.
PatchDataParameters & get_all_parameters()
Returns the PatchDataParameters object.
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
const int MSQ_MAX_NUM_VERT_PER_ENT
Definition: Mesquite.hpp:120
rational * A
Definition: vinci_lass.c:67
size_t num_elements() const
number of elements in the Patch.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
size_t num_vertices() const
number of vertices in the patch.
Class containing the target corner matrices for the context based smoothing.
object is in an invalid state
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.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
bool get_next_patch(PatchData &pd, PatchDataUser *pd_user, MsqError &err)
Gets the next PatchData.

Here is the call graph for this function:

void compute_reference_corner_matrices ( PatchData pd,
MsqError err 
)

Compute the corner matrices for the reference mesh refMesh.

The refMesh data member is set by the constructors of a concrete TargetCalculator that requires a reference mesh.

virtual void compute_target_matrices ( PatchData pd,
MsqError err 
)
pure virtual

This function provides the corner matrices for all elements on the Patch.

Useful functionality includes: MsqMeshEntity::set_tag, MsqTag::target_matrix, MsqTag::scalar .

Implemented in LVQDTargetCalculator, LVQDTargetCalculator, WTargetCalculator, and WTargetCalculator.

Referenced by TargetCalculator::compute_target_matrices_and_check_det().

Here is the caller graph for this function:

virtual void compute_target_matrices ( PatchData pd,
MsqError err 
)
pure virtual

This function provides the corner matrices for all elements on the Patch.

Useful functionality includes: MsqMeshEntity::set_tag, MsqTag::target_matrix, MsqTag::scalar .

Implemented in LVQDTargetCalculator, LVQDTargetCalculator, WTargetCalculator, and WTargetCalculator.

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 positive.

Definition at line 55 of file TargetCalculator/TargetCalculator.cpp.

References TargetCalculator::compute_target_matrices(), Mesquite::det(), PatchData::get_element_array(), i, MsqError::INVALID_STATE, j, MSQ_ERRRTN, MSQ_FUNCTION_TIMER, MSQ_SETERR, PatchData::num_elements(), PatchData::targetMatrices, and MsqMeshEntity::vertex_count().

Referenced by TargetCalculator::loop_over_mesh().

56 {
57  MSQ_FUNCTION_TIMER( "TargetCalculator::compute_target_matrices_and_check_det" );
58 
59  // Compute the target matrices
60  compute_target_matrices(pd, err); MSQ_ERRRTN(err);
61 
62  //checks that the determinant of each target matrix is positive.
63  MsqMeshEntity* elems=pd.get_element_array(err); MSQ_ERRRTN(err);
64  size_t num_elements=pd.num_elements();
65  for (size_t i=0; i<num_elements; ++i) {
66  const TargetMatrix* matrices = pd.targetMatrices.get_element_corner_tags(&pd, i, err);
67  MSQ_ERRRTN(err);
68  size_t num_corners = elems[i].vertex_count();
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.",
74  return;
75  }
76  }
77  }
78 }
CornerTag< TargetMatrix > targetMatrices
Target matrix data.
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
size_t num_elements() const
number of elements in the Patch.
msq_stdc::size_t vertex_count() const
Returns the number of vertices in this element, based on its element type.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
double det(const Matrix3D &A)
j indices j
Definition: Indexing.h:6
Class containing the target corner matrices for the context based smoothing.
object is in an invalid state
const MsqMeshEntity * get_element_array(MsqError &err) const
Returns a pointer to the start of the element array.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
virtual void compute_target_matrices(PatchData &pd, MsqError &err)=0
This function provides the corner matrices for all elements on the Patch.

Here is the call graph for this function:

Here is the caller graph for this function:

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 positive.

Matrix3D compute_V_3D ( const Matrix3D A,
MsqError err 
)
Matrix3D compute_V_3D ( const Matrix3D A,
MsqError err 
)

Definition at line 216 of file TargetCalculator/TargetCalculator.cpp.

References Matrix3D::column_length(), MsqError::INVALID_STATE, Vector3D::length(), MSQ_SETERR, and Matrix3D::set_column().

Referenced by LVQDTargetCalculator::compute_target_matrices().

217  {
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]);
221 
222  double a1_norm = A.column_length(0);
223  Vector3D a1_x_a2 = a1 * a2;
224  double a1_x_a2_norm = a1_x_a2.length();
225 
226  Matrix3D V;
227  Vector3D v1, v2, v3;
228 
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)) {
232  MSQ_SETERR(err)("Numerical error", MsqError::INVALID_STATE);
233  }
234 
235  // note : % is the dot product
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;
239 
240  V.set_column(0, v1);
241  V.set_column(1, v2);
242  V.set_column(2, v3);
243 
244  return V;
245  }
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
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.
void set_column(int j, const Vector3D &c)
Sets column j (0, 1 or 2) to Vector3D c.
object is in an invalid state

Here is the call graph for this function:

Here is the caller graph for this function:

virtual AlgorithmType get_algorithm_type ( )
virtual

Return the algorithm type (to avoid RTTI use).

Implements PatchDataUser.

PatchDataUser::AlgorithmType get_algorithm_type ( )
virtual

Return the algorithm type (to avoid RTTI use).

Implements PatchDataUser.

Definition at line 250 of file TargetCalculator/TargetCalculator.cpp.

References PatchDataUser::TARGET_CALCULATOR.

virtual msq_std::string get_name ( )
virtual

Returns the algorithm name.

Implements PatchDataUser.

msq_std::string get_name ( )
virtual

Returns the algorithm name.

Implements PatchDataUser.

Definition at line 247 of file TargetCalculator/TargetCalculator.cpp.

248  { return "Target Calculator"; }
void initialize_default_target_matrices ( Matrix3D tri_M3D,
Matrix3D quad_M3D,
Matrix3D tet_M3D,
Matrix3D hex_M3D 
)
inlinestatic

Definition at line 153 of file includeLinks/TargetCalculator.hpp.

References Mesquite::MSQ_3RT_2_OVER_6RT_3, Mesquite::MSQ_SQRT_THREE, Mesquite::MSQ_SQRT_TWO, and Mesquite::pow().

Referenced by TargetCalculator::compute_default_target_matrices(), and TargetCalculator::compute_guide_matrices().

157  {
158  static const double SIXTH_ROOT_OF_TWO = msq_stdc::pow(2., 1./6.);
159 
160  const double v_tri[] = {1., 0.5, 0., 0., MSQ_SQRT_THREE/2., 0., 0., 0., 1.};
161  Matrix3D m1(v_tri);
162  tri_M3D = m1 * MSQ_3RT_2_OVER_6RT_3;
163 
164 // const double v_tri[] = {1., 0.5, 0., 0., MSQ_SQRT_THREE/2., 0., 0., 0., sqrt(MSQ_SQRT_THREE/2.)};
165 // Matrix3D m1(v_tri);
166 // tri_M3D = m1 * sqrt(2./MSQ_SQRT_THREE);
167 
168  const double v_quad[] = {1., 0., 0., 0., 1., 0., 0., 0., 1.};
169  Matrix3D m2(v_quad);
170  quad_M3D = m2;
171 
172  const double v_tet[] = {1., 0.5, 0.5, 0., MSQ_SQRT_THREE/2., MSQ_SQRT_THREE/6., 0., 0., MSQ_SQRT_TWO/MSQ_SQRT_THREE};
173  Matrix3D m3(v_tet);
174  tet_M3D = m3 * SIXTH_ROOT_OF_TWO;
175 
176  const double v_hex[] = {1., 0., 0., 0., 1., 0., 0., 0., 1.};
177  Matrix3D m4(v_hex);
178  hex_M3D = m4;
179  }
static const double MSQ_SQRT_TWO
Definition: Mesquite.hpp:122
double pow(double value, const Exponent &exp)
static const double MSQ_3RT_2_OVER_6RT_3
Definition: Mesquite.hpp:130
static const double MSQ_SQRT_THREE
Definition: Mesquite.hpp:123

Here is the call graph for this function:

Here is the caller graph for this function:

static void initialize_default_target_matrices ( Matrix3D tri_M3D,
Matrix3D quad_M3D,
Matrix3D tet_M3D,
Matrix3D hex_M3D 
)
static
double loop_over_mesh ( MeshSet ms,
MsqError err 
)
virtual

This is the "run" function of PatchDataUser. It can do anything really.

Implements PatchDataUser.

Definition at line 253 of file TargetCalculator/TargetCalculator.cpp.

References TargetCalculator::compute_target_matrices_and_check_det(), PatchDataUser::get_global_patch(), PatchDataUser::get_patch_type(), PatchData::GLOBAL_PATCH, MsqError::INVALID_STATE, MSQ_CHKERR, and MSQ_SETERR.

254  {
255  // Currently, target calculators only work with global patches.
256  // The constructor for TargetCalculator sets the patch type
257  // to global, so if we don't have a global patch here something is
258  // really messed up.
259  PatchData* pd = get_global_patch();
260  if (get_patch_type() != PatchData::GLOBAL_PATCH || NULL == pd)
261  {
263  return 0.0;
264  }
265 
266  // Compute the target matrices.
268  return MSQ_CHKERR(err);
269  }
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
PatchData::PatchType get_patch_type()
Returns the Patch Type.
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...
PatchData * get_global_patch()
Returns the Global Patch.
object is in an invalid state

Here is the call graph for this function:

virtual double loop_over_mesh ( MeshSet ms,
MsqError err 
)
virtual

This is the "run" function of PatchDataUser. It can do anything really.

Implements PatchDataUser.

void reset_reference_meshset ( MsqError err)

Reset the reference mesh so it starts from the first vertex again.

Definition at line 47 of file TargetCalculator/TargetCalculator.cpp.

References MSQ_CHKERR, TargetCalculator::refMesh, and MeshSet::reset().

48 {
49  if (refMesh)
50  refMesh->reset(err);
51  MSQ_CHKERR(err);
52 }
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.
void reset(MsqError &err)
Resets the MeshSet object so that get_next_patch() will restart its iterations at the first vertex...

Here is the call graph for this function:

void reset_reference_meshset ( MsqError err)

Reset the reference mesh so it starts from the first vertex again.

Member Data Documentation


The documentation for this class was generated from the following files: