www.cemf.ir
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
Return true if end of input seen.
Definition: IOstream.hpp:192
twoPartEntry.hpp
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::token
Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...
Definition: token.hpp:44
pFlow::dataEntry::stream
virtual iTstream & stream()
access to token stream
Definition: dataEntry.cpp:265
pFlow::twoPartEntry
Definition: twoPartEntry.hpp:36
pFlow::iTstream::size
size_t size() const
size
Definition: iTstream.cpp:336
pFlow::iEntry::keyword
virtual const word & keyword() const
return keyword
Definition: iEntry.hpp:88
pFlow::twoPartEntry::secondPart
iTstream & secondPart()
Definition: twoPartEntry.hpp:56
pFlow::dataEntry
Data entry to be used in dictionries.
Definition: dataEntry.hpp:48
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pFlow::iTstream::read
virtual iIstream & read(token &t) override
Return next token from stream.
Definition: iTstream.cpp:111
pFlow::iTstream
Input token stream.
Definition: iTstream.hpp:27
pFlow::isTwoPartEntry
bool isTwoPartEntry(dataEntry entry)
Definition: twoPartEntry.cpp:56
pFlow::twoPartEntry::twoPartEntry
twoPartEntry(dataEntry entry)
Definition: twoPartEntry.cpp:28