initialPointsMethod.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) 2012-2015 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 "initialPointsMethod.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 defineTypeNameAndDebug(initialPointsMethod, 0);
37 defineRunTimeSelectionTable(initialPointsMethod, dictionary);
38 
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
42 initialPointsMethod::initialPointsMethod
43 (
44  const word& type,
45  const dictionary& initialPointsDict,
46  const Time& runTime,
47  Random& rndGen,
48  const conformationSurfaces& geometryToConformTo,
49  const cellShapeControl& cellShapeControls,
50  const autoPtr<backgroundMeshDecomposition>& decomposition
51 )
52 :
53  dictionary(initialPointsDict),
54  runTime_(runTime),
55  rndGen_(rndGen),
56  geometryToConformTo_(geometryToConformTo),
57  cellShapeControls_(cellShapeControls),
58  decomposition_(decomposition),
59  detailsDict_(subDict(type + "Coeffs")),
60  minimumSurfaceDistanceCoeffSqr_
61  (
62  sqr
63  (
65  (
66  initialPointsDict.lookup("minimumSurfaceDistanceCoeff")
67  )
68  )
69  ),
70  fixInitialPoints_(Switch(initialPointsDict.lookup("fixInitialPoints")))
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
75 
76 autoPtr<initialPointsMethod> initialPointsMethod::New
77 (
78  const dictionary& initialPointsDict,
79  const Time& runTime,
80  Random& rndGen,
81  const conformationSurfaces& geometryToConformTo,
82  const cellShapeControl& cellShapeControls,
83  const autoPtr<backgroundMeshDecomposition>& decomposition
84 )
85 {
86  word initialPointsMethodTypeName
87  (
88  initialPointsDict.lookup("initialPointsMethod")
89  );
90 
91  Info<< nl << "Selecting initialPointsMethod "
92  << initialPointsMethodTypeName << endl;
93 
94  dictionaryConstructorTable::iterator cstrIter =
95  dictionaryConstructorTablePtr_->find(initialPointsMethodTypeName);
96 
97  if (cstrIter == dictionaryConstructorTablePtr_->end())
98  {
100  << "Unknown initialPointsMethod type "
101  << initialPointsMethodTypeName
102  << endl << endl
103  << "Valid initialPointsMethod types are :" << endl
104  << dictionaryConstructorTablePtr_->toc()
105  << exit(FatalError);
106  }
107 
108  return
109  autoPtr<initialPointsMethod>
110  (
111  cstrIter()
112  (
113  initialPointsDict,
114  runTime,
115  rndGen,
119  )
120  );
121 }
122 
123 
124 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
125 
127 {}
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // ************************************************************************* //
const cellShapeControl & cellShapeControls() const
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
virtual ~initialPointsMethod()
Destructor.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
static autoPtr< initialPointsMethod > New(const dictionary &initialPointsDict, const Time &runTime, Random &rndGen, const conformationSurfaces &geometryToConformTo, const cellShapeControl &cellShapeControls, const autoPtr< backgroundMeshDecomposition > &decomposition)
Return a reference to the selected initialPointsMethod.
Macros for easy insertion into run-time selection tables.
dictionary()
Construct top-level dictionary null.
Definition: dictionary.C:113
stressControl lookup("compactNormalStress") >> compactNormalStress
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
static const char nl
Definition: Ostream.H:262
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
const conformationSurfaces & geometryToConformTo() const
messageStream Info
const backgroundMeshDecomposition & decomposition() const
Namespace for OpenFOAM.