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 : : [email protected]
26 : :
27 : : ***************************************************************** */
28 : : /*!
29 : : \file SphericalDomain.hpp
30 : : \brief
31 : :
32 : :
33 : : \author Thomas Leurent
34 : : \date 2002-01-17
35 : : */
36 : : #ifndef MSQ_SPHERICAL_DOMAIN_HPP
37 : : #define MSQ_SPHERICAL_DOMAIN_HPP
38 : :
39 : : #include "MeshInterface.hpp"
40 : : #include "Vector3D.hpp"
41 : :
42 : : namespace MBMesquite
43 : : {
44 : : /*! \class SphericalDomain
45 : : This is a template for a spherical domain.
46 : : It will provide the normal information necessary for surface mesh optimization.
47 : : */
48 : : class MESQUITE_EXPORT SphericalDomain : public MBMesquite::MeshDomain
49 : : {
50 : : public:
51 [ + - ]: 2 : SphericalDomain( const Vector3D& p_center, double p_radius ) : mCenter( p_center ), mRadius( p_radius ) {}
52 : :
53 : : SphericalDomain() {}
54 : :
55 : : virtual ~SphericalDomain();
56 : :
57 : 0 : void set_sphere( const Vector3D& p_center, double p_radius )
58 : : {
59 : 0 : mCenter = p_center;
60 : 0 : mRadius = p_radius;
61 : 0 : }
62 : :
63 : : void fit_vertices( Mesh* mesh, MsqError& err, double epsilon = 0.0 );
64 : :
65 : : void fit_vertices( Mesh* mesh, const Mesh::VertexHandle* vertex_array, size_t vertex_array_length, MsqError& err,
66 : : double epsilon = 0.0 );
67 : :
68 : : virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
69 : :
70 : : virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
71 : :
72 : : virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
73 : :
74 : : virtual void vertex_normal_at( const Mesh::VertexHandle* handle, Vector3D coords[], unsigned count,
75 : : MsqError& err ) const;
76 : :
77 : : virtual void closest_point( Mesh::VertexHandle handle, const Vector3D& position, Vector3D& closest,
78 : : Vector3D& normal, MsqError& err ) const;
79 : :
80 : : virtual void domain_DoF( const Mesh::VertexHandle* handle_array, unsigned short* dof_array, size_t num_vertices,
81 : : MsqError& err ) const;
82 : :
83 : : Vector3D center() const
84 : : {
85 : : return mCenter;
86 : : }
87 : : double radius() const
88 : : {
89 : : return mRadius;
90 : : }
91 : :
92 : : private:
93 : : Vector3D mCenter;
94 : : double mRadius;
95 : : };
96 : : } // namespace MBMesquite
97 : :
98 : : #endif
|