/*------------------------------- 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 "positionParticles.hpp" #include "pointStructure.hpp" //#include "setFields.hpp" #include "systemControl.hpp" #include "commandLine.hpp" #include "vocabs.hpp" //#include "readControlDict.hpp" using namespace pFlow; int main( int argc, char* argv[] ) { commandLine cmds( "createParticles", "Read the dictionary createParticles and create particles" " based on the two sub-dictionaries positionParticles and setFields.\n" "First executes positionParticles and then setFields, except " "otherwise selected in the command line."); bool positionOnly = false; cmds.add_flag( "--positionParticles-only", positionOnly, "Exectue the positionParticles part only and store the created " "pointStructure in the time folder."); bool setOnly = false; cmds.add_flag("--setFields-only", setOnly, "Exectue the setFields part only. Read the pointStructure from " "time folder and setFields and save the result in the same time folder."); bool isCoupling = false; cmds.add_flag( "-c,--coupling", isCoupling, "Is this a fluid-particle coupling simulation"); if(!cmds.parse(argc, argv)) return 0; if(setOnly && positionOnly) { ERR<< "Options --positionParticles-only and --setFields-only cannot be used simeltanuously. \n"< ( objectFile ( "particlesDict", Control.settings().path(), objectFile::READ_ALWAYS, objectFile::WRITE_ALWAYS ), "particlesDict" ); auto& cpDict = objCPDict().getObject(); pointStructure* pStructPtr = nullptr; if(!setOnly) { // position particles based on the dict content REPORT(0)<< "Positioning points . . . \n"< ( objectFile ( pointStructureFile__, Control.time().path(), objectFile::READ_NEVER, objectFile::WRITE_ALWAYS ), Control, finalPos ); pStructPtr = &pStruct; REPORT(1)<< "Created pStruct with "<< pStruct.size() << " points and capacity "<< pStruct.capacity()<<" . . ."<< END_REPORT; //REPORT(1)<< "Writing pStruct to " << Control.time().path()+ pointStructureFile__<< END_REPORT< ( objectFile ( pointStructureFile__, Control.time().path(), objectFile::READ_NEVER, objectFile::WRITE_ALWAYS ), Control ); pStructPtr = &pStruct; } if(!positionOnly) { WARNING<< "setFields is not active "< pStructObj{nullptr}; if(!setOnly) { // position particles based on the dict content REPORT(0)<< "Positioning points . . . \n"< ( objectFile ( pointStructureFile__, Control.time().path(), objectFile::READ_NEVER, objectFile::WRITE_ALWAYS ), finalPos ); auto& pSruct = pStructObj().getObject(); REPORT(1)<< "Created pStruct with "<< pSruct.size() << " points and capacity "<< pSruct.capacity()<<" . . ."<< endREPORT; REPORT(1)<< "Writing pStruct to " << pStructObj().path() << endREPORT< ( objectFile ( pointStructureFile__, Control.time().path(), objectFile::READ_ALWAYS, objectFile::WRITE_NEVER ) ); } if(!positionOnly) { auto& pStruct = pStructObj().getObject(); auto& sfDict = cpDict.subDict("setFields"); setFieldList defValueList(sfDict.subDict("defaultValue")); for(auto& sfEntry: defValueList) { if( !sfEntry.setPointFieldDefaultValueNewAll(Control.time(), pStruct, true)) { ERR<< "\n error occured in setting default value fields.\n"<