All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
treeDataTriSurface.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "treeDataTriSurface.H"
27 #include "triSurfaceTools.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 template<>
33 (
35  const point& sample
36 ) const
37 {
38  // Find nearest face to sample
39  pointIndexHit info = oc.findNearest(sample, sqr(great));
40 
41  if (info.index() == -1)
42  {
44  << "Could not find " << sample << " in octree."
45  << abort(FatalError);
46  }
47 
48  // Get actual intersection point on face
49  label facei = info.index();
50 
51  triSurfaceTools::sideType t = triSurfaceTools::surfaceSide
52  (
53  patch_,
54  sample,
55  facei
56  );
57 
58  if (t == triSurfaceTools::UNKNOWN)
59  {
60  return volumeType::unknown;
61  }
62  else if (t == triSurfaceTools::INSIDE)
63  {
64  return volumeType::inside;
65  }
66  else if (t == triSurfaceTools::OUTSIDE)
67  {
68  return volumeType::outside;
69  }
70  else
71  {
73  << "problem" << abort(FatalError);
74  return volumeType::unknown;
75  }
76 }
77 
78 
79 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
error FatalError
volumeType getVolumeType(const indexedOctree< treeDataPrimitivePatch< PatchType >> &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
dimensionedSymmTensor sqr(const dimensionedVector &dv)
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:53
Encapsulation of data needed to search on PrimitivePatches.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
sideType
On which side of surface.
Non-pointer based hierarchical recursive searching.
Definition: treeDataEdge.H:47
label index() const
Return index.