Branch data Line data Source code
1 : : /* *****************************************************************
2 : : MESQUITE -- The Mesh Quality Improvement Toolkit
3 : :
4 : : Copyright 2004 Sandia Corporation and Argonne National
5 : : Laboratory. Under the terms of Contract DE-AC04-94AL85000
6 : : with Sandia Corporation, the U.S. Government 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 : : [email protected], [email protected], [email protected],
24 : : [email protected], [email protected], [email protected]
25 : :
26 : : ***************************************************************** */
27 : :
28 : : /*! \file MsqVertex.hpp
29 : : \brief Mesquite's vertex object.
30 : :
31 : : \author Darryl Melander
32 : : \author Thomas Leurent
33 : : */
34 : : #ifndef MSQVERTEX_HPP
35 : : #define MSQVERTEX_HPP
36 : :
37 : : #include "Mesquite.hpp"
38 : : #include "Vector3D.hpp"
39 : :
40 : : namespace MBMesquite
41 : : {
42 : : /*!
43 : : \class MsqVertex
44 : : \brief MsqVertex is the Mesquite object that stores information about
45 : : the vertices in the mesh.
46 : :
47 : : This class has no virtual destructor for performance reasons.
48 : : !!! Make sure NOT to delete a MsqVertex object from a pointer
49 : : to Vector3D !!!
50 : : */
51 : 4614522 : class MESQUITE_EXPORT MsqVertex : public Vector3D
52 : : {
53 : : public:
54 : : //! Construct vertex using three doubles.
55 : : MsqVertex( double p_x, double p_y, double p_z ) : Vector3D( p_x, p_y, p_z ), vertexBitFlags( 0 ) {}
56 : :
57 : : //! Construct vertex using Vector3D.
58 : : MsqVertex( const Vector3D& vec ) : Vector3D( vec ), vertexBitFlags( 0 ) {}
59 : :
60 : : //! Construct default vertex with coordinates (0.0,0.0,0.0)
61 : 531282 : MsqVertex() : Vector3D( 0, 0, 0 ), vertexBitFlags( 0 ) {}
62 : :
63 : : //! Construct default vertex with coordinates (0.0,0.0,0.0)
64 : 476 : MsqVertex( const MsqVertex& rhs ) : Vector3D( rhs ), vertexBitFlags( rhs.vertexBitFlags ) {}
65 : :
66 : : //! Initializes with coordinates. Sets tag data/pointer to 0.
67 : 31283492 : MsqVertex& operator=( const Vector3D& rhs )
68 : : {
69 : 31283492 : Vector3D::operator=( rhs );
70 : 31283492 : return *this;
71 : : }
72 : :
73 : : // This allows for 8 flag bits.
74 : : // I don't think we'll want more than that (yet).
75 : : typedef unsigned char FlagMask;
76 : :
77 : : //! \enum FlagMaskID
78 : : //! Those are the available flags... currently only return
79 : : //! is_free.
80 : : //! Developers: The values used in that enum are used by a bitset,
81 : : //! so they have to be 2-based (2,4,8,16,32, ...)
82 : : enum FlagMaskID
83 : : {
84 : : MSQ_HARD_FIXED = 1 << 0, //!< vertex is always fixed. This can only be set on and never off.
85 : : MSQ_DEPENDENT = 1 << 1, //!< higher-order node w/ position determined by mapping function
86 : : MSQ_CULLED = 1 << 2, //!< vertex is fixed. This flag can be set on and off.
87 : : MSQ_PATCH_FIXED = 1 << 3, //!< vertex is fixed only because it is on patch boundary (not by app request)
88 : : MSQ_MARK = 1 << 4, //!< arbitrary mark for use by code - clear before using
89 : : MSQ_FIXED = ( MSQ_HARD_FIXED | MSQ_CULLED | MSQ_PATCH_FIXED )
90 : : };
91 : : //! Returns true if vertex is ``free''.
92 : 53288 : bool is_free_vertex() const
93 : : {
94 : 53288 : return ( vertexBitFlags & ( MSQ_HARD_FIXED | MSQ_PATCH_FIXED ) ) == 0;
95 : : }
96 : :
97 : 49295 : void set_soft_fixed_flag()
98 : : {
99 : 49295 : vertexBitFlags |= MSQ_CULLED;
100 : 49295 : }
101 : :
102 : 6991780 : void remove_soft_fixed_flag()
103 : : {
104 : 6991780 : vertexBitFlags &= ( ~MSQ_CULLED );
105 : 6991780 : }
106 : :
107 : : void set_hard_fixed_flag()
108 : : {
109 : : vertexBitFlags |= MSQ_HARD_FIXED;
110 : : }
111 : :
112 : : void set_vertex_flag( FlagMaskID flag )
113 : : {
114 : : vertexBitFlags |= flag;
115 : : }
116 : :
117 : : void remove_vertex_flag( FlagMaskID flag )
118 : : {
119 : : vertexBitFlags &= ( ~flag );
120 : : }
121 : :
122 : 51917 : bool is_flag_set( FlagMaskID flag ) const
123 : : {
124 : 51917 : return ( vertexBitFlags & flag ) != 0;
125 : : }
126 : :
127 : 7847711 : FlagMask get_flags() const
128 : : {
129 : 7847711 : return vertexBitFlags;
130 : : }
131 : :
132 : 9037380 : FlagMask& flags()
133 : : {
134 : 9037380 : return vertexBitFlags;
135 : : }
136 : :
137 : 0 : void set_flags( FlagMask p_flags )
138 : : {
139 : 0 : vertexBitFlags = p_flags;
140 : 0 : }
141 : :
142 : : private:
143 : : FlagMask vertexBitFlags;
144 : : };
145 : :
146 : : } // namespace MBMesquite
147 : :
148 : : #endif // MsqVertex_hpp
|