MOAB: Mesh Oriented datABase  (version 5.4.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) [email protected]
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,
00048                                        std::vector< size_t >& handles,
00049                                        bool free_vertices_only,
00050                                        MsqError& /*err*/ )
00051 {
00052     if( free_vertices_only )
00053     {
00054         handles.resize( pd.num_free_vertices() );
00055         for( size_t i = 0; i < pd.num_free_vertices(); ++i )
00056             handles[i] = i;
00057     }
00058     else
00059     {
00060         handles.clear();
00061         handles.reserve( pd.num_nodes() );
00062         for( size_t i = 0; i < pd.num_nodes(); ++i )
00063             if( !( pd.vertex_by_index( i ).get_flags() & MsqVertex::MSQ_PATCH_FIXED ) ) handles.push_back( i );
00064     }
00065 }
00066 
00067 void VertexQM::get_vertex_corner_handles( PatchData& pd, size_t vtx_idx, std::vector< size_t >& handles, MsqError& err )
00068 {
00069     size_t len;
00070     const size_t* elems = pd.get_vertex_element_adjacencies( vtx_idx, len, err );MSQ_ERRRTN( err );
00071 
00072     handles.resize( len );
00073     for( size_t i = 0; i < len; ++i )
00074     {
00075         const MsqMeshEntity& elem = pd.element_by_index( elems[i] );
00076         const size_t* verts       = elem.get_vertex_index_array();
00077         const size_t* ptr         = std::find( verts, verts + elem.node_count(), vtx_idx );
00078         unsigned idx              = ptr - verts;
00079         handles[i]                = ElemSampleQM::handle( Sample( 0, idx ), elems[i] );
00080     }
00081 }
00082 
00083 }  // namespace MBMesquite
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines