vtkUnstructuredReaderTemplates.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 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "vtkUnstructuredReader.H"
29 #include "labelIOField.H"
30 #include "scalarIOField.H"
31 #include "stringIOList.H"
32 #include "cellModel.H"
33 #include "vectorIOField.H"
34 
35 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
36 
37 template<class T>
38 void Foam::vtkUnstructuredReader::readBlock
39 (
40  Istream& inFile,
41  const label n,
42  List<T>& list
43 ) const
44 {
45  list.setSize(n);
46  for (T& val : list)
47  {
48  inFile >> val;
49  }
50 }
51 
52 
53 template<class Type>
55 (
56  const objectRegistry& obj
57 ) const
58 {
59  wordList fieldNames(obj.names(Type::typeName));
60 
61  if (fieldNames.size())
62  {
63  Info<< "Read " << fieldNames.size() << " " << Type::typeName
64  << " fields:" << nl
65  << "Size\tName" << nl
66  << "----\t----" << endl;
67 
68  for (const word& fieldName : fieldNames)
69  {
70  Info<< obj.lookupObject<Type>(fieldName).size()
71  << "\t" << fieldName
72  << endl;
73  }
74  Info<< endl;
75  }
76 }
77 
78 
79 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
vtkUnstructuredReader.H
Foam::vtkUnstructuredReader::printFieldStats
void printFieldStats(const objectRegistry &) const
Debug: print contents of objectRegistry.
Definition: vtkUnstructuredReaderTemplates.C:55
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
scalarIOField.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
n
label n
Definition: TABSMDCalcMethod2.H:31
cellModel.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
vectorIOField.H
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::objectRegistry::names
wordList names() const
The names of all objects.
Definition: objectRegistry.C:164
Foam::List< word >
labelIOField.H
stringIOList.H