Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TriangleInterface.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: TriangleInterface.h
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: class for interfacing with triangle
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_MESHUTILS_EXTLIBINTERFACE_TRIANGLEINTERFACE_H
37 #define NEKTAR_MESHUTILS_EXTLIBINTERFACE_TRIANGLEINTERFACE_H
38 
39 #include <boost/shared_ptr.hpp>
40 
44 
45 // horible definitions to get triangle to work
46 #define REAL double
47 #define ANSI_DECLARATORS
48 #define TRILIBRARY
49 #define VOID int
50 
51 extern "C" {
52 #include <triangle.h>
53 }
54 
55 namespace Nektar
56 {
57 namespace NekMeshUtils
58 {
59 
60 /**
61  * @brief class for interfacing with external library triangle
62  */
64 {
65 public:
67 
68  /**
69  * @brief default constructor
70  */
72 
73  /**
74  * @brief assign meshing paramters
75  */
76  void Assign(std::vector<std::vector<NodeSharedPtr> > &boundingloops,
77  std::vector<Array<OneD, NekDouble> > &centers,
78  int i,
79  NekDouble str = 1.0)
80  {
81  m_boundingloops = boundingloops;
82  m_centers = centers;
83  m_str = str;
84  sid = i;
85  }
86 
87  void AssignStiener(std::vector<NodeSharedPtr> stiner)
88  {
89  m_stienerpoints = stiner;
90  }
91 
92  /**
93  * @brief Execute meshing
94  */
95  void Mesh(bool Quiet = true, bool Quality = false);
96 
97  /**
98  * @brief Extract mesh
99  */
100  void Extract(std::vector<std::vector<NodeSharedPtr> > &Connec);
101 
102 private:
103  /**
104  * @brief Clear memory
105  */
106  void SetUp();
107 
108  /// List of bounding nodes to the surface
109  std::vector<std::vector<NodeSharedPtr> > m_boundingloops;
110  /// List of additional nodes
111  std::vector<NodeSharedPtr> m_stienerpoints;
112  /// Coordinates of the centers of the loops
113  std::vector<Array<OneD, NekDouble> > m_centers;
114  /// Map from NekMesh id to triangle id
115  std::map<int, NodeSharedPtr> nodemap;
116  /// ID of the surface
117  int sid;
118  /// Stretching factor of parameter plane
120  /// Triangle data strucutres
121  struct triangulateio in, out;
122 };
123 
124 typedef boost::shared_ptr<TriangleInterface> TriangleInterfaceSharedPtr;
125 }
126 }
127 
128 #endif
std::vector< Array< OneD, NekDouble > > m_centers
Coordinates of the centers of the loops.
class for interfacing with external library triangle
void Extract(std::vector< std::vector< NodeSharedPtr > > &Connec)
Extract mesh.
boost::shared_ptr< TriangleInterface > TriangleInterfaceSharedPtr
void Mesh(bool Quiet=true, bool Quality=false)
Execute meshing.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::vector< std::vector< NodeSharedPtr > > m_boundingloops
List of bounding nodes to the surface.
std::map< int, NodeSharedPtr > nodemap
Map from NekMesh id to triangle id.
std::vector< NodeSharedPtr > m_stienerpoints
List of additional nodes.
NekDouble m_str
Stretching factor of parameter plane.
double NekDouble
void AssignStiener(std::vector< NodeSharedPtr > stiner)
struct triangulateio in out
Triangle data strucutres.
void Assign(std::vector< std::vector< NodeSharedPtr > > &boundingloops, std::vector< Array< OneD, NekDouble > > &centers, int i, NekDouble str=1.0)
assign meshing paramters