# PhasicFlow: src/phasicFlow/triSurface/multiTriSurface.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.

multiTriSurface.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 __multiTriSurface_hpp__
#define __multiTriSurface_hpp__
#include "subscriber.hpp"
#include "triSurface.hpp"
#include "subSurface.hpp"
namespace pFlow
{
class multiTriSurface
:
public triSurface,
public subscriber
{
private:
subSurfaceList subSurfaces_;
public:
// - type info
TypeInfo("multiTriSurface");
multiTriSurface(const objectFile& obj, repository* owner);
multiTriSurface(
const objectFile& objf,
repository* owner,
const multiTriSurface& surf);
multiTriSurface(const multiTriSurface&) = default;
multiTriSurface& operator = (const multiTriSurface&) = default;
multiTriSurface(multiTriSurface&&) = delete;
multiTriSurface& operator = (multiTriSurface&&) = delete;
~multiTriSurface() override = default;
bool appendSurface(
const word& name,
const realx3x3Vector& vertices);
uint32 numSurfaces()const
{
return static_cast< uint32 >(subSurfaces_.size());
}
const subSurfaceList& subSurfaces()const
{
return subSurfaces_;
}
rangeU32 subSurfaceRange(uint32 nSub)const
{
if( !(nSub < numSurfaces() ) )
{
fatalErrorInFunction;
fatalExit;
}
return {subSurfaces_[nSub].start(),subSurfaces_[nSub].end()};
}
rangeU32 subSurfacePointRange(uint32 nSub)const
{
if( !(nSub < numSurfaces() ) )
{
fatalErrorInFunction;
fatalExit;
}
return {
subSurfaces_[nSub].pointStart(),
subSurfaces_[nSub].pointEnd()};
}
void clear()
{
triSurface::clear();
subSurfaces_.clear();
}
uint32 subSurfaceSize(uint32 nSub)const
{
if(nSub<numSurfaces())
{
return subSurfaceRange(nSub).numElements();
}
else
{
return 0;
}
}
uint32 subSurfaceNumPoints(uint32 nSub)const
{
if(nSub<numSurfaces())
{
return subSurfacePointRange(nSub).numElements();
}
else
{
return 0;
}
}
word subSurfaceName(uint32 nSub)const
{
if(nSub<numSurfaces())
{
return subSurfaces_[nSub].name();
}
else
{
return "";
}
}
bool read(iIstream& is, const IOPattern& iop)override;
bool write(iOstream& os, const IOPattern& iop)const override;
};
inline iOstream& operator << (iOstream& os, const multiTriSurface& tri)
{
if( !tri.write(os, IOPattern::AllProcessorsDifferent) )
{
ioErrorInFile(os.name(), os.lineNumber())<<
" error in writing multiTriSurface to file.\n";
fatalExit;
}
return os;
}
} // pFlow
#endif
subscriber.hpp
pFlow::List< subSurface >
pFlow::triSurface::clear
void clear()
Definition: triSurface.hpp:212
pFlow::multiTriSurface::appendSurface
bool appendSurface(const word &name, const realx3x3Vector &vertices)
Definition: multiTriSurface.cpp:56
pFlow::triSurface::vertices
const uint32x3Field_D & vertices() const
Definition: triSurface.hpp:192
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::multiTriSurface::operator=
multiTriSurface & operator=(const multiTriSurface &)=default
Copy assignment (default)
pFlow::multiTriSurface::multiTriSurface
multiTriSurface(const objectFile &obj, repository *owner)
Construct from objectFile and owner repository.
Definition: multiTriSurface.cpp:25
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::multiTriSurface::subSurfaceNumPoints
uint32 subSurfaceNumPoints(uint32 nSub) const
Definition: multiTriSurface.hpp:133
pFlow::multiTriSurface::write
bool write(iOstream &os, const IOPattern &iop) const override
Definition: multiTriSurface.cpp:91
pFlow::subscriber
Definition: subscriber.hpp:37
pFlow
Definition: demGeometry.hpp:27
pFlow::multiTriSurface
Definition: multiTriSurface.hpp:32
pFlow::multiTriSurface::subSurfacePointRange
rangeU32 subSurfacePointRange(uint32 nSub) const
Definition: multiTriSurface.hpp:101
pFlow::multiTriSurface::subSurfaces
const subSurfaceList & subSurfaces() const
Definition: multiTriSurface.hpp:86
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::IOPattern::AllProcessorsDifferent
@ AllProcessorsDifferent
Definition: IOPattern.hpp:57
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pFlow::objectFile::name
virtual const word & name() const
Definition: objectFile.hpp:101
pFlow::multiTriSurface::subSurfaceName
word subSurfaceName(uint32 nSub) const
Definition: multiTriSurface.hpp:145
pFlow::Range::numElements
INLINE_FUNCTION_HD T numElements()
Definition: Range.hpp:119
pFlow::multiTriSurface::subSurfaceSize
uint32 subSurfaceSize(uint32 nSub) const
Definition: multiTriSurface.hpp:121
pFlow::IOPattern
Definition: IOPattern.hpp:32
pFlow::multiTriSurface::subSurfaces_
subSurfaceList subSurfaces_
Definition: multiTriSurface.hpp:39
pFlow::multiTriSurface::read
bool read(iIstream &is, const IOPattern &iop) override
Definition: multiTriSurface.cpp:76
pFlow::IOobject::owner
const repository * owner() const override
Definition: IOobject.hpp:76
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
subSurface.hpp
pFlow::multiTriSurface::~multiTriSurface
~multiTriSurface() override=default
default destructor
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::multiTriSurface::clear
void clear()
Clear the content of object.
Definition: multiTriSurface.hpp:114
pFlow::Range< uint32 >
pFlow::IOstream::name
virtual const word & name() const
Return the name of the stream.
Definition: IOstream.cpp:31
pFlow::List::size
size_t size() const
Definition: ListI.hpp:82
pFlow::multiTriSurface::TypeInfo
TypeInfo("multiTriSurface")
ioErrorInFile
#define ioErrorInFile(fileName, lineNumber)
Report an error in file operation with supplied fileName and lineNumber.
Definition: error.hpp:87
pFlow::repository
Definition: repository.hpp:34
pFlow::IOstream::lineNumber
int32 lineNumber() const
Const access to the current stream line number.
Definition: IOstream.hpp:223
pFlow::triSurface
Definition: triSurface.hpp:103
pFlow::Vector
Definition: Vector.hpp:48
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
triSurface.hpp
pFlow::multiTriSurface::numSurfaces
uint32 numSurfaces() const
Definition: multiTriSurface.hpp:81
pFlow::multiTriSurface::subSurfaceRange
rangeU32 subSurfaceRange(uint32 nSub) const
Definition: multiTriSurface.hpp:91