26 #include "commandLine.hpp"
39 using pFlow::commandLine;
42 int main(
int argc,
char* argv[] )
47 "Read the dictionary createParticles and create particles"
48 " based on the two sub-dictionaries positionParticles and setFields.\n"
49 "First executes positionParticles and then setFields, except "
50 "otherwise selected in the command line.");
53 bool positionOnly =
false;
55 "--positionParticles-only",
57 "Exectue the positionParticles part only and store the created "
58 "pointStructure in the time folder.");
61 cmds.add_flag(
"--setFields-only",
63 "Exectue the setFields part only. Read the pointStructure from "
64 "time folder and setFields and save the result in the same time folder.");
66 bool isCoupling =
false;
70 "Is this a fluid-particle coupling simulation");
72 if(!cmds.parse(argc, argv))
return 0;
74 if(setOnly && positionOnly)
77 "Options --positionParticles-only and --setFields-only cannot be used simeltanuously. \n"<<
endERR;
84 auto objCPDict = IOobject::make<dictionary>
90 objectFile::READ_ALWAYS,
91 objectFile::WRITE_ALWAYS
97 auto& cpDict = objCPDict().getObject<
dictionary>();
106 auto pointPosition = positionParticles::create(cpDict.subDict(
"positionParticles"));
110 auto finalPos = pointPosition().getFinalPosition();
113 pStructObj = IOobject::make<pointStructure>
119 objectFile::READ_NEVER,
120 objectFile::WRITE_ALWAYS
127 REPORT(1)<<
"Created pStruct with "<< pSruct.size() <<
" points and capacity "<<
132 if( !pStructObj().write())
135 "ERRor in writing to file. \n ";
140 pStructObj = IOobject::make<pointStructure>
146 objectFile::READ_ALWAYS,
147 objectFile::WRITE_NEVER
159 auto& sfDict = cpDict.subDict(
"setFields");
161 setFieldList defValueList(sfDict.subDict(
"defaultValue"));
163 for(
auto& sfEntry: defValueList)
165 if( !sfEntry.setPointFieldDefaultValueNewAll(
Control.time(),
pStruct,
true))
167 ERR<<
"\n error occured in setting default value fields.\n"<<
endERR;
174 auto& selectorsDict = sfDict.subDict(
"selectors");
176 auto selNames = selectorsDict.dictionaryKeywords();
178 for(
auto name: selNames)
186 ERR<<
"\n error occured in setting selector. \n"<<
endERR;