pointConversion.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::pointConversion
28 
29 Description
30  Conversion functions between point (Foam::) and Point (CGAL::)
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef pointConversion_H
35 #define pointConversion_H
36 
37 #include "point.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 #ifdef CGAL_INEXACT
42 
43  // Define Point to be contiguous for inexact (double storage) kernel
44  typedef const Foam::point& pointFromPoint;
46 
47 #else
48 
51 
52 #endif
53 
54 namespace Foam
55 {
56 
57 #ifdef CGAL_INEXACT
58 
59  template<class Point>
60  inline pointFromPoint topoint(const Point& P)
61  {
62  return reinterpret_cast<pointFromPoint>(P);
63  }
64 
65  inline PointFrompoint toPoint(const Foam::point& p)
66  {
67  return reinterpret_cast<PointFrompoint>(p);
68  }
69 
70 #else
71 
72  template<class Point>
73  inline pointFromPoint topoint(const Point& P)
74  {
75  return Foam::point
76  (
77  CGAL::to_double(P.x()),
78  CGAL::to_double(P.y()),
79  CGAL::to_double(P.z())
80  );
81  }
82 
83  inline PointFrompoint toPoint(const Foam::point& p)
84  {
85  return PointFrompoint(p.x(), p.y(), p.z());
86  }
87 
88 #endif
89 
90  //- Specialisation for indexedVertex.
91  template<>
92  inline pointFromPoint topoint<CGAL::indexedVertex<K>>
93  (
94  const CGAL::indexedVertex<K>& P
95  )
96  {
97  return topoint(P.point());
98  }
99 
100  //- Specialisation for Foam::point. Used only as a dummy.
101  template<>
102  inline pointFromPoint topoint<Foam::point>
103  (
104  const Foam::point& P
105  )
106  {
107  return P;
108  }
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace Foam
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #endif
117 
118 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
point.H
CGAL::indexedVertex
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
Definition: indexedVertex.H:54
Foam::topoint
pointFromPoint topoint(const Point &P)
Definition: pointConversion.H:72
pointFromPoint
Foam::point pointFromPoint
Definition: pointConversion.H:48
Foam::toPoint
PointFrompoint toPoint(const Foam::point &p)
Definition: pointConversion.H:82
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Vector< scalar >
Point
CGAL::Point_3< K > Point
Definition: CGALIndexedPolyhedron.H:53
PointFrompoint
CGAL::Triangulation_vertex_base_3< K >::Point PointFrompoint
Definition: pointConversion.H:49
Foam::point
vector point
Point is a vector.
Definition: point.H:43