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 PMeanPMetric.hpp
28 : : * \brief
29 : : * \author Jason Kraftcheck
30 : : */
31 : :
32 : : #ifndef MSQ_PMEAN_PMETRIC_HPP
33 : : #define MSQ_PMEAN_PMETRIC_HPP
34 : :
35 : : #include "Mesquite.hpp"
36 : : #include "Exponent.hpp"
37 : :
38 : : #include "Vector3D.hpp"
39 : : #include "Matrix3D.hpp"
40 : :
41 : : #include <vector>
42 : :
43 : : namespace MBMesquite
44 : : {
45 : :
46 : : class PatchData;
47 : : class MsqError;
48 : : class QualityMetric;
49 : :
50 : 92 : class PMeanPMetric
51 : : {
52 : : public:
53 [ + - ][ + - ]: 46 : PMeanPMetric( double p ) : P( p ), P1( p - 1.0 ), P2( p - 2.0 ) {}
[ + - ][ + - ]
[ + - ]
54 : :
55 : : const Exponent& get_power() const
56 : : {
57 : : return P;
58 : : }
59 : :
60 : : protected:
61 : : bool average( PatchData& pd, QualityMetric* qm, const std::vector< size_t >& qm_handles, double& value, MsqError& );
62 : :
63 : : bool average_with_indices( PatchData& pd, QualityMetric* qm, const std::vector< size_t >& qm_handles, double& value,
64 : : std::vector< size_t >& indices, MsqError& err );
65 : :
66 : : bool average_with_gradient( PatchData& pd, QualityMetric* qm, const std::vector< size_t >& qm_handles,
67 : : double& value, std::vector< size_t >& indices, std::vector< Vector3D >& gradient,
68 : : MsqError& err );
69 : :
70 : : bool average_with_Hessian_diagonal( PatchData& pd, QualityMetric* metric, const std::vector< size_t >& qm_handles,
71 : : double& value, std::vector< size_t >& indices,
72 : : std::vector< Vector3D >& gradient, std::vector< SymMatrix3D >& Hessian_diagonal,
73 : : MsqError& err );
74 : :
75 : : bool average_with_Hessian( PatchData& pd, QualityMetric* metric, const std::vector< size_t >& qm_handles,
76 : : double& value, std::vector< size_t >& indices, std::vector< Vector3D >& gradient,
77 : : std::vector< Matrix3D >& Hessian, MsqError& err );
78 : :
79 : : private:
80 : : Exponent P;
81 : : Exponent P1;
82 : : Exponent P2;
83 : : std::vector< size_t > mIndices, mOffsets;
84 : : std::vector< Vector3D > mGrad;
85 : : std::vector< Matrix3D > mHess;
86 : : std::vector< SymMatrix3D > mDiag;
87 : : std::vector< double > mValues;
88 : : };
89 : :
90 : : } // namespace MBMesquite
91 : :
92 : : #endif
|