# PhasicFlow: src/phasicFlow/structuredData/trisurfaceStructure/multiTriSurface.hpp Source File

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 "triSurface.hpp"
#include "VectorDuals.hpp"
namespace pFlow
{
class multiTriSurface
:
public triSurface
{
protected:
// - the index of last point of each triSurface
int32Field_HD lastPointIndex_;
// - the index of the last vertex of each triSurface
int32Field_HD lastVertexIndex_;
// - name of each surface
wordField surfaceNames_;
int32Field_HD surfaceNumPoints_;
int32Vector_HD pointsStartPos_;
int32Field_HD surfaceNumVertices_;
int32Vector_HD verticesStartPos_;
int32 numSurfaces_ = 0;
void calculateVars();
public:
// - type info
TypeInfoNV("multiTriSurface");
// - emtpy
multiTriSurface();
multiTriSurface(const multiTriSurface&) = default;
multiTriSurface& operator = (const multiTriSurface&) = default;
multiTriSurface(multiTriSurface&&) = delete;
multiTriSurface& operator = (multiTriSurface&&) = delete;
~multiTriSurface() = default;
bool addTriSurface(const word& name, const triSurface& tSurf);
bool addTriSurface(const word& name, const realx3x3Vector& vertices);
int32 numSurfaces()const
{
return numSurfaces_;
}
void clear()
{
triSurface::clear();
lastPointIndex_.clear();
surfaceNames_.clear();
}
const auto& pointsStartPos()const
{
return pointsStartPos_;
}
const auto& verticesStartPos()const
{
return verticesStartPos_;
}
const auto& surfaceNumPoints()const
{
return surfaceNumPoints_;
}
auto& surfaceNumPoints()
{
return surfaceNumPoints_;
}
int32 surfNumPoints(int32 i)const
{
return surfaceNumPoints_[i];
}
int32 surfNumTriangles(int32 i)const
{
return surfaceNumVertices_[i];
}
int32 surfSize(int32 i)const
{
return surfNumTriangles(i);
}
word surfaceName(int32 i)const
{
return surfaceNames_[i];
}
bool readMultiTriSurface(iIstream& is);
bool writeMultiTriSurface(iOstream& os)const;
bool read(iIstream& is)
{
return readMultiTriSurface(is);
}
bool write(iOstream& os)const
{
return writeMultiTriSurface(os);
}
};
inline iIstream& operator >> (iIstream & is, multiTriSurface & tri )
{
if(!tri.readMultiTriSurface(is))
{
ioErrorInFile(is.name(), is.lineNumber())<<
" error in reading multiTriSurface from file.\n";
fatalExit;
}
return is;
}
inline iOstream& operator << (iOstream& os, const multiTriSurface& tri)
{
if( !tri.writeMultiTriSurface(os) )
{
ioErrorInFile(os.name(), os.lineNumber())<<
" error in writing multiTriSurface to file.\n";
fatalExit;
}
return os;
}
}
#endif
pFlow::multiTriSurface::surfNumTriangles
int32 surfNumTriangles(int32 i) const
Definition: multiTriSurface.hpp:125
pFlow::triSurface::clear
void clear()
Definition: triSurface.hpp:234
pFlow::multiTriSurface::multiTriSurface
multiTriSurface()
Definition: multiTriSurface.cpp:85
pFlow::multiTriSurface::numSurfaces
int32 numSurfaces() const
Definition: multiTriSurface.hpp:86
pFlow::multiTriSurface::write
bool write(iOstream &os) const
Definition: multiTriSurface.hpp:151
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::multiTriSurface::readMultiTriSurface
bool readMultiTriSurface(iIstream &is)
Definition: multiTriSurface.cpp:211
pFlow::multiTriSurface::lastVertexIndex_
int32Field_HD lastVertexIndex_
Definition: multiTriSurface.hpp:43
pFlow::multiTriSurface::operator=
multiTriSurface & operator=(const multiTriSurface &)=default
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::multiTriSurface::numSurfaces_
int32 numSurfaces_
Definition: multiTriSurface.hpp:56
pFlow::multiTriSurface::surfSize
int32 surfSize(int32 i) const
Definition: multiTriSurface.hpp:130
pFlow::multiTriSurface::surfaceNumVertices_
int32Field_HD surfaceNumVertices_
Definition: multiTriSurface.hpp:52
pFlow::Field< VectorDual, int32 >
pFlow::multiTriSurface::surfaceNumPoints
auto & surfaceNumPoints()
Definition: multiTriSurface.hpp:115
pFlow::multiTriSurface::lastPointIndex_
int32Field_HD lastPointIndex_
Definition: multiTriSurface.hpp:40
pFlow::multiTriSurface::surfaceNames_
wordField surfaceNames_
Definition: multiTriSurface.hpp:46
pFlow
Definition: demComponent.hpp:28
pFlow::multiTriSurface
Definition: multiTriSurface.hpp:33
pFlow::multiTriSurface::TypeInfoNV
TypeInfoNV("multiTriSurface")
pFlow::multiTriSurface::surfaceNumPoints
const auto & surfaceNumPoints() const
Definition: multiTriSurface.hpp:110
pFlow::multiTriSurface::surfNumPoints
int32 surfNumPoints(int32 i) const
Definition: multiTriSurface.hpp:120
pFlow::iIstream
Definition: iIstream.hpp:33
pFlow::VectorDual::clear
INLINE_FUNCTION_H void clear()
Definition: VectorDual.hpp:448
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorDual< int32 >
pFlow::operator>>
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
Definition: AdamsBashforth3.hpp:41
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
pFlow::multiTriSurface::pointsStartPos_
int32Vector_HD pointsStartPos_
Definition: multiTriSurface.hpp:50
pFlow::multiTriSurface::clear
void clear()
Definition: multiTriSurface.hpp:91
pFlow::IOstream::name
virtual const word & name() const
Definition: IOstream.cpp:31
pFlow::multiTriSurface::verticesStartPos_
int32Vector_HD verticesStartPos_
Definition: multiTriSurface.hpp:54
pFlow::Vector::clear
auto clear()
Definition: Vector.hpp:248
pFlow::multiTriSurface::~multiTriSurface
~multiTriSurface()=default
pFlow::multiTriSurface::read
bool read(iIstream &is)
Definition: multiTriSurface.hpp:146
pFlow::multiTriSurface::surfaceNumPoints_
int32Field_HD surfaceNumPoints_
Definition: multiTriSurface.hpp:48
pFlow::multiTriSurface::pointsStartPos
const auto & pointsStartPos() const
Definition: multiTriSurface.hpp:100
pFlow::multiTriSurface::addTriSurface
bool addTriSurface(const word &name, const triSurface &tSurf)
Definition: multiTriSurface.cpp:96
pFlow::multiTriSurface::writeMultiTriSurface
bool writeMultiTriSurface(iOstream &os) const
Definition: multiTriSurface.cpp:232
pFlow::triSurface::vertices
const int32x3Vector_D & vertices() const
Definition: triSurface.hpp:214
ioErrorInFile
#define ioErrorInFile(fileName, lineNumber)
Definition: error.hpp:49
pFlow::IOstream::lineNumber
int32 lineNumber() const
Definition: IOstream.hpp:187
pFlow::triSurface
Definition: triSurface.hpp:38
pFlow::multiTriSurface::surfaceName
word surfaceName(int32 i) const
Definition: multiTriSurface.hpp:135
pFlow::multiTriSurface::calculateVars
void calculateVars()
Definition: multiTriSurface.cpp:24
pFlow::Vector
Definition: Vector.hpp:46
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::multiTriSurface::verticesStartPos
const auto & verticesStartPos() const
Definition: multiTriSurface.hpp:105
VectorDuals.hpp
triSurface.hpp