twoPartEntry.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 // based on OpenFOAM dictionary, with some modifications/simplifications
21 // to be tailored to our needs
22 
23 
24 #include "twoPartEntry.hpp"
25 
26 
28 (
29  dataEntry entry
30 )
31 :
32  keyword_(entry.keyword()),
33  secondPart_(keyword_)
34 {
35  iTstream& iT = entry.stream();
36 
37  iT >> firstPart_;
38 
39 
40  if(iT.eof()) return;
41 
42  token t;
43  while(true)
44  {
45  if( !iT.read(t) )
46  {
47  fatalErrorInFunction<<"attemps to read from token stream failed \n";
48  fatalExit;
49  }
50  secondPart_.appendToken(t);
51  if(iT.eof())break;
52  }
53 
54 }
55 
57 {
58  twoPartEntry tpEntry(entry);
59  if(tpEntry.secondPart().size() == 0) return false;
60  return true;
61 }
pFlow::IOstream::eof
bool eof() const
Definition: IOstream.hpp:156
twoPartEntry.hpp
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::token
Definition: token.hpp:42
pFlow::dataEntry::stream
virtual iTstream & stream()
Definition: dataEntry.cpp:261
pFlow::twoPartEntry
Definition: twoPartEntry.hpp:36
pFlow::iTstream::size
size_t size() const
Definition: iTstream.cpp:328
pFlow::iEntry::keyword
virtual const word & keyword() const
Definition: iEntry.hpp:84
pFlow::twoPartEntry::secondPart
iTstream & secondPart()
Definition: twoPartEntry.hpp:56
pFlow::dataEntry
Definition: dataEntry.hpp:40
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
pFlow::iTstream::read
virtual iIstream & read(token &t) override
Definition: iTstream.cpp:111
pFlow::iTstream
Definition: iTstream.hpp:21
pFlow::isTwoPartEntry
bool isTwoPartEntry(dataEntry entry)
Definition: twoPartEntry.cpp:56
pFlow::twoPartEntry::twoPartEntry
twoPartEntry(dataEntry entry)
Definition: twoPartEntry.cpp:28