Loading...
Searching...
No Matches
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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2017 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "fieldFromFile.H"
31#include "triSurfaceMesh.H"
32#include "triSurfaceFields.H"
33#include "Time.H"
34
35// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36
37namespace Foam
38{
41 (
45 );
46}
47
48// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49
51(
52 const dictionary& cellSizeCalcTypeDict,
53 const triSurfaceMesh& surface,
54 const scalar& defaultCellSize
55)
56:
57 cellSizeCalculationType
58 (
59 typeName,
60 cellSizeCalcTypeDict,
61 surface,
62 defaultCellSize
63 ),
64 coeffsDict_(cellSizeCalcTypeDict.optionalSubDict(typeName + "Coeffs")),
65 fileName_
66 (
67 cellSizeCalcTypeDict.optionalSubDict
68 (
69 typeName + "Coeffs"
70 ).get<word>("fieldFile")
71 ),
72 cellSizeMultipleCoeff_
73 (
74 coeffsDict_.getOrDefault<scalar>("cellSizeMultipleCoeff", 1)
75 )
76{}
77
78
79// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80
82{
83 Info<< indent << "Loading: " << fileName_ << endl;
84
85 tmp<triSurfacePointScalarField> pointCellSize
86 (
88 (
89 IOobject
90 (
91 fileName_,
92 surface_.searchableSurface::time().constant(),
93 "triSurface",
94 surface_.searchableSurface::time(),
97 ),
100 true
101 )
102 );
103
104 pointCellSize.ref() *= cellSizeMultipleCoeff_;
105
106 return pointCellSize;
107}
108
109
110// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Abstract base class for specifying target cell sizes.
const triSurfaceMesh & surface_
Reference to the triSurfaceMesh.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
fieldFromFile(const dictionary &cellSizeCalcTypeDict, const triSurfaceMesh &surface, const scalar &defaultCellSize)
Construct from components.
virtual tmp< triSurfacePointScalarField > load()
Load the cell size field.
A class for managing temporary objects.
Definition tmp.H:75
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc).
Namespace for OpenFOAM.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
Ostream & indent(Ostream &os)
Indent stream.
Definition Ostream.H:481
DimensionedField< scalar, triSurfacePointGeoMesh > triSurfacePointScalarField
Fields for triSurface.