MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 /* ***************************************************************** 00002 MESQUITE -- The Mesh Quality Improvement Toolkit 00003 00004 Copyright 2004 Sandia Corporation and Argonne National 00005 Laboratory. Under the terms of Contract DE-AC04-94AL85000 00006 with Sandia Corporation, the U.S. Government 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 [email protected], [email protected], [email protected], 00024 [email protected], [email protected], [email protected] 00025 00026 ***************************************************************** */ 00027 00028 /*! \file MsqVertex.hpp 00029 \brief Mesquite's vertex object. 00030 00031 \author Darryl Melander 00032 \author Thomas Leurent 00033 */ 00034 #ifndef MSQVERTEX_HPP 00035 #define MSQVERTEX_HPP 00036 00037 #include "Mesquite.hpp" 00038 #include "Vector3D.hpp" 00039 00040 namespace MBMesquite 00041 { 00042 /*! 00043 \class MsqVertex 00044 \brief MsqVertex is the Mesquite object that stores information about 00045 the vertices in the mesh. 00046 00047 This class has no virtual destructor for performance reasons. 00048 !!! Make sure NOT to delete a MsqVertex object from a pointer 00049 to Vector3D !!! 00050 */ 00051 class MESQUITE_EXPORT MsqVertex : public Vector3D 00052 { 00053 public: 00054 //! Construct vertex using three doubles. 00055 MsqVertex( double p_x, double p_y, double p_z ) : Vector3D( p_x, p_y, p_z ), vertexBitFlags( 0 ) {} 00056 00057 //! Construct vertex using Vector3D. 00058 MsqVertex( const Vector3D& vec ) : Vector3D( vec ), vertexBitFlags( 0 ) {} 00059 00060 //! Construct default vertex with coordinates (0.0,0.0,0.0) 00061 MsqVertex() : Vector3D( 0, 0, 0 ), vertexBitFlags( 0 ) {} 00062 00063 //! Construct default vertex with coordinates (0.0,0.0,0.0) 00064 MsqVertex( const MsqVertex& rhs ) : Vector3D( rhs ), vertexBitFlags( rhs.vertexBitFlags ) {} 00065 00066 //! Initializes with coordinates. Sets tag data/pointer to 0. 00067 MsqVertex& operator=( const Vector3D& rhs ) 00068 { 00069 Vector3D::operator=( rhs ); 00070 return *this; 00071 } 00072 00073 // This allows for 8 flag bits. 00074 // I don't think we'll want more than that (yet). 00075 typedef unsigned char FlagMask; 00076 00077 //! \enum FlagMaskID 00078 //! Those are the available flags... currently only return 00079 //! is_free. 00080 //! Developers: The values used in that enum are used by a bitset, 00081 //! so they have to be 2-based (2,4,8,16,32, ...) 00082 enum FlagMaskID 00083 { 00084 MSQ_HARD_FIXED = 1 << 0, //!< vertex is always fixed. This can only be set on and never off. 00085 MSQ_DEPENDENT = 1 << 1, //!< higher-order node w/ position determined by mapping function 00086 MSQ_CULLED = 1 << 2, //!< vertex is fixed. This flag can be set on and off. 00087 MSQ_PATCH_FIXED = 1 << 3, //!< vertex is fixed only because it is on patch boundary (not by app request) 00088 MSQ_MARK = 1 << 4, //!< arbitrary mark for use by code - clear before using 00089 MSQ_FIXED = ( MSQ_HARD_FIXED | MSQ_CULLED | MSQ_PATCH_FIXED ) 00090 }; 00091 //! Returns true if vertex is ``free''. 00092 bool is_free_vertex() const 00093 { 00094 return ( vertexBitFlags & ( MSQ_HARD_FIXED | MSQ_PATCH_FIXED ) ) == 0; 00095 } 00096 00097 void set_soft_fixed_flag() 00098 { 00099 vertexBitFlags |= MSQ_CULLED; 00100 } 00101 00102 void remove_soft_fixed_flag() 00103 { 00104 vertexBitFlags &= ( ~MSQ_CULLED ); 00105 } 00106 00107 void set_hard_fixed_flag() 00108 { 00109 vertexBitFlags |= MSQ_HARD_FIXED; 00110 } 00111 00112 void set_vertex_flag( FlagMaskID flag ) 00113 { 00114 vertexBitFlags |= flag; 00115 } 00116 00117 void remove_vertex_flag( FlagMaskID flag ) 00118 { 00119 vertexBitFlags &= ( ~flag ); 00120 } 00121 00122 bool is_flag_set( FlagMaskID flag ) const 00123 { 00124 return ( vertexBitFlags & flag ) != 0; 00125 } 00126 00127 FlagMask get_flags() const 00128 { 00129 return vertexBitFlags; 00130 } 00131 00132 FlagMask& flags() 00133 { 00134 return vertexBitFlags; 00135 } 00136 00137 void set_flags( FlagMask p_flags ) 00138 { 00139 vertexBitFlags = p_flags; 00140 } 00141 00142 private: 00143 FlagMask vertexBitFlags; 00144 }; 00145 00146 } // namespace MBMesquite 00147 00148 #endif // MsqVertex_hpp