mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
MPI-parallelization upto IO file
This commit is contained in:
@ -6,6 +6,8 @@ positionOrdered/positionOrdered.cpp
|
||||
#positionRandom/positionRandom.cpp
|
||||
empty/empty.cpp
|
||||
)
|
||||
set(link_lib phasicFlow Kokkos::kokkos Interaction Utilities)
|
||||
#set(link_lib phasicFlow Kokkos::kokkos Interaction Utilities)
|
||||
|
||||
set(link_lib phasicFlow Kokkos::kokkos Utilities)
|
||||
|
||||
pFlow_make_executable_install(particlesPhasicFlow source_files link_lib)
|
||||
|
@ -21,25 +21,14 @@ Licence:
|
||||
|
||||
#include "positionParticles.hpp"
|
||||
#include "pointStructure.hpp"
|
||||
#include "setFields.hpp"
|
||||
//#include "setFields.hpp"
|
||||
#include "systemControl.hpp"
|
||||
#include "commandLine.hpp"
|
||||
#include "vocabs.hpp"
|
||||
|
||||
//#include "readControlDict.hpp"
|
||||
|
||||
using pFlow::output;
|
||||
using pFlow::endl;
|
||||
using pFlow::dictionary;
|
||||
using pFlow::uniquePtr;
|
||||
using pFlow::IOobject;
|
||||
using pFlow::objectFile;
|
||||
using pFlow::fileSystem;
|
||||
using pFlow::pointStructure;
|
||||
using pFlow::pointStructureFile__;
|
||||
using pFlow::positionParticles;
|
||||
using pFlow::commandLine;
|
||||
using pFlow::setFieldList;
|
||||
using namespace pFlow;
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
@ -83,7 +72,7 @@ int main( int argc, char* argv[] )
|
||||
// this should be palced in each main
|
||||
#include "initialize_Control.hpp"
|
||||
|
||||
auto objCPDict = IOobject::make<dictionary>
|
||||
auto objCPDict = IOobject::make<fileDictionary>
|
||||
(
|
||||
objectFile
|
||||
(
|
||||
@ -92,11 +81,10 @@ int main( int argc, char* argv[] )
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
"particlesDict",
|
||||
true
|
||||
"particlesDict"
|
||||
);
|
||||
|
||||
auto& cpDict = objCPDict().getObject<dictionary>();
|
||||
auto& cpDict = objCPDict().getObject<fileDictionary>();
|
||||
|
||||
pointStructure* pStructPtr = nullptr;
|
||||
|
||||
@ -128,19 +116,19 @@ int main( int argc, char* argv[] )
|
||||
|
||||
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<<endl<<endl;
|
||||
|
||||
if( !Control.time().write())
|
||||
//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
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
auto& pStruct = Control.time().emplaceObject<pointStructure>
|
||||
@ -163,8 +151,8 @@ int main( int argc, char* argv[] )
|
||||
|
||||
if(!positionOnly)
|
||||
{
|
||||
|
||||
auto& pStruct = *pStructPtr;
|
||||
WARNING<< "setFields is not active "<<END_WARNING;
|
||||
/* auto& pStruct = *pStructPtr;
|
||||
|
||||
auto& sfDict = cpDict.subDict("setFields");
|
||||
|
||||
@ -197,10 +185,16 @@ int main( int argc, char* argv[] )
|
||||
return 1;
|
||||
}
|
||||
output<<endl;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Control.time().write(true);
|
||||
|
||||
if( !Control.time().write(true))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"ERRor in writing to file. \n ";
|
||||
return 1;
|
||||
}
|
||||
REPORT(0)<< Green_Text("\nFinished successfully.\n")<<END_REPORT;
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ Licence:
|
||||
#include "cylinder.hpp"
|
||||
#include "sphere.hpp"
|
||||
#include "cells.hpp"
|
||||
#include "contactSearchFunctions.hpp"
|
||||
//#include "contactSearchFunctions.hpp"
|
||||
|
||||
#include "streams.hpp"
|
||||
|
||||
@ -32,20 +32,20 @@ pFlow::realx3Vector pFlow::positionParticles::sortByMortonCode(realx3Vector& pos
|
||||
{
|
||||
struct indexMorton
|
||||
{
|
||||
size_t morton;
|
||||
size_t index;
|
||||
uint64 morton;
|
||||
uint64 index;
|
||||
};
|
||||
|
||||
realx3 minP = min(position);
|
||||
/*realx3 minP = min(position);
|
||||
realx3 maxP = max(position);
|
||||
real cellsize = maxDiameter();
|
||||
cells<size_t> allCells( box(minP, maxP), cellsize);
|
||||
cells<uint64> allCells( box(minP, maxP), cellsize);
|
||||
|
||||
Vector<indexMorton> indMor(position.size(),RESERVE());
|
||||
|
||||
indMor.clear();
|
||||
|
||||
size_t ind=0;
|
||||
uint64 ind=0;
|
||||
for(const auto& p:position)
|
||||
{
|
||||
auto cellInd = allCells.pointIndex(p);
|
||||
@ -68,9 +68,10 @@ pFlow::realx3Vector pFlow::positionParticles::sortByMortonCode(realx3Vector& pos
|
||||
for(auto& ind:indMor)
|
||||
{
|
||||
sortedPos.push_back( position[ind.index] );
|
||||
}
|
||||
}*/
|
||||
|
||||
return sortedPos;
|
||||
WARNING<<"Morton sorting is inactive!"<<END_WARNING;
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
@ -80,7 +81,7 @@ pFlow::positionParticles::positionParticles
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
maxNumberOfParticles_ = dict.getValOrSet("maxNumberOfParticles", static_cast<size_t>(10000));
|
||||
maxNumberOfParticles_ = dict.getValOrSet("maxNumberOfParticles", static_cast<uint64>(10000));
|
||||
|
||||
mortonSorting_ = dict.getValOrSet("mortonSorting", Logical("Yes"));
|
||||
|
||||
@ -90,11 +91,13 @@ pFlow::positionParticles::positionParticles
|
||||
}
|
||||
else if(dict.containsDictionay("cylinder"))
|
||||
{
|
||||
region_ = makeUnique<region<cylinder>>(dict.subDict("cylinder"));
|
||||
WARNING<<"cylinder region is not set!"<<END_WARNING;
|
||||
//region_ = makeUnique<region<cylinder>>(dict.subDict("cylinder"));
|
||||
}
|
||||
else if(dict.containsDictionay("sphere"))
|
||||
{
|
||||
region_ = makeUnique<region<sphere>>(dict.subDict("sphere"));
|
||||
WARNING<<"sphere region is not set!"<<END_WARNING;
|
||||
//region_ = makeUnique<region<sphere>>(dict.subDict("sphere"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -112,7 +115,7 @@ pFlow::realx3Vector pFlow::positionParticles::getFinalPosition()
|
||||
}
|
||||
else
|
||||
{
|
||||
realx3Vector vec(position().capacity(), RESERVE());
|
||||
realx3Vector vec("final position",position().capacity(), 0 , RESERVE());
|
||||
vec.assign( position().begin(), position().end());
|
||||
|
||||
return std::move(vec);
|
||||
@ -132,7 +135,7 @@ pFlow::uniquePtr<pFlow::positionParticles>
|
||||
|
||||
if( dictionaryvCtorSelector_.search(method) )
|
||||
{
|
||||
return dictionaryvCtorSelector_[method] (dict);
|
||||
return dictionaryvCtorSelector_[method] (control, dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user