indexedCellChecks.C
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-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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\*---------------------------------------------------------------------------*/
27
28#include "plane.H"
29#include "tetPointRef.H"
30#include "pointConversion.H"
32
33
34template<class Cell>
36(
37 Cell& c,
38 const scalar tol
39)
40{
41 tetPointRef tet
42 (
43 topoint(c->vertex(0)->point()),
44 topoint(c->vertex(1)->point()),
45 topoint(c->vertex(2)->point()),
46 topoint(c->vertex(3)->point())
47 );
48
49 const scalar quality = tet.quality();
50
51 if (quality < tol)
52 {
53 return quality;
54 }
55
56 return 0;
57
58// plane triPlane
59// (
60// topoint(c->vertex(0)->point()),
61// topoint(c->vertex(1)->point()),
62// topoint(c->vertex(2)->point())
63// );
64//
65// const scalar distance = triPlane.distance(topoint(c->vertex(3)->point()));
66//
67// // Check if the four points are roughly coplanar. If they are then we
68// // cannot calculate the circumcentre. Better test might be the volume
69// // of the tet.
70// if (distance < tol)
71// {
72// return 0;
73// }
74//
75// return distance;
76}
77
78
79template<class Cell>
81(
82 Cell& c,
83 const scalar tol
84)
85{
86 for (label v = 0; v < 4; ++v)
87 {
88 for (label vA = v + 1; vA < 4; ++vA)
89 {
90 if
91 (
92 mag
93 (
94 topoint(c->vertex(v)->point())
95 - topoint(c->vertex(vA)->point())
96 )
97 < tol
98 )
99 {
100 return true;
101 }
102 }
103 }
104
105 return false;
106}
107
108
109template<class Cell>
111(
112 Cell& c,
113 const scalar tol
114)
115{
116 CGAL::Tetrahedron_3<baseK> tet
117 (
118 c->vertex(0)->point(),
119 c->vertex(1)->point(),
120 c->vertex(2)->point(),
121 c->vertex(3)->point()
122 );
123
124 if (tet.volume() < tol)
125 {
126 return true;
127 }
128
129 return false;
130}
const dimensionedScalar c
Speed of light in a vacuum.
bool smallVolume(Cell &c, const scalar tol=0.0)
bool closePoints(Cell &c, const scalar tol=1e-12)
scalar coplanarTet(Cell &c, const scalar tol=1e-12)
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
Definition: tetPointRef.H:47
pointFromPoint topoint(const Point &P)