# PhasicFlow: utilities/Utilities/geometryPhasicFlow/stlWall/stlFile.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.

stlFile.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 __stlFile_hpp__
#define __stlFile_hpp__
#include "types.hpp"
#include "Vectors.hpp"
#include "Lists.hpp"
#include "fileSystem.hpp"
namespace pFlow
{
class iIstream;
class stlFile
{
protected:
// - list of verticies of all solids
ListPtr<realx3x3Vector> solids_;
// - list of names of all solids
wordList solidNames_;
// - file name of stl file (used for reading and writing)
mutable fileSystem file_;
// - protected members
bool readSolid(iIstream& is, realx3x3Vector & vertecies, word & name);
bool readFacet(iIstream& is, realx3x3& tri);
bool writeSolid(iOstream& os, const realx3x3Vector& vertecies, const word& name)const;
bool writeFacet(iOstream& os, const realx3x3& tri)const;
public:
// - construct with file name
// an empty stlFile
stlFile( fileSystem file );
// - construct with file name and one solid (copy)
stlFile( fileSystem file, const word& name, const realx3x3Vector& vertecies);
// - construct with file name and one solid (copy)
stlFile( fileSystem file, const word& name, realx3x3Vector&& vertecies);
// - copy construct
stlFile(const stlFile&) = default;
// - move construct
stlFile(stlFile&&) = default;
~stlFile() = default;
// - add a solid at the end of list, with copy operation
void addSolid(const word& name, const realx3x3Vector& vertecies);
// - add a solid at the end of list, with move operation
void addSolid(const word& name, realx3x3Vector&& vertecies);
// - clear current content and read from file
bool read();
// - write the current contnet to file
bool write()const;
// - set stl file path
void setFile(fileSystem file) const;
// - name of solids
const wordList& names()const;
// - number of solids
size_t size()const;
// - vertecies of ith solid
const realx3x3Vector& solid(size_t i)const;
// - name of ith solid
const word& name(size_t i)const;
};
} // pFlow
#endif //__stlFile_hpp__
pFlow::List< word >
pFlow::ListPtr
Definition: ListPtr.hpp:37
Lists.hpp
types.hpp
pFlow::stlFile::stlFile
stlFile(fileSystem file)
Definition: stlFile.cpp:238
pFlow::stlFile::file_
fileSystem file_
Definition: stlFile.hpp:51
pFlow::stlFile::solid
const realx3x3Vector & solid(size_t i) const
Definition: stlFile.cpp:355
pFlow::stlFile::writeFacet
bool writeFacet(iOstream &os, const realx3x3 &tri) const
Definition: stlFile.cpp:178
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::stlFile
Definition: stlFile.hpp:38
Vectors.hpp
pFlow::stlFile::writeSolid
bool writeSolid(iOstream &os, const realx3x3Vector &vertecies, const word &name) const
Definition: stlFile.cpp:222
pFlow::stlFile::name
const word & name(size_t i) const
Definition: stlFile.cpp:371
fileSystem.hpp
pFlow
Definition: demGeometry.hpp:27
pFlow::stlFile::size
size_t size() const
Definition: stlFile.cpp:349
pFlow::fileSystem
Manages file pathes, manupulate and combines them.
Definition: fileSystem.hpp:71
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::stlFile::addSolid
void addSolid(const word &name, const realx3x3Vector &vertecies)
Definition: stlFile.cpp:270
pFlow::stlFile::solidNames_
wordList solidNames_
Definition: stlFile.hpp:48
pFlow::stlFile::~stlFile
~stlFile()=default
pFlow::stlFile::readSolid
bool readSolid(iIstream &is, realx3x3Vector &vertecies, word &name)
Definition: stlFile.cpp:52
pFlow::stlFile::names
const wordList & names() const
Definition: stlFile.cpp:344
pFlow::stlFile::setFile
void setFile(fileSystem file) const
Definition: stlFile.cpp:337
pFlow::stlFile::readFacet
bool readFacet(iIstream &is, realx3x3 &tri)
Definition: stlFile.cpp:127
pFlow::stlFile::read
bool read()
Definition: stlFile.cpp:292
pFlow::triple
A set of 3 variables that can be used for vector variables.
Definition: triple.hpp:36
pFlow::Vector
Definition: Vector.hpp:48
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::stlFile::write
bool write() const
Definition: stlFile.cpp:324
pFlow::stlFile::solids_
ListPtr< realx3x3Vector > solids_
Definition: stlFile.hpp:45