www.cemf.ir
Wall.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 
22 #include "Wall.hpp"
23 
25 {
26  materialName_ = dict.getVal<word>("material");
27 
28  motionName_ = dict.getValOrSet("motion", word("none"));
29 
30  name_ = dict.name();
31 
32  return true;
33 }
34 
35 
37 {
38  if(!readCommon(dict))
39  {
40  fatalExit;
41  }
42 }
43 
44 
46 (
47  const realx3 &p1,
48  const realx3 &p2,
49  const realx3 &p3
50 )
51 {
52  realx3 ln = cross(p2 - p1, p3 - p1);
53 
54  if (ln.length() < smallValue) return false;
55 
56  return true;
57 }
58 
61 (
62  const dictionary& dict
63 )
64 {
65  word type = dict.getVal<word>("type");
66 
67  if( dictionaryvCtorSelector_.search(type) )
68  {
69  return dictionaryvCtorSelector_[type] (dict);
70  }
71  else
72  {
73  printKeys
74  (
75  fatalError << "Ctor Selector "<< type << " dose not exist. \n"
76  <<"Avaiable ones are: \n\n"
77  ,
78  dictionaryvCtorSelector_
79  );
80  fatalExit;
81  }
82  return nullptr;
83 }
84 
85 namespace pFlow
86 {
87 
89  const realx3 &p1,
90  const realx3 &p2,
91  const realx3 &p3,
92  realx3& norm )
93 {
94  realx3 ln = cross(p2 - p1, p3 - p1);
95  real len = length(ln);
96  if (len < smallValue) return false;
97 
98  norm = ln/len;
99 
100  return true;
101 }
102 
103 }
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
get the value of data entry or if not found, set the value to setVal
Definition: dictionary.hpp:415
pFlow::Wall::materialName_
word materialName_
Definition: Wall.hpp:49
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::smallValue
const real smallValue
Definition: numericConstants.hpp:31
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::Wall::readCommon
bool readCommon(const dictionary &ditc)
Definition: Wall.cpp:24
Wall.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::printKeys
iOstream & printKeys(iOstream &os, const wordHashMap< T > &m)
pFlow::checkNormalVec
bool checkNormalVec(const realx3 &p1, const realx3 &p2, const realx3 &p3, realx3 &norm)
Definition: Wall.cpp:88
pFlow
Definition: demGeometry.hpp:27
cross
INLINE_FUNCTION_HD triple< T > cross(const triple< T > &v1, const triple< T > &v2)
length
INLINE_FUNCTION_HD T length(const triple< T > &v1)
pFlow::Wall::create
static uniquePtr< Wall > create(const dictionary &dict)
Definition: Wall.cpp:61
pFlow::Wall::motionName_
word motionName_
Definition: Wall.hpp:51
pFlow::Wall::name_
word name_
Definition: Wall.hpp:47
fatalError
#define fatalError
Report a fatal error and exit the applicaiton.
Definition: error.hpp:70
pFlow::iEntry::name
virtual word name() const
name/keyword of entry
Definition: iEntry.hpp:100
pFlow::dictionary::getVal
T getVal(const word &keyword) const
get the value of data entry
Definition: dictionary.hpp:379
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
pFlow::Wall::checkTrianlge
static bool checkTrianlge(const realx3 &p1, const realx3 &p2, const realx3 &p3)
Definition: Wall.cpp:46
pFlow::triple< real >
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67
pFlow::Wall::Wall
Wall()
Definition: Wall.hpp:63
pFlow::triple::length
INLINE_FUNCTION_HD T length() const
Length of the vector.
Definition: tripleI.hpp:56