fieldFromFile.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-2016 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 "fieldFromFile.H"
28 #include "triSurfaceMesh.H"
29 #include "triSurfaceFields.H"
30 #include "Time.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(fieldFromFile, 0);
38  (
39  cellSizeCalculationType,
40  fieldFromFile,
41  dictionary
42  );
43 }
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const dictionary& cellSizeCalcTypeDict,
50  const triSurfaceMesh& surface,
51  const scalar& defaultCellSize
52 )
53 :
54  cellSizeCalculationType
55  (
56  typeName,
57  cellSizeCalcTypeDict,
58  surface,
59  defaultCellSize
60  ),
61  coeffsDict_(cellSizeCalcTypeDict.subDict(typeName + "Coeffs")),
62  fileName_
63  (
64  cellSizeCalcTypeDict.subDict(typeName + "Coeffs").lookup("fieldFile")
65  ),
66  cellSizeMultipleCoeff_
67  (
68  coeffsDict_.lookupOrDefault<scalar>("cellSizeMultipleCoeff", 1)
69  )
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
76 {
77  Info<< indent << "Loading: " << fileName_ << endl;
78 
79  tmp<triSurfacePointScalarField> pointCellSize
80  (
82  (
83  IOobject
84  (
85  fileName_,
86  surface_.searchableSurface::time().constant(),
87  "triSurface",
88  surface_.searchableSurface::time(),
91  ),
92  surface_,
93  dimLength,
94  true
95  )
96  );
97 
98  pointCellSize.ref() *= cellSizeMultipleCoeff_;
99 
100  return pointCellSize;
101 }
102 
103 
104 // ************************************************************************* //
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:223
Fields for triSurface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Macros for easy insertion into run-time selection tables.
stressControl lookup("compactNormalStress") >> compactNormalStress
fieldFromFile(const dictionary &cellSizeCalcTypeDict, const triSurfaceMesh &surface, const scalar &defaultCellSize)
Construct from components.
const triSurfaceMesh & surface_
Reference to the triSurfaceMesh.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
messageStream Info
Foam::DimensionedField< scalar, triSurfacePointGeoMesh > triSurfacePointScalarField
A class for managing temporary objects.
Definition: PtrList.H:54
virtual tmp< triSurfacePointScalarField > load()
Load the cell size field.
Namespace for OpenFOAM.