tokenTupleNI.H
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) 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 "tokenTupleN.H"
27 #include "ITstream.H"
28 #include "SubList.H"
29 
30 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
31 
33 {
34  return offsets_.size() - 1;
35 }
36 
37 
38 template<class Type>
39 inline Type Foam::tokenTupleN::get(const IOstream& s, const label i)
40 {
41  if (i < 0 || i > size() - 1)
42  {
44  << "index " << i << " out of range 0 ... " << size() - 1
45  << exit(FatalIOError);
46  }
47 
48  ITstream its
49  (
50  s.name(),
51  SubList<token>(tokens_, offsets_[i + 1] - offsets_[i], offsets_[i])
52  );
53 
54  return pTraits<Type>(its);
55 }
56 
57 
58 // ************************************************************************* //
An IOstream is an abstract base class for all input/output systems; be they streams,...
Definition: IOstream.H:72
Input token stream.
Definition: ITstream.H:53
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
A List obtained as a section of another List.
Definition: SubList.H:56
label size() const
Get the number of elements in the tuple.
Definition: tokenTupleNI.H:32
Type get(const IOstream &s, const label i)
Get a type at a given position in the tuple. Stream used for error.
Definition: tokenTupleNI.H:39
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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
IOerror FatalIOError