writeVTKTemplates.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) 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 "writeVTK.H"
27 #include "objectRegistry.H"
28 #include "DynamicList.H"
29 
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 
32 template<class GeoField>
34 Foam::functionObjects::writeVTK::lookupFields() const
35 {
36  DynamicList<word> allNames(obr_.toc().size());
37  forAll(objectNames_, i)
38  {
39  wordList names(obr_.names<GeoField>(objectNames_[i]));
40 
41  if (names.size())
42  {
43  allNames.append(names);
44  }
45  }
46 
47  UPtrList<const GeoField> fields(allNames.size());
48 
49  forAll(allNames, i)
50  {
51  const GeoField& field = obr_.lookupObject<GeoField>(allNames[i]);
52  Info<< " Writing " << GeoField::typeName
53  << " field " << field.name() << endl;
54  fields.set(i, &field);
55  }
56 
57  return fields;
58 }
59 
60 
61 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
wordList names() const
Return the list of names of the IOobjects.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:54
List< Key > toc() const
Return the table of contents.
Definition: HashTable.C:198
List< word > wordList
A List of words.
Definition: fileName.H:54
const objectRegistry & obr_
Reference to the region objectRegistry.
messageStream Info