Branch data Line data Source code
1 : : /* *****************************************************************
2 : : MESQUITE -- The Mesh Quality Improvement Toolkit
3 : :
4 : : Copyright 2006 Lawrence Livermore National Laboratory. Under
5 : : the terms of Contract B545069 with the University of Wisconsin --
6 : : Madison, Lawrence Livermore National Laboratory retains certain
7 : : rights in 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 VertexQM.cpp
28 : : * \brief
29 : : * \author Jason Kraftcheck
30 : : */
31 : :
32 : : #include "Mesquite.hpp"
33 : : #include "VertexQM.hpp"
34 : : #include "PatchData.hpp"
35 : : #include "ElemSampleQM.hpp"
36 : :
37 : : namespace MBMesquite
38 : : {
39 : :
40 [ - + ]: 6 : VertexQM::~VertexQM() {}
41 : :
42 : 2 : void VertexQM::get_evaluations( PatchData& pd, std::vector< size_t >& handles, bool free_vertices_only, MsqError& err )
43 : : {
44 : 2 : get_vertex_evaluations( pd, handles, free_vertices_only, err );
45 : 2 : }
46 : :
47 : 2 : void VertexQM::get_vertex_evaluations( PatchData& pd, std::vector< size_t >& handles, bool free_vertices_only,
48 : : MsqError& /*err*/ )
49 : : {
50 [ + - ]: 2 : if( free_vertices_only )
51 : : {
52 : 2 : handles.resize( pd.num_free_vertices() );
53 [ + + ]: 4 : for( size_t i = 0; i < pd.num_free_vertices(); ++i )
54 : 2 : handles[i] = i;
55 : : }
56 : : else
57 : : {
58 : 0 : handles.clear();
59 : 0 : handles.reserve( pd.num_nodes() );
60 [ # # ][ # # ]: 0 : for( size_t i = 0; i < pd.num_nodes(); ++i )
61 [ # # ][ # # ]: 0 : if( !( pd.vertex_by_index( i ).get_flags() & MsqVertex::MSQ_PATCH_FIXED ) ) handles.push_back( i );
[ # # ][ # # ]
62 : : }
63 : 2 : }
64 : :
65 : 0 : void VertexQM::get_vertex_corner_handles( PatchData& pd, size_t vtx_idx, std::vector< size_t >& handles, MsqError& err )
66 : : {
67 : : size_t len;
68 [ # # ][ # # ]: 0 : const size_t* elems = pd.get_vertex_element_adjacencies( vtx_idx, len, err );MSQ_ERRRTN( err );
[ # # ][ # # ]
[ # # ][ # # ]
69 : :
70 [ # # ]: 0 : handles.resize( len );
71 [ # # ]: 0 : for( size_t i = 0; i < len; ++i )
72 : : {
73 [ # # ]: 0 : const MsqMeshEntity& elem = pd.element_by_index( elems[i] );
74 [ # # ]: 0 : const size_t* verts = elem.get_vertex_index_array();
75 [ # # ][ # # ]: 0 : const size_t* ptr = std::find( verts, verts + elem.node_count(), vtx_idx );
76 : 0 : unsigned idx = ptr - verts;
77 [ # # ][ # # ]: 0 : handles[i] = ElemSampleQM::handle( Sample( 0, idx ), elems[i] );
[ # # ]
78 : : }
79 : : }
80 : :
81 [ + - ][ + - ]: 12 : } // namespace MBMesquite
|