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_VERTEX_PATCHES_HPP
28 : : #define MSQ_VERTEX_PATCHES_HPP
29 : :
30 : : /** \file VertexPatches.hpp
31 : : * \brief
32 : : * \author Jason Kraftcheck
33 : : */
34 : :
35 : : #include "Mesquite.hpp"
36 : : #include "PatchSet.hpp"
37 : :
38 : : namespace MBMesquite
39 : : {
40 : :
41 : : /**\brief A PatchSet representing a decomposition of the mesh
42 : : * into patches containing a single free vertex and the
43 : : * adjacent elements
44 : : */
45 : : class VertexPatches : public PatchSet
46 : : {
47 : : public:
48 : : /**\brief constructor
49 : : *\param num_layers Number of layers of elements adjacent to each vertex
50 : : *\param free_vertices_only Skip fixed vertices if true.
51 : : */
52 : 284 : inline VertexPatches( unsigned p_num_layers = 1, bool p_free_vertices_only = true )
53 [ + - ]: 284 : : numLayers( p_num_layers ), freeVertices( p_free_vertices_only )
54 : : {
55 : 284 : }
56 : :
57 : : MESQUITE_EXPORT
58 : : ~VertexPatches();
59 : :
60 : : /**\brief Set number of layers of elements adjacent to each vertex */
61 : 30 : inline void set_num_layers( unsigned num_layers )
62 : : {
63 : 30 : numLayers = num_layers;
64 : 30 : }
65 : :
66 : : /**\brief Get number of layers of elements adjacent to each vertex */
67 : : inline unsigned get_num_layers() const
68 : : {
69 : : return numLayers;
70 : : }
71 : :
72 : : /**\brief Skip fixed vertices if true. */
73 : : inline void free_vertices_only( bool yesno )
74 : : {
75 : : freeVertices = yesno;
76 : : }
77 : :
78 : : /**\brief Skip fixed vertices if true. */
79 : 928246 : inline bool free_vertices_only() const
80 : : {
81 : 928246 : return freeVertices;
82 : : }
83 : :
84 : : /**\brief Get a list of handles, one for each patch */
85 : : MESQUITE_EXPORT
86 : : virtual void get_patch_handles( std::vector< PatchHandle >& patch_handles_out, MsqError& err );
87 : :
88 : : /**\brief Get the mesh entities in a patch
89 : : *
90 : : * Given one of the handles returned by get_patch_handles(),
91 : : * return the mesh entities in the corresponding patch. If
92 : : * only free vertices are to be returned, this funtion will return
93 : : * empty lists for culled vertices.
94 : : *
95 : : *\param patch_handle one of the handles returned by get_patch_handles()
96 : : *\param elem_handles_out the list of elements in the mesh
97 : : *\param free_vertices_out the list of vertices interior to the patch
98 : : */
99 : : MESQUITE_EXPORT
100 : : virtual void get_patch( PatchHandle patch_handle, std::vector< Mesh::ElementHandle >& elem_handles_out,
101 : : std::vector< Mesh::VertexHandle >& free_vertices_out, MsqError& err );
102 : :
103 : : private:
104 : : std::vector< size_t > junk;
105 : :
106 : : unsigned numLayers; //!< number of layers of adjacent elements
107 : : bool freeVertices; //!< skip fixed vertices if true
108 : : };
109 : :
110 : : } // namespace MBMesquite
111 : :
112 : : #endif
|