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 : : #ifndef MSQ_PATCH_ITERATOR_CPP
28 : : #define MSQ_PATCH_ITERATOR_CPP
29 : :
30 : : #include "PatchIterator.hpp"
31 : : #include "MsqError.hpp"
32 : : #include "PatchData.hpp"
33 : :
34 : : namespace MBMesquite
35 : : {
36 : :
37 : 73 : bool PatchIterator::get_next_patch( PatchData& pd, MsqError& err )
38 : : {
39 [ + - ]: 73 : if( !patches.size() )
40 : : {
41 [ - + ]: 73 : if( pd.get_mesh() != patchSet->get_mesh() )
42 : : {
43 [ # # ]: 0 : if( pd.get_mesh() == 0 )
44 : 0 : pd.set_mesh( patchSet->get_mesh() );
45 [ # # ]: 0 : else if( patchSet->get_mesh() == 0 )
46 : 0 : patchSet->set_mesh( pd.get_mesh() );
47 : : else
48 : : {
49 : : MSQ_SETERR( err )
50 [ # # ]: 0 : ( "PatchSet and PatchData do not share the same Mesh instance.", MsqError::INVALID_STATE );
51 : 0 : return false;
52 : : }
53 : : }
54 : 73 : patchSet->get_patch_handles( patches, err );
55 [ - + ][ # # ]: 73 : MSQ_ERRZERO( err );
[ - + ]
56 : 73 : current = patches.begin();
57 : : }
58 : :
59 [ + - ][ - + ]: 73 : if( current == patches.end() ) return false;
60 : :
61 : 73 : patchSet->get_patch( *current, elems, verts, err );
62 [ - + ][ # # ]: 73 : MSQ_ERRZERO( err );
[ - + ]
63 : 73 : pd.set_mesh_entities( elems, verts, err );
64 [ - + ][ # # ]: 73 : MSQ_ERRZERO( err );
[ - + ]
65 : 73 : ++current;
66 : 73 : return true;
67 : : }
68 : :
69 : 0 : void PatchIterator::reset()
70 : : {
71 : 0 : current = patches.begin();
72 : 0 : }
73 : :
74 [ + - ][ + - ]: 120 : } // namespace MBMesquite
75 : :
76 : : #endif
|