mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
bug remove for GPU run after CPU MPI parallelization
- specialization of VectorSingle for word - dummyFile creation to solve write to file in MPI mode
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
|
||||
#add_subdirectory(checkPhasicFlow)
|
||||
add_subdirectory(checkPhasicFlow)
|
||||
|
||||
add_subdirectory(particlesPhasicFlow)
|
||||
|
||||
|
@ -5,7 +5,8 @@ readFromTimeFolder.cpp
|
||||
vtkFile/vtkFile.cpp
|
||||
geometryPhasicFlow/Wall/Wall.cpp
|
||||
geometryPhasicFlow/planeWall/planeWall.cpp
|
||||
#geometryPhasicFlow/stlWall/stlWall.cpp
|
||||
geometryPhasicFlow/stlWall/stlFile.cpp
|
||||
geometryPhasicFlow/stlWall/stlWall.cpp
|
||||
geometryPhasicFlow/cylinderWall/cylinderWall.cpp
|
||||
geometryPhasicFlow/cuboidWall/cuboidWall.cpp
|
||||
)
|
||||
|
384
utilities/Utilities/geometryPhasicFlow/stlWall/stlFile.cpp
Normal file
384
utilities/Utilities/geometryPhasicFlow/stlWall/stlFile.cpp
Normal file
@ -0,0 +1,384 @@
|
||||
/*------------------------------- 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 "stlFile.hpp"
|
||||
#include "iFstream.hpp"
|
||||
#include "oFstream.hpp"
|
||||
#include "error.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
inline bool badInput(iIstream& is, token& tok )
|
||||
{
|
||||
return is.bad() || !tok.good();
|
||||
}
|
||||
|
||||
inline bool checkWordToken(iIstream& is, token& tok, const word& check)
|
||||
{
|
||||
|
||||
if( badInput(is, tok) || is.eof() || !tok.isWord() || tok.wordToken() != check ) return false;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
inline bool checkNumberToken(iIstream& is, token& tok, real& val)
|
||||
{
|
||||
if(badInput(is, tok) || is.eof() || !tok.isNumber() )return false;
|
||||
val = tok.number();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool pFlow::stlFile::readSolid
|
||||
(
|
||||
iIstream& is,
|
||||
realx3x3Vector & vertecies,
|
||||
word & name
|
||||
)
|
||||
{
|
||||
|
||||
token tok;
|
||||
is>> tok;
|
||||
if(!checkWordToken(is, tok, "solid")) return false;
|
||||
|
||||
// check if there is a name associated with solid
|
||||
name = "";
|
||||
|
||||
|
||||
int32 nWords =0;
|
||||
bool reachedFacet = false;
|
||||
is >> tok;
|
||||
|
||||
while (nWords < 20 )
|
||||
{
|
||||
if( badInput(is, tok) ) return false;
|
||||
//if(!tok.isWord()) return false;
|
||||
nWords++;
|
||||
if(tok.isWord() && tok.wordToken() != "facet" )
|
||||
{
|
||||
name += tok.wordToken();
|
||||
}
|
||||
else if( tok.isNumber())
|
||||
{
|
||||
auto val = tok.number();
|
||||
name += real2Word(val);
|
||||
}
|
||||
else if( tok.isPunctuation())
|
||||
{
|
||||
name += tok.pToken();
|
||||
}
|
||||
else if (tok.isWord() && tok.wordToken() == "facet")
|
||||
{
|
||||
is.putBack(tok);
|
||||
reachedFacet = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
is >> tok;
|
||||
}
|
||||
|
||||
if(!reachedFacet) return false;
|
||||
|
||||
vertecies.clear();
|
||||
while(true )
|
||||
{
|
||||
is>>tok;
|
||||
if( badInput(is,tok) || !tok.isWord() )return false;
|
||||
word wTok = tok.wordToken();
|
||||
if( wTok == "endsolid" ) return true; // end of solid
|
||||
if( wTok != "facet" ) return false;
|
||||
|
||||
// read facet
|
||||
is.putBack(tok);
|
||||
realx3x3 tri;
|
||||
if( !readFacet(is, tri) ) return false;
|
||||
|
||||
vertecies.push_back(tri);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::stlFile::readFacet
|
||||
(
|
||||
iIstream& is,
|
||||
realx3x3& tri
|
||||
)
|
||||
{
|
||||
token tok;
|
||||
|
||||
is>>tok;
|
||||
if( !checkWordToken(is, tok, "facet") ) return false;
|
||||
|
||||
is >> tok;
|
||||
if( !checkWordToken(is, tok , "normal") ) return false;
|
||||
|
||||
real val;
|
||||
for(uint32 i=0; i<3; i++ )
|
||||
{
|
||||
is>>tok;
|
||||
if( !checkNumberToken(is, tok, val))return false;
|
||||
}
|
||||
|
||||
is>> tok;
|
||||
if( !checkWordToken(is, tok, "outer")) return false;
|
||||
|
||||
is>> tok;
|
||||
if(!checkWordToken(is, tok, "loop")) return false;
|
||||
|
||||
realx3 v;
|
||||
|
||||
for(uint32 i=0; i<3; i++)
|
||||
{
|
||||
is>>tok;
|
||||
if(!checkWordToken(is, tok, "vertex")) return false;
|
||||
is>>tok;
|
||||
if(!checkNumberToken(is, tok, v.x()))return false;
|
||||
is>>tok;
|
||||
if(!checkNumberToken(is, tok, v.y()))return false;
|
||||
is>>tok;
|
||||
if(!checkNumberToken(is, tok, v.z()))return false;
|
||||
if( i==0 ) tri.x() = v;
|
||||
if( i==1 ) tri.y() = v;
|
||||
if( i==2) tri.z() = v;
|
||||
}
|
||||
is>> tok;
|
||||
if(!checkWordToken(is, tok, "endloop")) return false;
|
||||
is>> tok;
|
||||
if(!checkWordToken(is, tok, "endfacet")) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::stlFile::writeFacet
|
||||
(
|
||||
iOstream& os,
|
||||
const realx3x3& tri
|
||||
)const
|
||||
{
|
||||
realx3 n = cross( tri.y() - tri.x(), tri.z()-tri.x());
|
||||
n.normalize();
|
||||
os.incrIndent();
|
||||
indent(os) << "facet" << spaceToken()
|
||||
<< "normal"<<spaceToken()
|
||||
<< n.x() << spaceToken()
|
||||
<< n.y() << spaceToken()
|
||||
<< n.z() << endl;
|
||||
os.incrIndent();
|
||||
indent(os) << "outer loop"<<endl;
|
||||
os.incrIndent();
|
||||
indent(os) << "vertex"<< spaceToken()
|
||||
<< tri.x().x() << spaceToken()
|
||||
<< tri.x().y() << spaceToken()
|
||||
<< tri.x().z() << endl;
|
||||
|
||||
indent(os) << "vertex"<< spaceToken()
|
||||
<< tri.y().x() << spaceToken()
|
||||
<< tri.y().y() << spaceToken()
|
||||
<< tri.y().z() << endl;
|
||||
|
||||
indent(os) << "vertex"<< spaceToken()
|
||||
<< tri.z().x() << spaceToken()
|
||||
<< tri.z().y() << spaceToken()
|
||||
<< tri.z().z() << endl;
|
||||
os.decrIndent();
|
||||
indent(os) << "endloop"<<endl;
|
||||
|
||||
os.decrIndent();
|
||||
indent(os)<< "endfacet"<<endl;
|
||||
|
||||
os.decrIndent();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::stlFile::writeSolid
|
||||
(
|
||||
iOstream& os,
|
||||
const realx3x3Vector& vertecies,
|
||||
const word& name
|
||||
)const
|
||||
{
|
||||
os<< "solid"<<spaceToken()<<name<<endl;
|
||||
for(const auto& tri: vertecies)
|
||||
{
|
||||
writeFacet(os, tri);
|
||||
}
|
||||
os<< "endsolid"<<endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::stlFile::stlFile( fileSystem file )
|
||||
:
|
||||
file_(file)
|
||||
{
|
||||
}
|
||||
|
||||
pFlow::stlFile::stlFile
|
||||
(
|
||||
fileSystem file,
|
||||
const word& name,
|
||||
const realx3x3Vector& vertecies
|
||||
)
|
||||
:
|
||||
stlFile(file)
|
||||
{
|
||||
addSolid(name, vertecies);
|
||||
}
|
||||
|
||||
|
||||
pFlow::stlFile::stlFile
|
||||
(
|
||||
fileSystem file,
|
||||
const word& name,
|
||||
realx3x3Vector&& vertecies
|
||||
)
|
||||
:
|
||||
stlFile(file)
|
||||
{
|
||||
addSolid(name, vertecies);
|
||||
}
|
||||
|
||||
void pFlow::stlFile::addSolid
|
||||
(
|
||||
const word& name,
|
||||
const realx3x3Vector& vertecies
|
||||
)
|
||||
{
|
||||
solids_.push_back(makeUnique<realx3x3Vector>(vertecies));
|
||||
solidNames_.push_back(name);
|
||||
}
|
||||
|
||||
|
||||
void pFlow::stlFile::addSolid
|
||||
(
|
||||
const word& name,
|
||||
realx3x3Vector&& vertecies
|
||||
)
|
||||
{
|
||||
solids_.push_back(makeUnique<realx3x3Vector>(vertecies));
|
||||
solidNames_.push_back(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool pFlow::stlFile::read()
|
||||
{
|
||||
solids_.clear();
|
||||
solidNames_.clear();
|
||||
|
||||
// open file
|
||||
iFstream is(file_);
|
||||
|
||||
token tok;
|
||||
while (true)
|
||||
{
|
||||
|
||||
realx3x3Vector vertecies;
|
||||
word name;
|
||||
if(!readSolid(is, vertecies, name))
|
||||
{
|
||||
ioErrorInFile(is.name(), is.lineNumber());
|
||||
return false;
|
||||
}
|
||||
|
||||
addSolid(name, std::move(vertecies));
|
||||
|
||||
is >> tok;
|
||||
if( is.eof() || !tok.good())return true;
|
||||
is.putBack(tok);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::stlFile::write()const
|
||||
{
|
||||
oFstream os(file_);
|
||||
os.precision(8);
|
||||
for(size_t i=0; i<size(); i++)
|
||||
{
|
||||
writeSolid(os, solids_[i], solidNames_[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pFlow::stlFile::setFile
|
||||
(
|
||||
fileSystem file
|
||||
) const
|
||||
{
|
||||
file_ = file;
|
||||
}
|
||||
|
||||
const pFlow::wordList& pFlow::stlFile::names()const
|
||||
{
|
||||
return solidNames_;
|
||||
}
|
||||
|
||||
size_t pFlow::stlFile::size()const
|
||||
{
|
||||
return solids_.size();
|
||||
}
|
||||
|
||||
const pFlow::realx3x3Vector& pFlow::stlFile::solid
|
||||
(
|
||||
size_t i
|
||||
)const
|
||||
{
|
||||
if(i >= size() )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"requested out of range solid from stlFile "<<
|
||||
file_<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
return solids_[i];
|
||||
}
|
||||
|
||||
const pFlow::word& pFlow::stlFile::name
|
||||
(
|
||||
size_t i
|
||||
)const
|
||||
{
|
||||
if(i >= size() )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"requested out of range solid name from stlFile "<<
|
||||
file_<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
return solidNames_[i];
|
||||
}
|
119
utilities/Utilities/geometryPhasicFlow/stlWall/stlFile.hpp
Normal file
119
utilities/Utilities/geometryPhasicFlow/stlWall/stlFile.hpp
Normal file
@ -0,0 +1,119 @@
|
||||
/*------------------------------- 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:
|
||||
|
||||
//// - data memebrs
|
||||
|
||||
// - 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:
|
||||
|
||||
//// - Constructors
|
||||
// - 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;
|
||||
|
||||
//// - Methods
|
||||
|
||||
// - 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__
|
@ -20,6 +20,7 @@ Licence:
|
||||
|
||||
#include "KokkosTypes.hpp"
|
||||
#include "systemControl.hpp"
|
||||
#include "localProcessors.hpp"
|
||||
#include "commandLine.hpp"
|
||||
|
||||
|
||||
@ -40,9 +41,11 @@ if(!cmds.parse(argc, argv)) return 0;
|
||||
#include "initialize.hpp"
|
||||
|
||||
output<<endl;
|
||||
REPORT(1)<< "You are using "<<yellowText(cmds.productNameCopyright())<<endREPORT;
|
||||
REPORT(1)<< yellowText(pFlow::floatingPointDescription())<<endREPORT;
|
||||
|
||||
REPORT(1)<< "You are using "<<Yellow_Text(cmds.productNameCopyright())<<END_REPORT;
|
||||
REPORT(1)<< Yellow_Text(pFlow::floatingPointDescription())<<END_REPORT;
|
||||
REPORT(1)<< (pFlow::localProcessors::builtForMPI()?
|
||||
"This is a built for MPI execution":
|
||||
"This is not a build for MPI execution")<<END_REPORT;
|
||||
|
||||
// this should be palced in each main
|
||||
#include "finalize.hpp"
|
||||
|
@ -26,12 +26,10 @@ Licence:
|
||||
//#include "readControlDict.hpp"
|
||||
|
||||
|
||||
using namespace pFlow;
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
||||
commandLine cmds(
|
||||
pFlow::commandLine cmds(
|
||||
"geometryPhasicFlow",
|
||||
"Converts the supplied informaiton for sufraces in"
|
||||
" geometryDict into PhasicFlow geometry data structure");
|
||||
@ -51,13 +49,13 @@ int main( int argc, char* argv[] )
|
||||
#include "setProperty.hpp"
|
||||
|
||||
REPORT(0)<<"\nReading "<<"geometryDict"<<" . . ."<<END_REPORT;
|
||||
auto geometryDict = fileDictionary(
|
||||
objectFile
|
||||
auto geometryDict = pFlow::fileDictionary(
|
||||
pFlow::objectFile
|
||||
(
|
||||
"geometryDict",
|
||||
Control.settings().path(),
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_NEVER
|
||||
pFlow::objectFile::READ_ALWAYS,
|
||||
pFlow::objectFile::WRITE_NEVER
|
||||
),
|
||||
nullptr
|
||||
);
|
||||
@ -67,33 +65,33 @@ int main( int argc, char* argv[] )
|
||||
auto wallsDictName = surfacesDict.dictionaryKeywords();
|
||||
|
||||
|
||||
word mSurfaceName = word("geometryPhasicFlow_")+word(triSurfaceFile__);
|
||||
multiTriSurface surface
|
||||
auto mSurfaceName = pFlow::word("geometryPhasicFlow_")+pFlow::word(pFlow::triSurfaceFile__);
|
||||
pFlow::multiTriSurface surface
|
||||
(
|
||||
objectFile
|
||||
pFlow::objectFile
|
||||
(
|
||||
mSurfaceName,
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
pFlow::objectFile::READ_NEVER,
|
||||
pFlow::objectFile::WRITE_ALWAYS
|
||||
),
|
||||
nullptr
|
||||
);
|
||||
|
||||
wordVector materials;
|
||||
wordList materialsList;
|
||||
pFlow::wordVector materials;
|
||||
pFlow::wordList materialsList;
|
||||
|
||||
wordVector motion;
|
||||
wordList motionList;
|
||||
pFlow::wordVector motion;
|
||||
pFlow::wordList motionList;
|
||||
|
||||
for(auto& name:wallsDictName)
|
||||
{
|
||||
REPORT(1)<<"Creating wall "<<Green_Text(name)<<" from dictionary "<<surfacesDict.globalName() <<END_REPORT;
|
||||
auto wallPtr = Wall::create( surfacesDict.subDict(name));
|
||||
auto wallPtr = pFlow::Wall::create( surfacesDict.subDict(name));
|
||||
auto& wall = wallPtr();
|
||||
REPORT(1)<<"wall type is "<<Green_Text(wall.typeName())<<'\n'<<END_REPORT;
|
||||
|
||||
realx3x3Vector trinalges(wall.name(), wall.triangles());
|
||||
pFlow::realx3x3Vector trinalges(wall.name(), wall.triangles());
|
||||
|
||||
surface.appendSurface(wall.name(), trinalges);
|
||||
materials.push_back(wall.materialName());
|
||||
@ -108,7 +106,7 @@ int main( int argc, char* argv[] )
|
||||
REPORT(1)<<"Selected wall motion components are "<<Cyan_Text(motionList)<<'\n'<<END_REPORT;
|
||||
|
||||
REPORT(0)<< "\nCreating geometry . . ."<<END_REPORT;
|
||||
auto geomPtr = geometry::create(
|
||||
auto geomPtr = pFlow::geometry::create(
|
||||
Control,
|
||||
proprties,
|
||||
surface,
|
||||
|
@ -30,18 +30,16 @@ Licence:
|
||||
//#include "readControlDict.hpp"
|
||||
|
||||
|
||||
using namespace pFlow;
|
||||
|
||||
int main(int argc, char** argv )
|
||||
{
|
||||
word outFolder = (pFlow::CWD()/word("VTK")).wordPath();
|
||||
pFlow::word outFolder = (pFlow::CWD()/pFlow::word("VTK")).wordPath();
|
||||
|
||||
commandLine cmds(
|
||||
pFlow::commandLine cmds(
|
||||
"pFlowToVTK",
|
||||
"Convrtes the saved pointField and geometry"
|
||||
" date in time folders into vtk file format.");
|
||||
|
||||
wordVector times;
|
||||
pFlow::wordVector times;
|
||||
|
||||
bool noGoem = false;
|
||||
cmds.add_flag(
|
||||
@ -65,7 +63,7 @@ int main(int argc, char** argv )
|
||||
separateSurfaces,
|
||||
"use this when you want to have sub-surfaces in separate files");
|
||||
|
||||
wordVector fields;
|
||||
pFlow::wordVector fields;
|
||||
bool allFields = true;
|
||||
cmds.addOption("-f,--fields",
|
||||
fields.vectorField(),
|
||||
@ -87,10 +85,10 @@ int main(int argc, char** argv )
|
||||
#include "initialize_Control.hpp"
|
||||
|
||||
|
||||
timeFolder folders(Control);
|
||||
auto destFolder = fileSystem(outFolder)/word(geometryFolder__);
|
||||
auto destFolderField = fileSystem(outFolder);
|
||||
wordList geomfiles{"triSurface"};
|
||||
pFlow::timeFolder folders(Control);
|
||||
auto destFolder = pFlow::fileSystem(outFolder)/pFlow::word(pFlow::geometryFolder__);
|
||||
auto destFolderField = pFlow::fileSystem(outFolder);
|
||||
pFlow::wordList geomfiles{"triSurface"};
|
||||
|
||||
|
||||
if(cmds.count("--fields"))
|
||||
@ -98,7 +96,7 @@ int main(int argc, char** argv )
|
||||
allFields = false;
|
||||
}
|
||||
|
||||
realCombinedRange validRange;
|
||||
pFlow::realCombinedRange validRange;
|
||||
if( cmds.count("--time") )
|
||||
{
|
||||
if(!validRange.addRanges(times))
|
||||
@ -116,7 +114,7 @@ int main(int argc, char** argv )
|
||||
Control.time().setTime(folders.time());
|
||||
if( !validRange.isMember( folders.time() ) )continue;
|
||||
|
||||
output<< "time: " << Cyan_Text( folders.time() )<<" s" <<endl;
|
||||
pFlow::output<< "time: " << Cyan_Text( folders.time() )<<" s" <<pFlow::endl;
|
||||
if(!noGoem)
|
||||
{
|
||||
|
||||
@ -155,13 +153,13 @@ int main(int argc, char** argv )
|
||||
}
|
||||
}
|
||||
|
||||
output<<endl;
|
||||
pFlow::output<<pFlow::endl;
|
||||
|
||||
}
|
||||
while( folders++ );
|
||||
|
||||
|
||||
output<< "\nFinished successfully.\n";
|
||||
pFlow::output<< "\nFinished successfully.\n";
|
||||
|
||||
|
||||
// this should be palced in each main
|
||||
|
@ -29,12 +29,10 @@ Licence:
|
||||
|
||||
//#include "readControlDict.hpp"
|
||||
|
||||
using namespace pFlow;
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
||||
commandLine cmds(
|
||||
pFlow::commandLine cmds(
|
||||
"createParticles",
|
||||
"Read the dictionary createParticles and create particles"
|
||||
" based on the two sub-dictionaries positionParticles and setFields.\n"
|
||||
@ -73,10 +71,10 @@ int main( int argc, char* argv[] )
|
||||
// this should be palced in each main
|
||||
#include "initialize_Control.hpp"
|
||||
|
||||
fileDictionary cpDict("particlesDict", Control.settings().path());
|
||||
pFlow::fileDictionary cpDict("particlesDict", Control.settings().path());
|
||||
|
||||
|
||||
uniquePtr<pointStructure> pStructPtr = nullptr;
|
||||
pFlow::uniquePtr<pFlow::pointStructure> pStructPtr = nullptr;
|
||||
|
||||
|
||||
if(!setOnly)
|
||||
@ -84,13 +82,13 @@ int main( int argc, char* argv[] )
|
||||
|
||||
// position particles based on the dict content
|
||||
REPORT(0)<< "Positioning points . . . \n"<<END_REPORT;
|
||||
auto pointPosition = positionParticles::create(Control, cpDict.subDict("positionParticles"));
|
||||
auto pointPosition = pFlow::positionParticles::create(Control, cpDict.subDict("positionParticles"));
|
||||
|
||||
fileSystem pStructPath = Control.time().path()+pointStructureFile__;
|
||||
pFlow::fileSystem pStructPath = Control.time().path()+pFlow::pointStructureFile__;
|
||||
|
||||
auto finalPos = pointPosition().getFinalPosition();
|
||||
|
||||
pStructPtr = makeUnique<pointStructure>(Control, finalPos);
|
||||
pStructPtr = pFlow::makeUnique<pFlow::pointStructure>(Control, finalPos);
|
||||
|
||||
|
||||
REPORT(1)<< "Created pStruct with "<< pStructPtr().size() << " points and capacity "<<
|
||||
@ -100,11 +98,11 @@ int main( int argc, char* argv[] )
|
||||
else
|
||||
{
|
||||
// read the content of pStruct from 0/pStructure
|
||||
pStructPtr = makeUnique<pointStructure>(Control);
|
||||
pStructPtr = pFlow::makeUnique<pFlow::pointStructure>(Control);
|
||||
|
||||
}
|
||||
|
||||
List<uniquePtr<IOobject>> allObjects;
|
||||
pFlow::List<pFlow::uniquePtr<pFlow::IOobject>> allObjects;
|
||||
|
||||
if(!positionOnly)
|
||||
{
|
||||
@ -113,7 +111,7 @@ int main( int argc, char* argv[] )
|
||||
|
||||
auto& sfDict = cpDict.subDict("setFields");
|
||||
|
||||
setFieldList defValueList(sfDict.subDict("defaultValue"));
|
||||
pFlow::setFieldList defValueList(sfDict.subDict("defaultValue"));
|
||||
|
||||
for(auto& sfEntry: defValueList)
|
||||
{
|
||||
@ -128,7 +126,7 @@ int main( int argc, char* argv[] )
|
||||
}
|
||||
}
|
||||
|
||||
output<<endl;
|
||||
pFlow::output<<pFlow::endl;
|
||||
|
||||
auto& selectorsDict = sfDict.subDict("selectors");
|
||||
|
||||
@ -145,45 +143,45 @@ int main( int argc, char* argv[] )
|
||||
ERR<<"\n error occured in setting selector. \n"<<END_ERR;
|
||||
return 1;
|
||||
}
|
||||
output<<endl;
|
||||
pFlow::output<<pFlow::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Control.clearIncludeExclude();
|
||||
Control.addExclude("shapeName");
|
||||
|
||||
uint64PointField_H shapeHash
|
||||
pFlow::uint64PointField_H shapeHash
|
||||
(
|
||||
objectFile
|
||||
pFlow::objectFile
|
||||
(
|
||||
"shapeHash",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
pFlow::objectFile::READ_NEVER,
|
||||
pFlow::objectFile::WRITE_ALWAYS
|
||||
),
|
||||
pStructPtr(),
|
||||
0u
|
||||
);
|
||||
|
||||
uint32PointField_H shapeIndex
|
||||
pFlow::uint32PointField_H shapeIndex
|
||||
(
|
||||
objectFile
|
||||
pFlow::objectFile
|
||||
(
|
||||
"shapeIndex",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
pFlow::objectFile::READ_NEVER,
|
||||
pFlow::objectFile::WRITE_ALWAYS
|
||||
),
|
||||
pStructPtr(),
|
||||
0u
|
||||
);
|
||||
|
||||
baseShapeNames shapes(
|
||||
shapeFile__,
|
||||
pFlow::baseShapeNames shapes(
|
||||
pFlow::shapeFile__,
|
||||
&Control.caseSetup()
|
||||
);
|
||||
|
||||
auto& shapeName = Control.time().template lookupObject<wordPointField_H>("shapeName");
|
||||
auto& shapeName = Control.time().template lookupObject<pFlow::wordPointField_H>("shapeName");
|
||||
|
||||
REPORT(0)<< "Converting shapeName field to shapeIndex field"<<END_REPORT;
|
||||
|
||||
@ -196,7 +194,7 @@ int main( int argc, char* argv[] )
|
||||
|
||||
ForAll(i, shapeHash)
|
||||
{
|
||||
if(uint32 index; shapes.shapeNameToIndex(shapeName_D[i], index))
|
||||
if(pFlow::uint32 index; shapes.shapeNameToIndex(shapeName_D[i], index))
|
||||
{
|
||||
shapeHash_D[i] = shapes.hashes()[index];
|
||||
shapeIndex_D[i] = index;
|
||||
@ -206,7 +204,7 @@ int main( int argc, char* argv[] )
|
||||
fatalErrorInFunction<<"Found shape name "<< Yellow_Text(shapeName_D[i])<<
|
||||
"in shapeName field. But the list of shape names in file "<<
|
||||
shapes.globalName()<<" is : \n"<<
|
||||
shapes.shapeNames()<<endl;
|
||||
shapes.shapeNames()<<pFlow::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user