vtkUnstructuredReaderTemplates.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-2024 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 "vtkUnstructuredReader.H"
27 #include "labelIOField.H"
28 #include "scalarIOField.H"
29 #include "stringIOList.H"
30 #include "cellModeller.H"
31 #include "vectorIOField.H"
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 template<class T>
36 void Foam::vtkUnstructuredReader::readBlock
37 (
38  Istream& inFile,
39  const label n,
40  List<T>& lst
41 ) const
42 {
43  lst.setSize(n);
44  forAll(lst, i)
45  {
46  inFile >> lst[i];
47  }
48 }
49 
50 
51 template<class Type>
53 (
54  const objectRegistry& obj
55 ) const
56 {
57  wordList fieldNames(obj.toc(Type::typeName));
58 
59  if (fieldNames.size() > 0)
60  {
61  Info<< "Read " << fieldNames.size() << " " << Type::typeName
62  << " fields:" << endl;
63  Info<< "Size\tName" << nl
64  << "----\t----" << endl;
65  forAll(fieldNames, i)
66  {
67  Info<< obj.lookupObject<Type>(fieldNames[i]).size()
68  << "\t" << fieldNames[i]
69  << endl;
70  }
71  Info<< endl;
72  }
73 }
74 
75 
76 // ************************************************************************* //
label n
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
Registry of regIOobjects.
wordList toc(const word &className) const
Return the list of names of IOobjects of given class name.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
void printFieldStats(const objectRegistry &) const
Debug: print contents of objectRegistry.
static List< word > fieldNames
Definition: globalFoam.H:46
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
static const char nl
Definition: Ostream.H:266