Branch data Line data Source code
1 : : /* *****************************************************************
2 : : MESQUITE -- The Mesh Quality Improvement Toolkit
3 : :
4 : : Copyright 2006 Sandia National Laboratories. Developed at the
5 : : University of Wisconsin--Madison under SNL contract number
6 : : 624796. The U.S. Government and the University of Wisconsin
7 : : retain certain rights to this software.
8 : :
9 : : This library is free software; you can redistribute it and/or
10 : : modify it under the terms of the GNU Lesser General Public
11 : : License as published by the Free Software Foundation; either
12 : : version 2.1 of the License, or (at your option) any later version.
13 : :
14 : : This library is distributed in the hope that it will be useful,
15 : : but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 : : Lesser General Public License for more details.
18 : :
19 : : You should have received a copy of the GNU Lesser General Public License
20 : : (lgpl.txt) along with this library; if not, write to the Free Software
21 : : Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 : :
23 : : (2006) [email protected]
24 : :
25 : : ***************************************************************** */
26 : :
27 : : /** \file TMPQualityMetric.hpp
28 : : * \brief
29 : : * \author Jason Kraftcheck
30 : : */
31 : :
32 : : #ifndef MSQ_TMP_QUALITY_METRIC_HPP
33 : : #define MSQ_TMP_QUALITY_METRIC_HPP
34 : :
35 : : #include "Mesquite.hpp"
36 : : #include "ElemSampleQM.hpp"
37 : : #include "MsqMatrix.hpp"
38 : :
39 : : namespace MBMesquite
40 : : {
41 : :
42 : : class TargetCalculator;
43 : : class WeightCalculator;
44 : : class TRel2DMetric;
45 : : class TRel3DMetric;
46 : : class NodeSet;
47 : : class Mesh;
48 : : class MeshDomain;
49 : : class Settings;
50 : :
51 : : /**\brief Compare targets to mapping function Jacobian matrices
52 : : *
53 : : * Base class for various TMP QualityMetric implementations
54 : : */
55 [ - + ]: 148 : class TMPQualityMetric : public ElemSampleQM
56 : : {
57 : : public:
58 : : /**
59 : : *\param tc The target calculator
60 : : *\param wc The weight calculator
61 : : */
62 [ + - ][ + - ]: 4345 : TMPQualityMetric( TargetCalculator* tc, WeightCalculator* wc ) : targetCalc( tc ), weightCalc( wc ) {}
[ + + ][ + - ]
[ + + ]
63 : :
64 : : MESQUITE_EXPORT virtual int get_negate_flag() const;
65 : :
66 : : MESQUITE_EXPORT virtual void get_evaluations( PatchData& pd, std::vector< size_t >& handles,
67 : : bool free_vertices_only, MsqError& err );
68 : :
69 : : MESQUITE_EXPORT static void get_patch_evaluations( PatchData& pd, std::vector< size_t >& handles,
70 : : bool free_vertices_only, MsqError& err );
71 : :
72 : : MESQUITE_EXPORT virtual void get_element_evaluations( PatchData& pd, size_t elem_index,
73 : : std::vector< size_t >& handles, MsqError& err );
74 : :
75 : : MESQUITE_EXPORT virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err );
76 : :
77 : : MESQUITE_EXPORT virtual bool evaluate_with_indices( PatchData& pd, size_t handle, double& value,
78 : : std::vector< size_t >& indices, MsqError& err );
79 : :
80 : : MESQUITE_EXPORT
81 : : void set_target_calculator( TargetCalculator* tc )
82 : : {
83 : : targetCalc = tc;
84 : : }
85 : : MESQUITE_EXPORT
86 : : void set_weight_calculator( WeightCalculator* wc )
87 : : {
88 : : weightCalc = wc;
89 : : }
90 : : MESQUITE_EXPORT
91 : : TargetCalculator* get_target_calculator() const
92 : : {
93 : : return targetCalc;
94 : : }
95 : : MESQUITE_EXPORT
96 : : WeightCalculator* get_weight_calculator() const
97 : : {
98 : : return weightCalc;
99 : : }
100 : :
101 : : MESQUITE_EXPORT
102 : : virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
103 : :
104 : : protected:
105 : : MESQUITE_EXPORT virtual bool evaluate_internal( PatchData& pd, size_t handle, double& value, size_t* indices,
106 : : size_t& num_indices, MsqError& err ) = 0;
107 : :
108 : : MESQUITE_EXPORT
109 : : bool evaluate_surface_common( // input:
110 : : PatchData& pd, Sample sample, size_t element_index, const NodeSet& bits,
111 : : // output:
112 : : size_t* indices, size_t& num_indices, MsqVector< 2 >* derivs, MsqMatrix< 2, 2 >& W, MsqMatrix< 2, 2 >& A,
113 : : MsqMatrix< 3, 2 >& S_a_transpose_Theta, MsqError& err );
114 : :
115 : : MESQUITE_EXPORT
116 : : void weight( PatchData& pd, Sample sample, size_t elem, int num_points, double& value, Vector3D* grad,
117 : : SymMatrix3D* diag, Matrix3D* hess, MsqError& err );
118 : :
119 : : enum
120 : : {
121 : : MAX_ELEM_NODES = 27
122 : : };
123 : : size_t mIndices[MAX_ELEM_NODES];
124 : : std::vector< MsqMatrix< 2, 2 > > hess2d;
125 : : MsqVector< 3 > mDerivs3D[MAX_ELEM_NODES];
126 : : MsqVector< 2 > mDerivs2D[MAX_ELEM_NODES];
127 : :
128 : : TargetCalculator* targetCalc;
129 : :
130 : : private:
131 : : WeightCalculator* weightCalc;
132 : : };
133 : :
134 : : } // namespace MBMesquite
135 : :
136 : : #endif
|