DataEntry.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) 2011-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 "DataEntry.H"
27 #include "Time.H"
28 
29 // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 :
34  refCount(),
35  name_(entryName)
36 {}
37 
38 
39 template<class Type>
41 :
42  refCount(),
43  name_(de.name_)
44 {}
45 
46 
47 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
48 
49 template<class Type>
51 {}
52 
53 
54 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
55 
56 template<class Type>
58 {
59  return name_;
60 }
61 
62 
63 template<class Type>
65 {
66  // do nothing
67 }
68 
69 
70 template<class Type>
71 Type Foam::DataEntry<Type>::value(const scalar x) const
72 {
74 
75  return pTraits<Type>::zero;
76 }
77 
78 
79 template<class Type>
80 Type Foam::DataEntry<Type>::integrate(const scalar x1, const scalar x2) const
81 {
83 
84  return pTraits<Type>::zero;
85 }
86 
87 
88 template<class Type>
90 (
91  const scalarField& x
92 ) const
93 {
94  tmp<Field<Type> > tfld(new Field<Type>(x.size()));
95  Field<Type>& fld = tfld();
96 
97  forAll(x, i)
98  {
99  fld[i] = this->value(x[i]);
100  }
101  return tfld;
102 }
103 
104 
105 template<class Type>
107 (
108  const scalarField& x1,
109  const scalarField& x2
110 ) const
111 {
112  tmp<Field<Type> > tfld(new Field<Type>(x1.size()));
113  Field<Type>& fld = tfld();
114 
115  forAll(x1, i)
116  {
117  fld[i] = this->integrate(x1[i], x2[i]);
118  }
119  return tfld;
120 }
121 
122 
123 
124 template<class Type>
126 {
128 
130 }
131 
132 
133 template<class Type>
135 (
136  const scalar x1,
137  const scalar x2
138 ) const
139 {
141 
143 }
144 
145 
146 template<class Type>
149 (
150  const scalarField& x
151 ) const
152 {
153 
155  (
157  (
158  x.size(),
160  )
161  );
162 
163  Field<dimensioned<Type> >& fld = tfld();
164 
165  forAll(x, i)
166  {
167  fld[i] = this->dimValue(x[i]);
168  }
169  return tfld;
170 }
171 
172 
173 template<class Type>
176 (
177  const scalarField& x1,
178  const scalarField& x2
179 ) const
180 {
182  (
183  new Field<dimensioned<Type> >(x1.size())
184  );
185 
186  Field<dimensioned<Type> >& fld = tfld();
187 
188  forAll(x1, i)
189  {
190  fld[i] = this->dimIntegrate(x1[i], x2[i]);
191  }
192  return tfld;
193 }
194 
195 
196 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
197 
198 #include "DataEntryIO.C"
199 
200 // ************************************************************************* //
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:45
Foam::DataEntry::name
const word & name() const
Return the name of the entry.
Definition: DataEntry.C:57
Foam::DataEntry::~DataEntry
virtual ~DataEntry()
Destructor.
Definition: DataEntry.C:50
Foam::DataEntry::DataEntry
DataEntry
Definition: DataEntry.H:93
Foam::DataEntry::dimIntegrate
virtual dimensioned< Type > dimIntegrate(const scalar x1, const scalar x2) const
Integrate between two scalars and return a dimensioned type.
Definition: DataEntry.C:135
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
DataEntry.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
DataEntryIO.C
fld
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::dimensioned< Type >
Foam::DataEntry::dimValue
virtual dimensioned< Type > dimValue(const scalar x) const
Return dimensioned type.
Definition: DataEntry.C:125
Foam::DataEntry::convertTimeBase
virtual void convertTimeBase(const Time &t)
Convert time.
Definition: DataEntry.C:64
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::DataEntry::integrate
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
Definition: DataEntry.C:80
Foam::DataEntry
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: DataEntry.H:52
Foam::DataEntry::value
virtual Type value(const scalar x) const
Return value as a function of (scalar) independent variable.
Definition: DataEntry.C:71