MOAB: Mesh Oriented datABase  (version 5.2.1)
VertexQM.cpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2006 Lawrence Livermore National Laboratory.  Under
00005     the terms of Contract B545069 with the University of Wisconsin --
00006     Madison, Lawrence Livermore National Laboratory retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     (2006) kraftche@cae.wisc.edu
00024 
00025   ***************************************************************** */
00026 
00027 /** \file VertexQM.cpp
00028  *  \brief
00029  *  \author Jason Kraftcheck
00030  */
00031 
00032 #include "Mesquite.hpp"
00033 #include "VertexQM.hpp"
00034 #include "PatchData.hpp"
00035 #include "ElemSampleQM.hpp"
00036 
00037 namespace MBMesquite
00038 {
00039 
00040 VertexQM::~VertexQM() {}
00041 
00042 void VertexQM::get_evaluations( PatchData& pd, std::vector< size_t >& handles, bool free_vertices_only, MsqError& err )
00043 {
00044     get_vertex_evaluations( pd, handles, free_vertices_only, err );
00045 }
00046 
00047 void VertexQM::get_vertex_evaluations( PatchData& pd, std::vector< size_t >& handles, bool free_vertices_only,
00048                                        MsqError& /*err*/ )
00049 {
00050     if( free_vertices_only )
00051     {
00052         handles.resize( pd.num_free_vertices() );
00053         for( size_t i = 0; i < pd.num_free_vertices(); ++i )
00054             handles[i] = i;
00055     }
00056     else
00057     {
00058         handles.clear();
00059         handles.reserve( pd.num_nodes() );
00060         for( size_t i = 0; i < pd.num_nodes(); ++i )
00061             if( !( pd.vertex_by_index( i ).get_flags() & MsqVertex::MSQ_PATCH_FIXED ) ) handles.push_back( i );
00062     }
00063 }
00064 
00065 void VertexQM::get_vertex_corner_handles( PatchData& pd, size_t vtx_idx, std::vector< size_t >& handles, MsqError& err )
00066 {
00067     size_t len;
00068     const size_t* elems = pd.get_vertex_element_adjacencies( vtx_idx, len, err );MSQ_ERRRTN( err );
00069 
00070     handles.resize( len );
00071     for( size_t i = 0; i < len; ++i )
00072     {
00073         const MsqMeshEntity& elem = pd.element_by_index( elems[i] );
00074         const size_t* verts       = elem.get_vertex_index_array();
00075         const size_t* ptr         = std::find( verts, verts + elem.node_count(), vtx_idx );
00076         unsigned idx              = ptr - verts;
00077         handles[i]                = ElemSampleQM::handle( Sample( 0, idx ), elems[i] );
00078     }
00079 }
00080 
00081 }  // namespace MBMesquite
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines