# PhasicFlow: utilities/Utilities/geometryPhasicFlow/Wall/Wall.cpp Source File

Wall.cpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "Wall.hpp"
bool pFlow::Wall::readCommon(const dictionary& dict)
{
materialName_ = dict.getVal<word>("material");
motionName_ = dict.getValOrSet("motion", word("none"));
name_ = dict.name();
return true;
}
pFlow::Wall::Wall(const dictionary& dict)
{
if(!readCommon(dict))
{
fatalExit;
}
}
bool pFlow::Wall::checkTrianlge
(
const realx3 &p1,
const realx3 &p2,
const realx3 &p3
)
{
realx3 ln = cross(p2 - p1, p3 - p1);
if (ln.length() < smallValue) return false;
return true;
}
pFlow::uniquePtr<pFlow::Wall>
pFlow::Wall::create
(
const dictionary& dict
)
{
word type = dict.getVal<word>("type");
if( dictionaryvCtorSelector_.search(type) )
{
return dictionaryvCtorSelector_[type] (dict);
}
else
{
printKeys
(
fatalError << "Ctor Selector "<< type << " dose not exist. \n"
<<"Avaiable ones are: \n\n"
,
dictionaryvCtorSelector_
);
fatalExit;
}
return nullptr;
}
namespace pFlow
{
bool checkNormalVec(
const realx3 &p1,
const realx3 &p2,
const realx3 &p3,
realx3& norm )
{
realx3 ln = cross(p2 - p1, p3 - p1);
real len = length(ln);
if (len < smallValue) return false;
norm = ln/len;
return true;
}
}
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
Definition: dictionary.hpp:325
pFlow::Wall::materialName_
word materialName_
Definition: Wall.hpp:49
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::smallValue
const real smallValue
Definition: numericConstants.hpp:33
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::Wall::readCommon
bool readCommon(const dictionary &ditc)
Definition: Wall.cpp:24
Wall.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
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: demComponent.hpp:28
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
Definition: error.hpp:36
pFlow::iEntry::name
virtual word name() const
Definition: iEntry.hpp:95
pFlow::dictionary::getVal
T getVal(const word &keyword) const
Definition: dictionary.hpp:309
pFlow::uniquePtr
Definition: uniquePtr.hpp:44
pFlow::Wall::checkTrianlge
static bool checkTrianlge(const realx3 &p1, const realx3 &p2, const realx3 &p3)
Definition: Wall.cpp:46
pFlow::triple< real >
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::Wall::Wall
Wall()
Definition: Wall.hpp:63
pFlow::triple::length
INLINE_FUNCTION_HD T length() const
Definition: tripleI.hpp:64