fieldFromFile.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-2018 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.optionalSubDict(typeName + "Coeffs")),
62  fileName_
63  (
64  cellSizeCalcTypeDict.optionalSubDict
65  (
66  typeName + "Coeffs"
67  ).lookup("fieldFile")
68  ),
69  cellSizeMultipleCoeff_
70  (
71  coeffsDict_.lookupOrDefault<scalar>("cellSizeMultipleCoeff", 1)
72  )
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
79 {
80  Info<< indent << "Loading: " << fileName_ << endl;
81 
82  tmp<triSurfacePointScalarField> pointCellSize
83  (
85  (
86  IOobject
87  (
88  fileName_,
89  surface_.searchableSurface::time().constant(),
90  "triSurface",
91  surface_.searchableSurface::time(),
94  ),
95  surface_,
96  dimLength,
97  true
98  )
99  );
100 
101  pointCellSize.ref() *= cellSizeMultipleCoeff_;
102 
103  return pointCellSize;
104 }
105 
106 
107 // ************************************************************************* //
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
Fields for triSurface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
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:53
virtual tmp< triSurfacePointScalarField > load()
Load the cell size field.
Namespace for OpenFOAM.