utility particlesPhasicFlow updated. TODO: upgrade it further more to mandates supplying shapeName in particlesDict
This commit is contained in:
parent
ab6308bb0a
commit
206df8924e
|
@ -8,6 +8,6 @@ empty/empty.cpp
|
|||
)
|
||||
#set(link_lib phasicFlow Kokkos::kokkos Interaction Utilities)
|
||||
|
||||
set(link_lib phasicFlow Kokkos::kokkos Utilities)
|
||||
set(link_lib phasicFlow Kokkos::kokkos Particles Utilities)
|
||||
|
||||
pFlow_make_executable_install(particlesPhasicFlow source_files link_lib)
|
||||
|
|
|
@ -21,10 +21,11 @@ Licence:
|
|||
|
||||
#include "positionParticles.hpp"
|
||||
#include "pointStructure.hpp"
|
||||
//#include "setFields.hpp"
|
||||
#include "setFields.hpp"
|
||||
#include "systemControl.hpp"
|
||||
#include "commandLine.hpp"
|
||||
#include "vocabs.hpp"
|
||||
#include "baseShapeNames.hpp"
|
||||
|
||||
//#include "readControlDict.hpp"
|
||||
|
||||
|
@ -95,14 +96,6 @@ int main( int argc, char* argv[] )
|
|||
REPORT(1)<< "Created pStruct with "<< pStructPtr().size() << " points and capacity "<<
|
||||
pStructPtr().capacity()<<" . . ."<< END_REPORT;
|
||||
|
||||
//REPORT(1)<< "Writing pStruct to " << Control.time().path()+ pointStructureFile__<< END_REPORT<<endl<<endl;
|
||||
|
||||
/*if( !Control.time().write())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"ERRor in writing to file. \n ";
|
||||
return 1;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,12 +104,12 @@ int main( int argc, char* argv[] )
|
|||
|
||||
}
|
||||
|
||||
|
||||
List<uniquePtr<IOobject>> allObjects;
|
||||
|
||||
if(!positionOnly)
|
||||
{
|
||||
WARNING<< "setFields is not active "<<END_WARNING;
|
||||
/* auto& pStruct = *pStructPtr;
|
||||
|
||||
auto& pStruct = pStructPtr();
|
||||
|
||||
auto& sfDict = cpDict.subDict("setFields");
|
||||
|
||||
|
@ -124,7 +117,11 @@ int main( int argc, char* argv[] )
|
|||
|
||||
for(auto& sfEntry: defValueList)
|
||||
{
|
||||
if( !sfEntry.setPointFieldDefaultValueNewAll(Control.time(), pStruct, true))
|
||||
if( auto Ptr = sfEntry.setPointFieldDefaultValueNewAll( pStruct, true); Ptr)
|
||||
{
|
||||
allObjects.push_back(std::move(Ptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR<< "\n error occured in setting default value fields.\n"<<END_ERR;
|
||||
return 1;
|
||||
|
@ -149,10 +146,55 @@ int main( int argc, char* argv[] )
|
|||
return 1;
|
||||
}
|
||||
output<<endl;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
Control.clearIncludeExclude();
|
||||
Control.addExclude("shapeName");
|
||||
|
||||
uint32PointField_H shapeIndex
|
||||
(
|
||||
objectFile
|
||||
(
|
||||
"shapeIndex",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
pStructPtr(),
|
||||
0u
|
||||
);
|
||||
|
||||
baseShapeNames shapes(
|
||||
shapeFile__,
|
||||
&Control.caseSetup()
|
||||
);
|
||||
|
||||
auto& shapeName = Control.time().template lookupObject<wordPointField_H>("shapeName");
|
||||
|
||||
REPORT(0)<< "Converting shapeName field to shapeIndex field"<<END_REPORT;
|
||||
|
||||
auto shapeName_D = shapeName.fieldDevice();
|
||||
auto shapeIndex_D = shapeIndex.fieldDevice();
|
||||
|
||||
REPORT(1)<<"List of shape names in "<<shapes.globalName()<<
|
||||
" is: "<<Green_Text(shapes.shapeNameList())<<END_REPORT;
|
||||
|
||||
ForAll(i, shapeIndex)
|
||||
{
|
||||
if(uint32 index; shapes.shapeNameToIndex(shapeName_D[i], index))
|
||||
{
|
||||
shapeIndex_D[i] = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if( !Control.time().write(true))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
|
@ -161,107 +203,9 @@ int main( int argc, char* argv[] )
|
|||
}
|
||||
REPORT(0)<< Green_Text("\nFinished successfully.\n")<<END_REPORT;
|
||||
|
||||
|
||||
|
||||
// this should be palced in each main
|
||||
#include "finalize.hpp"
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
uniquePtr<IOobject> pStructObj{nullptr};
|
||||
|
||||
if(!setOnly)
|
||||
{
|
||||
|
||||
// position particles based on the dict content
|
||||
REPORT(0)<< "Positioning points . . . \n"<<endREPORT;
|
||||
auto pointPosition = positionParticles::create(cpDict.subDict("positionParticles"));
|
||||
|
||||
fileSystem pStructPath = Control.time().path()+pointStructureFile__;
|
||||
|
||||
auto finalPos = pointPosition().getFinalPosition();
|
||||
|
||||
|
||||
pStructObj = IOobject::make<pointStructure>
|
||||
(
|
||||
objectFile
|
||||
(
|
||||
pointStructureFile__,
|
||||
Control.time().path(),
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
finalPos
|
||||
);
|
||||
|
||||
auto& pSruct = pStructObj().getObject<pointStructure>();
|
||||
|
||||
REPORT(1)<< "Created pStruct with "<< pSruct.size() << " points and capacity "<<
|
||||
pSruct.capacity()<<" . . ."<< endREPORT;
|
||||
|
||||
REPORT(1)<< "Writing pStruct to " << pStructObj().path() << endREPORT<<endl<<endl;
|
||||
|
||||
if( !pStructObj().write())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"ERRor in writing to file. \n ";
|
||||
return 1;
|
||||
}
|
||||
}else
|
||||
{
|
||||
pStructObj = IOobject::make<pointStructure>
|
||||
(
|
||||
objectFile
|
||||
(
|
||||
pointStructureFile__,
|
||||
Control.time().path(),
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_NEVER
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!positionOnly)
|
||||
{
|
||||
|
||||
auto& pStruct = pStructObj().getObject<pointStructure>();
|
||||
|
||||
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"<<endERR;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
output<<endl;
|
||||
|
||||
auto& selectorsDict = sfDict.subDict("selectors");
|
||||
|
||||
auto selNames = selectorsDict.dictionaryKeywords();
|
||||
|
||||
for(auto name: selNames)
|
||||
{
|
||||
REPORT(1)<< "Applying selector " << greenText(name) <<endREPORT;
|
||||
|
||||
if(
|
||||
!applySelector(Control, pStruct, selectorsDict.subDict(name))
|
||||
)
|
||||
{
|
||||
ERR<<"\n error occured in setting selector. \n"<<endERR;
|
||||
return 1;
|
||||
}
|
||||
output<<endl;
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -39,7 +39,7 @@ bool applySelector(systemControl& control, const pointStructure& pStruct, const
|
|||
|
||||
auto& selected = selector().selectedPoinsts();
|
||||
|
||||
int32IndexContainer selIndex(selected.data(), selected.size());
|
||||
uint32IndexContainer selIndex(selected.data(), selected.size());
|
||||
|
||||
setFieldList sfList(selDict.subDict("fieldValue"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue