fixedWall.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 
21 #include "fixedWall.hpp"
22 #include "dictionary.hpp"
23 #include "vocabs.hpp"
24 
26 (
27  const dictionary& dict
28 )
29 {
30 
31  auto motionModel = dict.getVal<word>("motionModel");
32 
33  if(motionModel != "fixedWall")
34  {
36  " motionModel should be fixedWall, but found " << motionModel <<endl;
37  return false;
38  }
39 
40  return true;
41 }
42 
44 (
45  dictionary& dict
46 )const
47 {
48  dict.add("motionModel", "fixedWall");
49 
50  auto& motionInfo = dict.subDictOrCreate("fixedWallInfo");
51 
52  return true;
53 }
54 
56 {}
57 
59 (
60  const dictionary& dict
61 )
62 {
63  if(! readDictionary(dict) )
64  {
65  fatalExit;
66  }
67 }
68 
70 (
71  iIstream& is
72 )
73 {
74  // create an empty file dictionary
75  dictionary motionInfo(motionModelFile__, true);
76 
77  // read dictionary from stream
78  if( !motionInfo.read(is) )
79  {
80  ioErrorInFile(is.name(), is.lineNumber()) <<
81  " error in reading dictionray " << motionModelFile__ <<" from file. \n";
82  return false;
83  }
84 
85  if( !readDictionary(motionInfo) ) return false;
86 
87  return true;
88 }
89 
91 (
92  iOstream& os
93 )const
94 {
95  // create an empty file dictionary
96  dictionary motionInfo(motionModelFile__, true);
97 
98  if( !writeDictionary(motionInfo))
99  {
100  return false;
101  }
102 
103  if( !motionInfo.write(os) )
104  {
105  ioErrorInFile( os.name(), os.lineNumber() )<<
106  " error in writing dictionray to file. \n";
107  return false;
108  }
109  return true;
110 }
pFlow::motionModelFile__
const char * motionModelFile__
Definition: vocabs.hpp:45
pFlow::fixedWall::read
FUNCTION_H bool read(iIstream &is)
Definition: fixedWall.cpp:70
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::fixedWall::writeDictionary
bool writeDictionary(dictionary &dict) const
Definition: fixedWall.cpp:44
pFlow::dictionary::write
virtual bool write(iOstream &os) const
Definition: dictionary.cpp:780
pFlow::dictionary::read
virtual bool read(iIstream &is)
Definition: dictionary.cpp:759
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::dictionary::subDictOrCreate
dictionary & subDictOrCreate(const word &keyword)
Definition: dictionary.cpp:634
pFlow::dictionary::add
bool add(const word &keyword, const float &v)
Definition: dictionary.cpp:422
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::fixedWall::write
FUNCTION_H bool write(iOstream &os) const
Definition: fixedWall.cpp:91
pFlow::iIstream
Definition: iIstream.hpp:33
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
pFlow::fixedWall::fixedWall
fixedWall()
Definition: fixedWall.cpp:55
dictionary.hpp
fixedWall.hpp
pFlow::IOstream::name
virtual const word & name() const
Definition: IOstream.cpp:31
pFlow::dictionary::getVal
T getVal(const word &keyword) const
Definition: dictionary.hpp:309
pFlow::fixedWall::readDictionary
bool readDictionary(const dictionary &dict)
Definition: fixedWall.cpp:26
ioErrorInFile
#define ioErrorInFile(fileName, lineNumber)
Definition: error.hpp:49
pFlow::IOstream::lineNumber
int32 lineNumber() const
Definition: IOstream.hpp:187
vocabs.hpp
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::dictionary
Definition: dictionary.hpp:38