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

This is an intermediary class. Concrete classes will simply instantiate the various guide enums in their constructor. More...

#include <LVQDTargetCalculator.hpp>

Inheritance diagram for LVQDTargetCalculator:
Collaboration diagram for LVQDTargetCalculator:

Public Member Functions

virtual ~LVQDTargetCalculator ()
 virtual destructor ensures use of polymorphism during destruction More...
 
virtual void compute_target_matrices (PatchData &pd, MsqError &err)
 
void compute_target_matrices (PatchData &pd, PatchData &ref_pd, MsqError &err)
 Function called by compute_target_matrices(PatchData& pd, MsqError& err) to compute the matrices after the reference PatchData has been created. More...
 
virtual ~LVQDTargetCalculator ()
 virtual destructor ensures use of polymorphism during destruction More...
 
virtual void compute_target_matrices (PatchData &pd, MsqError &err)
 This function provides the corner matrices for all elements on the Patch. More...
 
void compute_target_matrices (PatchData &pd, PatchData &ref_pd, MsqError &err)
 Function called by compute_target_matrices(PatchData& pd, MsqError& err) to compute the matrices after the reference PatchData has been created. More...
 
- Public Member Functions inherited from TargetCalculator
 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 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 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...
 

Protected Member Functions

 LVQDTargetCalculator ()
 the constructor is protected since this is not intended to be a concrete class. More...
 
 LVQDTargetCalculator ()
 the constructor is protected since this is not intended to be a concrete class. More...
 
- Protected Member Functions inherited from PatchDataUser
 PatchDataUser ()
 
 PatchDataUser ()
 

Protected Attributes

enum Lambda_type lambdaBase
 
enum guide_type guideLambda
 
enum guide_type guideV
 
enum guide_type guideQ
 
enum guide_type guideDelta
 
- Protected Attributes inherited from TargetCalculator
MeshSetrefMesh
 

Additional Inherited Members

- Public Types inherited from TargetCalculator
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
}
 
- Static Public Member Functions inherited from TargetCalculator
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)
 

Detailed Description

This is an intermediary class. Concrete classes will simply instantiate the various guide enums in their constructor.

Definition at line 49 of file includeLinks/LVQDTargetCalculator.hpp.

Constructor & Destructor Documentation

LVQDTargetCalculator ( )
inlineprotected

the constructor is protected since this is not intended to be a concrete class.

Concrete classes will instantiate the various guide enums in their constructor.

Definition at line 54 of file includeLinks/LVQDTargetCalculator.hpp.

55  { }
virtual ~LVQDTargetCalculator ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 59 of file includeLinks/LVQDTargetCalculator.hpp.

60  {};
LVQDTargetCalculator ( )
inlineprotected

the constructor is protected since this is not intended to be a concrete class.

Concrete classes will instantiate the various guide enums in their constructor.

Definition at line 54 of file src/TargetCalculator/LVQDTargetCalculator.hpp.

55  { }
virtual ~LVQDTargetCalculator ( )
inlinevirtual

virtual destructor ensures use of polymorphism during destruction

Definition at line 59 of file src/TargetCalculator/LVQDTargetCalculator.hpp.

60  {};

Member Function Documentation

void compute_target_matrices ( PatchData pd,
MsqError err 
)
virtual

The type of targets computed by this function is selected by the constructor of the base classes.

Implements TargetCalculator.

Definition at line 49 of file TargetCalculator/LVQDTargetCalculator.cpp.

References PatchDataUser::get_all_parameters(), MeshSet::get_next_patch(), MsqError::INVALID_STATE, MSQ_ERRRTN, MSQ_FUNCTION_TIMER, MSQ_SETERR, and TargetCalculator::refMesh.

50 {
51  MSQ_FUNCTION_TIMER( "LVQDTargetCalculator::compute_target_matrices" );
52 
53  // Gets from the reference mesh a patch ref_pd equivalent to the patch pd of the main mesh.
54  PatchData ref_pd;
55  PatchDataParameters ref_pd_params(this->get_all_parameters());
56  if (refMesh)
57  refMesh->get_next_patch(ref_pd, ref_pd_params, err);
58  else
59  MSQ_SETERR(err)("No reference mesh", MsqError::INVALID_STATE);
60  MSQ_ERRRTN(err);
61  compute_target_matrices(pd, ref_pd, err);
62 }
PatchDataParameters & get_all_parameters()
Returns the PatchDataParameters object.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
virtual void compute_target_matrices(PatchData &pd, MsqError &err)
object is in an invalid state
#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:

virtual void compute_target_matrices ( PatchData pd,
MsqError err 
)
virtual

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

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

Implements TargetCalculator.

void compute_target_matrices ( PatchData pd,
PatchData ref_pd,
MsqError err 
)

Function called by compute_target_matrices(PatchData& pd, MsqError& err) to compute the matrices after the reference PatchData has been created.

Todo:
Michael: this function should be protected, but it is used in QualityMetricTest to avoid creating the MeshSet in the unit tests.
void compute_target_matrices ( PatchData pd,
PatchData ref_pd,
MsqError err 
)

Function called by compute_target_matrices(PatchData& pd, MsqError& err) to compute the matrices after the reference PatchData has been created.

Todo:
Michael: this function should be protected, but it is used in QualityMetricTest to avoid creating the MeshSet in the unit tests.

Definition at line 63 of file TargetCalculator/LVQDTargetCalculator.cpp.

References TargetCalculator::AVERAGE, TargetCalculator::compute_Delta_3D(), TargetCalculator::compute_guide_matrices(), TargetCalculator::compute_Lambda(), TargetCalculator::compute_Q_3D(), TargetCalculator::compute_V_3D(), PatchData::get_average_Lambda_3d(), PatchData::get_element_array(), LVQDTargetCalculator::guideDelta, LVQDTargetCalculator::guideLambda, LVQDTargetCalculator::guideQ, LVQDTargetCalculator::guideV, i, MsqError::INVALID_STATE, LVQDTargetCalculator::lambdaBase, MSQ_ERRRTN, Mesquite::MSQ_MAX_NUM_VERT_PER_ENT, MSQ_SETERR, PatchData::num_elements(), PatchData::num_vertices(), TargetCalculator::REGULAR, PatchData::targetMatrices, and MsqMeshEntity::vertex_count().

65 {
66  // Make sure topology of ref_pd and pd are equal
67  size_t num_elements=pd.num_elements();
68  size_t num_vertices=pd.num_vertices();
69  if (num_elements != pd.num_elements() || num_vertices != pd.num_vertices())
70  {
72  return;
73  }
74 
75 
76  MsqMeshEntity* elems = pd.get_element_array(err); MSQ_ERRRTN(err);
77  MsqMeshEntity* elems_ref = ref_pd.get_element_array(err); MSQ_ERRRTN(err);
78 
84  Matrix3D V, Q, Delta;
85  double Lambda=1;
86 
87 // std::map<enum guide_type, Matrix3D[MSQ_MAX_NUM_VERT_PER_ENT]> guides;
88 
89  if (lambdaBase == AVERAGE)
90  Lambda = ref_pd.get_average_Lambda_3d(err); MSQ_ERRRTN(err);
91 
92  for (size_t i=0; i<num_elements; ++i) {
93  unsigned nve = elems[i].vertex_count();
94  if (nve != elems_ref[i].vertex_count())
95  {
97  return;
98  }
99 
100  if (lambdaBase == REGULAR) {
101  compute_guide_matrices(guideLambda, ref_pd, i, L_guides, nve, err);
102  MSQ_ERRRTN(err); }
103  compute_guide_matrices(guideV, ref_pd, i, V_guides, nve, err); MSQ_ERRRTN(err);
104  compute_guide_matrices(guideQ, ref_pd, i, Q_guides, nve, err); MSQ_ERRRTN(err);
105  compute_guide_matrices(guideDelta, ref_pd, i, D_guides, nve, err); MSQ_ERRRTN(err);
106 
107  for (unsigned c=0; c<nve; ++c) {
108  if (lambdaBase == REGULAR) Lambda = compute_Lambda(L_guides[c], err); MSQ_ERRRTN(err);
109  V = compute_V_3D(V_guides[c], err); MSQ_ERRRTN(err);
110  Q = compute_Q_3D(Q_guides[c], err); MSQ_ERRRTN(err);
111  Delta = compute_Delta_3D(D_guides[c], err); MSQ_ERRRTN(err);
112  matrices[c] = Lambda * V * Q * Delta;
113  }
114  pd.targetMatrices.set_element_corner_tags( &pd, i, matrices, err ); MSQ_ERRRTN(err);
115  }
116 }
The Lambda coefficient is the average on the mesh.
CornerTag< TargetMatrix > targetMatrices
Target matrix data.
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.
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
Matrix3D compute_V_3D(const Matrix3D &A, MsqError &err)
Each element has a lambda coefficient.
const int MSQ_MAX_NUM_VERT_PER_ENT
Definition: Mesquite.hpp:120
Matrix3D compute_Q_3D(const Matrix3D &A, MsqError &err)
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.
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.
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
double get_average_Lambda_3d(MsqError &err)
Returns average corner determinant over all corners in the patch This information is stored in the pa...
size_t num_vertices() const
number of vertices in the patch.
Matrix3D compute_Delta_3D(const Matrix3D &A, MsqError &err)
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.

Here is the call graph for this function:

Member Data Documentation


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