treeDataTriSurface.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 | Copyright (C) 2011-2013 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  (
45  "treeDataPrimitivePatch::getSampleType"
46  "(indexedOctree<treeDataPrimitivePatch>&, const point&)"
47  ) << "Could not find " << sample << " in octree."
48  << abort(FatalError);
49  }
50 
51  // Get actual intersection point on face
52  label faceI = info.index();
53 
54  triSurfaceTools::sideType t = triSurfaceTools::surfaceSide
55  (
56  patch_,
57  sample,
58  faceI
59  );
60 
61  if (t == triSurfaceTools::UNKNOWN)
62  {
63  return volumeType::UNKNOWN;
64  }
65  else if (t == triSurfaceTools::INSIDE)
66  {
67  return volumeType::INSIDE;
68  }
69  else if (t == triSurfaceTools::OUTSIDE)
70  {
71  return volumeType::OUTSIDE;
72  }
73  else
74  {
75  FatalErrorIn("treeDataPrimitivePatch<PatchType>::getVolumeType(..)")
76  << "problem" << abort(FatalError);
77  return volumeType::UNKNOWN;
78  }
79 }
80 
81 
82 // ************************************************************************* //
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:53
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
label index() const
Return index.
Encapsulation of data needed to search on PrimitivePatches.
volumeType getVolumeType(const indexedOctree< treeDataPrimitivePatch< PatchType > > &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
sideType
On which side of surface.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
Non-pointer based hierarchical recursive searching.
Definition: treeDataEdge.H:47
error FatalError
dimensionedSymmTensor sqr(const dimensionedVector &dv)