# PhasicFlow: src/phasicFlow/types/basicTypes/Logical.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

Logical.hpp
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.
-----------------------------------------------------------------------------*/
#ifndef __Logical_hpp__
#define __Logical_hpp__
#include "builtinTypes.hpp"
#include "bTypesFunctions.hpp"
namespace pFlow
{
//- Forward
class iIstream;
class iOstream;
class Logical
{
private:
bool s_ = false;
int yesNoSet_ = 0;
inline static const word YesNo__[4][2] = { { "Yes", "No" },
{ "on", "off" },
{ "true", "false" },
{ "Ok", "No" } };
inline explicit Logical(bool s, int yns)
: s_(s),
yesNoSet_(yns)
{
}
public:
inline static word TYPENAME()
{
return "Logical";
}
inline word typeName()const
{
return TYPENAME();
}
inline Logical() = default;
inline explicit Logical(bool s)
: s_(s)
{
}
Logical(const word& l);
Logical(const char* ch);
Logical(const Logical&) = default;
Logical(Logical&&) = default;
Logical& operator=(const Logical&) = default;
Logical& operator=(Logical&&) = default;
inline Logical& operator=(const bool& b)
{
s_ = b;
yesNoSet_ = 0;
return *this;
}
inline bool operator()() const
{
return s_;
}
inline explicit operator bool() const
{
return s_;
}
inline Logical operator!() const
{
return Logical(!s_, yesNoSet_);
}
bool read(iIstream& is);
bool write(iOstream& os) const;
bool static evaluteWord(const word& l, bool& b, int& yesNoSet);
};
iIstream&
operator>>(iIstream& is, Logical& L);
iOstream&
operator<<(iOstream& os, const Logical& L);
} // pFlow
#endif // __Logical_hpp__
pFlow::Logical::evaluteWord
static bool evaluteWord(const word &l, bool &b, int &yesNoSet)
Definition: Logical.cpp:41
pFlow::Logical::YesNo__
static const word YesNo__[4][2]
Set of Yes or Nos.
Definition: Logical.hpp:50
pFlow::Logical::operator=
Logical & operator=(const Logical &)=default
Copy assignment.
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow
Definition: demGeometry.hpp:27
pFlow::Logical::write
bool write(iOstream &os) const
Definition: Logical.cpp:97
pFlow::Logical::TYPENAME
static word TYPENAME()
Type info.
Definition: Logical.hpp:65
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::Logical::read
bool read(iIstream &is)
Definition: Logical.cpp:65
pFlow::Logical::s_
bool s_
bool value
Definition: Logical.hpp:44
pFlow::operator>>
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
Definition: AdamsBashforth3.hpp:41
pFlow::Logical::typeName
word typeName() const
Definition: Logical.hpp:70
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
pFlow::Logical::operator()
bool operator()() const
() operator, return bool value
Definition: Logical.hpp:115
pFlow::Logical::Logical
Logical(bool s)
Construct from bool.
Definition: Logical.hpp:81
pFlow::Logical::operator=
Logical & operator=(const bool &b)
Assignment with bool.
Definition: Logical.hpp:105
pFlow::Logical
Holds a bool value and converts strings to bool.
Definition: Logical.hpp:39
pFlow::Logical::Logical
Logical()=default
Default constructor.
pFlow::Logical::Logical
Logical(bool s, int yns)
Construct from bool and set number.
Definition: Logical.hpp:56
pFlow::Logical::operator!
Logical operator!() const
Not operator.
Definition: Logical.hpp:127
builtinTypes.hpp
bTypesFunctions.hpp
pFlow::Logical::yesNoSet_
int yesNoSet_
Set numbe of of Yes or No.
Definition: Logical.hpp:47
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59