particlePhasicFlow bug-fix when flag --set-fields-only is used and no shpaeName is set

This commit is contained in:
Hamidreza Norouzi 2025-01-20 15:39:17 +03:30
parent 967bb753aa
commit a32786eb8a
1 changed files with 27 additions and 23 deletions

View File

@ -181,32 +181,36 @@ int main( int argc, char* argv[] )
&Control.caseSetup() &Control.caseSetup()
); );
auto& shapeName = Control.time().template lookupObject<pFlow::wordPointField_H>("shapeName"); if(Control.time().lookupObjectName("shapeName"))
REPORT(0)<< "Converting shapeName field to shapeIndex field"<<END_REPORT;
auto shapeName_D = shapeName.deviceView();
auto shapeHash_D = shapeHash.deviceView();
auto shapeIndex_D = shapeIndex.deviceView();
REPORT(1)<<"List of shape names in "<<shapes.globalName()<<
" is: "<<Green_Text(shapes.shapeNameList())<<END_REPORT;
ForAll(i, shapeHash)
{ {
if(pFlow::uint32 index; shapes.shapeNameToIndex(shapeName_D[i], index)) auto& shapeName = Control.time().template lookupObject<pFlow::wordPointField_H>("shapeName");
REPORT(0)<< "Converting shapeName field to shapeIndex field"<<END_REPORT;
auto shapeName_D = shapeName.deviceView();
auto shapeHash_D = shapeHash.deviceView();
auto shapeIndex_D = shapeIndex.deviceView();
REPORT(1)<<"List of shape names in "<<shapes.globalName()<<
" is: "<<Green_Text(shapes.shapeNameList())<<END_REPORT;
ForAll(i, shapeHash)
{ {
shapeHash_D[i] = shapes.hashes()[index]; if(pFlow::uint32 index; shapes.shapeNameToIndex(shapeName_D[i], index))
shapeIndex_D[i] = index; {
} shapeHash_D[i] = shapes.hashes()[index];
else shapeIndex_D[i] = index;
{ }
fatalErrorInFunction<<"Found shape name "<< Yellow_Text(shapeName_D[i])<< else
"in shapeName field. But the list of shape names in file "<< {
shapes.globalName()<<" is : \n"<< fatalErrorInFunction<<"Found shape name "<< Yellow_Text(shapeName_D[i])<<
shapes.shapeNames()<<pFlow::endl; "in shapeName field. But the list of shape names in file "<<
} shapes.globalName()<<" is : \n"<<
shapes.shapeNames()<<pFlow::endl;
}
}
} }
if( !Control.time().write(true)) if( !Control.time().write(true))
{ {