refactor up to particles.hpp

This commit is contained in:
Hamidreza Norouzi
2024-01-21 13:26:23 -08:00
parent 46bf08fa91
commit 9c86fe8f31
38 changed files with 868 additions and 855 deletions

View File

@ -72,21 +72,10 @@ int main( int argc, char* argv[] )
// this should be palced in each main
#include "initialize_Control.hpp"
auto objCPDict = IOobject::make<fileDictionary>
(
objectFile
(
"particlesDict",
Control.settings().path(),
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS
),
"particlesDict"
);
fileDictionary cpDict("particlesDict", Control.settings().path());
auto& cpDict = objCPDict().getObject<fileDictionary>();
pointStructure* pStructPtr = nullptr;
uniquePtr<pointStructure> pStructPtr = nullptr;
if(!setOnly)
@ -100,24 +89,11 @@ int main( int argc, char* argv[] )
auto finalPos = pointPosition().getFinalPosition();
auto& pStruct = Control.time().emplaceObject<pointStructure>
(
objectFile
(
pointStructureFile__,
Control.time().path(),
objectFile::READ_NEVER,
objectFile::WRITE_ALWAYS
),
Control,
finalPos
);
pStructPtr = makeUnique<pointStructure>(Control, finalPos);
pStructPtr = &pStruct;
REPORT(1)<< "Created pStruct with "<< pStruct.size() << " points and capacity "<<
pStruct.capacity()<<" . . ."<< END_REPORT;
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;
@ -130,20 +106,8 @@ int main( int argc, char* argv[] )
}
else
{
auto& pStruct = Control.time().emplaceObject<pointStructure>
(
objectFile
(
pointStructureFile__,
Control.time().path(),
objectFile::READ_NEVER,
objectFile::WRITE_ALWAYS
),
Control
);
pStructPtr = &pStruct;
// read the content of pStruct from 0/pStructure
pStructPtr = makeUnique<pointStructure>(Control);
}

View File

@ -19,6 +19,7 @@ Licence:
-----------------------------------------------------------------------------*/
#include "positionParticles.hpp"
#include "vocabs.hpp"
#include "box.hpp"
#include "cylinder.hpp"
#include "sphere.hpp"
@ -101,7 +102,18 @@ pFlow::positionParticles::positionParticles
}
else
{
region_ = makeUnique<region<box>>( control.domainDict().subDict("globalBox"));
fileDictionary domainDict
(
objectFile
{
domainFile__,
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_NEVER
},
&control.settings()
);
region_ = makeUnique<region<box>>( domainDict.subDict("globalBox"));
}
}