searchableSurface.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-2014 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 "searchableSurface.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(searchableSurface, 0);
33  defineRunTimeSelectionTable(searchableSurface, dict);
34 }
35 
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
40 (
41  const word& searchableSurfaceType,
42  const IOobject& io,
43  const dictionary& dict
44 )
45 {
46  dictConstructorTable::iterator cstrIter =
47  dictConstructorTablePtr_->find(searchableSurfaceType);
48 
49  if (cstrIter == dictConstructorTablePtr_->end())
50  {
52  (
53  "searchableSurface::New(const word&,"
54  " const IOobject&, const dictionary&)"
55  ) << "Unknown searchableSurface type " << searchableSurfaceType
56  << endl << endl
57  << "Valid searchableSurface types : " << endl
58  << dictConstructorTablePtr_->sortedToc()
59  << exit(FatalError);
60  }
61 
62  return autoPtr<searchableSurface>(cstrIter()(io, dict));
63 }
64 
65 
66 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67 
68 Foam::searchableSurface::searchableSurface(const IOobject& io)
69 :
70  regIOobject(io)
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
75 
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
83 (
84  const pointField& sample,
85  const scalarField& nearestDistSqr,
86  List<pointIndexHit>& info,
87  vectorField& normal,
88  labelList& region
89 ) const
90 {
91  findNearest(sample, nearestDistSqr, info);
92  getNormal(info, normal);
93  getRegion(info, region);
94 }
95 
96 
97 // ************************************************************************* //
A class for handling words, derived from string.
Definition: word.H:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
dictionary dict
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
virtual ~searchableSurface()
Destructor.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const =0
From a set of points and indices get the region.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:60
error FatalError
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const =0
From a set of points and indices get the normal.
defineTypeNameAndDebug(combustionModel, 0)