1 /* ***************************************************************** 2 MESQUITE -- The Mesh Quality Improvement Toolkit 3 4 Copyright 2005 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 kraftche@cae.wisc.edu 24 25 ***************************************************************** */ 26 27 #ifndef MSQ_BOUNDED_CYLINDER_DOMAIN_HPP 28 #define MSQ_BOUNDED_CYLINDER_DOMAIN_HPP 29 30 #include "CylinderDomain.hpp" 31 #include "Vector3D.hpp" 32 33 #include <list> 34 35 namespace MBMesquite { 36 37 class BoundedCylinderDomain : public CylinderDomain 38 { 39 public: 40 /** 41 *\param radius - Radius of the cylinder 42 *\param axis_direction - Vector defining the direction of the axis 43 *\param axis_point - A point through which the axis passes. 44 */ BoundedCylinderDomain(double pradius,Vector3D axis_direction=Vector3D (0,0,1),Vector3D axis_point=Vector3D (0,0,0))45 inline BoundedCylinderDomain( double pradius, 46 Vector3D axis_direction = Vector3D(0,0,1), 47 Vector3D axis_point = Vector3D(0,0,0) ) 48 : CylinderDomain( pradius, axis_direction, axis_point ) {} 49 50 51 virtual void domain_DoF( const Mesh::VertexHandle* handle_array, 52 unsigned short* dof_array, 53 size_t count, 54 MsqError& err ) const; 55 56 /**\brief define a circular curve bounding the cylinder 57 *\param distance Location on cylinder at which to create 58 * a circular curve, specified as the distance 59 * along the cylinder axis from axis_point 60 * specified to the constructor. 61 *\param handles A list of handles which are to be constidered 62 * bound to the curve. 63 */ 64 void create_curve( double distance, 65 const std::vector<Mesh::VertexHandle>& handles ); 66 67 /**\brief define a circular curve bounding the cylinder 68 *\param distance Location on cylinder at which to create 69 * a circular curve, specified as the distance 70 * along the cylinder axis from axis_point 71 * specified to the constructor. 72 *\param mesh All vertices in this mesh within the specified 73 * tolerance of the curve will be considered bound 74 * to the curve. 75 *\param tolerance The distance tolerance to use. 76 */ 77 void create_curve( double distance, 78 Mesh* mesh, 79 double tolerance, 80 MsqError& err ); 81 82 protected: 83 84 void evaluate( double t, 85 const Vector3D& point, 86 Vector3D& closest, 87 Vector3D& normal ) const; 88 89 virtual void evaluate( Mesh::VertexHandle handle, 90 const Vector3D& point, 91 Vector3D& closest, 92 Vector3D& normal ) const; 93 94 bool find_curve( Mesh::VertexHandle handle, double& t ) const; 95 96 private: 97 98 struct Curve { 99 double t; 100 std::vector<Mesh::EntityHandle> handles; 101 }; 102 103 std::list<Curve> curveList; 104 }; 105 106 107 } // namespace MBMesquite 108 109 #endif 110