searchableSurface.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-2021 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 #include "Time.H"
28 #include "triSurface.H"
29 #include "OSspecific.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(searchableSurface, 0);
36  defineRunTimeSelectionTable(searchableSurface, dict);
37 }
38 
40 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
45 (
46  const word& searchableSurfaceType,
47  const IOobject& io,
48  const dictionary& dict
49 )
50 {
51  dictConstructorTable::iterator cstrIter =
52  dictConstructorTablePtr_->find(searchableSurfaceType);
53 
54  if (cstrIter == dictConstructorTablePtr_->end())
55  {
57  << "Unknown searchableSurface type " << searchableSurfaceType
58  << endl << endl
59  << "Valid searchableSurface types : " << endl
60  << dictConstructorTablePtr_->sortedToc()
61  << exit(FatalError);
62  }
63 
64  return autoPtr<searchableSurface>(cstrIter()(io, dict));
65 }
66 
67 
68 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
69 
71 :
72  regIOobject(io)
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
77 
79 {}
80 
81 
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83 
85 {
86  return geometryDir_;
87 }
88 
89 
91 {
92  if
93  (
94  isDir
95  (
96  time.rootPath()/time.globalCaseName()/time.constant()/
98  )
99  )
100  {
102  }
103  else if
104  (
105  isDir
106  (
107  time.rootPath()/time.globalCaseName()/time.constant()/
108  triSurface::typeName
109  )
110  )
111  {
112  return triSurface::typeName;
113  }
114  else
115  {
117  }
118 }
119 
120 
122 (
123  const pointField& sample,
124  const scalarField& nearestDistSqr,
125  List<pointIndexHit>& info,
126  vectorField& normal,
127  labelList& region
128 ) const
129 {
130  findNearest(sample, nearestDistSqr, info);
131  getNormal(info, normal);
132  getRegion(info, region);
133 }
134 
135 
136 // ************************************************************************* //
dictionary dict
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
static word geometryDir_
Name of the directory for the geometry files.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
Definition: POSIX.C:539
static const word & geometryDir()
Return the geometry directory name.
A class for handling words, derived from string.
Definition: word.H:59
const fileName & rootPath() const
Return root path.
Definition: TimePaths.H:95
const word & constant() const
Return constant name.
Definition: TimePaths.H:123
searchableSurface(const IOobject &io)
const fileName & globalCaseName() const
Return global case name.
Definition: TimePaths.H:101
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
virtual ~searchableSurface()
Destructor.
const Time & time() const
Return time.
Definition: IOobject.C:318
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const =0
From a set of points and indices get the region.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:52
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const =0
From a set of points and indices get the normal.
Namespace for OpenFOAM.