initialPointsMethod.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) 2012-2019 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 
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_(optionalSubDict(type + "Coeffs")),
60  minimumSurfaceDistanceCoeffSqr_
61  (
62  sqr( initialPointsDict.lookup<scalar>("minimumSurfaceDistanceCoeff"))
63  ),
64  fixInitialPoints_(Switch(initialPointsDict.lookup("fixInitialPoints")))
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
69 
70 autoPtr<initialPointsMethod> initialPointsMethod::New
71 (
72  const dictionary& initialPointsDict,
73  const Time& runTime,
74  Random& rndGen,
75  const conformationSurfaces& geometryToConformTo,
76  const cellShapeControl& cellShapeControls,
77  const autoPtr<backgroundMeshDecomposition>& decomposition
78 )
79 {
80  word initialPointsMethodTypeName
81  (
82  initialPointsDict.lookup("initialPointsMethod")
83  );
84 
85  Info<< nl << "Selecting initialPointsMethod "
86  << initialPointsMethodTypeName << endl;
87 
88  dictionaryConstructorTable::iterator cstrIter =
89  dictionaryConstructorTablePtr_->find(initialPointsMethodTypeName);
90 
91  if (cstrIter == dictionaryConstructorTablePtr_->end())
92  {
94  << "Unknown initialPointsMethod type "
95  << initialPointsMethodTypeName
96  << endl << endl
97  << "Valid initialPointsMethod types are :" << endl
98  << dictionaryConstructorTablePtr_->toc()
99  << exit(FatalError);
100  }
101 
102  return
103  autoPtr<initialPointsMethod>
104  (
105  cstrIter()
106  (
107  initialPointsDict,
108  runTime,
109  rndGen,
113  )
114  );
115 }
116 
117 
118 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
119 
121 {}
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // ************************************************************************* //
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:306
virtual ~initialPointsMethod()
Destructor.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
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.
const cellShapeControl & cellShapeControls() const
Macros for easy insertion into run-time selection tables.
dictionary()
Construct top-level dictionary null.
Definition: dictionary.C:440
stressControl lookup("compactNormalStress") >> compactNormalStress
initialPointsMethod(const word &type, const dictionary &initialPointsDict, const Time &runTime, Random &rndGen, const conformationSurfaces &geometryToConformTo, const cellShapeControl &cellShapeControls, const autoPtr< backgroundMeshDecomposition > &decomposition)
Construct from components.
const backgroundMeshDecomposition & decomposition() const
static const char nl
Definition: Ostream.H:260
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
const conformationSurfaces & geometryToConformTo() const
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
messageStream Info
Namespace for OpenFOAM.