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 InvTransBarrier.cpp
28 : : * \brief
29 : : * \author Jason Kraftcheck
30 : : */
31 : :
32 : : #include "Mesquite.hpp"
33 : : #include "InvTransBarrier.hpp"
34 : : #include "MsqMatrix.hpp"
35 : : #include "MsqError.hpp"
36 : :
37 : : namespace MBMesquite
38 : : {
39 : :
40 : 0 : std::string InvTransBarrier::get_name() const
41 : : {
42 [ # # ]: 0 : return "InvTransBarrier";
43 : : }
44 : :
45 [ - + ]: 12 : InvTransBarrier::~InvTransBarrier() {}
46 : :
47 : 606390 : bool InvTransBarrier::evaluate( const MsqMatrix< 2, 2 >& T, double& result, MsqError& err )
48 : : {
49 [ + - ]: 606390 : double tau = det( T );
50 [ + - ][ + + ]: 606390 : if( invalid_determinant( tau ) )
51 : : {
52 [ + - ][ + - ]: 38 : MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
53 : 38 : return false;
54 : : }
55 [ + - ]: 606352 : MsqMatrix< 2, 2 > Tp = transpose_adj( T );
56 [ + - ]: 606352 : Tp *= 1.0 / tau;
57 [ + - ]: 606352 : bool rval = metricPtr->evaluate( Tp, result, err );
58 [ + - ][ - + ]: 606390 : return !MSQ_CHKERR( err ) && rval;
[ # # ][ # # ]
[ + - ]
59 : : }
60 : :
61 : 0 : bool InvTransBarrier::evaluate( const MsqMatrix< 3, 3 >& T, double& result, MsqError& err )
62 : : {
63 [ # # ]: 0 : double tau = det( T );
64 [ # # ][ # # ]: 0 : if( invalid_determinant( tau ) )
65 : : {
66 [ # # ][ # # ]: 0 : MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
67 : 0 : return false;
68 : : }
69 [ # # ]: 0 : MsqMatrix< 3, 3 > Tp = transpose_adj( T );
70 [ # # ]: 0 : Tp *= 1.0 / tau;
71 [ # # ]: 0 : bool rval = metricPtr->evaluate( Tp, result, err );
72 [ # # ][ # # ]: 0 : return !MSQ_CHKERR( err ) && rval;
[ # # ][ # # ]
[ # # ]
73 : : }
74 : :
75 [ + - ][ + - ]: 4 : } // namespace MBMesquite
|