# PhasicFlow: src/phasicFlow/triSurface/multiTriSurface.cpp 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.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 "multiTriSurface.hpp"
pFlow::multiTriSurface::multiTriSurface
(
const objectFile &obj,
repository *owner
)
:
triSurface(obj, owner),
subscriber("multiTriSurface")
{
if( !IOobject::readObject() )
{
fatalErrorInFunction<<
"Error in reading from file "<<IOobject::path()<<endl;
fatalExit;
}
}
pFlow::multiTriSurface::multiTriSurface
(
const objectFile &objf,
repository *owner,
const multiTriSurface &surf
)
:
triSurface(objf, owner, surf),
subscriber("multiTriSurface"),
subSurfaces_(surf.subSurfaces_)
{
}
bool pFlow::multiTriSurface::appendSurface
(
const word &name,
const realx3x3Vector &triangles
)
{
uint32 start = size();
uint32 pointStart = numPoints();
if(!triSurface::append(triangles))
{
fatalErrorInFunction;
return false;
}
uint32 end = size();
uint32 pointEnd = numPoints();
subSurfaces_.emplace_back(name, start, end, pointStart, pointEnd);
return true;
}
bool pFlow::multiTriSurface::read(iIstream &is, const IOPattern &iop)
{
subSurfaces_.clear();
if( !is.findKeywordAndVal("subSurfaces", subSurfaces_ ) )
{
fatalErrorInFunction<<
"Error in reading subSurfaces from stream "<< is.name()<<endl;
return false;
}
return triSurface::read(is, iop);
}
bool pFlow::multiTriSurface::write
(
iOstream &os,
const IOPattern &iop
) const
{
if( iop.thisProcWriteData() )
{
os.writeWordEntry("subSurfaces", subSurfaces_);
if(!os.check(FUNCTION_NAME))return false;
}
return triSurface::write(os,iop);
}
pFlow::multiTriSurface::appendSurface
bool appendSurface(const word &name, const realx3x3Vector &vertices)
Definition: multiTriSurface.cpp:56
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
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
FUNCTION_NAME
#define FUNCTION_NAME
Definition: pFlowMacros.hpp:29
pFlow::multiTriSurface::write
bool write(iOstream &os, const IOPattern &iop) const override
Definition: multiTriSurface.cpp:91
pFlow::triSurface::write
bool write(iOstream &os, const IOPattern &iop) const override
Definition: triSurface.cpp:282
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::iIstream::findKeywordAndVal
bool findKeywordAndVal(const word &keyword, T &val, bool checkEndStatement=true)
find a pair of keyword and data terminated by ; keyword data; return false if keyword does not exist ...
Definition: iIstreamI.hpp:24
pFlow::subscriber
Definition: subscriber.hpp:37
pFlow::multiTriSurface
Definition: multiTriSurface.hpp:32
pFlow::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.cpp:42
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
multiTriSurface.hpp
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::IOPattern::thisProcWriteData
bool thisProcWriteData() const
Definition: IOPattern.hpp:146
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::IOstream::name
virtual const word & name() const
Return the name of the stream.
Definition: IOstream.cpp:31
pFlow::triSurface::read
bool read(iIstream &is, const IOPattern &iop) override
Definition: triSurface.cpp:257
pFlow::repository
Definition: repository.hpp:34
pFlow::triSurface
Definition: triSurface.hpp:103
pFlow::Vector
Definition: Vector.hpp:48
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::iOstream::writeWordEntry
iOstream & writeWordEntry(const word &key, const T &value)
Write a keyword/value entry.
Definition: iOstream.hpp:239