MOAB: Mesh Oriented datABase  (version 5.3.0)
PatchIterator.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 #ifndef MSQ_PATCH_ITERATOR_CPP
00028 #define MSQ_PATCH_ITERATOR_CPP
00029 
00030 #include "PatchIterator.hpp"
00031 #include "MsqError.hpp"
00032 #include "PatchData.hpp"
00033 
00034 namespace MBMesquite
00035 {
00036 
00037 bool PatchIterator::get_next_patch( PatchData& pd, MsqError& err )
00038 {
00039     if( !patches.size() )
00040     {
00041         if( pd.get_mesh() != patchSet->get_mesh() )
00042         {
00043             if( pd.get_mesh() == 0 )
00044                 pd.set_mesh( patchSet->get_mesh() );
00045             else if( patchSet->get_mesh() == 0 )
00046                 patchSet->set_mesh( pd.get_mesh() );
00047             else
00048             {
00049                 MSQ_SETERR( err )
00050                 ( "PatchSet and PatchData do not share the same Mesh instance.", MsqError::INVALID_STATE );
00051                 return false;
00052             }
00053         }
00054         patchSet->get_patch_handles( patches, err );
00055         MSQ_ERRZERO( err );
00056         current = patches.begin();
00057     }
00058 
00059     if( current == patches.end() ) return false;
00060 
00061     patchSet->get_patch( *current, elems, verts, err );
00062     MSQ_ERRZERO( err );
00063     pd.set_mesh_entities( elems, verts, err );
00064     MSQ_ERRZERO( err );
00065     ++current;
00066     return true;
00067 }
00068 
00069 void PatchIterator::reset()
00070 {
00071     current = patches.begin();
00072 }
00073 
00074 }  // namespace MBMesquite
00075 
00076 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines