1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/* *****************************************************************
    MESQUITE -- The Mesh Quality Improvement Toolkit

    Copyright 2008 Sandia National Laboratories.  Developed at the
    University of Wisconsin--Madison under SNL contract number
    624796.  The U.S. Government and the University of Wisconsin
    retain certain rights to this software.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    (lgpl.txt) along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    (2008) [email protected]

  ***************************************************************** */

/** \file MeshDomain1D.hpp
 *  \brief
 *  \author Jason Kraftcheck
 */

#ifndef MSQ_MESH_DOMAIN1D_HPP
#define MSQ_MESH_DOMAIN1D_HPP

#include "Mesquite.hpp"
#include "MeshInterface.hpp"
#include "MsqGeomPrim.hpp"
#include "CurveDomain.hpp"

namespace MBMesquite
{

class MESQUITE_EXPORT PointDomain : public MeshDomain
{
  private:
    Vector3D mGeom;

  public:
    PointDomain( const Vector3D& location ) : mGeom( location ) {}

    const Vector3D& geom() const
    {
        return mGeom;
    }

    virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;

    virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
    virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;

    virtual void vertex_normal_at( const Mesh::VertexHandle* handles,
                                   Vector3D coordinates[],
                                   unsigned count,
                                   MsqError& err ) const;

    virtual void closest_point( Mesh::VertexHandle handle,
                                const Vector3D& position,
                                Vector3D& closest,
                                Vector3D& normal,
                                MsqError& err ) const;

    virtual void domain_DoF( const Mesh::VertexHandle* handle_array,
                             unsigned short* dof_array,
                             size_t num_handles,
                             MsqError& err ) const;
};

class MESQUITE_EXPORT LineDomain : public MeshDomain, public CurveDomain
{
  private:
    MsqLine mGeom;

  public:
    LineDomain( const Vector3D& point, const Vector3D& dir ) : mGeom( point, dir ) {}

    LineDomain( const MsqLine& line ) : mGeom( line ) {}

    const MsqLine& geom() const
    {
        return mGeom;
    }

    virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;

    virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
    virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;

    virtual void vertex_normal_at( const Mesh::VertexHandle* handles,
                                   Vector3D coordinates[],
                                   unsigned count,
                                   MsqError& err ) const;

    virtual void closest_point( Mesh::VertexHandle handle,
                                const Vector3D& position,
                                Vector3D& closest,
                                Vector3D& normal,
                                MsqError& err ) const;

    virtual void domain_DoF( const Mesh::VertexHandle* handle_array,
                             unsigned short* dof_array,
                             size_t num_handles,
                             MsqError& err ) const;

    virtual double arc_length( const double position1[3], const double position2[3], MsqError& err );

    virtual void position_from_length( const double from_here[3],
                                       double length,
                                       double result_point[3],
                                       MsqError& err );
};

class MESQUITE_EXPORT CircleDomain : public MeshDomain, CurveDomain
{
  private:
    MsqCircle mGeom;

  public:
    CircleDomain( const Vector3D& center, const Vector3D& normal, double radius ) : mGeom( center, normal, radius ) {}

    CircleDomain( const MsqCircle& circle ) : mGeom( circle ) {}

    const MsqCircle& geom() const
    {
        return mGeom;
    }

    virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;

    virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
    virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;

    virtual void vertex_normal_at( const Mesh::VertexHandle* handles,
                                   Vector3D coordinates[],
                                   unsigned count,
                                   MsqError& err ) const;

    virtual void closest_point( Mesh::VertexHandle handle,
                                const Vector3D& position,
                                Vector3D& closest,
                                Vector3D& normal,
                                MsqError& err ) const;

    virtual void domain_DoF( const Mesh::VertexHandle* handle_array,
                             unsigned short* dof_array,
                             size_t num_handles,
                             MsqError& err ) const;

    virtual double arc_length( const double position1[3], const double position2[3], MsqError& err );

    virtual void position_from_length( const double from_here[3],
                                       double length,
                                       double result_point[3],
                                       MsqError& err );
};

}  // namespace MBMesquite

#endif