From 1314516ef7cd32d326ce133f07332558d9a301bc Mon Sep 17 00:00:00 2001 From: Konstantin Kutscher <kutscher@irmb.tu-bs.de> Date: Thu, 19 May 2016 16:15:34 +0000 Subject: [PATCH] fixed AdjustForcingCoProcessor and TimeAveragedValuesCoProcessor --- source/Applications.cmake | 4 +- source/Applications/BoxBenchmark/bb.cfg | 4 +- source/Applications/BoxBenchmark/bb.cpp | 2 +- source/Applications/DHIT/CMakeLists.txt | 25 + source/Applications/DHIT/dhit.cfg | 15 + source/Applications/DHIT/dhit.cpp | 217 ++ source/Applications/FNG/CMakeLists.txt | 25 + source/Applications/FNG/fng.cpp | 414 +++ .../pChannel/configBombadilpChannel.cfg | 14 +- source/Applications/pChannel/pChannel.cpp | 28 +- source/Applications/sphere/sphere.cpp | 16 +- .../cmake_config_files/FRY29.config.cmake | 29 + source/CMake/compilerflags/icc160.cmake | 39 + source/VirtualFluids.h | 7 - .../CoProcessors/AdjustForcingCoProcessor.cpp | 66 +- .../CoProcessors/AdjustForcingCoProcessor.h | 3 +- .../TimeAveragedValuesCoProcessor.cpp | 271 +- .../TimeAveragedValuesCoProcessor.h | 20 +- .../Connectors/Block3DConnector.h | 4 - .../Connectors/Block3DConnectorFactory.cpp | 4 +- .../Connectors/D3Q27ETCFOffVectorConnector.h | 2359 ++++++++--------- .../Connectors/D3Q27ETCFVectorConnector.cpp | 1 - .../Connectors/D3Q27ETCFVectorConnector.h | 707 ----- .../Connectors/D3Q27ETDirectConnector.cpp | 275 -- .../Connectors/D3Q27ETDirectConnector.h | 60 - .../Connectors/D3Q27ETDirectConnector2.cpp | 435 --- .../Connectors/D3Q27ETDirectConnector2.h | 21 - .../Connectors/D3Q27ETFCOffVectorConnector.h | 6 +- .../Connectors/D3Q27ETFCVectorConnector.cpp | 1 - .../Connectors/D3Q27ETFCVectorConnector.h | 537 ---- .../Connectors/D3Q27ETFCVectorConnector.h.bak | 511 ---- .../Connectors/D3Q27ETFullDirectConnector.cpp | 247 +- .../Connectors/D3Q27ETFullDirectConnector.h | 69 +- .../D3Q27ETFullDirectConnector2.cpp | 289 -- .../D3Q27ETFullDirectConnector2.cpp_old | 274 -- .../Connectors/D3Q27ETFullDirectConnector2.h | 193 -- .../D3Q27ETFullDirectConnector2.h_old | 226 -- .../D3Q27ETFullDirectConnector3.cpp | 210 -- .../Connectors/D3Q27ETFullDirectConnector3.h | 84 - .../Connectors/D3Q27ETFullVectorConnector.h | 4 - .../Connectors/D3Q27ETVectorConnector.cpp | 2 - .../Connectors/D3Q27ETVectorConnector.h | 720 ----- .../D3Q27ETWithInvDirectConnector.cpp | 371 --- .../D3Q27ETWithInvDirectConnector.h | 60 - .../FineToCoarseNodeSetBlock3DConnector.h | 2 - source/VirtualFluidsCore/Grid/Calculator.cpp | 50 +- source/VirtualFluidsCore/Grid/Calculator.h | 9 +- .../Grid/PrePostBcCalculator.cpp | 6 +- .../LBM/D3Q27IntegrateValuesHelper.cpp | 757 ++++-- .../LBM/D3Q27IntegrateValuesHelper.h | 162 +- .../Visitors/ConnectorBlockVisitor.cpp | 8 - .../Visitors/CreateTransmittersHelper.cpp | 18 +- .../D3Q27SetConnectorsBlockVisitor.cpp | 23 +- 53 files changed, 2985 insertions(+), 6919 deletions(-) create mode 100644 source/Applications/DHIT/CMakeLists.txt create mode 100644 source/Applications/DHIT/dhit.cfg create mode 100644 source/Applications/DHIT/dhit.cpp create mode 100644 source/Applications/FNG/CMakeLists.txt create mode 100644 source/Applications/FNG/fng.cpp create mode 100644 source/CMake/cmake_config_files/FRY29.config.cmake create mode 100644 source/CMake/compilerflags/icc160.cmake delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.h delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.h delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.h delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h.bak delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp_old delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h_old delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.h delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.h delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.cpp delete mode 100644 source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.h diff --git a/source/Applications.cmake b/source/Applications.cmake index a3e520746..2858a50cb 100644 --- a/source/Applications.cmake +++ b/source/Applications.cmake @@ -42,4 +42,6 @@ add_subdirectory(Applications/LaminarTubeFlow) # add_subdirectory(Applications/perm) add_subdirectory(Applications/pChannel) #add_subdirectory(Applications/pDisk) -add_subdirectory(Applications/BoxBenchmark) \ No newline at end of file +add_subdirectory(Applications/BoxBenchmark) +add_subdirectory(Applications/DHIT) +add_subdirectory(Applications/FNG) \ No newline at end of file diff --git a/source/Applications/BoxBenchmark/bb.cfg b/source/Applications/BoxBenchmark/bb.cfg index 6bab4c4d6..d1054652a 100644 --- a/source/Applications/BoxBenchmark/bb.cfg +++ b/source/Applications/BoxBenchmark/bb.cfg @@ -3,8 +3,8 @@ numOfThreads = 1 availMem = 11e9 #Grid -length = 64 64 64 -blocknx = 8 8 8 +length = 128 128 128 +blocknx = 32 32 32 dx = 1 refineLevel = 0 diff --git a/source/Applications/BoxBenchmark/bb.cpp b/source/Applications/BoxBenchmark/bb.cpp index c4b41e5e0..bfffec0c6 100644 --- a/source/Applications/BoxBenchmark/bb.cpp +++ b/source/Applications/BoxBenchmark/bb.cpp @@ -26,7 +26,7 @@ void run(string configname) vector<double> length = config.getVector<double>("length"); bool logToFile = config.getBool("logToFile"); - UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG3"); + //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG3"); CommunicatorPtr comm = MPICommunicator::getInstance(); int myid = comm->getProcessID(); diff --git a/source/Applications/DHIT/CMakeLists.txt b/source/Applications/DHIT/CMakeLists.txt new file mode 100644 index 000000000..f0264bd09 --- /dev/null +++ b/source/Applications/DHIT/CMakeLists.txt @@ -0,0 +1,25 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +######################################################## +## C++ PROJECT ### +######################################################## +PROJECT(dhit) + +INCLUDE(${SOURCE_ROOT}/IncludsList.cmake) + +################################################################# +### LOCAL FILES ### +################################################################# +FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp ) + +SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) +SOURCE_GROUP(src FILES ${SPECIFIC_FILES}) + +SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids) + +################################################################# +### CREATE PROJECT ### +################################################################# +CREATE_CAB_PROJECT(dhit BINARY) diff --git a/source/Applications/DHIT/dhit.cfg b/source/Applications/DHIT/dhit.cfg new file mode 100644 index 000000000..a5e02884b --- /dev/null +++ b/source/Applications/DHIT/dhit.cfg @@ -0,0 +1,15 @@ +pathname = d:/temp/DHIT +numOfThreads = 4 +availMem = 11e9 + +#Grid +length = 128 128 128 +blocknx = 32 32 32 + +dx = 1 +refineLevel = 0 + +outTime = 100 +endTime = 100 + +logToFile = false \ No newline at end of file diff --git a/source/Applications/DHIT/dhit.cpp b/source/Applications/DHIT/dhit.cpp new file mode 100644 index 000000000..920760790 --- /dev/null +++ b/source/Applications/DHIT/dhit.cpp @@ -0,0 +1,217 @@ +#include <iostream> +#include <string> + +#include "VirtualFluids.h" + +using namespace std; + + +void run(string configname) +{ + try + { + ConfigurationFile config; + config.load(configname); + + string pathname = config.getString("pathname"); + int numOfThreads = config.getInt("numOfThreads"); + vector<int> blocknx = config.getVector<int>("blocknx"); + double endTime = config.getDouble("endTime"); + double outTime = config.getDouble("outTime"); + double availMem = config.getDouble("availMem"); + vector<double> length = config.getVector<double>("length"); + bool logToFile = config.getBool("logToFile"); + + + CommunicatorPtr comm = MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + if (logToFile) + { +#if defined(__unix__) + if (myid == 0) + { + const char* str = pathname.c_str(); + mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } +#endif + + if (myid == 0) + { + stringstream logFilename; + logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + + LBMReal uLB = 0.032; + LBMReal dx = 1.0; + LBMReal rhoLB = 0.0; + LBMReal nuLB = 1.2395e-2; + + + LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter()); + + //bounding box + double g_minX1 = 0.0; + double g_minX2 = 0.0; + double g_minX3 = 0.0; + + double g_maxX1 = length[0]; + double g_maxX2 = length[1]; + double g_maxX3 = length[2]; + + //geometry + GbObject3DPtr box(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + if (myid == 0) GbSystem3D::writeGeoObject(box.get(), pathname + "/geo/box", WbWriterVtkXmlBinary::getInstance()); + + GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + + double blockLength = blocknx[0] * dx; + + Grid3DPtr grid(new Grid3D(comm)); + + if (myid == 0) + { + UBLOG(logINFO, "uLb = " << uLB); + UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "nuLb = " << nuLB); + UBLOG(logINFO, "dx = " << dx); + UBLOG(logINFO, "length = " << length[0] << " " << length[1] << " " << length[2]); + UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]); + UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses()); + UBLOG(logINFO, "number of threads = " << numOfThreads); + UBLOG(logINFO, "Preprocess - start"); + } + + grid->setDeltaX(dx); + grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); + grid->setPeriodicX1(true); + grid->setPeriodicX2(true); + grid->setPeriodicX3(true); + + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + + Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B)); + InteractorsHelper intHelper(grid, metisVisitor); + //intHelper.addInteractor(boxInt); + intHelper.selectBlocks(); + + ppblocks->process(0); + ppblocks.reset(); + + //set connectors + D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); + D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + grid->accept(setConnsVisitor); + + //domain decomposition for threads + PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); + grid->accept(pqPartVisitor); + + unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); + int ghostLayer = 3; + unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]); + unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock; + unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer); + double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4)); + double needMem = needMemAll / double(comm->getNumberOfProcesses()); + + if (myid == 0) + { + UBLOG(logINFO, "Number of blocks = " << numberOfBlocks); + UBLOG(logINFO, "Number of nodes = " << numberOfNodes); + int minInitLevel = grid->getCoarsestInitializedLevel(); + int maxInitLevel = grid->getFinestInitializedLevel(); + for (int level = minInitLevel; level <= maxInitLevel; level++) + { + int nobl = grid->getNumberOfBlocks(level); + UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl); + UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock); + } + UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes"); + UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes"); + UBLOG(logINFO, "Available memory per process = " << availMem << " bytes"); + } + + LBMKernel3DPtr kernel; + + kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL)); + + BCProcessorPtr bcProc(new D3Q27ETBCProcessor()); + kernel->setBCProcessor(bcProc); + + SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem); + grid->accept(kernelVisitor); + + intHelper.setBC(); + + //initialization of distributions + D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB, uLB, uLB, uLB); + grid->accept(initVisitor); + + //boundary conditions grid + { + UbSchedulerPtr geoSch(new UbScheduler(1)); + MacroscopicQuantitiesCoProcessorPtr ppgeo( + new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true)); + grid->coProcess(0); + } + + if (myid == 0) UBLOG(logINFO, "Preprocess - end"); + + if (myid == 0) + { + UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()); + UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()); + UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()); + } + + UbSchedulerPtr visSch(new UbScheduler(outTime)); + MacroscopicQuantitiesCoProcessor pp(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv); + + UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100)); + NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm); + + CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch)); + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + calculation->calculate(); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); + } + catch (std::exception& e) + { + cerr << e.what() << endl << flush; + } + catch (std::string& s) + { + cerr << s << endl; + } + catch (...) + { + cerr << "unknown exception" << endl; + } + +} +int main(int argc, char* argv[]) +{ + if (argv != NULL) + { + if (argv[1] != NULL) + { + run(string(argv[1])); + } + else + { + cout << "Configuration file is missing!" << endl; + } + } + +} + diff --git a/source/Applications/FNG/CMakeLists.txt b/source/Applications/FNG/CMakeLists.txt new file mode 100644 index 000000000..bf4e41743 --- /dev/null +++ b/source/Applications/FNG/CMakeLists.txt @@ -0,0 +1,25 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +######################################################## +## C++ PROJECT ### +######################################################## +PROJECT(fng) + +INCLUDE(${SOURCE_ROOT}/IncludsList.cmake) + +################################################################# +### LOCAL FILES ### +################################################################# +FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp ) + +SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) +SOURCE_GROUP(src FILES ${SPECIFIC_FILES}) + +SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids) + +################################################################# +### CREATE PROJECT ### +################################################################# +CREATE_CAB_PROJECT(fng BINARY) diff --git a/source/Applications/FNG/fng.cpp b/source/Applications/FNG/fng.cpp new file mode 100644 index 000000000..8be1bb26d --- /dev/null +++ b/source/Applications/FNG/fng.cpp @@ -0,0 +1,414 @@ +#include <iostream> +#include <string> + +#include <boost/pointer_cast.hpp> + +#include "VirtualFluids.h" + +using namespace std; + + +void setup(const char *cstr1, const char *cstr2) +{ + try + { + //Sleep(30000); + + ConfigFileReader cf(cstr1); + if ( !cf.read() ) + { + std::string exceptionText = "Unable to read configuration file\n"; + throw exceptionText; + } + + //parameters from config file + string machine = cf.getValue("machine"); + string pathname = cf.getValue("path"); + string geoFile = cf.getValue("geoFile"); + int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads")); + double availMem = UbSystem::stringTo<double>(cf.getValue("availMem")); + int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel")); + int blocknx = UbSystem::stringTo<int>(cf.getValue("blocknx")); + + CommunicatorPtr comm = MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + if(machine == "Bombadil") int dumy=0; + else if(machine == "Ludwig" || machine == "HLRN") + { + if(myid ==0) + { + stringstream logFilename; + logFilename << pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + else throw UbException(UB_EXARGS, "unknown machine"); + + GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo")); + if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance()); + + double dx = (fabs(geo->getX3Maximum()-geo->getX3Minimum())*10e-3)*(double)(1<<refineLevel); + dx /= 4.0; + + double blockLength = blocknx*dx; + + double offsetX1 = fabs(geo->getX1Maximum()-geo->getX1Minimum()); + double h = fabs(geo->getX3Maximum()-geo->getX3Minimum()); + double offsetX2 = fabs(geo->getX2Maximum()-geo->getX2Minimum())/3.0; + double offsetX3 = 3.0*h; //30.0*h; + + double g_minX1 = geo->getX1Minimum()-offsetX1; + double g_minX2 = geo->getX2Minimum()+offsetX2; + double g_minX3 = geo->getX3Centroid()-offsetX3; + + double g_maxX1 = geo->getX1Maximum()+5.0*offsetX1; + double g_maxX2 = g_minX2 + 4.0*blockLength; + double g_maxX3 = geo->getX3Centroid()+offsetX3; + + //########################################################################## + //## physical parameters + //########################################################################## + double Re = 1e6; + + double rhoLB = 0.0; + double rhoReal = 1.0; + double nueReal = 0.000015;//0.015; + + double lReal = 3.0;//<-m ;//Profile laenge in cm(! cm nicht m !) + double uReal = Re*nueReal/lReal; + + //##Machzahl: + //#Ma = uReal/csReal + double Ma = 0.1;//Ma-Real! + double csReal = uReal/Ma; + double hLB = lReal/dx; + + LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB); + + double uLB = uReal * unitConverter.getFactorVelocityWToLb(); + double nueLB = nueReal * unitConverter.getFactorViscosityWToLb(); + + LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter()); + + const int baseLevel = 0; + + //////////////////////////////////////////////////////////////////////// + //Grid + ////////////////////////////////////////////////////////////////////////// + Grid3DPtr grid(new Grid3D(comm)); + grid->setDeltaX(dx); + grid->setBlockNX(blocknx, blocknx, blocknx); + + GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + //gridCube->setCenterCoordinates(geo->getX1Centroid(), geo->getX2Centroid(), geo->getX3Centroid()); + if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance()); + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + grid->setPeriodicX2(true); + grid->setPeriodicX3(true); + + double outTime = 1.0; + UbSchedulerPtr stepSch(new UbScheduler(outTime)); + //PostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm)); + + UbSchedulerPtr rSch(new UbScheduler()); + rSch->addSchedule(50,50,50); + RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::TXT)); + + + std::string opt; + + if(cstr2!= NULL) + opt = std::string(cstr2); + + if/*(cstr== NULL)*/(cstr2!= NULL) + { + if(myid==0) UBLOG(logINFO,"Restart step: " << opt); + grid = rp->restart(UbSystem::stringTo<int>(opt)); + rp->reconnect(grid); + + SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0); + grid->accept(forcingVisitor); + + D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); + D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); + grid->accept( setConnsVisitor ); + } + else +{ + //rp->addPostprocessor(pp); + if(myid ==0) + { + UBLOG(logINFO,"Parameters:"); + UBLOG(logINFO, "* Re ="<<Re); + UBLOG(logINFO, "* Ma ="<<Ma); + UBLOG(logINFO, "* uReal ="<<uReal); + UBLOG(logINFO, "* nueReal ="<<nueReal); + UBLOG(logINFO, "* nue ="<<nueLB); + UBLOG(logINFO, "* velocity ="<<uLB); + //UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx); + //UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx); + //UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx); + UBLOG(logINFO, "* dx_base ="<<dx); + UBLOG(logINFO, "* dx_refine ="<<dx/(double)(1<<refineLevel)); + //UBLOG(logINFO, "* nx1/2/3 ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]); + UBLOG(logINFO, "* blocknx1/2/3 ="<<blocknx<<"/"<<blocknx<<"/"<<blocknx); + //UBLOG(logINFO, "* x2Periodic ="<<periodicx2); + //UBLOG(logINFO, "* x3Periodic ="<<periodicx3); + UBLOG(logINFO, "*****************************************"); + UBLOGML(logINFO, "UnitConverter:"<<unitConverter.toString()); + UBLOG(logINFO, "*****************************************"); + UBLOG(logINFO,"number of levels = " << refineLevel+1 ); + UBLOG(logINFO,"numOfThreads = " << numOfThreads ); + UBLOG(logINFO,"Preprozess - start"); + } + + + //inflow + GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_minX1+2.0*dx, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength)); + if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance()); + + //outflow + GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1-2.0*dx, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength)); + if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); + + BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm)); + + double scaleFactorX = 1.2; + double scaleFactorZ = 1.2; + //geo->scale(scaleFactorX, 1.0, scaleFactorZ); + if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo2", WbWriterVtkXmlASCII::getInstance()); + + int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB + D3Q27BoundaryConditionAdapterPtr noSlipBCAdapter(new D3Q27NoSlipBCAdapter(bbOption)); + + Interactor3DPtr geoIntr = D3Q27TriFaceMeshInteractorPtr(new D3Q27TriFaceMeshInteractor(geo, grid, noSlipBCAdapter,Interactor3D::SOLID)); + + //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr)->refineBlockGridToLevel(refineLevel, 0.0, 5.0); + + if (refineLevel > 0) + { + if(myid == 0) UBLOG(logINFO,"Refinement - start"); + //RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel); + //refineHelper.addGbObject(geo, refineLevel); + //refineHelper.refine(); + RefineAroundGbObjectHelper refineHelper(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr), 0.0, 0.5); + refineHelper.refine(); + if(myid == 0) UBLOG(logINFO,"Refinement - end"); + } + + ppblocks->update(0); + ppblocks.reset(); + return; + + //geo->scale(1.0/scaleFactorX, 1.0, 1.0/scaleFactorX); + //geo = GbTriFaceMesh3DPtr(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo")); + if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo3", WbWriterVtkXmlASCII::getInstance()); + + MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads); + grid->accept( metisVisitor ); + + SolidBlocksHelper sd(grid, comm); + + mu::Parser fct; + fct.SetExpr("U"); + fct.DefineConst("U", uLB); + + //inflow + D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST)); + velBCAdapter->setSecondaryBcOption(2); + D3Q27InteractorPtr inflowIntr = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID)); + + //outflow + D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB)); + denBCAdapter->setSecondaryBcOption(0); + D3Q27InteractorPtr outflowIntr = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID)); + + + sd.addInteractor(inflowIntr); + sd.addInteractor(outflowIntr); + sd.addInteractor(geoIntr); + + sd.deleteSolidBlocks(); + + grid->accept( metisVisitor ); + + sd.setTransBlocks(); + + ppblocks->update(0); + ppblocks.reset(); + + //set connectors + D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); + D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); + grid->accept( setConnsVisitor ); + + //domain decomposition for threads + //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); + //grid->accept(pqPartVisitor); + + + unsigned long nob = grid->getNumberOfBlocks(); + int gl = 3; + unsigned long nodb = (blocknx) * (blocknx) * (blocknx); + unsigned long nod = nob * (blocknx) * (blocknx) * (blocknx); + unsigned long nodg = nob * (blocknx+gl) * (blocknx+gl) * (blocknx+gl); + double needMemAll = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4)); + double needMem = needMemAll / double(comm->getNumberOfProcesses()); + + if(myid == 0) + { + UBLOG(logINFO,"Number of blocks = " << nob); + UBLOG(logINFO,"Number of nodes = " << nod); + int minInitLevel = grid->getCoarsestInitializedLevel(); + int maxInitLevel = grid->getFinestInitializedLevel(); + for(int level = minInitLevel; level<=maxInitLevel; level++) + { + int nobl = grid->getNumberOfBlocks(level); + UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl); + UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb); + } + UBLOG(logINFO,"Necessary memory = " << needMemAll << " bytes"); + UBLOG(logINFO,"Necessary memory per process = " << needMem << " bytes"); + UBLOG(logINFO,"Available memory per process = " << availMem << " bytes"); + } + + LBMKernel3DPtr kernel; + kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx, blocknx, blocknx, LBMKernelETD3Q27CCLB::NORMAL)); + + //mu::Parser fctForcingX1; + //fctForcingX1.SetExpr("Fx1"); + //fctForcingX1.DefineConst("Fx1", 9.99685e-7); + + //kernel->setForcingX1(fctForcingX1); + //kernel->setWithForcing(true); + // + BCProcessorPtr bcProc(new D3Q27ETBCProcessor()); + kernel->setBCProcessor(bcProc); + + SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem); + grid->accept(kernelVisitor); + + if (refineLevel > 0) + { + D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor; + grid->accept(undefNodesVisitor); + } + + //UbSchedulerPtr geoSch(new UbScheduler(1)); + //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo( + // new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true)); + //ppgeo->update(0); + //ppgeo.reset(); + + //return; + + //inflow + grid->addAndInitInteractor(inflowIntr); + + //outflow + grid->addAndInitInteractor(outflowIntr); + + //geo + grid->addAndInitInteractor(geoIntr); + + //initialization of distributions + D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB); + initVisitor.setVx1(fct); + initVisitor.setNu(nueLB); + grid->accept(initVisitor); + + //Postrozess + //UbSchedulerPtr geoSch(new UbScheduler(1)); + //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo( + // new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true)); + //ppgeo->update(0); + //ppgeo.reset(); + + { + UbSchedulerPtr geoSch(new UbScheduler(1)); + //D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true); + D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo( + new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true)); + //grid->addObserver(ppgeo); + grid->doPostProcess(0); + //grid->notifyObservers(0); + //grid->removeObserver(ppgeo); + } + + //grid->notifyObservers(0); + + //UbSchedulerPtr stepSch(new UbScheduler(outTime)); + D3Q27MacroscopicQuantitiesPostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv)); + rp->addPostprocessor(pp); + + if(myid == 0) UBLOG(logINFO,"Preprozess - end"); +} + UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100)); + NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm); + + // double outTime = 3.0; + // UbSchedulerPtr stepSch(new UbScheduler(outTime)); + //UbSchedulerPtr stepSch(new UbScheduler()); + //stepSch->addSchedule(10, 100, 1000); + //nodeSch->addSchedule(1000, 1000, 10000); + //nodeSch->addSchedule(10000, 10000, 50000); + //stepSch->addSchedule(100, 100, 1000); + + //UbSchedulerPtr st(new UbScheduler(100,50,1000)); + //UbSchedulerPtr rs(new UbScheduler(3)); + //AverageValuesPostprocessor ap(grid, pathname + "/av/av", WbWriterVtkXmlASCII::getInstance(), stepSch, rs, comm); + + //D3Q27ShearStressPostprocessor shs(grid,pathname + "/shs/shs", WbWriterVtkXmlASCII::getInstance(), stepSch, rs, comm); + //shs.addInteractor(boost::dynamic_pointer_cast<D3Q27Interactor>(addWallZminInt)); + + //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm); + + UbSchedulerPtr visSch(new UbScheduler(1)); + //UbSchedulerPtr visSch(stepSch); + double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0; + + //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl; + //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl; + //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl; + + CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch)); + if(myid == 0) UBLOG(logINFO,"Simulation-start"); + calculation->calculate(); + if(myid == 0) UBLOG(logINFO,"Simulation-end"); + } + catch(std::exception& e) + { + cerr << e.what() << endl << flush; + } + catch(std::string& s) + { + cerr << s << endl; + } + catch(...) + { + cerr << "unknown exception" << endl; + } + +} + +int main(int argc, char* argv[]) +{ + + if ( argv != NULL ) + { + if (argc > 1) + { + setup(argv[1], argv[2]); + } + else + { + cout << "Configuration file must be set!: " << argv[0] << " <config file>" << endl << std::flush; + } + } + + return 0; +} + diff --git a/source/Applications/pChannel/configBombadilpChannel.cfg b/source/Applications/pChannel/configBombadilpChannel.cfg index 6ad0619b9..548e8ca59 100644 --- a/source/Applications/pChannel/configBombadilpChannel.cfg +++ b/source/Applications/pChannel/configBombadilpChannel.cfg @@ -2,9 +2,9 @@ #Simulation parameters for porous channel # -pathname = d:/temp/pChannel +pathname = d:/temp/pChannel5 pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/PA80-110 -numOfThreads = 1 +numOfThreads = 4 availMem = 4e9 logToFile = false @@ -84,13 +84,13 @@ Re = 51000 #real velocity is 54.95 m/s u_LB = 0.1 -restartStep = 300 -restartStepStart=300 +restartStep = 3 +restartStepStart = 3 -timeAvStart = 100 -timeAvStop = 300 +timeAvStart = 2 +timeAvStop = 5 endTime = 5 -outTime = 1 +outTime = 1000 diff --git a/source/Applications/pChannel/pChannel.cpp b/source/Applications/pChannel/pChannel.cpp index 2e202ca04..03b985410 100644 --- a/source/Applications/pChannel/pChannel.cpp +++ b/source/Applications/pChannel/pChannel.cpp @@ -372,9 +372,9 @@ void run(string configname) grid->accept(bcVisitor); mu::Parser inflowProfile; - inflowProfile.SetExpr("x3 < h ? 0.0 : uLB+1*x1-1*x2"); + //inflowProfile.SetExpr("x3 < h ? 0.0 : uLB+1*x1-1*x2"); //inflowProfile.SetExpr("uLB+1*x1-1*x2"); - //inflowProfile.SetExpr("uLB"); + inflowProfile.SetExpr("uLB"); inflowProfile.DefineConst("uLB", u_LB); inflowProfile.DefineConst("h", pmL[2]); @@ -403,7 +403,7 @@ void run(string configname) coord[0] = g_minX1; coord[1] = g_minX2; - coord[2] = g_minX3; + coord[2] = g_minX3 + pmL[2]; coord[3] = g_maxX1; coord[4] = g_maxX2; coord[5] = g_maxX3; @@ -490,7 +490,7 @@ void run(string configname) UbSchedulerPtr AdjForcSch(new UbScheduler()); - AdjForcSch->addSchedule(100, 0, 10000000); + AdjForcSch->addSchedule(1, 0, 10000000); D3Q27IntegrateValuesHelperPtr intValHelp(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5])); @@ -517,10 +517,26 @@ void run(string configname) // Utilities::ChangeRandomQs(intValHelp2); //} - + std::vector<double> levelCoords; + std::vector<int> levels; + std::vector<double> bounds; + bounds.push_back(0); + bounds.push_back(0); + bounds.push_back(0); + bounds.push_back(0.004); + bounds.push_back(0.002); + bounds.push_back(0.003); + levels.push_back(1); + levels.push_back(0); + levels.push_back(1); + levelCoords.push_back(0); + levelCoords.push_back(0.0016); + levelCoords.push_back(0.0024); + levelCoords.push_back(0.003); UbSchedulerPtr tavSch(new UbScheduler(1, timeAvStart, timeAvStop)); TimeAveragedValuesCoProcessorPtr tav(new TimeAveragedValuesCoProcessor(grid, pathname, WbWriterVtkXmlBinary::getInstance(), tavSch, - TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations | TimeAveragedValuesCoProcessor::Triplecorrelations)); + TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations | TimeAveragedValuesCoProcessor::Triplecorrelations, + levels, levelCoords, bounds)); //UbSchedulerPtr catalystSch(new UbScheduler(1)); //InSituCatalystCoProcessor catalyst(grid, catalystSch, "pchannel.py"); diff --git a/source/Applications/sphere/sphere.cpp b/source/Applications/sphere/sphere.cpp index 85e33ed15..d610ad3d5 100644 --- a/source/Applications/sphere/sphere.cpp +++ b/source/Applications/sphere/sphere.cpp @@ -56,9 +56,9 @@ void run(string configname) const int blocknx2 = 8; const int blocknx3 = 8; - const int gridNx1 = 8;//18; - const int gridNx2 = 8;// 11; - const int gridNx3 = 8;// 11; + const int gridNx1 = 4;//18; + const int gridNx2 = 4;// 11; + const int gridNx3 = 4;// 11; //const int blocknx1 = 40; //const int blocknx2 = 40; @@ -224,13 +224,13 @@ void run(string configname) //set connectors D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); - //D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); - //grid->accept(setConnsVisitor); - - Block3DConnectorFactoryPtr factory(new Block3DConnectorFactory()); - ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); + D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); + //Block3DConnectorFactoryPtr factory(new Block3DConnectorFactory()); + //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); + //grid->accept(setConnsVisitor); + ppblocks->process(0); ppblocks.reset(); diff --git a/source/CMake/cmake_config_files/FRY29.config.cmake b/source/CMake/cmake_config_files/FRY29.config.cmake new file mode 100644 index 000000000..27b63654b --- /dev/null +++ b/source/CMake/cmake_config_files/FRY29.config.cmake @@ -0,0 +1,29 @@ +LIST(APPEND CAB_ADDTIONAL_COMPILER_FLAGS -D__unix__) +LIST(APPEND CAB_ADDTIONAL_COMPILER_FLAGS -D__UNIX__) + +######################################################################################## +## BOOST ALLGMEINGUELTIG ## +######################################################################################## +SET(BOOST_VERSION "1.60.0" CACHE STRING "std: 1.60.0") + + +SET(USE_MPI_CXX_SYNTAX OFF) +SET(BOOST_INCLUDEDIR "/home/irmb/kutscher/boost_1_60_0/boost") +SET(BOOST_LIBRARYDIR "/home/irmb/kutscher/boost_1_60_0/stage/lib") +SET(Boost_INCLUDE_DIR "/home/irmb/kutscher/boost_1_60_0") + +IF(BOOST_VERSION AND NOT BOOST_INCLUDEDIR) + MESSAGE("${BOOST_VERSION} not found on ${CAB_MACHINE} for specified compiler") +ENDIF() + +################################################################################# +# METIS +################################################################################# +IF(${USE_METIS}) + SET(METIS_INCLUDEDIR "/home/irmb/kutscher/metis-5.1.0/include") + SET(METIS_DEBUG_LIBRARY "/home/irmb/kutscher/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") + SET(METIS_RELEASE_LIBRARY "/home/irmb/kutscher/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") +ENDIF() + + + diff --git a/source/CMake/compilerflags/icc160.cmake b/source/CMake/compilerflags/icc160.cmake new file mode 100644 index 000000000..ca0e66a75 --- /dev/null +++ b/source/CMake/compilerflags/icc160.cmake @@ -0,0 +1,39 @@ +############################################################################################################### +## +## intel160 +## +############################################################################################################### + +MACRO(SET_COMPILER_SPECIFIC_FLAGS_INTERN build_type use64BitOptions) + + #~ IF( ${use64BitOptions} ) + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D__amd64" ) + #~ ENDIF() + + #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O") + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd654") + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd1125") #virtual function override intended + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd1224") #warning directive: This file includes at least one deprecated or antiquated header + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd377") #class "std::auto_ptr<RCF::I_ClientTransport>" has no suitable copy constructor + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd327") #class "std::auto_ptr<RCF::I_ClientTransport>" has no suitable copy constructor + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd327") #class "std::auto_ptr<RCF::I_ClientTransport>" has no suitable copy constructor +#~ + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-wd266") #function "__GKfree" declared implicitly + #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-xHOST -O3 -ip -ipo -fno-alias -mcmodel=medium -qopt-streaming-stores=always") + + LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-xHOST -O3 -ip -fno-alias -mcmodel=medium -qopt-streaming-stores=always") + ############################################################################################################### + ## OpenMP support + ############################################################################################################### + IF(USE_OPENMP) + LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-qopenmp") + ENDIF() + + + ############################################################################################################### + ## mt support + ############################################################################################################### + #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") + #LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-pthread") + +ENDMACRO(SET_COMPILER_SPECIFIC_FLAGS_INTERN build_type use64BitOptions) diff --git a/source/VirtualFluids.h b/source/VirtualFluids.h index 3df635fb9..ff43ee1e5 100644 --- a/source/VirtualFluids.h +++ b/source/VirtualFluids.h @@ -118,16 +118,9 @@ #include <Connectors/Block3DConnector.h> #include <Connectors/D3Q27ETCFOffVectorConnector.h> -#include <Connectors/D3Q27ETCFVectorConnector.h> -#include <Connectors/D3Q27ETDirectConnector.h> -#include <Connectors/D3Q27ETDirectConnector2.h> #include <Connectors/D3Q27ETFCOffVectorConnector.h> -#include <Connectors/D3Q27ETFCVectorConnector.h> #include <Connectors/D3Q27ETFullDirectConnector.h> -#include <Connectors/D3Q27ETFullDirectConnector2.h> #include <Connectors/D3Q27ETFullVectorConnector.h> -#include <Connectors/D3Q27ETVectorConnector.h> -#include <Connectors/D3Q27ETWithInvDirectConnector.h> #include <Connectors/LocalBlock3DConnector.h> #include <Connectors/RemoteBlock3DConnector.h> #include <Connectors/CoarseToFineBlock3DConnector.h> diff --git a/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp b/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp index 2c71d261d..a233a680b 100644 --- a/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp +++ b/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp @@ -19,8 +19,8 @@ using namespace std; AdjustForcingCoProcessor::AdjustForcingCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& path, D3Q27IntegrateValuesHelperPtr integrateValues, - LBMReal vTarged, - LBMReal forcing, + double vTarged, + double forcing, CommunicatorPtr comm) : CoProcessor(grid, s), @@ -28,7 +28,6 @@ AdjustForcingCoProcessor::AdjustForcingCoProcessor(Grid3DPtr grid, UbSchedulerPt integrateValues(integrateValues), comm(comm), vTarged(vTarged), - vPreviousStep(0.0), forcing(forcing) { cnodes = integrateValues->getCNodes(); @@ -71,41 +70,44 @@ void AdjustForcingCoProcessor::collectData(double step) double cellsVolume = integrateValues->getCellsVolume(); double vx1 = integrateValues->getVx1(); - double vx1average = (vx1/cellsVolume); - - - double newForcing = forcing; - - if (!((vPreviousStep>(vx1average) && (vx1average)>vTarged) || (vPreviousStep<(vx1average) && ((vx1average)<vTarged)))) + double vx1Average = (vx1/cellsVolume); + + //double C = 5.0; //0.7 //P; //free parameter [0.1, 1] + //double factor = 1.0 - ((vx1average - vTarged) / vTarged)*C; + + double factor = vTarged / vx1Average; + //forcing *= factor; + + //forcing = UbMath::max(forcing, 0.0); + //forcing = UbMath::min(forcing, 5e-3); + + if (vTarged > vx1Average) { - double C = 1.0; //0.7 //P; //free parameter [0.1, 1] - newForcing = forcing*((1-((vx1average-vTarged)/vTarged)*C)); - newForcing=UbMath::max(newForcing,0.0); - newForcing=UbMath::min(newForcing,5e-3); + forcing = fabs(factor*forcing); + } + else + { + forcing = -fabs(factor*forcing); } - vPreviousStep=vx1average; - - forcing = newForcing; - mu::Parser fctForcingX1, fctForcingX2, fctForcingX3; fctForcingX1.SetExpr("Fx1"); - fctForcingX1.DefineConst("Fx1", newForcing); + fctForcingX1.DefineConst("Fx1", forcing); fctForcingX2.SetExpr("0.0"); fctForcingX3.SetExpr("0.0"); - //SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3); - //grid->accept(forcingVisitor); - - BOOST_FOREACH(CalcNodes cn, cnodes) - { - LBMKernel3DPtr kernel = cn.block->getKernel(); - if (kernel) - { - kernel->setForcingX1(fctForcingX1); - kernel->setWithForcing(true); - } - - } + SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3); + grid->accept(forcingVisitor); + + //BOOST_FOREACH(CalcNodes cn, cnodes) + //{ + // LBMKernel3DPtr kernel = cn.block->getKernel(); + // if (kernel) + // { + // kernel->setForcingX1(fctForcingX1); + // kernel->setWithForcing(true); + // } + // + //} if (comm->getProcessID() == comm->getRoot()) { @@ -122,7 +124,7 @@ void AdjustForcingCoProcessor::collectData(double step) if (!ostr) throw UbException(UB_EXARGS, "couldn't open file "+fname); } int istep = static_cast<int>(step); - ostr << istep << ";" << cellsVolume << ";" << vx1average << "; " << 1-((vx1average-vTarged)/vTarged) << "; " << forcing << "\n"; + ostr << istep << ";" << cellsVolume << ";" << vx1Average << "; " << factor << "; " << forcing << "\n"; ostr.close(); } } diff --git a/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h b/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h index ba5c72d72..c7e99ecf4 100644 --- a/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h +++ b/source/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h @@ -19,7 +19,7 @@ public: AdjustForcingCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& path, D3Q27IntegrateValuesHelperPtr integrateValues, - LBMReal vTarged, LBMReal forcing, CommunicatorPtr comm); + double vTarged, double forcing, CommunicatorPtr comm); virtual ~AdjustForcingCoProcessor(); //!< calls collect PostprocessData void process(double step); @@ -30,7 +30,6 @@ protected: void collectData(double step); CommunicatorPtr comm; private: - double vPreviousStep; //!< velocity at previous update step. double vTarged; //!< target velocity. double forcing; //!< forcing at previous update step. std::vector<CalcNodes> cnodes; diff --git a/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp b/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp index 391385460..910ec8721 100644 --- a/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp +++ b/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp @@ -24,15 +24,33 @@ TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(Grid3DPtr grid, con writer(writer), options(options) { - gridRank = grid->getRank(); + init(s); + volumeAveraging = false; +} +////////////////////////////////////////////////////////////////////////// +TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(Grid3DPtr grid, const std::string& path, WbWriter* const writer, UbSchedulerPtr s, int options, + std::vector<int> levels, std::vector<double>& levelCoords, std::vector<double>& bounds) + : CoProcessor(grid, s), + path(path), + writer(writer), + options(options), + levels(levels), + levelCoords(levelCoords), + bounds(bounds) +{ + init(s); + volumeAveraging = true; +} +////////////////////////////////////////////////////////////////////////// +void TimeAveragedValuesCoProcessor::init(UbSchedulerPtr s) +{ + gridRank = grid->getRank(); minInitLevel = this->grid->getCoarsestInitializedLevel(); maxInitLevel = this->grid->getFinestInitializedLevel(); - counter = 0; + blockVector.resize(maxInitLevel + 1); - blockVector.resize(maxInitLevel+1); - - for (int level = minInitLevel; level<=maxInitLevel; level++) + for (int level = minInitLevel; level <= maxInitLevel; level++) { grid->getBlocks(level, gridRank, true, blockVector[level]); @@ -49,19 +67,19 @@ TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(Grid3DPtr grid, con UbTupleInt3 nx = grid->getBlockNX(); if ((options&Velocity) == Velocity) { - AverageVelocityArray3DPtr av = AverageVelocityArray3DPtr(new AverageVelocityArray3D(3, val<1>(nx)+1, val<2>(nx)+1, val<3>(nx)+1, 0.0)); + AverageVelocityArray3DPtr av = AverageVelocityArray3DPtr(new AverageVelocityArray3D(3, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); block->getKernel()->getDataSet()->setAverageVelocity(av); } if ((options&Fluctuations) == Fluctuations) { - AverageFluctuationsArray3DPtr af = AverageFluctuationsArray3DPtr(new AverageFluctuationsArray3D(6, val<1>(nx)+1, val<2>(nx)+1, val<3>(nx)+1, 0.0)); + AverageFluctuationsArray3DPtr af = AverageFluctuationsArray3DPtr(new AverageFluctuationsArray3D(6, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); block->getKernel()->getDataSet()->setAverageFluctuations(af); } if ((options&Triplecorrelations) == Triplecorrelations) { - AverageTriplecorrelationsArray3DPtr at = AverageTriplecorrelationsArray3DPtr(new AverageTriplecorrelationsArray3D(10, val<1>(nx)+1, val<2>(nx)+1, val<3>(nx)+1, 0.0)); + AverageTriplecorrelationsArray3DPtr at = AverageTriplecorrelationsArray3DPtr(new AverageTriplecorrelationsArray3D(10, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); block->getKernel()->getDataSet()->setAverageTriplecorrelations(at); } @@ -69,43 +87,65 @@ TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(Grid3DPtr grid, con } } - breakStep = scheduler->getMaxEnd() - scheduler->getMinBegin() + 1; + //breakStep = scheduler->getMaxEnd() - scheduler->getMinBegin()+1; //UBLOG(logINFO, "breakSteps = " << breakStep); - breakStep = breakStep * (double)(1 << maxInitLevel) + breakStep; + //breakStep = breakStep * (double)(1 << maxInitLevel); + //breakStep = scheduler->getMaxEnd()*(double)(1 << maxInitLevel); //UBLOG(logINFO, "breakSteps = " << breakStep); iMinX1 = 1; iMinX2 = 1; iMinX3 = 1; + + lcounter = 0; + + levelFactor = 1 << maxInitLevel; + minFineStep = (int)scheduler->getMinBegin() * levelFactor; + maxFineStep = (int)scheduler->getMaxEnd() * levelFactor + levelFactor - 1; + numberOfFineSteps = (maxFineStep - minFineStep) + 1; } ////////////////////////////////////////////////////////////////////////// void TimeAveragedValuesCoProcessor::process(double step) { + fineStep = (int)step * levelFactor + lcounter; + if (scheduler->isDue(step)) { + //DEBUG///////////////////// + UBLOG(logINFO, "step = " << step << ", lcounter = " << lcounter << ", fineStep = " << fineStep << ", maxFineStep = " << maxFineStep << ", numberOfFineSteps = " << numberOfFineSteps); + //////////////////////////// + calculateSubtotal(); - counter++; - //UBLOG(logINFO, "step = " << step<<", counter = " << counter); - } + if (fineStep == maxFineStep) + { + calculateAverageValues((double)numberOfFineSteps); + collectData(step); + if (volumeAveraging) + { + volumeAverage(step); + } + clearData(); + } - //if (step == scheduler->getMaxEnd()) - if (counter == (int)breakStep) - { - calculateAverageValues(breakStep); - collectData(step); - clearData(); - counter = 0; + if (lcounter == levelFactor-1) + { + lcounter = 0; + } + else + { + lcounter++; + } } - UBLOG(logDEBUG3, "AverageValues2CoProcessor::update:" << step); + UBLOG(logDEBUG3, "AverageValuesCoProcessor::update:" << step); } ////////////////////////////////////////////////////////////////////////// void TimeAveragedValuesCoProcessor::collectData(double step) { int istep = int(step); - for (int level = minInitLevel; level<=maxInitLevel; level++) + for (int level = minInitLevel; level <= maxInitLevel; level++) { BOOST_FOREACH(Block3DPtr block, blockVector[level]) { @@ -117,13 +157,13 @@ void TimeAveragedValuesCoProcessor::collectData(double step) } string pfilePath, partPath, subfolder, cfilePath; - subfolder = "tav"+UbSystem::toString(istep); - pfilePath = path+"/tav/"+subfolder; - partPath = pfilePath+"/tav"+UbSystem::toString(gridRank)+ "_" + UbSystem::toString(istep); + subfolder = "tav" + UbSystem::toString(istep); + pfilePath = path + "/tav/" + subfolder; + partPath = pfilePath + "/tav" + UbSystem::toString(gridRank) + "_" + UbSystem::toString(istep); string partName = writer->writeOctsWithNodeData(partPath, nodes, cells, datanames, data); - size_t found=partName.find_last_of("/"); - string piece = partName.substr(found+1); + size_t found = partName.find_last_of("/"); + string piece = partName.substr(found + 1); piece = subfolder + "/" + piece; vector<string> cellDataNames; @@ -148,10 +188,10 @@ void TimeAveragedValuesCoProcessor::clearData() ////////////////////////////////////////////////////////////////////////// void TimeAveragedValuesCoProcessor::addData(const Block3DPtr block) { - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); + UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); + UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); + double dx = grid->getDeltaX(block); //Diese Daten werden geschrieben: datanames.resize(0); @@ -187,7 +227,7 @@ void TimeAveragedValuesCoProcessor::addData(const Block3DPtr block) datanames.push_back("taVxyz"); } - + //datanames.push_back("AvP"); //datanames.push_back("AvPrms"); @@ -224,19 +264,19 @@ void TimeAveragedValuesCoProcessor::addData(const Block3DPtr block) int nr = (int)nodes.size(); - for (int ix3=minX3; ix3<=maxX3; ix3++) + for (int ix3 = minX3; ix3 <= maxX3; ix3++) { - for (int ix2=minX2; ix2<=maxX2; ix2++) + for (int ix2 = minX2; ix2 <= maxX2; ix2++) { - for (int ix1=minX1; ix1<=maxX1; ix1++) + for (int ix1 = minX1; ix1 <= maxX1; ix1++) { if (!bcArray.isUndefined(ix1, ix2, ix3) && !bcArray.isSolid(ix1, ix2, ix3)) { int index = 0; nodeNumbers(ix1, ix2, ix3) = nr++; - nodes.push_back(makeUbTuple(float(val<1>(org) -val<1>(nodeOffset) +ix1*dx), - float(val<2>(org) -val<2>(nodeOffset) +ix2*dx), - float(val<3>(org) -val<3>(nodeOffset) +ix3*dx))); + nodes.push_back(makeUbTuple(float(val<1>(org) - val<1>(nodeOffset) + ix1*dx), + float(val<2>(org) - val<2>(nodeOffset) + ix2*dx), + float(val<3>(org) - val<3>(nodeOffset) + ix3*dx))); if ((options&Velocity) == Velocity) { @@ -282,20 +322,20 @@ void TimeAveragedValuesCoProcessor::addData(const Block3DPtr block) maxX3 -= 1; //cell vector erstellen - for (int ix3=minX3; ix3<=maxX3; ix3++) + for (int ix3 = minX3; ix3 <= maxX3; ix3++) { - for (int ix2=minX2; ix2<=maxX2; ix2++) + for (int ix2 = minX2; ix2 <= maxX2; ix2++) { - for (int ix1=minX1; ix1<=maxX1; ix1++) + for (int ix1 = minX1; ix1 <= maxX1; ix1++) { - if ((SWB=nodeNumbers(ix1, ix2, ix3)) >= 0 - && (SEB=nodeNumbers(ix1+1, ix2, ix3)) >= 0 - && (NEB=nodeNumbers(ix1+1, ix2+1, ix3)) >= 0 - && (NWB=nodeNumbers(ix1, ix2+1, ix3)) >= 0 - && (SWT=nodeNumbers(ix1, ix2, ix3+1)) >= 0 - && (SET=nodeNumbers(ix1+1, ix2, ix3+1)) >= 0 - && (NET=nodeNumbers(ix1+1, ix2+1, ix3+1)) >= 0 - && (NWT=nodeNumbers(ix1, ix2+1, ix3+1)) >= 0) + if ((SWB = nodeNumbers(ix1, ix2, ix3)) >= 0 + && (SEB = nodeNumbers(ix1 + 1, ix2, ix3)) >= 0 + && (NEB = nodeNumbers(ix1 + 1, ix2 + 1, ix3)) >= 0 + && (NWB = nodeNumbers(ix1, ix2 + 1, ix3)) >= 0 + && (SWT = nodeNumbers(ix1, ix2, ix3 + 1)) >= 0 + && (SET = nodeNumbers(ix1 + 1, ix2, ix3 + 1)) >= 0 + && (NET = nodeNumbers(ix1 + 1, ix2 + 1, ix3 + 1)) >= 0 + && (NWT = nodeNumbers(ix1, ix2 + 1, ix3 + 1)) >= 0) { cells.push_back(makeUbTuple(SWB, SEB, NEB, NWB, SWT, SET, NET, NWT)); } @@ -306,14 +346,13 @@ void TimeAveragedValuesCoProcessor::addData(const Block3DPtr block) ////////////////////////////////////////////////////////////////////////// void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps) { - timeSteps = breakStep; - for (int level = minInitLevel; level<=maxInitLevel; level++) + for (int level = minInitLevel; level <= maxInitLevel; level++) { int i; -//#ifdef _OPENMP -// #pragma omp parallel for -//#endif - //BOOST_FOREACH(Block3DPtr block, blockVector[level]) + //#ifdef _OPENMP + // #pragma omp parallel for + //#endif + //BOOST_FOREACH(Block3DPtr block, blockVector[level]) for (i = 0; i < blockVector[level].size(); i++) { Block3DPtr block = blockVector[level][i]; @@ -340,11 +379,11 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps) LBMReal ux, uy, uz, uxx, uzz, uyy, uxy, uxz, uyz; - for (int ix3=minX3; ix3<=maxX3; ix3++) + for (int ix3 = minX3; ix3 <= maxX3; ix3++) { - for (int ix2=minX2; ix2<=maxX2; ix2++) + for (int ix2 = minX2; ix2 <= maxX2; ix2++) { - for (int ix1=minX1; ix1<=maxX1; ix1++) + for (int ix1 = minX1; ix1 <= maxX1; ix1++) { if (!bcArray.isUndefined(ix1, ix2, ix3) && !bcArray.isSolid(ix1, ix2, ix3)) { @@ -355,9 +394,9 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps) //mean velocity if ((options&Velocity) == Velocity) { - ux = (*av)(Vx, ix1, ix2, ix3)/timeSteps; - uy = (*av)(Vy, ix1, ix2, ix3)/timeSteps; - uz = (*av)(Vz, ix1, ix2, ix3)/timeSteps; + ux = (*av)(Vx, ix1, ix2, ix3) / timeSteps; + uy = (*av)(Vy, ix1, ix2, ix3) / timeSteps; + uz = (*av)(Vz, ix1, ix2, ix3) / timeSteps; (*av)(Vx, ix1, ix2, ix3) = ux; (*av)(Vy, ix1, ix2, ix3) = uy; @@ -367,12 +406,12 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps) //fluctuations if ((options&Fluctuations) == Fluctuations) { - uxx = (*af)(Vxx, ix1, ix2, ix3)/timeSteps; - uyy = (*af)(Vyy, ix1, ix2, ix3)/timeSteps; - uzz = (*af)(Vzz, ix1, ix2, ix3)/timeSteps; - uxy = (*af)(Vxy, ix1, ix2, ix3)/timeSteps; - uxz = (*af)(Vxz, ix1, ix2, ix3)/timeSteps; - uyz = (*af)(Vyz, ix1, ix2, ix3)/timeSteps; + uxx = (*af)(Vxx, ix1, ix2, ix3) / timeSteps; + uyy = (*af)(Vyy, ix1, ix2, ix3) / timeSteps; + uzz = (*af)(Vzz, ix1, ix2, ix3) / timeSteps; + uxy = (*af)(Vxy, ix1, ix2, ix3) / timeSteps; + uxz = (*af)(Vxz, ix1, ix2, ix3) / timeSteps; + uyz = (*af)(Vyz, ix1, ix2, ix3) / timeSteps; (*af)(Vxx, ix1, ix2, ix3) = uxx - ux*ux; (*af)(Vyy, ix1, ix2, ix3) = uyy - uy*uy; @@ -385,16 +424,16 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps) if ((options&Triplecorrelations) == Triplecorrelations) { //triple-correlations - (*at)(Vxxx, ix1, ix2, ix3) = (*at)(Vxxx, ix1, ix2, ix3)/timeSteps - 3*uxx*ux + 2*ux*ux*ux; - (*at)(Vxxy, ix1, ix2, ix3) = (*at)(Vxxy, ix1, ix2, ix3)/timeSteps - 2*uxy*ux - uxx*uy + 2*ux*ux*uy; - (*at)(Vxxz, ix1, ix2, ix3) = (*at)(Vxxz, ix1, ix2, ix3)/timeSteps - 2*uxz*ux - uxx*uz + 2*ux*ux*uz; - (*at)(Vyyy, ix1, ix2, ix3) = (*at)(Vyyy, ix1, ix2, ix3)/timeSteps - 3*uyy*uy + 2*uy*uy*uy; - (*at)(Vyyx, ix1, ix2, ix3) = (*at)(Vyyx, ix1, ix2, ix3)/timeSteps - 2*uxy*uy - uyy*ux + 2*uy*uy*ux; - (*at)(Vyyz, ix1, ix2, ix3) = (*at)(Vyyz, ix1, ix2, ix3)/timeSteps - 2*uyz*uy - uyy*uz + 2*uy*uy*uz; - (*at)(Vzzz, ix1, ix2, ix3) = (*at)(Vzzz, ix1, ix2, ix3)/timeSteps - 3*uzz*uz + 2*uz*uz*uz; - (*at)(Vzzx, ix1, ix2, ix3) = (*at)(Vzzx, ix1, ix2, ix3)/timeSteps - 2*uxz*uz - uzz*ux + 2*uz*uz*ux; - (*at)(Vzzy, ix1, ix2, ix3) = (*at)(Vzzy, ix1, ix2, ix3)/timeSteps - 2*uyz*uz - uzz*uy + 2*uz*uz*uy; - (*at)(Vxyz, ix1, ix2, ix3) = (*at)(Vxyz, ix1, ix2, ix3)/timeSteps - uxy*uz - uxz*uy - uyz*ux + 2*ux*uy*uz; + (*at)(Vxxx, ix1, ix2, ix3) = (*at)(Vxxx, ix1, ix2, ix3) / timeSteps - 3 * uxx*ux + 2 * ux*ux*ux; + (*at)(Vxxy, ix1, ix2, ix3) = (*at)(Vxxy, ix1, ix2, ix3) / timeSteps - 2 * uxy*ux - uxx*uy + 2 * ux*ux*uy; + (*at)(Vxxz, ix1, ix2, ix3) = (*at)(Vxxz, ix1, ix2, ix3) / timeSteps - 2 * uxz*ux - uxx*uz + 2 * ux*ux*uz; + (*at)(Vyyy, ix1, ix2, ix3) = (*at)(Vyyy, ix1, ix2, ix3) / timeSteps - 3 * uyy*uy + 2 * uy*uy*uy; + (*at)(Vyyx, ix1, ix2, ix3) = (*at)(Vyyx, ix1, ix2, ix3) / timeSteps - 2 * uxy*uy - uyy*ux + 2 * uy*uy*ux; + (*at)(Vyyz, ix1, ix2, ix3) = (*at)(Vyyz, ix1, ix2, ix3) / timeSteps - 2 * uyz*uy - uyy*uz + 2 * uy*uy*uz; + (*at)(Vzzz, ix1, ix2, ix3) = (*at)(Vzzz, ix1, ix2, ix3) / timeSteps - 3 * uzz*uz + 2 * uz*uz*uz; + (*at)(Vzzx, ix1, ix2, ix3) = (*at)(Vzzx, ix1, ix2, ix3) / timeSteps - 2 * uxz*uz - uzz*ux + 2 * uz*uz*ux; + (*at)(Vzzy, ix1, ix2, ix3) = (*at)(Vzzy, ix1, ix2, ix3) / timeSteps - 2 * uyz*uz - uzz*uy + 2 * uz*uz*uy; + (*at)(Vxyz, ix1, ix2, ix3) = (*at)(Vxyz, ix1, ix2, ix3) / timeSteps - uxy*uz - uxz*uy - uyz*ux + 2 * ux*uy*uz; } ////////////////////////////////////////////////////////////////////////// } @@ -426,8 +465,8 @@ void TimeAveragedValuesCoProcessor::calculateSubtotal() #ifdef _OPENMP #pragma omp parallel private (f) #endif - { - for (int level = minInitLevel; level<=maxInitLevel; level++) + { + for (int level = minInitLevel; level <= maxInitLevel; level++) { int i; #ifdef _OPENMP @@ -458,11 +497,11 @@ void TimeAveragedValuesCoProcessor::calculateSubtotal() maxX2 -= 2; maxX3 -= 2; - for (int ix3=minX3; ix3<=maxX3; ix3++) + for (int ix3 = minX3; ix3 <= maxX3; ix3++) { - for (int ix2=minX2; ix2<=maxX2; ix2++) + for (int ix2 = minX2; ix2 <= maxX2; ix2++) { - for (int ix1=minX1; ix1<=maxX1; ix1++) + for (int ix1 = minX1; ix1 <= maxX1; ix1++) { if (!bcArray.isUndefined(ix1, ix2, ix3) && !bcArray.isSolid(ix1, ix2, ix3)) { @@ -524,5 +563,75 @@ void TimeAveragedValuesCoProcessor::calculateSubtotal() } } } +////////////////////////////////////////////////////////////////////////// +void TimeAveragedValuesCoProcessor::volumeAverage(double step) +{ + int istep = int(step); + string fname = path + "/tav/" + "tav" + UbSystem::toString(istep) + ".csv"; + + std::ofstream ostr; + ostr.open(fname.c_str(), std::ios_base::out); + if (!ostr) + { + ostr.clear(); + string path = UbSystem::getPathFromString(fname); + if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out); } + if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname); + } + ostr << "z;Vx;Vy;Vz;Vxx;Vyy;Vzz;Vxy;Vxz;Vyz;Vxxx;Vxxy;Vxxz;Vyyy;Vyyx;Vyyz;Vzzz;Vzzx;Vzzy;Vxyz\n"; + + CommunicatorPtr comm = Communicator::getInstance(); + int size = (int)levels.size(); + + for (int i = 0; i < size; i++) + { + int level = levels[i]; + double dx = grid->getDeltaX(level); + double start = levelCoords[i]; + double stop = levelCoords[i + 1] - dx*0.5; + + for (double j = start; j <= stop; j += dx) + { + D3Q27IntegrateValuesHelper intValHelp(grid, comm, + bounds[0], bounds[1], j, + bounds[3], bounds[4], j + dx, level); + + intValHelp.calculateAV2(); + + double numberOfFluidsNodes = intValHelp.getNumberOfFluidsNodes(); + if (numberOfFluidsNodes > 0) + { + double Vx = intValHelp.getAVx() / numberOfFluidsNodes; + double Vy = intValHelp.getAVy() / numberOfFluidsNodes; + double Vz = intValHelp.getAVz() / numberOfFluidsNodes; + + double Vxx = intValHelp.getAVxx() / numberOfFluidsNodes; + double Vyy = intValHelp.getAVyy() / numberOfFluidsNodes; + double Vzz = intValHelp.getAVzz() / numberOfFluidsNodes; + double Vxy = intValHelp.getAVxy() / numberOfFluidsNodes; + double Vxz = intValHelp.getAVxz() / numberOfFluidsNodes; + double Vyz = intValHelp.getAVyz() / numberOfFluidsNodes; + + double Vxxx = intValHelp.getAVxxx() / numberOfFluidsNodes; + double Vxxy = intValHelp.getAVxxy() / numberOfFluidsNodes; + double Vxxz = intValHelp.getAVxxz() / numberOfFluidsNodes; + double Vyyy = intValHelp.getAVyyy() / numberOfFluidsNodes; + double Vyyx = intValHelp.getAVyyx() / numberOfFluidsNodes; + double Vyyz = intValHelp.getAVyyz() / numberOfFluidsNodes; + double Vzzz = intValHelp.getAVzzz() / numberOfFluidsNodes; + double Vzzx = intValHelp.getAVzzx() / numberOfFluidsNodes; + double Vzzy = intValHelp.getAVzzy() / numberOfFluidsNodes; + double Vxyz = intValHelp.getAVxyz() / numberOfFluidsNodes; + + + ostr << j + 0.5*dx << ";" << Vx << ";" << Vy << ";" << Vz << ";"; + ostr << Vxx << ";" << Vyy << ";" << Vzz << ";" << Vxy << ";" << Vxz << ";" << Vyz << ";"; + ostr << Vxxx << ";" << Vxxy << ";" << Vxxz << ";" << Vyyy << ";" << Vyyx << ";" << Vyyz << ";" << Vzzz << ";" << Vzzx << ";" << Vzzy << ";" << Vxyz << "\n"; + } + } + } + ostr.close(); +} + diff --git a/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h b/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h index 45445eccc..1bfbc7bd1 100644 --- a/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h +++ b/source/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h @@ -38,10 +38,11 @@ public: TimeAveragedValuesCoProcessor(); TimeAveragedValuesCoProcessor(Grid3DPtr grid, const std::string& path, WbWriter* const writer, UbSchedulerPtr s, int options); + TimeAveragedValuesCoProcessor(Grid3DPtr grid, const std::string& path, WbWriter* const writer, + UbSchedulerPtr s, int options, std::vector<int> levels, std::vector<double>& levelCoords, std::vector<double>& bounds); //! Make update void process(double step); - //! Resets averaged velocity and RMS-values according to ResetSceduler - void reset(double step); + void addLevelCoordinate(double c); protected: //! Prepare data and write in .vtk file void collectData(double step); @@ -52,6 +53,8 @@ protected: void calculateAverageValues(double timeStep); //! Computes subtotal of velocity , fluctuations and triple correlations void calculateSubtotal(); + void init(UbSchedulerPtr s); + void volumeAverage(double step); private: std::vector<UbTupleFloat3> nodes; @@ -79,8 +82,12 @@ private: //enum Pressure { P, Prms }; int options; - int counter; - double breakStep; + int lcounter; + int numberOfFineSteps; + int fineStep; + int minFineStep; + int maxFineStep; + int levelFactor; int iMinX1, iMinX2, iMinX3; int iMaxX1, iMaxX2, iMaxX3; @@ -88,7 +95,10 @@ private: typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); CalcMacrosFct calcMacros; - + bool volumeAveraging; + std::vector<double> levelCoords; + std::vector<int> levels; + std::vector<double> bounds; //friend class boost::serialization::access; //template<class Archive> diff --git a/source/VirtualFluidsCore/Connectors/Block3DConnector.h b/source/VirtualFluidsCore/Connectors/Block3DConnector.h index 856671f5c..95a15b1c0 100644 --- a/source/VirtualFluidsCore/Connectors/Block3DConnector.h +++ b/source/VirtualFluidsCore/Connectors/Block3DConnector.h @@ -27,7 +27,6 @@ public: public: Block3DConnector() : sendDir(-1) - , invStep(false) #ifdef VF_FETOL , ttype(NONE) #endif @@ -35,7 +34,6 @@ public: Block3DConnector(const int& sendDir) : sendDir(sendDir) - , invStep(false) #ifdef VF_FETOL , ttype(NONE) #endif @@ -66,7 +64,6 @@ public: virtual bool isInterpolationConnectorFC() = 0; //grid refinement - virtual void setInvStep(bool step) {invStep = step;} virtual int getSendDir() const { return sendDir; } //virtual double getSendRecieveTime() = 0; @@ -95,7 +92,6 @@ public: protected: int sendDir; - bool invStep; //FETOL #ifdef VF_FETOL TransmitterType ttype; diff --git a/source/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp b/source/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp index 4aac35250..44fc37843 100644 --- a/source/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp +++ b/source/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp @@ -1,5 +1,5 @@ #include "Block3DConnectorFactory.h" -#include "D3Q27ETFullDirectConnector3.h" +#include "D3Q27ETFullDirectConnector.h" #include "D3Q27ETFullVectorConnector.h" #include "CoarseToFineNodeSetBlock3DConnector.h" #include "FineToCoarseNodeSetBlock3DConnector.h" @@ -14,7 +14,7 @@ Block3DConnectorFactory::~Block3DConnectorFactory() ////////////////////////////////////////////////////////////////////////// Block3DConnectorPtr Block3DConnectorFactory::createSameLevelDirectConnector(Block3DPtr from, Block3DPtr to, int sendDir) { - return Block3DConnectorPtr(new D3Q27ETFullDirectConnector3(from, to, sendDir)); + return Block3DConnectorPtr(new D3Q27ETFullDirectConnector(from, to, sendDir)); } ////////////////////////////////////////////////////////////////////////// Block3DConnectorPtr Block3DConnectorFactory::createSameLevelVectorConnector(Block3DPtr block, diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h index 588b6bcb3..c330253d4 100644 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h +++ b/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h @@ -22,7 +22,7 @@ #include "Grid3D.h" #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> -#include "D3Q27ETFCVectorConnector.h" +#include "D3Q27ETFCOffVectorConnector.h" class Block3D; @@ -43,322 +43,322 @@ template< typename VectorTransmitter > class D3Q27ETCFOffVectorConnector : public Block3DConnector { public: - typedef typename VectorTransmitter::value_type vector_type; - typedef boost::shared_ptr< VectorTransmitter > VectorTransmitterPtr; + typedef typename VectorTransmitter::value_type vector_type; + typedef boost::shared_ptr< VectorTransmitter > VectorTransmitterPtr; public: - D3Q27ETCFOffVectorConnector( Block3DPtr block, - VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, - VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, - VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, - VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, - int sendDir, D3Q27InterpolationProcessorPtr iprocessor); + D3Q27ETCFOffVectorConnector(Block3DPtr block, + VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, + VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, + VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, + VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, + int sendDir, D3Q27InterpolationProcessorPtr iprocessor); - bool isLocalConnector(); - bool isRemoteConnector(); - void init(); + bool isLocalConnector(); + bool isRemoteConnector(); + void init(); - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); + void sendTransmitterDataSize(); + void receiveTransmitterDataSize(); - void prepareForSend(); - void sendVectors(); + void prepareForSend(); + void sendVectors(); - void prepareForReceive(); - void receiveVectors(); + void prepareForReceive(); + void receiveVectors(); - void fillSendVectors(); - void distributeReceiveVectors(); + void fillSendVectors(); + void distributeReceiveVectors(); - bool isInterpolationConnectorCF() { return true; } - bool isInterpolationConnectorFC() { return false; } + bool isInterpolationConnectorCF() { return true; } + bool isInterpolationConnectorFC() { return false; } - double getSendRecieveTime(); + double getSendRecieveTime(); - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} + void prepareForSendX1() {} + void prepareForSendX2() {} + void prepareForSendX3() {} - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} + void sendVectorsX1() {} + void sendVectorsX2() {} + void sendVectorsX3() {} - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} + void prepareForReceiveX1() {} + void prepareForReceiveX2() {} + void prepareForReceiveX3() {} - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} + void receiveVectorsX1() {} + void receiveVectorsX2() {} + void receiveVectorsX3() {} protected: - boost::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - VectorTransmitterPtr senderEvenEvenSW, receiverEvenEvenSW, - senderEvenOddNW, receiverEvenOddNW, - senderOddEvenSE, receiverOddEvenSE, - senderOddOddNE, receiverOddOddNE; - - D3Q27InterpolationProcessorPtr iprocessor; - - void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF); - void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); - void getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); + boost::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet + VectorTransmitterPtr senderEvenEvenSW, receiverEvenEvenSW, + senderEvenOddNW, receiverEvenOddNW, + senderOddEvenSE, receiverOddEvenSE, + senderOddOddNE, receiverOddOddNE; + + D3Q27InterpolationProcessorPtr iprocessor; + + void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF); + void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); + void getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution); + void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType); - void fillSendVectorExt(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); + void fillSendVectorExt(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - void distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - void readICellCfromData(vector_type& data, int& index, LBMReal* icellC); + void distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); + void readICellCfromData(vector_type& data, int& index, LBMReal* icellC); void findCFnodes(); void findCFnodes(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - int bMaxX1, bMaxX2, bMaxX3; + int bMaxX1, bMaxX2, bMaxX3; }; //////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > -D3Q27ETCFOffVectorConnector<VectorTransmitter>::D3Q27ETCFOffVectorConnector( Block3DPtr block, - VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, - VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, - VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, - VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, - int sendDir, D3Q27InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir) - , block(block) - , senderEvenEvenSW(senderEvenEvenSW) - , senderEvenOddNW(senderEvenOddNW) - , senderOddEvenSE(senderOddEvenSE) - , senderOddOddNE(senderOddOddNE) - , receiverEvenEvenSW(receiverEvenEvenSW) - , receiverEvenOddNW(receiverEvenOddNW) - , receiverOddEvenSE(receiverOddEvenSE) - , receiverOddOddNE(receiverOddOddNE) - , iprocessor(iprocessor) +D3Q27ETCFOffVectorConnector<VectorTransmitter>::D3Q27ETCFOffVectorConnector(Block3DPtr block, + VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, + VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, + VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, + VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, + int sendDir, D3Q27InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir) + , block(block) + , senderEvenEvenSW(senderEvenEvenSW) + , senderEvenOddNW(senderEvenOddNW) + , senderOddEvenSE(senderOddEvenSE) + , senderOddOddNE(senderOddOddNE) + , receiverEvenEvenSW(receiverEvenEvenSW) + , receiverEvenOddNW(receiverEvenOddNW) + , receiverOddEvenSE(receiverOddEvenSE) + , receiverOddOddNE(receiverOddOddNE) + , iprocessor(iprocessor) { - if( !( sendDir==D3Q27System::E || sendDir==D3Q27System::W || sendDir==D3Q27System::N || sendDir==D3Q27System::S || sendDir==D3Q27System::T || sendDir==D3Q27System::B - || sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW - || sendDir==D3Q27System::TE || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE || sendDir==D3Q27System::TW - || sendDir==D3Q27System::TN || sendDir==D3Q27System::BS || sendDir==D3Q27System::BN || sendDir==D3Q27System::TS - || sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW - || sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW - ) ) - { - throw UbException(UB_EXARGS,"invalid constructor for this direction"); - } + if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N || sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B + || sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE || sendDir == D3Q27System::NW + || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE || sendDir == D3Q27System::TW + || sendDir == D3Q27System::TN || sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS + || sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE || sendDir == D3Q27System::TSW + || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW + )) + { + throw UbException(UB_EXARGS, "invalid constructor for this direction"); + } } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isLocalConnector() -{ - return !this->isRemoteConnector(); +{ + return !this->isRemoteConnector(); } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > -bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isRemoteConnector() -{ - return ( ( senderOddOddNE && senderOddOddNE->isRemoteTransmitter() ) || ( receiverOddOddNE && receiverOddOddNE->isRemoteTransmitter() ) - || ( senderEvenEvenSW && senderEvenEvenSW->isRemoteTransmitter() ) || ( receiverEvenEvenSW && receiverEvenEvenSW->isRemoteTransmitter() ) - || ( senderEvenOddNW && senderEvenOddNW->isRemoteTransmitter() ) || ( receiverEvenOddNW && receiverEvenOddNW->isRemoteTransmitter() ) - || ( senderOddEvenSE && senderOddEvenSE->isRemoteTransmitter() ) || ( receiverOddEvenSE && receiverOddEvenSE->isRemoteTransmitter() ) ); +bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isRemoteConnector() +{ + return ((senderOddOddNE && senderOddOddNE->isRemoteTransmitter()) || (receiverOddOddNE && receiverOddOddNE->isRemoteTransmitter()) + || (senderEvenEvenSW && senderEvenEvenSW->isRemoteTransmitter()) || (receiverEvenEvenSW && receiverEvenEvenSW->isRemoteTransmitter()) + || (senderEvenOddNW && senderEvenOddNW->isRemoteTransmitter()) || (receiverEvenOddNW && receiverEvenOddNW->isRemoteTransmitter()) + || (senderOddEvenSE && senderOddEvenSE->isRemoteTransmitter()) || (receiverOddEvenSE && receiverOddEvenSE->isRemoteTransmitter())); } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize() -{ - if(senderEvenEvenSW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenEvenSW "<<block.lock()->toString()<<" sendDir="<<sendDir); - senderEvenEvenSW->sendDataSize(); - } - if(senderEvenOddNW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenOddNW "<<block.lock()->toString()<<"sendDir="<<sendDir); - senderEvenOddNW->sendDataSize(); - } - if(senderOddEvenSE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddEvenSE "<<block.lock()->toString()+"sendDir="<<sendDir); - senderOddEvenSE->sendDataSize(); - } - if(senderOddOddNE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddOddNE "<<block.lock()->toString()<<"sendDir="<<sendDir); - senderOddOddNE->sendDataSize(); - } +void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize() +{ + if (senderEvenEvenSW) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenEvenSW " << block.lock()->toString() << " sendDir=" << sendDir); + senderEvenEvenSW->sendDataSize(); + } + if (senderEvenOddNW) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir); + senderEvenOddNW->sendDataSize(); + } + if (senderOddEvenSE) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddEvenSE " << block.lock()->toString() + "sendDir=" << sendDir); + senderOddEvenSE->sendDataSize(); + } + if (senderOddOddNE) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir); + senderOddOddNE->sendDataSize(); + } } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize() -{ - if(receiverEvenEvenSW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenEvenSW "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiverEvenEvenSW->receiveDataSize(); - } - if(receiverEvenOddNW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenOddNW "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiverEvenOddNW->receiveDataSize(); - } - if(receiverOddEvenSE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddEvenSE "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiverOddEvenSE->receiveDataSize(); - } - if(receiverOddOddNE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddOddNE "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiverOddOddNE->receiveDataSize(); - } +{ + if (receiverEvenEvenSW) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenEvenSW " << block.lock()->toString() << "sendDir=" << sendDir); + receiverEvenEvenSW->receiveDataSize(); + } + if (receiverEvenOddNW) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir); + receiverEvenOddNW->receiveDataSize(); + } + if (receiverOddEvenSE) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddEvenSE " << block.lock()->toString() << "sendDir=" << sendDir); + receiverOddEvenSE->receiveDataSize(); + } + if (receiverOddOddNE) + { + UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir); + receiverOddOddNE->receiveDataSize(); + } } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForSend() -{ - if(senderEvenEvenSW) senderEvenEvenSW->prepareForSend(); - if(senderEvenOddNW) senderEvenOddNW->prepareForSend(); - if(senderOddEvenSE) senderOddEvenSE->prepareForSend(); - if(senderOddOddNE) senderOddOddNE->prepareForSend(); +{ + if (senderEvenEvenSW) senderEvenEvenSW->prepareForSend(); + if (senderEvenOddNW) senderEvenOddNW->prepareForSend(); + if (senderOddEvenSE) senderOddEvenSE->prepareForSend(); + if (senderOddOddNE) senderOddOddNE->prepareForSend(); } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendVectors() -{ - if(senderEvenEvenSW) senderEvenEvenSW->sendData(); - if(senderEvenOddNW) senderEvenOddNW->sendData(); - if(senderOddEvenSE) senderOddEvenSE->sendData(); - if(senderOddOddNE) senderOddOddNE->sendData(); +void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendVectors() +{ + if (senderEvenEvenSW) senderEvenEvenSW->sendData(); + if (senderEvenOddNW) senderEvenOddNW->sendData(); + if (senderOddEvenSE) senderOddEvenSE->sendData(); + if (senderOddOddNE) senderOddOddNE->sendData(); } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForReceive() -{ - if(receiverEvenEvenSW) receiverEvenEvenSW->prepareForReceive(); - if(receiverEvenOddNW) receiverEvenOddNW->prepareForReceive(); - if(receiverOddEvenSE) receiverOddEvenSE->prepareForReceive(); - if(receiverOddOddNE) receiverOddOddNE->prepareForReceive(); +void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForReceive() +{ + if (receiverEvenEvenSW) receiverEvenEvenSW->prepareForReceive(); + if (receiverEvenOddNW) receiverEvenOddNW->prepareForReceive(); + if (receiverOddEvenSE) receiverOddEvenSE->prepareForReceive(); + if (receiverOddOddNE) receiverOddOddNE->prepareForReceive(); } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveVectors() -{ - if(receiverEvenEvenSW) receiverEvenEvenSW->receiveData(); - if(receiverEvenOddNW) receiverEvenOddNW->receiveData(); - if(receiverOddEvenSE) receiverOddEvenSE->receiveData(); - if(receiverOddOddNE) receiverOddOddNE->receiveData(); +void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveVectors() +{ + if (receiverEvenEvenSW) receiverEvenEvenSW->receiveData(); + if (receiverEvenOddNW) receiverEvenOddNW->receiveData(); + if (receiverOddEvenSE) receiverOddEvenSE->receiveData(); + if (receiverOddOddNE) receiverOddOddNE->receiveData(); } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector<VectorTransmitter>::init() { - using namespace D3Q27System; - - bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 8; //size of interpolation cell - - switch(this->sendDir) - { - case E : case W : sendSize = bMaxX2*bMaxX3*sendDataPerNode*iCellSize; break; - case N : case S : sendSize = bMaxX1*bMaxX3*sendDataPerNode*iCellSize; break; - case T : case B : sendSize = bMaxX1*bMaxX2*sendDataPerNode*iCellSize; break; - case NE : case SW :case SE : case NW : sendSize = 2*bMaxX3*sendDataPerNode*iCellSize; break; - case TE : case BW :case BE : case TW : sendSize = 2*bMaxX2*sendDataPerNode*iCellSize; break; - case TN : case BS :case BN : case TS : sendSize = 2*bMaxX1*sendDataPerNode*iCellSize; break; - case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 6*bMaxX1*sendDataPerNode*iCellSize; break; - default: throw UbException(UB_EXARGS,"direction not allowed in this constructor"); - } - if(senderEvenEvenSW) senderEvenEvenSW->getData().resize(sendSize, initValue); - else senderEvenEvenSW = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - if(senderEvenOddNW) senderEvenOddNW->getData().resize(sendSize, initValue); - else senderEvenOddNW = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - if(senderOddEvenSE) senderOddEvenSE->getData().resize(sendSize, initValue); - else senderOddEvenSE = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - if(senderOddOddNE) senderOddOddNE->getData().resize(sendSize, initValue); - else senderOddOddNE = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - - if(!receiverEvenEvenSW) receiverEvenEvenSW = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - if(!receiverEvenOddNW) receiverEvenOddNW = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - if(!receiverOddEvenSE) receiverOddEvenSE = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - if(!receiverOddOddNE) receiverOddOddNE = VectorTransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); + using namespace D3Q27System; + + bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); + bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); + bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); + + int sendSize = 0; + LBMReal initValue = -999.0; + + int sendDataPerNode = 27/*f*/; + int iCellSize = 8; //size of interpolation cell + + switch (this->sendDir) + { + case E: case W: sendSize = bMaxX2*bMaxX3*sendDataPerNode*iCellSize; break; + case N: case S: sendSize = bMaxX1*bMaxX3*sendDataPerNode*iCellSize; break; + case T: case B: sendSize = bMaxX1*bMaxX2*sendDataPerNode*iCellSize; break; + case NE: case SW:case SE: case NW: sendSize = 2 * bMaxX3*sendDataPerNode*iCellSize; break; + case TE: case BW:case BE: case TW: sendSize = 2 * bMaxX2*sendDataPerNode*iCellSize; break; + case TN: case BS:case BN: case TS: sendSize = 2 * bMaxX1*sendDataPerNode*iCellSize; break; + case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 6 * bMaxX1*sendDataPerNode*iCellSize; break; + default: throw UbException(UB_EXARGS, "direction not allowed in this constructor"); + } + if (senderEvenEvenSW) senderEvenEvenSW->getData().resize(sendSize, initValue); + else senderEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); + if (senderEvenOddNW) senderEvenOddNW->getData().resize(sendSize, initValue); + else senderEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); + if (senderOddEvenSE) senderOddEvenSE->getData().resize(sendSize, initValue); + else senderOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); + if (senderOddOddNE) senderOddOddNE->getData().resize(sendSize, initValue); + else senderOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); + + if (!receiverEvenEvenSW) receiverEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); + if (!receiverEvenOddNW) receiverEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); + if (!receiverOddEvenSE) receiverOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); + if (!receiverOddOddNE) receiverOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); //findCFnodes(); } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1(); - int maxX2 = (int)fFrom->getNX2(); - int maxX3 = (int)fFrom->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int indexEvEv = 0; - int indexEvOd = 0; - int indexOdEv = 0; - int indexOdOd = 0; - - vector_type& dataEvEv = this->senderEvenEvenSW->getData(); - vector_type& dataEvOd = this->senderEvenOddNW->getData(); - vector_type& dataOdEv = this->senderOddEvenSE->getData(); - vector_type& dataOdOd = this->senderOddOddNE->getData(); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - //int lMinX1_2, lMinX2_2, lMinX3_2, lMaxX1_2, lMaxX2_2, lMaxX3_2; +void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() +{ + using namespace D3Q27System; + + DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); + int maxX1 = (int)fFrom->getNX1(); + int maxX2 = (int)fFrom->getNX2(); + int maxX3 = (int)fFrom->getNX3(); + int minX1 = 0; + int minX2 = 0; + int minX3 = 0; + + int indexEvEv = 0; + int indexEvOd = 0; + int indexOdEv = 0; + int indexOdOd = 0; + + vector_type& dataEvEv = this->senderEvenEvenSW->getData(); + vector_type& dataEvOd = this->senderEvenOddNW->getData(); + vector_type& dataOdEv = this->senderOddEvenSE->getData(); + vector_type& dataOdOd = this->senderOddOddNE->getData(); + + int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; + //int lMinX1_2, lMinX2_2, lMinX3_2, lMaxX1_2, lMaxX2_2, lMaxX3_2; //for coners int lMinX1W = 1; int lMaxX1W = 2; - int lMinX1E = maxX1-3; - int lMaxX1E = maxX1-2; + int lMinX1E = maxX1 - 3; + int lMaxX1E = maxX1 - 2; int lMinX2S = 1; int lMaxX2S = 2; - int lMinX2N = maxX2-3; - int lMaxX2N = maxX2-2; + int lMinX2N = maxX2 - 3; + int lMaxX2N = maxX2 - 2; int lMinX3B = 1; int lMaxX3B = 2; - int lMinX3T = maxX3-3; - int lMaxX3T = maxX3-2; - - - switch(sendDir) - { - case E: - lMinX1 = maxX1-3; - lMaxX1 = lMinX1 + 1; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case W: + int lMinX3T = maxX3 - 3; + int lMaxX3T = maxX3 - 2; + + + switch (sendDir) + { + case E: + lMinX1 = maxX1 - 3; + lMaxX1 = lMinX1 + 1; + + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case W: /////////////////////////////////////// ///DEBUG //if (block.lock()->getGlobalID() == 5780) @@ -366,284 +366,284 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() // int test = 0; //} ////////////// - lMinX1 = 1; - lMaxX1 = lMinX1 + 1; + lMinX1 = 1; + lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case N: - lMinX2 = maxX2-3; - lMaxX2 = lMinX2 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case S: - lMinX2 = 1; - lMaxX2 = lMinX2 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case T: - lMinX3 = maxX3-3; - lMaxX3 = lMinX3 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case B: - lMinX3 = 1; - lMaxX3 = lMinX3 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; -///N-S-E-W - case NE: - lMinX1 = maxX1-3; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2-3; - lMaxX2 = lMinX2 + 2; - - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case N: + lMinX2 = maxX2 - 3; + lMaxX2 = lMinX2 + 1; + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); break; + case S: + lMinX2 = 1; + lMaxX2 = lMinX2 + 1; - case SW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - break; + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - case SE: - lMinX1 = maxX1-3; - lMaxX1 = lMinX1 + 2; - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case T: + lMinX3 = maxX3 - 3; + lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case B: + lMinX3 = 1; + lMaxX3 = lMinX3 + 1; + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + ///N-S-E-W + case NE: + lMinX1 = maxX1 - 3; + lMaxX1 = lMinX1 + 2; + lMinX2 = maxX2 - 3; + lMaxX2 = lMinX2 + 2; + + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case NW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2-3; - lMaxX2 = lMinX2 + 2; + case SW: + lMinX1 = 0; + lMaxX1 = lMinX1 + 2; + lMinX2 = 0; + lMaxX2 = lMinX2 + 2; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); break; -/////T-B-E-W - case TE: - lMinX1 = maxX1-3; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3-3; - lMaxX3 = lMinX3 + 2; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case SE: + lMinX1 = maxX1 - 3; + lMaxX1 = lMinX1 + 2; + lMinX2 = 0; + lMaxX2 = lMinX2 + 2; - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + break; - case BW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; + case NW: + lMinX1 = 0; + lMaxX1 = lMinX1 + 2; + lMinX2 = maxX2 - 3; + lMaxX2 = lMinX2 + 2; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + break; + /////T-B-E-W + case TE: + lMinX1 = maxX1 - 3; + lMaxX1 = lMinX1 + 2; + lMinX3 = maxX3 - 3; + lMaxX3 = lMinX3 + 2; + + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); break; - case BE: - lMinX1 = maxX1-3; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; + case BW: + lMinX1 = 0; + lMaxX1 = lMinX1 + 2; + lMinX3 = 0; + lMaxX3 = lMinX3 + 2; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case TW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3-3; - lMaxX3 = lMinX3 + 2; + case BE: + lMinX1 = maxX1 - 3; + lMaxX1 = lMinX1 + 2; + lMinX3 = 0; + lMaxX3 = lMinX3 + 2; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; -//// -/////T-B-N-S - case TN: - lMinX2 = maxX2-3; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3-3; - lMaxX3 = lMinX3 + 2; + break; + + case TW: + lMinX1 = 0; + lMaxX1 = lMinX1 + 2; + lMinX3 = maxX3 - 3; + lMaxX3 = lMinX3 + 2; + + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + break; + //// + /////T-B-N-S + case TN: + lMinX2 = maxX2 - 3; + lMaxX2 = lMinX2 + 2; + lMinX3 = maxX3 - 3; + lMaxX3 = lMinX3 + 2; + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case BS: - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; + case BS: + lMinX2 = 0; + lMaxX2 = lMinX2 + 2; + lMinX3 = 0; + lMaxX3 = lMinX3 + 2; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case BN: - lMinX2 = maxX2-3; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; + case BN: + lMinX2 = maxX2 - 3; + lMaxX2 = lMinX2 + 2; + lMinX3 = 0; + lMaxX3 = lMinX3 + 2; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case TS: - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3-3; - lMaxX3 = lMinX3 + 2; + case TS: + lMinX2 = 0; + lMaxX2 = lMinX2 + 2; + lMinX3 = maxX3 - 3; + lMaxX3 = lMinX3 + 2; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); + fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; //TNE case TNE: - lMinX1 = maxX1-3; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-3; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-3; - lMaxX3 = maxX3-1; + lMinX1 = maxX1 - 3; + lMaxX1 = maxX1 - 1; + lMinX2 = maxX2 - 3; + lMaxX2 = maxX2 - 1; + lMinX3 = maxX3 - 3; + lMaxX3 = maxX3 - 1; fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; @@ -651,21 +651,21 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() case TNW: lMinX1 = 0; lMaxX1 = 2; - lMinX2 = maxX2-3; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-3; - lMaxX3 = maxX3-1; + lMinX2 = maxX2 - 3; + lMaxX2 = maxX2 - 1; + lMinX3 = maxX3 - 3; + lMaxX3 = maxX3 - 1; fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; // TSE case TSE: - lMinX1 = maxX1-3; - lMaxX1 = maxX1-1; + lMinX1 = maxX1 - 3; + lMaxX1 = maxX1 - 1; lMinX2 = 0; lMaxX2 = 2; - lMinX3 = maxX3-3; - lMaxX3 = maxX3-1; + lMinX3 = maxX3 - 3; + lMaxX3 = maxX3 - 1; fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; @@ -675,17 +675,17 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() lMaxX1 = 2; lMinX2 = 0; lMaxX2 = 2; - lMinX3 = maxX3-3; - lMaxX3 = maxX3-1; + lMinX3 = maxX3 - 3; + lMaxX3 = maxX3 - 1; fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; // BNE case BNE: - lMinX1 = maxX1-3; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-3; - lMaxX2 = maxX2-1; + lMinX1 = maxX1 - 3; + lMaxX1 = maxX1 - 1; + lMinX2 = maxX2 - 3; + lMaxX2 = maxX2 - 1; lMinX3 = 0; lMaxX3 = 2; @@ -695,8 +695,8 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() case BNW: lMinX1 = 0; lMaxX1 = 2; - lMinX2 = maxX2-3; - lMaxX2 = maxX2-1; + lMinX2 = maxX2 - 3; + lMaxX2 = maxX2 - 1; lMinX3 = 0; lMaxX3 = 2; @@ -704,8 +704,8 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() break; // BSE case BSE: - lMinX1 = maxX1-3; - lMaxX1 = maxX1-1; + lMinX1 = maxX1 - 3; + lMaxX1 = maxX1 - 1; lMinX2 = 0; lMaxX2 = 2; lMinX3 = 0; @@ -724,154 +724,154 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; - } + } } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > +template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution) { - int halfEven = 0; - int halfOdd = 0; - int dCoef = 0; - - if (dataDistribution) - dCoef = 1; - - if (Utilities::isOdd(gMax)) - { - halfEven = gMax/2; - halfOdd = gMax/2; - } - if (Utilities::isEven(gMax)) - { - halfEven = gMax/2; - halfOdd = gMax/2 - 1 + dCoef; - } - - switch (even) - { - case true : - lMin = gMin + dCoef; - lMax = lMin + halfEven - dCoef; - break; - case false : - lMin = gMin + halfOdd; - lMax = gMax-1; - break; - } + int halfEven = 0; + int halfOdd = 0; + int dCoef = 0; + + if (dataDistribution) + dCoef = 1; + + if (Utilities::isOdd(gMax)) + { + halfEven = gMax / 2; + halfOdd = gMax / 2; + } + if (Utilities::isEven(gMax)) + { + halfEven = gMax / 2; + halfOdd = gMax / 2 - 1 + dCoef; + } + + switch (even) + { + case true: + lMin = gMin + dCoef; + lMax = lMin + halfEven - dCoef; + break; + case false: + lMin = gMin + halfOdd; + lMax = gMax - 1; + break; + } } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > +template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectorExt(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) { - if(data.size() == 0) return; - int ix1, ix2, ix3; - LBMReal xoff, yoff, zoff; - BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(block.lock()->getKernel()->getBCProcessor())->getBCArray(); - - for (ix3=lMinX3; ix3<lMaxX3; ix3++) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2++) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1++) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - - int howManySolids= iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if(howManySolids == 0 || howManySolids == 8) - { - iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3); - xoff=0.0; - yoff=0.0; - zoff=0.0; - } - else - { - if(!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) - { - std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+ - " interpolation is not implemented for other direction"+ - " by using in: "+(std::string)typeid(*this).name()+ - " or maybe you have a solid on the block boundary"; - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); - this->writeICellFtoData(data, index, icellF); - } - } - } + if (data.size() == 0) return; + int ix1, ix2, ix3; + LBMReal xoff, yoff, zoff; + BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(block.lock()->getKernel()->getBCProcessor())->getBCArray(); + + for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) + { + for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) + { + for (ix1 = lMinX1; ix1 < lMaxX1; ix1++) + { + D3Q27ICell icellC; + D3Q27ICell icellF; + + int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); + + if (howManySolids == 0 || howManySolids == 8) + { + iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3); + xoff = 0.0; + yoff = 0.0; + zoff = 0.0; + } + else + { + if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) + { + std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) + + " interpolation is not implemented for other direction" + + " by using in: " + (std::string)typeid(*this).name() + + " or maybe you have a solid on the block boundary"; + UB_THROW(UbException(UB_EXARGS, err)); + } + } + + iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); + this->writeICellFtoData(data, index, icellF); + } + } + } } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF) +template< typename VectorTransmitter > +void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF) { - writeNodeToVector(data, index, icellF.BSW); - writeNodeToVector(data, index, icellF.BSE); - writeNodeToVector(data, index, icellF.BNW); - writeNodeToVector(data, index, icellF.BNE); - writeNodeToVector(data, index, icellF.TSW); - writeNodeToVector(data, index, icellF.TSE); - writeNodeToVector(data, index, icellF.TNW); - writeNodeToVector(data, index, icellF.TNE); + writeNodeToVector(data, index, icellF.BSW); + writeNodeToVector(data, index, icellF.BSE); + writeNodeToVector(data, index, icellF.BNW); + writeNodeToVector(data, index, icellF.BNE); + writeNodeToVector(data, index, icellF.TSW); + writeNodeToVector(data, index, icellF.TSE); + writeNodeToVector(data, index, icellF.TNW); + writeNodeToVector(data, index, icellF.TNE); } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > +template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeNodeToVector(vector_type& data, int& index, LBMReal* inode) { - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - data[index++] = inode[i]; - } + for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) + { + data[index++] = inode[i]; + } } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() +template< typename VectorTransmitter > +void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() { - using namespace D3Q27System; + using namespace D3Q27System; - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fTo->getNX1(); - int maxX2 = (int)fTo->getNX2(); - int maxX3 = (int)fTo->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; + DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); + int maxX1 = (int)fTo->getNX1(); + int maxX2 = (int)fTo->getNX2(); + int maxX3 = (int)fTo->getNX3(); + int minX1 = 0; + int minX2 = 0; + int minX3 = 0; - int indexEvEv = 0; - int indexEvOd = 0; - int indexOdEv = 0; - int indexOdOd = 0; + int indexEvEv = 0; + int indexEvOd = 0; + int indexOdEv = 0; + int indexOdOd = 0; - vector_type& dataEvEv = this->receiverEvenEvenSW->getData(); - vector_type& dataEvOd = this->receiverEvenOddNW->getData(); - vector_type& dataOdEv = this->receiverOddEvenSE->getData(); - vector_type& dataOdOd = this->receiverOddOddNE->getData(); + vector_type& dataEvEv = this->receiverEvenEvenSW->getData(); + vector_type& dataEvOd = this->receiverEvenOddNW->getData(); + vector_type& dataOdEv = this->receiverOddEvenSE->getData(); + vector_type& dataOdOd = this->receiverOddOddNE->getData(); - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int dummy; + int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; + int dummy; //for coners int lMinX1W = 3; int lMaxX1W = 3; - int lMinX1E = maxX1-3; - int lMaxX1E = maxX1-2; + int lMinX1E = maxX1 - 3; + int lMaxX1E = maxX1 - 2; int lMinX2S = 1; int lMaxX2S = 3; - int lMinX2N = maxX2-3; - int lMaxX2N = maxX2-2; + int lMinX2N = maxX2 - 3; + int lMaxX2N = maxX2 - 2; int lMinX3B = 1; int lMaxX3B = 3; - int lMinX3T = maxX3-3; - int lMaxX3T = maxX3-2; + int lMinX3T = maxX3 - 3; + int lMaxX3T = maxX3 - 2; /////////////////////////////////////// ///DEBUG @@ -881,32 +881,32 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() //} ////////////// - switch(sendDir) - { - case E: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case W: + switch (sendDir) + { + case E: + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 1; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case W: /////////////////////////////////////// ///DEBUG //if (block.lock()->getGlobalID() == 5780) @@ -914,472 +914,472 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() // int test = 0; //} ////////////// - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy, none); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3, none); + lMinX1 = 3; + lMaxX1 = lMinX1 + 1; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case N: + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case S: + lMinX2 = 3; + lMaxX2 = lMinX2 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case T: + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + case B: + lMinX3 = 3; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy, none); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3, none); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case N: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case S: - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case T: - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case B: - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - - // /////E-W-N-S - case NE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); + + getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); + getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); + break; + + // /////E-W-N-S + case NE: + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 3; + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 1; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 1; + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 3; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case SW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case SW: + lMinX1 = 1; + lMaxX1 = lMinX1 + 3; + lMinX2 = 3; + lMaxX2 = lMinX2 + 1; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = 3; + lMaxX1 = lMinX1 + 1; + lMinX2 = 1; + lMaxX2 = lMinX2 + 3; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; - - case SE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + break; + + case SE: + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 3; + lMinX2 = 3; + lMaxX2 = lMinX2 + 1; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 1; + lMinX2 = 1; + lMaxX2 = lMinX2 + 3; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case NW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case NW: + lMinX1 = 1; + lMaxX1 = lMinX1 + 3; + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 1; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = 3; + lMaxX1 = lMinX1 + 1; + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 3; + getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); + getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); + getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; -// /////T-B-E-W - case TE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + break; + // /////T-B-E-W + case TE: + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 3; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 1; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case BW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case BW: + lMinX1 = 1; + lMaxX1 = lMinX1 + 3; + lMinX3 = 3; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = 3; + lMaxX1 = lMinX1 + 1; + lMinX3 = 1; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case BE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case BE: + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 3; + lMinX3 = 3; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = maxX1 - 4; + lMaxX1 = lMinX1 + 1; + lMinX3 = 1; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case TW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case TW: + lMinX1 = 1; + lMaxX1 = lMinX1 + 3; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX1 = 3; + lMaxX1 = lMinX1 + 1; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); + getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; -/////////////////////////T-N-B-S - case TN: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + /////////////////////////T-N-B-S + case TN: + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 3; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 1; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case BS: - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case BS: + lMinX2 = 1; + lMaxX2 = lMinX2 + 3; + lMinX3 = 3; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX2 = 3; + lMaxX2 = lMinX2 + 1; + lMinX3 = 1; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; - - - case BN: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + break; + + + case BN: + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 3; + lMinX3 = 3; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX2 = maxX2 - 4; + lMaxX2 = lMinX2 + 1; + lMinX3 = 1; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; - case TS: - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + case TS: + lMinX2 = 1; + lMaxX2 = lMinX2 + 3; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 1; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); + lMinX2 = 3; + lMaxX2 = lMinX2 + 1; + lMinX3 = maxX3 - 4; + lMaxX3 = lMinX3 + 3; + getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); + getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); + distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - break; + break; //TNE case TNE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-3; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 3; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-3; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 3; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-3; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 3; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; @@ -1387,53 +1387,53 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() case TNW: lMinX1 = 3; lMaxX1 = 4; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); lMinX1 = 1; lMaxX1 = 4; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-3; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 3; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); lMinX1 = 1; lMaxX1 = 4; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-3; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 3; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; // TSE case TSE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-3; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 3; lMinX2 = 1; lMaxX2 = 4; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; lMinX2 = 3; lMaxX2 = 4; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; + + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; lMinX2 = 1; lMaxX2 = 4; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-3; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 3; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; // TSW @@ -1442,48 +1442,48 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() lMaxX1 = 4; lMinX2 = 1; lMaxX2 = 4; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); lMinX1 = 1; lMaxX1 = 4; lMinX2 = 3; lMaxX2 = 4; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 1; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); lMinX1 = 1; lMaxX1 = 4; lMinX2 = 1; lMaxX2 = 4; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-3; + lMinX3 = maxX3 - 4; + lMaxX3 = maxX3 - 3; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; // BNE case BNE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-3; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 3; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; lMinX3 = 1; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-3; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 3; lMinX3 = 1; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; lMinX3 = 3; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); @@ -1493,48 +1493,48 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() case BNW: lMinX1 = 3; lMaxX1 = 4; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; lMinX3 = 1; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); lMinX1 = 1; lMaxX1 = 4; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-3; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 3; lMinX3 = 1; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); lMinX1 = 1; lMaxX1 = 4; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; + lMinX2 = maxX2 - 4; + lMaxX2 = maxX2 - 1; lMinX3 = 3; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; // BSE case BSE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-3; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 3; lMinX2 = 1; lMaxX2 = 4; lMinX3 = 1; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; lMinX2 = 3; lMaxX2 = 4; lMinX3 = 1; lMaxX3 = 4; distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; + lMinX1 = maxX1 - 4; + lMaxX1 = maxX1 - 1; lMinX2 = 1; lMaxX2 = 4; lMinX3 = 3; @@ -1568,143 +1568,143 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); break; - } + } } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > +template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) { - if(data.size() == 0) return; - - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3++) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2++) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1++) - { - LBMReal icellC[27]; - this->readICellCfromData(data, index, icellC); - iprocessor->writeINode(fTo, icellC, ix1, ix2, ix3); - } - } - } + if (data.size() == 0) return; + + int ix1, ix2, ix3; + for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) + { + for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) + { + for (ix1 = lMinX1; ix1 < lMaxX1; ix1++) + { + LBMReal icellC[27]; + this->readICellCfromData(data, index, icellC); + iprocessor->writeINode(fTo, icellC, ix1, ix2, ix3); + } + } + } } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::readICellCfromData(vector_type& data, int& index, LBMReal* icellC) +template< typename VectorTransmitter > +void D3Q27ETCFOffVectorConnector< VectorTransmitter>::readICellCfromData(vector_type& data, int& index, LBMReal* icellC) { - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - icellC[i] = data[index++]; - } + for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) + { + icellC[i] = data[index++]; + } } ////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > +template< typename VectorTransmitter > void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) { - using namespace D3Q27System; - int TminX1=minX1; int TminX2=minX2; int TminX3=minX3; int TmaxX1=maxX1; int TmaxX2=maxX2; int TmaxX3=maxX3; - - if(block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - } - if(block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1==TminX1) minX1 += 2; - } - if(block.lock()->hasInterpolationFlagCF(N)) - { - if (maxX2==TmaxX2) maxX2 -= 2; - } - if(block.lock()->hasInterpolationFlagCF(S)) - { - if (minX2==TminX2) minX2 += 2; - } - if(block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX3==TmaxX3) maxX3 -= 2; - } - if(block.lock()->hasInterpolationFlagCF(B)) - { - if (minX3==TminX3) minX3 += 2; - } - - //E-W-N-S - if(block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (maxX2==TmaxX2) maxX2 -= 2; - } - if( block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (minX1==TminX1) minX1 += 2; - if (minX2==TminX2) minX2 += 2; - } - if(block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (minX2==TminX2) minX2 += 2; - } - if(block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1==TminX1) minX1 += 2; - if (maxX2==TmaxX2) maxX2 -= 2; - } - -// ////T-B-E-W - if(block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } - if(block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX1==TminX1) minX1 += 2; - if (minX3==TminX3) minX3 += 2; - } - if(block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (minX3==TminX3) minX3 += 2; - } - if(block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX1==TminX1) minX1 += 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } - - - ////T-B-N-S - if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX2==TmaxX2) maxX2 -= 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX2==TminX2) minX2 += 2; - if (minX3==TminX3) minX3 += 2; - } - if(block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX2==TmaxX2) maxX2 -= 2; - if (minX3==TminX3) minX3 += 2; - } - if(block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX2==TminX2) minX2 += 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } - - //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) - //if (!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&& !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) - //{ - // if (maxX1==TmaxX1) maxX1 -= 2; - // if (maxX2==TmaxX2) maxX2 -= 2; - // if (maxX3==TmaxX3) maxX3 -= 2; - //} + using namespace D3Q27System; + int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3; + + if (block.lock()->hasInterpolationFlagCF(E)) + { + if (maxX1 == TmaxX1) maxX1 -= 2; + } + if (block.lock()->hasInterpolationFlagCF(W)) + { + if (minX1 == TminX1) minX1 += 2; + } + if (block.lock()->hasInterpolationFlagCF(N)) + { + if (maxX2 == TmaxX2) maxX2 -= 2; + } + if (block.lock()->hasInterpolationFlagCF(S)) + { + if (minX2 == TminX2) minX2 += 2; + } + if (block.lock()->hasInterpolationFlagCF(T)) + { + if (maxX3 == TmaxX3) maxX3 -= 2; + } + if (block.lock()->hasInterpolationFlagCF(B)) + { + if (minX3 == TminX3) minX3 += 2; + } + + //E-W-N-S + if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E)) + { + if (maxX1 == TmaxX1) maxX1 -= 2; + if (maxX2 == TmaxX2) maxX2 -= 2; + } + if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S)) + { + if (minX1 == TminX1) minX1 += 2; + if (minX2 == TminX2) minX2 += 2; + } + if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S)) + { + if (maxX1 == TmaxX1) maxX1 -= 2; + if (minX2 == TminX2) minX2 += 2; + } + if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W)) + { + if (minX1 == TminX1) minX1 += 2; + if (maxX2 == TmaxX2) maxX2 -= 2; + } + + // ////T-B-E-W + if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T)) + { + if (maxX1 == TmaxX1) maxX1 -= 2; + if (maxX3 == TmaxX3) maxX3 -= 2; + } + if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B)) + { + if (minX1 == TminX1) minX1 += 2; + if (minX3 == TminX3) minX3 += 2; + } + if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B)) + { + if (maxX1 == TmaxX1) maxX1 -= 2; + if (minX3 == TminX3) minX3 += 2; + } + if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T)) + { + if (minX1 == TminX1) minX1 += 2; + if (maxX3 == TmaxX3) maxX3 -= 2; + } + + + ////T-B-N-S + if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) + { + if (maxX2 == TmaxX2) maxX2 -= 2; + if (maxX3 == TmaxX3) maxX3 -= 2; + } + if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B)) + { + if (minX2 == TminX2) minX2 += 2; + if (minX3 == TminX3) minX3 += 2; + } + if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B)) + { + if (maxX2 == TmaxX2) maxX2 -= 2; + if (minX3 == TminX3) minX3 += 2; + } + if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T)) + { + if (minX2 == TminX2) minX2 += 2; + if (maxX3 == TmaxX3) maxX3 -= 2; + } + + //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) + //if (!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&& !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) + //{ + // if (maxX1==TmaxX1) maxX1 -= 2; + // if (maxX2==TmaxX2) maxX2 -= 2; + // if (maxX3==TmaxX3) maxX3 -= 2; + //} } ////////////////////////////////////////////////////////////////////////// template< typename VectorTransmitter > @@ -1715,97 +1715,94 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, if (block.lock()->hasInterpolationFlagCF(E)) { - if (maxX1==TmaxX1) maxX1 -= 2; + if (maxX1 == TmaxX1) maxX1 -= 2; } if (block.lock()->hasInterpolationFlagCF(W)) { - if (minX1==TminX1) minX1 += 2; + if (minX1 == TminX1) minX1 += 2; } if (block.lock()->hasInterpolationFlagCF(N)) { - if (maxX2==TmaxX2) maxX2 -= 2; + if (maxX2 == TmaxX2) maxX2 -= 2; } if (block.lock()->hasInterpolationFlagCF(S)) { - if (minX2==TminX2) minX2 += 2; + if (minX2 == TminX2) minX2 += 2; } if (block.lock()->hasInterpolationFlagCF(T)) { - if (maxX3==TmaxX3) maxX3 -= 2; + if (maxX3 == TmaxX3) maxX3 -= 2; } if (block.lock()->hasInterpolationFlagCF(B)) { - if (minX3==TminX3) minX3 += 2; + if (minX3 == TminX3) minX3 += 2; } //E-W-N-S if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E)) { - if (maxX1==TmaxX1) maxX1 -= 2; - if (maxX2==TmaxX2) maxX2 -= 2; + if (maxX1 == TmaxX1) maxX1 -= 2; + if (maxX2 == TmaxX2) maxX2 -= 2; } if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S)) { - if (minX1==TminX1) minX1 += 2; - if (minX2==TminX2) minX2 += 2; + if (minX1 == TminX1) minX1 += 2; + if (minX2 == TminX2) minX2 += 2; } if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S)) { - if (maxX1==TmaxX1) maxX1 -= 2; - if (minX2==TminX2) minX2 += 2; + if (maxX1 == TmaxX1) maxX1 -= 2; + if (minX2 == TminX2) minX2 += 2; } if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W)) { - if (minX1==TminX1) minX1 += 2; - if (maxX2==TmaxX2) maxX2 -= 2; + if (minX1 == TminX1) minX1 += 2; + if (maxX2 == TmaxX2) maxX2 -= 2; } // ////T-B-E-W if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T)) { - if (maxX1==TmaxX1) maxX1 -= 2; - if (maxX3==TmaxX3) maxX3 -= 2; + if (maxX1 == TmaxX1) maxX1 -= 2; + if (maxX3 == TmaxX3) maxX3 -= 2; } if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B)) { - if (minX1==TminX1) minX1 += 2; - if (minX3==TminX3) minX3 += 2; + if (minX1 == TminX1) minX1 += 2; + if (minX3 == TminX3) minX3 += 2; } if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B)) { - if (maxX1==TmaxX1) maxX1 -= 2; - if (minX3==TminX3) minX3 += 2; + if (maxX1 == TmaxX1) maxX1 -= 2; + if (minX3 == TminX3) minX3 += 2; } if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T)) { - if (minX1==TminX1) minX1 += 2; - if (maxX3==TmaxX3) maxX3 -= 2; + if (minX1 == TminX1) minX1 += 2; + if (maxX3 == TmaxX3) maxX3 -= 2; } ////T-B-N-S if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) { - if(connType != none) - { - if (maxX2==TmaxX2) maxX2 -= 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } + if (maxX2 == TmaxX2) maxX2 -= 2; + if (maxX3 == TmaxX3) maxX3 -= 2; } if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B)) { - if (minX2==TminX2) minX2 += 2; - if (minX3==TminX3) minX3 += 2; + if (minX2 == TminX2) minX2 += 2; + if (minX3 == TminX3) minX3 += 2; } if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B)) { - if (maxX2==TmaxX2) maxX2 -= 2; - if (minX3==TminX3) minX3 += 2; + if (maxX2 == TmaxX2) maxX2 -= 2; + if (minX3 == TminX3) minX3 += 2; } if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T)) { - if (minX2==TminX2) minX2 += 2; - if (maxX3==TmaxX3) maxX3 -= 2; + if (minX2 == TminX2) minX2 += 2; + if (maxX3 == TmaxX3) maxX3 -= 2; } //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) @@ -1838,7 +1835,7 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes() vector_type& dataOdOd = this->senderOddOddNE->getData(); int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - + using namespace D3Q27System; if (block.lock()->hasInterpolationFlagCF(W)) { @@ -1863,15 +1860,15 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes() } if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) { - lMinX2 = maxX2-3; + lMinX2 = maxX2 - 3; lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3-3; + lMinX3 = maxX3 - 3; lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1+1, maxX1, true, lMinX1, lMaxX1, false); + getLocalMinMax(minX1 + 1, maxX1, true, lMinX1, lMaxX1, false); findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - getLocalMinMax(minX1+1, maxX1, false, lMinX1, lMaxX1, false); + getLocalMinMax(minX1 + 1, maxX1, false, lMinX1, lMaxX1, false); findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); } } @@ -1884,11 +1881,11 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes(DistributionAr LBMReal xoff, yoff, zoff; BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(block.lock()->getKernel()->getBCProcessor())->getBCArray(); - for (ix3 = lMinX3; ix3<lMaxX3; ix3++) + for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) { - for (ix2 = lMinX2; ix2<lMaxX2; ix2++) + for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) { - for (ix1 = lMinX1; ix1<lMaxX1; ix1++) + for (ix1 = lMinX1; ix1 < lMaxX1; ix1++) { D3Q27ICell icellC; D3Q27ICell icellF; @@ -1906,9 +1903,9 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes(DistributionAr { if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) { - std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+ - " interpolation is not implemented for other direction"+ - " by using in: "+(std::string)typeid(*this).name()+ + std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) + + " interpolation is not implemented for other direction" + + " by using in: " + (std::string)typeid(*this).name() + " or maybe you have a solid on the block boundary"; UB_THROW(UbException(UB_EXARGS, err)); } @@ -1935,7 +1932,7 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes(DistributionAr template< typename VectorTransmitter > double D3Q27ETCFOffVectorConnector<VectorTransmitter>::getSendRecieveTime() { - return 0; + return 0; } #endif diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.cpp deleted file mode 100644 index 5e24d5d7a..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "D3Q27ETCFVectorConnector.h" diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.h deleted file mode 100644 index baffa59f7..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETCFVectorConnector.h +++ /dev/null @@ -1,707 +0,0 @@ -/** -* @file D3Q27ETCFVectorConnector.h -* @brief Interpolation from coarse level to fine. -* @author Kostyantyn Kucher -* @date 08.06.2011 -*/ -#ifndef D3Q27ETCFVECTORCONNECTOR_H -#define D3Q27ETCFVECTORCONNECTOR_H - -#include <vector> - -#include "basics/transmitter/TbTransmitter.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernelETD3Q27.h" -#include "D3Q27InterpolationProcessor.h" -#include "MathUtil.hpp" - -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -class Block3D; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) - -//sendrichtung: E<->W N<->S T<->B -// --------- x3 x3 x2 -// | NW | NE | ^ ^ ^ -// |----+----| +-> x2 +->x1 +->x1 -// | SW | SE | -// --------- -// NW==even-odd, SW==even-even, SE==odd-even, NE==odd-odd - -template< typename VectorTransmitter > -class D3Q27ETCFVectorConnector : public Block3DConnector -{ -protected: - typedef typename VectorTransmitter::value_type vector_type; - typedef boost::shared_ptr< VectorTransmitter > VectorTransmitterPtr; -public: - D3Q27ETCFVectorConnector( Block3DPtr block, - VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, - VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, - VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, - VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, - int sendDir, D3Q27InterpolationProcessorPtr iprocessor); - - bool isLocalConnector(); - bool isRemoteConnector(); - void init(); - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - void fillSendVectors(); - void distributeReceiveVectors(); - - bool isInterpolationConnectorCF() { return true; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - boost::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - - VectorTransmitterPtr senderEvenEvenSW, receiverEvenEvenSW, - senderEvenOddNW, receiverEvenOddNW, - senderOddEvenSE, receiverOddEvenSE, - senderOddOddNE, receiverOddOddNE; - - D3Q27InterpolationProcessorPtr iprocessor; - - void readICellC(DistributionArray3DPtr f, D3Q27ICell& icellC, const int& x1, const int& x2, const int& x3) ; - void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF); - void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); - void getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - void fillSendVectorExt(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - - void distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - void writeICellC(DistributionArray3DPtr f, LBMReal* icellC, const int& x1, const int& x2, const int& x3); - void readICellCfromData(vector_type& data, int& index, LBMReal* icellC); -}; - -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -D3Q27ETCFVectorConnector<VectorTransmitter>::D3Q27ETCFVectorConnector( Block3DPtr block, - VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, - VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, - VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, - VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, - int sendDir, D3Q27InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir) - , block(block) - , senderEvenEvenSW(senderEvenEvenSW) - , senderEvenOddNW(senderEvenOddNW) - , senderOddEvenSE(senderOddEvenSE) - , senderOddOddNE(senderOddOddNE) - , receiverEvenEvenSW(receiverEvenEvenSW) - , receiverEvenOddNW(receiverEvenOddNW) - , receiverOddEvenSE(receiverOddEvenSE) - , receiverOddOddNE(receiverOddOddNE) - , iprocessor(iprocessor) -{ - if( !( sendDir==D3Q27System::E || sendDir==D3Q27System::W || sendDir==D3Q27System::N - || sendDir==D3Q27System::S || sendDir==D3Q27System::T || sendDir==D3Q27System::B ) ) - { - throw UbException(UB_EXARGS,"invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETCFVectorConnector<VectorTransmitter>::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETCFVectorConnector<VectorTransmitter>::isRemoteConnector() -{ - return ( ( senderOddOddNE && senderOddOddNE->isRemoteTransmitter() ) || ( receiverOddOddNE && receiverOddOddNE->isRemoteTransmitter() ) - || ( senderEvenEvenSW && senderEvenEvenSW->isRemoteTransmitter() ) || ( receiverEvenEvenSW && receiverEvenEvenSW->isRemoteTransmitter() ) - || ( senderEvenOddNW && senderEvenOddNW->isRemoteTransmitter() ) || ( receiverEvenOddNW && receiverEvenOddNW->isRemoteTransmitter() ) - || ( senderOddEvenSE && senderOddEvenSE->isRemoteTransmitter() ) || ( receiverOddEvenSE && receiverOddEvenSE->isRemoteTransmitter() ) ); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector<VectorTransmitter>::sendTransmitterDataSize() -{ - if(senderEvenEvenSW) senderEvenEvenSW->sendDataSize(); - if(senderEvenOddNW) senderEvenOddNW->sendDataSize(); - if(senderOddEvenSE) senderOddEvenSE->sendDataSize(); - if(senderOddOddNE) senderOddOddNE->sendDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector<VectorTransmitter>::receiveTransmitterDataSize() -{ - if(receiverEvenEvenSW) receiverEvenEvenSW->receiveDataSize(); - if(receiverEvenOddNW) receiverEvenOddNW->receiveDataSize(); - if(receiverOddEvenSE) receiverOddEvenSE->receiveDataSize(); - if(receiverOddOddNE) receiverOddOddNE->receiveDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector<VectorTransmitter>::prepareForSend() -{ - if(senderEvenEvenSW) senderEvenEvenSW->prepareForSend(); - if(senderEvenOddNW) senderEvenOddNW->prepareForSend(); - if(senderOddEvenSE) senderOddEvenSE->prepareForSend(); - if(senderOddOddNE) senderOddOddNE->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector<VectorTransmitter>::sendVectors() -{ - if(senderEvenEvenSW) senderEvenEvenSW->sendData(); - if(senderEvenOddNW) senderEvenOddNW->sendData(); - if(senderOddEvenSE) senderOddEvenSE->sendData(); - if(senderOddOddNE) senderOddOddNE->sendData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector<VectorTransmitter>::prepareForReceive() -{ - if(receiverEvenEvenSW) receiverEvenEvenSW->prepareForReceive(); - if(receiverEvenOddNW) receiverEvenOddNW->prepareForReceive(); - if(receiverOddEvenSE) receiverOddEvenSE->prepareForReceive(); - if(receiverOddOddNE) receiverOddOddNE->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector<VectorTransmitter>::receiveVectors() -{ - if(receiverEvenEvenSW) receiverEvenEvenSW->receiveData(); - if(receiverEvenOddNW) receiverEvenOddNW->receiveData(); - if(receiverOddEvenSE) receiverOddEvenSE->receiveData(); - if(receiverOddOddNE) receiverOddOddNE->receiveData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector<VectorTransmitter>::init() -{ - using namespace D3Q27System; - - int maxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - int maxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - int maxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 8; //size of interpolation cell - - switch(this->sendDir) - { - case E : case W : sendSize = maxX2*maxX3*sendDataPerNode*iCellSize; break; - case N : case S : sendSize = maxX1*maxX3*sendDataPerNode*iCellSize; break; - case T : case B : sendSize = maxX1*maxX2*sendDataPerNode*iCellSize; break; - default: throw UbException(UB_EXARGS,"direction not allowed in this constructor"); - } - senderEvenEvenSW->getData().resize(sendSize, initValue); - senderEvenOddNW->getData().resize(sendSize, initValue); - senderOddEvenSE->getData().resize(sendSize, initValue); - senderOddOddNE->getData().resize(sendSize, initValue); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1(); - int maxX2 = (int)fFrom->getNX2(); - int maxX3 = (int)fFrom->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int indexEvEv = 0; - int indexEvOd = 0; - int indexOdEv = 0; - int indexOdOd = 0; - - vector_type& dataEvEv = this->senderEvenEvenSW->getData(); - vector_type& dataEvOd = this->senderEvenOddNW->getData(); - vector_type& dataOdEv = this->senderOddEvenSE->getData(); - vector_type& dataOdOd = this->senderOddOddNE->getData(); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - - switch(sendDir) - { - case E: - lMinX1 = maxX1-3; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case W: - lMinX1 = 1; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case N: - lMinX2 = maxX2-3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case S: - lMinX2 = 1; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case T: - lMinX3 = maxX3-3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case B: - lMinX3 = 1; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution) -{ - int halfEven = 0; - int halfOdd = 0; - int dCoef = 0; - - if (dataDistribution) - dCoef = 1; - - if (Utilities::isOdd(gMax)) - { - halfEven = gMax/2; - halfOdd = gMax/2; - } - if (Utilities::isEven(gMax)) - { - halfEven = gMax/2; - halfOdd = gMax/2 - 1 + dCoef; - } - - switch (even) - { - case true : - lMin = gMin + dCoef; - lMax = lMin + halfEven - dCoef; - break; - case false : - lMin = gMin + halfOdd; - lMax = gMax-1; - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::fillSendVectorExt(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3++) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2++) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1++) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - this->readICellC(fFrom, icellC, ix1, ix2, ix3); - iprocessor->interpolateCoarseToFine(icellC, icellF); - this->writeICellFtoData(data, index, icellF); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::readICellC(DistributionArray3DPtr f, D3Q27ICell& icellC, const int& x1, const int& x2, const int& x3) -{ - f->getDistribution(icellC.BSW, x1, x2, x3); - f->getDistribution(icellC.BSE, x1+1, x2, x3); - f->getDistribution(icellC.BNW, x1, x2+1, x3); - f->getDistribution(icellC.BNE, x1+1, x2+1, x3); - f->getDistribution(icellC.TSW, x1, x2, x3+1); - f->getDistribution(icellC.TSE, x1+1, x2, x3+1); - f->getDistribution(icellC.TNW, x1, x2+1, x3+1); - f->getDistribution(icellC.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF) -{ - writeNodeToVector(data, index, icellF.BSW); - writeNodeToVector(data, index, icellF.BSE); - writeNodeToVector(data, index, icellF.BNW); - writeNodeToVector(data, index, icellF.BNE); - writeNodeToVector(data, index, icellF.TSW); - writeNodeToVector(data, index, icellF.TSE); - writeNodeToVector(data, index, icellF.TNW); - writeNodeToVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::writeNodeToVector(vector_type& data, int& index, LBMReal* inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - data[index++] = inode[i]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::distributeReceiveVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fTo->getNX1(); - int maxX2 = (int)fTo->getNX2(); - int maxX3 = (int)fTo->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - - int indexEvEv = 0; - int indexEvOd = 0; - int indexOdEv = 0; - int indexOdOd = 0; - - vector_type& dataEvEv = this->receiverEvenEvenSW->getData(); - vector_type& dataEvOd = this->receiverEvenOddNW->getData(); - vector_type& dataOdEv = this->receiverOddEvenSE->getData(); - vector_type& dataOdOd = this->receiverOddOddNE->getData(); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int dummy; - - switch(sendDir) - { - case E: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case W: - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case N: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case S: - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case T: - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case B: - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3++) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2++) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1++) - { - LBMReal icellC[27]; - this->readICellCfromData(data, index, icellC); - this->writeICellC(fTo, icellC, ix1, ix2, ix3); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::readICellCfromData(vector_type& data, int& index, LBMReal* icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - icellC[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::writeICellC(DistributionArray3DPtr f, LBMReal* icellC, const int& x1, const int& x2, const int& x3) -{ - f->setDistributionInv(icellC, x1, x2, x3); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) -{ - using namespace D3Q27System; - - if(block.lock()->hasInterpolationFlagCF(E)) - { - maxX1 -= 2; - } - if(block.lock()->hasInterpolationFlagCF(W)) - { - minX1 += 2; - } - if(block.lock()->hasInterpolationFlagCF(N)) - { - maxX2 -= 2; - } - if(block.lock()->hasInterpolationFlagCF(S)) - { - minX2 += 2; - } - if(block.lock()->hasInterpolationFlagCF(T)) - { - maxX3 -= 2; - } - if(block.lock()->hasInterpolationFlagCF(B)) - { - minX3 += 2; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -double D3Q27ETCFVectorConnector<VectorTransmitter>::getSendRecieveTime() -{ - return 0; -} - -#endif diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.cpp deleted file mode 100644 index 08279fe62..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.cpp +++ /dev/null @@ -1,275 +0,0 @@ -#include "D3Q27ETDirectConnector.h" -#include "LBMKernelETD3Q27.h" -#include "EsoTwistD3Q27System.h" - - -using namespace std; - -//Im Anschluss sind die Bulkbereiche synchron - -//*==========================================================*/ -void D3Q27ETDirectConnector::sendVectors() -{ - EsoTwist3DPtr fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - EsoTwist3DPtr fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); - - int maxX1 = (int)fFrom->getNX1()-1; - int maxX2 = (int)fFrom->getNX2()-1; - int maxX3 = (int)fFrom->getNX3()-1; - - LBMReal f[D3Q27System::ENDF+1]; - - //EAST - if(sendDir==D3Q27System::E) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,maxX1-1,x2,x3); - fTo->setDistributionForDirection(f,0,x2,x3,EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etE - | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTE - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBSE); - } - } - } - //WEST - else if(sendDir==D3Q27System::W) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,1,x2,x3); - fTo->setDistributionForDirection(f,maxX1,x2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etW - | EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etTW - | EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTSW | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBSW); - } - } - } - //NORTH - else if(sendDir==D3Q27System::N) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,maxX2-1,x3); - fTo->setDistributionForDirection(f,x1,0,x3,EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etN - | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTN - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTNE | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBNE); - } - } - } - //SOUTH - else if(sendDir==D3Q27System::S) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,1,x3); - fTo->setDistributionForDirection(f,x1,maxX2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etS - | EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etBS | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - } - } - } - - //TOP - else if(sendDir==D3Q27System::T) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,x2,maxX3-1); - fTo->setDistributionForDirection(f,x1,x2,0,EsoTwistD3Q27System::etTW | EsoTwistD3Q27System::etT - | EsoTwistD3Q27System::etTE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etTN | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTNW | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE); - } - } - } - //BOTTOM - else if(sendDir==D3Q27System::B) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,x2,1); - fTo->setDistributionForDirection(f,x1,x2,maxX3,EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etB - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etBS - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBNW | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - } - } - } - //NORTHEAST - else if(sendDir==D3Q27System::NE) - { - for(int x3=1; x3<maxX3; x3++) - { - fFrom->getDistributionInv(f,maxX1-1,maxX2-1,x3); - fTo->setDistributionForDirection(f,0,0,x3,EsoTwistD3Q27System::etNE - | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etBNE); - } - } - //NORTHWEST - else if(sendDir==D3Q27System::NW) - { - for(int x3=1; x3<maxX3; x3++) - { - fFrom->getDistributionInv(f,1,maxX2-1,x3); - fTo->setDistributionForDirection(f,maxX1,0,x3,EsoTwistD3Q27System::etNW - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etBNW); - } - } - //SOUTHWEST - else if(sendDir==D3Q27System::SW) - { - for(int x3=1; x3<maxX3; x3++) - { - fFrom->getDistributionInv(f,1,1,x3); - fTo->setDistributionForDirection(f,maxX1,maxX2,x3,EsoTwistD3Q27System::etSW - | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etBSW); - } - } - //SOUTHEAST - else if(sendDir==D3Q27System::SE) - { - for(int x3=1; x3<maxX3; x3++) - { - fFrom->getDistributionInv(f,maxX1-1,1,x3); - fTo->setDistributionForDirection(f,0,maxX2,x3,EsoTwistD3Q27System::etSE - | EsoTwistD3Q27System::etTSE - | EsoTwistD3Q27System::etBSE); - } - } - else if(sendDir==D3Q27System::TE) - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,maxX1-1,x2,maxX3-1); - fTo->setDistributionForDirection(f,0,x2,0,EsoTwistD3Q27System::etTE - | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTSE); - } - else if(sendDir==D3Q27System::BW) - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,1,x2,1); - fTo->setDistributionForDirection(f,maxX1,x2,maxX3,EsoTwistD3Q27System::etBW - | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBSW); - } - else if(sendDir==D3Q27System::BE) - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,maxX1-1,x2,1); - fTo->setDistributionForDirection(f,0,x2,maxX3,EsoTwistD3Q27System::etBE - | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBSE); - } - else if(sendDir==D3Q27System::TW) - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,1,x2,maxX3-1); - fTo->setDistributionForDirection(f,maxX1,x2,0,EsoTwistD3Q27System::etTW - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTSW); - } - else if(sendDir==D3Q27System::TN) - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,maxX2-1,maxX3-1); - fTo->setDistributionForDirection(f,x1,0,0,EsoTwistD3Q27System::etTN - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTNE); - } - else if(sendDir==D3Q27System::BS) - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,1,1); - fTo->setDistributionForDirection(f,x1,maxX2,maxX3,EsoTwistD3Q27System::etBS - | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - } - else if(sendDir==D3Q27System::BN) - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,maxX2-1,1); - fTo->setDistributionForDirection(f,x1,0,maxX3,EsoTwistD3Q27System::etBN - | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBNE); - } - - else if(sendDir==D3Q27System::TS) - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,1,maxX3-1); - fTo->setDistributionForDirection(f,x1,maxX2,0,EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE); - } - - else if(sendDir==D3Q27System::TSW) - { - fFrom->getDistributionInv(f,1,1,maxX3-1); - fTo->setDistributionForDirection(f,maxX1,maxX2,0,EsoTwistD3Q27System::etTSW); - } - else if(sendDir==D3Q27System::TSE) - { - fFrom->getDistributionInv(f,maxX1-1,1,maxX3-1); - fTo->setDistributionForDirection(f,0,maxX2,0,EsoTwistD3Q27System::etTSE); - } - else if(sendDir==D3Q27System::TNW) - { - fFrom->getDistributionInv(f,1,maxX2-1,maxX3-1); - fTo->setDistributionForDirection(f,maxX1,0,0,EsoTwistD3Q27System::etTNW); - } - else if(sendDir==D3Q27System::TNE) - { - fFrom->getDistributionInv(f,maxX1-1,maxX2-1,maxX3-1); - fTo->setDistributionForDirection(f,0,0,0,EsoTwistD3Q27System::etTNE); - } - else if(sendDir==D3Q27System::BSW) - { - fFrom->getDistributionInv(f,1,1,1); - fTo->setDistributionForDirection(f,maxX1,maxX2,maxX3,EsoTwistD3Q27System::etBSW); - } - else if(sendDir==D3Q27System::BSE) - { - fFrom->getDistributionInv(f,maxX1-1,1,1); - fTo->setDistributionForDirection(f,0,maxX2,maxX3,EsoTwistD3Q27System::etBSE); - } - else if(sendDir==D3Q27System::BNW) - { - fFrom->getDistributionInv(f,1,maxX2-1,1); - fTo->setDistributionForDirection(f,maxX1,0,maxX3,EsoTwistD3Q27System::etBNW); - } - else if(sendDir==D3Q27System::BNE) - { - fFrom->getDistributionInv(f,maxX1-1,maxX2-1,1); - fTo->setDistributionForDirection(f,0,0,maxX3,EsoTwistD3Q27System::etBNE); - } - else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -////////////////////////////////////////////////////////////////////////// -double D3Q27ETDirectConnector::getSendRecieveTime() -{ - return 0; -} diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.h deleted file mode 100644 index f7cc7119a..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef D3Q27DIRECTCONNECTOR_H -#define D3Q27DIRECTCONNECTOR_H - -#include <boost/weak_ptr.hpp> - -#include "Block3DConnector.h" -#include "Block3D.h" - -class D3Q27ETDirectConnector : public Block3DConnector -{ -public: - D3Q27ETDirectConnector(Block3DPtr from, Block3DPtr to, const int& sendDir) - : Block3DConnector(sendDir) - , from(from) - , to(to) - { - - } - - void sendTransmitterDataSize() { } - void receiveTransmitterDataSize() { } - void init() { } - void prepareForReceive() { } - void prepareForSend() { } - void fillSendVectors() { } - void sendVectors();// { } - void receiveVectors() { } - - void distributeReceiveVectors() { } - - bool isLocalConnector() { return true; } - bool isRemoteConnector() { return false; } - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - boost::weak_ptr<Block3D> from; - boost::weak_ptr<Block3D> to; -}; - -#endif //D3Q27DIRECTCONNECTOR_H - diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.cpp deleted file mode 100644 index e17616314..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.cpp +++ /dev/null @@ -1,435 +0,0 @@ -#include "D3Q27ETDirectConnector2.h" -#include "LBMKernelETD3Q27.h" -#include "EsoTwistD3Q27System.h" - - -using namespace std; - -//Im Anschluss sind die Bulkbereiche synchron - -//*==========================================================*/ -void D3Q27ETDirectConnector2::sendVectors() -{ - EsoTwist3DPtr fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - EsoTwist3DPtr fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); - - int maxX1 = (int)fFrom->getNX1()-1; - int maxX2 = (int)fFrom->getNX2()-1; - int maxX3 = (int)fFrom->getNX3()-1; - - LBMReal f[D3Q27System::ENDF+1]; - - //EAST - //if(sendDir==D3Q27System::E) - //{ - // for(int x3=1; x3<maxX3; x3++) - // { - // for(int x2=1; x2<maxX2; x2++) - // { - // fFrom->getDistribution(f,maxX1,x2,x3); - // fTo->setDistributionInvForDirection(f,1,x2,x3,EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etE - // | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTE - // | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBNE - // | EsoTwistD3Q27System::etBSE); - - // //////////DEBUG - // //LBMReal fdebug[D3Q27System::ENDF+1]; - // //fTo->getDistribution(fdebug,0,x2,x3); - - // - // //////////DEBUG - // //fTo->getDistribution(fdebug,0,x2,x3); - - // fFrom->getDistribution(f,maxX1-1,x2,x3); - // fTo->setDistributionInvForDirection(f,0,x2,x3,EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etE - // | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTE - // | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBNE - // | EsoTwistD3Q27System::etBSE); - - // } - // } - //} - ////WEST - //else if(sendDir==D3Q27System::W) - //{ - // for(int x3=1; x3<maxX3; x3++) - // { - // for(int x2=1; x2<maxX2; x2++) - // { - // fFrom->getDistribution(f,0,x2,x3); - // fTo->setDistributionInvForDirection(f,maxX1-1,x2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etW - // | EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etTW - // | EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etTSW | EsoTwistD3Q27System::etBNW - // | EsoTwistD3Q27System::etBSW); - // fFrom->getDistribution(f,1,x2,x3); - // fTo->setDistributionInvForDirection(f,maxX1,x2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etW - // | EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etTW - // | EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etTSW | EsoTwistD3Q27System::etBNW - // | EsoTwistD3Q27System::etBSW); - // } - // } - //} - //NORTH - /*else*/ if(sendDir==D3Q27System::N) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistribution(f,x1,maxX2,x3); - fTo->setDistributionInvForDirection(f,x1,1,x3,EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etN - | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTN - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTNE | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBNE); - //fFrom->getDistribution(f,x1,maxX2-1,x3); - //fTo->setDistributionInvForDirection(f,x1,0,x3,EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etN - // | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTN - // | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etTNE | EsoTwistD3Q27System::etBNW - // | EsoTwistD3Q27System::etBNE); - } - } - } - //SOUTH - /*else*/ if(sendDir==D3Q27System::S) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistribution(f,x1,0,x3); - fTo->setDistributionInvForDirection(f,x1,maxX2-1,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etS - | EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etBS | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - - - - //fFrom->getDistribution(f,x1,1,x3); - - ////////////DEBUG - //LBMReal fdebug[D3Q27System::ENDF+1]; - //fTo->getDistribution(fdebug,x1,maxX2,x3); - // - //fTo->setDistributionInvForDirection(f,x1,maxX2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etS - // | EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etTS - // | EsoTwistD3Q27System::etBS | EsoTwistD3Q27System::etTSW - // | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBSW - // | EsoTwistD3Q27System::etBSE); - - ////////////DEBUG - //fTo->getDistribution(fdebug,x1,maxX2,x3); - - //int deb = 0; - } - } - } - - //TOP - else if(sendDir==D3Q27System::T) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - ////////////DEBUG - LBMReal fdebug[D3Q27System::ENDF+1]; - fTo->getDistribution(fdebug,x1,x2,0); - - fFrom->getDistribution(f,x1,x2,maxX3); - fTo->setDistributionInvForDirection(f,x1,x2,1,EsoTwistD3Q27System::etTW | EsoTwistD3Q27System::etT - | EsoTwistD3Q27System::etTE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etTN | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTNW | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE); - //fFrom->getDistribution(f,x1,x2,maxX3-1); - //fTo->setDistributionInvForDirection(f,x1,x2,0,EsoTwistD3Q27System::etTW | EsoTwistD3Q27System::etT - // | EsoTwistD3Q27System::etTE | EsoTwistD3Q27System::etTS - // | EsoTwistD3Q27System::etTN | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etTNW | EsoTwistD3Q27System::etTSW - // | EsoTwistD3Q27System::etTSE); - ////////////DEBUG - fTo->getDistribution(fdebug,x1,x2,0); - int deb = 0; - } - } - } - //BOTTOM - else if(sendDir==D3Q27System::B) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistribution(f,x1,x2,0); - - ////////////DEBUG - LBMReal fdebug1[D3Q27System::ENDF+1]; - fTo->getDistribution(fdebug1,x1,x2,maxX3-1); - - fTo->setDistributionInvForDirection(f,x1,x2,maxX3-1,EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etB - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etBS - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBNW | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - - fTo->getDistribution(fdebug1,x1,x2,maxX3-1); - - ////////////DEBUG - LBMReal fdebug[D3Q27System::ENDF+1]; - fTo->getDistribution(fdebug,x1,x2,maxX3); - - fFrom->getDistribution(f,x1,x2,1); - fTo->setDistributionInvForDirection(f,x1,x2,maxX3,EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etB - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etBS - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBNW | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - //fTo->setDistributionInvForDirection(f,x1,x2,maxX3,EsoTwistD3Q27System::etTW | EsoTwistD3Q27System::etT - // | EsoTwistD3Q27System::etTE | EsoTwistD3Q27System::etTS - // | EsoTwistD3Q27System::etTN | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etTNW | EsoTwistD3Q27System::etTSW - // | EsoTwistD3Q27System::etTSE); - fTo->getDistribution(fdebug,x1,x2,maxX3); - int deb = 0; - LBMReal temp1, temp2; - for (int i = 0; i<26;i++) - { - temp1 = fTo->getDistributionInvForDirection(x1,x2,maxX3,i); - temp2 = fTo->getDistributionInvForDirection(x1,x2,maxX3,D3Q27System::INVDIR[i]); - fTo->setDistributionInvForDirection(temp1,x1,x2,maxX3,D3Q27System::INVDIR[i]); - fTo->setDistributionInvForDirection(temp2,x1,x2,maxX3,i); - } - } - } - } - ////NORTHEAST - //else if(sendDir==D3Q27System::NE) - //{ - // for(int x3=1; x3<maxX3; x3++) - // { - // fFrom->getDistribution(f,maxX1,maxX2,x3); - // fTo->setDistributionInvForDirection(f,1,1,x3,EsoTwistD3Q27System::etNE - // | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etBNE); - // fFrom->getDistribution(f,maxX1-1,maxX2-1,x3); - // fTo->setDistributionInvForDirection(f,0,0,x3,EsoTwistD3Q27System::etNE - // | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etBNE); - // } - //} - ////NORTHWEST - //else if(sendDir==D3Q27System::NW) - //{ - // for(int x3=1; x3<maxX3; x3++) - // { - // fFrom->getDistribution(f,0,maxX2,x3); - // fTo->setDistributionInvForDirection(f,maxX1-1,1,x3,EsoTwistD3Q27System::etNW - // | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etBNW); - // fFrom->getDistribution(f,1,maxX2-1,x3); - // fTo->setDistributionInvForDirection(f,maxX1,0,x3,EsoTwistD3Q27System::etNW - // | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etBNW); - // } - //} - ////SOUTHWEST - //else if(sendDir==D3Q27System::SW) - //{ - // for(int x3=1; x3<maxX3; x3++) - // { - // fFrom->getDistribution(f,0,0,x3); - // fTo->setDistributionInvForDirection(f,maxX1-1,maxX2-1,x3,EsoTwistD3Q27System::etSW - // | EsoTwistD3Q27System::etTSW - // | EsoTwistD3Q27System::etBSW); - // fFrom->getDistribution(f,1,1,x3); - // fTo->setDistributionInvForDirection(f,maxX1,maxX2,x3,EsoTwistD3Q27System::etSW - // | EsoTwistD3Q27System::etTSW - // | EsoTwistD3Q27System::etBSW); - - // } - //} - ////SOUTHEAST - //else if(sendDir==D3Q27System::SE) - //{ - // for(int x3=1; x3<maxX3; x3++) - // { - // fFrom->getDistribution(f,maxX1,0,x3); - // fTo->setDistributionInvForDirection(f,1,maxX2-1,x3,EsoTwistD3Q27System::etSE - // | EsoTwistD3Q27System::etTSE - // | EsoTwistD3Q27System::etBSE); - // fFrom->getDistribution(f,maxX1-1,1,x3); - // fTo->setDistributionInvForDirection(f,0,maxX2,x3,EsoTwistD3Q27System::etSE - // | EsoTwistD3Q27System::etTSE - // | EsoTwistD3Q27System::etBSE); - // } - //} - //else if(sendDir==D3Q27System::TE) - // for(int x2=1; x2<maxX2; x2++) - // { - // fFrom->getDistribution(f,maxX1,x2,maxX3); - // fTo->setDistributionInvForDirection(f,1,x2,1,EsoTwistD3Q27System::etTE - // | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etTSE); - // fFrom->getDistribution(f,maxX1-1,x2,maxX3-1); - // fTo->setDistributionInvForDirection(f,0,x2,0,EsoTwistD3Q27System::etTE - // | EsoTwistD3Q27System::etTNE - // | EsoTwistD3Q27System::etTSE); - - // } - //else if(sendDir==D3Q27System::BW) - // for(int x2=1; x2<maxX2; x2++) - // { - // fFrom->getDistribution(f,0,x2,0); - // fTo->setDistributionInvForDirection(f,maxX1-1,x2,maxX3-1,EsoTwistD3Q27System::etBW - // | EsoTwistD3Q27System::etBNW - // | EsoTwistD3Q27System::etBSW); - // fFrom->getDistribution(f,1,x2,1); - // fTo->setDistributionInvForDirection(f,maxX1,x2,maxX3,EsoTwistD3Q27System::etBW - // | EsoTwistD3Q27System::etBNW - // | EsoTwistD3Q27System::etBSW); - // } - //else if(sendDir==D3Q27System::BE) - // for(int x2=1; x2<maxX2; x2++) - // { - // fFrom->getDistribution(f,maxX1,x2,0); - // fTo->setDistributionInvForDirection(f,1,x2,maxX3-1,EsoTwistD3Q27System::etBE - // | EsoTwistD3Q27System::etBNE - // | EsoTwistD3Q27System::etBSE); - // fFrom->getDistribution(f,maxX1-1,x2,1); - // fTo->setDistributionInvForDirection(f,0,x2,maxX3,EsoTwistD3Q27System::etBE - // | EsoTwistD3Q27System::etBNE - // | EsoTwistD3Q27System::etBSE); - // } - //else if(sendDir==D3Q27System::TW) - // for(int x2=1; x2<maxX2; x2++) - // { - // fFrom->getDistribution(f,0,x2,maxX3); - // fTo->setDistributionInvForDirection(f,maxX1-1,x2,1,EsoTwistD3Q27System::etTW - // | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etTSW); - // fFrom->getDistribution(f,1,x2,maxX3-1); - // fTo->setDistributionInvForDirection(f,maxX1,x2,0,EsoTwistD3Q27System::etTW - // | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etTSW); - // } - //else if(sendDir==D3Q27System::TN) - // for(int x1=1; x1<maxX1; x1++) - // { - // fFrom->getDistribution(f,x1,maxX2,maxX3); - // fTo->setDistributionInvForDirection(f,x1,1,1,EsoTwistD3Q27System::etTN - // | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etTNE); - // fFrom->getDistribution(f,x1,maxX2-1,maxX3-1); - // fTo->setDistributionInvForDirection(f,x1,0,0,EsoTwistD3Q27System::etTN - // | EsoTwistD3Q27System::etTNW - // | EsoTwistD3Q27System::etTNE); - - // } - //else if(sendDir==D3Q27System::BS) - // for(int x1=1; x1<maxX1; x1++) - // { - // fFrom->getDistribution(f,x1,0,0); - // fTo->setDistributionInvForDirection(f,x1,maxX2-1,maxX3-1,EsoTwistD3Q27System::etBS - // | EsoTwistD3Q27System::etBSW - // | EsoTwistD3Q27System::etBSE); - // fFrom->getDistribution(f,x1,1,1); - // fTo->setDistributionInvForDirection(f,x1,maxX2,maxX3,EsoTwistD3Q27System::etBS - // | EsoTwistD3Q27System::etBSW - // | EsoTwistD3Q27System::etBSE); - // } - //else if(sendDir==D3Q27System::BN) - // for(int x1=1; x1<maxX1; x1++) - // { - // fFrom->getDistribution(f,x1,maxX2,0); - // fTo->setDistributionInvForDirection(f,x1,1,maxX3-1,EsoTwistD3Q27System::etBN - // | EsoTwistD3Q27System::etBNW - // | EsoTwistD3Q27System::etBNE); - // fFrom->getDistribution(f,x1,maxX2-1,1); - // fTo->setDistributionInvForDirection(f,x1,0,maxX3,EsoTwistD3Q27System::etBN - // | EsoTwistD3Q27System::etBNW - // | EsoTwistD3Q27System::etBNE); - // } - - //else if(sendDir==D3Q27System::TS) - // for(int x1=1; x1<maxX1; x1++) - // { - // fFrom->getDistribution(f,x1,0,maxX3); - // fTo->setDistributionInvForDirection(f,x1,maxX2-1,1,EsoTwistD3Q27System::etTS - // | EsoTwistD3Q27System::etTSW - // | EsoTwistD3Q27System::etTSE); - // fFrom->getDistribution(f,x1,1,maxX3-1); - // fTo->setDistributionInvForDirection(f,x1,maxX2,0,EsoTwistD3Q27System::etTS - // | EsoTwistD3Q27System::etTSW - // | EsoTwistD3Q27System::etTSE); - // } - - //else if(sendDir==D3Q27System::TSW) - //{ - // fFrom->getDistribution(f,0,0,maxX3); - // fTo->setDistributionInvForDirection(f,maxX1-1,maxX2-1,1,EsoTwistD3Q27System::etTSW); - // fFrom->getDistribution(f,1,1,maxX3-1); - // fTo->setDistributionInvForDirection(f,maxX1,maxX2,0,EsoTwistD3Q27System::etTSW); - //} - //else if(sendDir==D3Q27System::TSE) - //{ - // fFrom->getDistribution(f,maxX1,0,maxX3); - // fTo->setDistributionInvForDirection(f,1,maxX2-1,1,EsoTwistD3Q27System::etTSE); - // fFrom->getDistribution(f,maxX1-1,1,maxX3-1); - // fTo->setDistributionInvForDirection(f,0,maxX2,0,EsoTwistD3Q27System::etTSE); - //} - //else if(sendDir==D3Q27System::TNW) - //{ - // fFrom->getDistribution(f,0,maxX2,maxX3); - // fTo->setDistributionInvForDirection(f,maxX1-1,1,1,EsoTwistD3Q27System::etTNW); - // fFrom->getDistribution(f,1,maxX2-1,maxX3-1); - // fTo->setDistributionInvForDirection(f,maxX1,0,0,EsoTwistD3Q27System::etTNW); - //} - //else if(sendDir==D3Q27System::TNE) - //{ - // fFrom->getDistribution(f,maxX1,maxX2,maxX3); - // fTo->setDistributionInvForDirection(f,1,1,1,EsoTwistD3Q27System::etTNE); - // fFrom->getDistribution(f,maxX1-1,maxX2-1,maxX3-1); - // fTo->setDistributionInvForDirection(f,0,0,0,EsoTwistD3Q27System::etTNE); - //} - //else if(sendDir==D3Q27System::BSW) - //{ - // fFrom->getDistribution(f,0,0,0); - // fTo->setDistributionInvForDirection(f,maxX1-1,maxX2-1,maxX3-1,EsoTwistD3Q27System::etBSW); - // fFrom->getDistribution(f,1,1,1); - // fTo->setDistributionInvForDirection(f,maxX1,maxX2,maxX3,EsoTwistD3Q27System::etBSW); - //} - //else if(sendDir==D3Q27System::BSE) - //{ - // fFrom->getDistribution(f,maxX1,0,0); - // fTo->setDistributionInvForDirection(f,1,maxX2-1,maxX3-1,EsoTwistD3Q27System::etBSE); - // fFrom->getDistribution(f,maxX1-1,1,1); - // fTo->setDistributionInvForDirection(f,0,maxX2,maxX3,EsoTwistD3Q27System::etBSE); - //} - //else if(sendDir==D3Q27System::BNW) - //{ - // fFrom->getDistribution(f,0,maxX2,0); - // fTo->setDistributionInvForDirection(f,maxX1-1,1,maxX3-1,EsoTwistD3Q27System::etBNW); - // fFrom->getDistribution(f,1,maxX2-1,1); - // fTo->setDistributionInvForDirection(f,maxX1,0,maxX3,EsoTwistD3Q27System::etBNW); - //} - //else if(sendDir==D3Q27System::BNE) - //{ - // fFrom->getDistribution(f,maxX1,maxX2,0); - // fTo->setDistributionInvForDirection(f,1,1,maxX3-1,EsoTwistD3Q27System::etBNE); - // fFrom->getDistribution(f,maxX1-1,maxX2-1,1); - // fTo->setDistributionInvForDirection(f,0,0,maxX3,EsoTwistD3Q27System::etBNE); - //} - //else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -////////////////////////////////////////////////////////////////////////// -//double D3Q27ETDirectConnector2::getSendRecieveTime() -//{ -// return 0; -//} diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.h b/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.h deleted file mode 100644 index eeb790d68..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETDirectConnector2.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef D3Q27ETDirectConnector2_H -#define D3Q27ETDirectConnector2_H - -#include <boost/weak_ptr.hpp> - -#include "LocalBlock3DConnector.h" -#include "Block3D.h" - -class D3Q27ETDirectConnector2 : public LocalBlock3DConnector -{ -public: - D3Q27ETDirectConnector2(Block3DPtr from, Block3DPtr to, const int& sendDir) - : LocalBlock3DConnector(from, to, sendDir) - { - - } - void sendVectors(); -}; - -#endif //D3Q27ETDirectConnector2_H - diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h index 827ef9711..ea6cea2f7 100644 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h +++ b/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h @@ -21,12 +21,10 @@ #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> -#include "D3Q27ETFCVectorConnector.h" -//#include "FineToCoarseBlock3DConnector.h" class Block3D; -//enum CFconnectorType {EvenOddNW, EvenEvenSW, OddEvenSE, OddOddNE}; +enum CFconnectorType {EvenOddNW, EvenEvenSW, OddEvenSE, OddOddNE}; //daten werden in einen vector (dieser befindet sich im transmitter) kopiert //der vector wird via transmitter uebertragen @@ -1289,7 +1287,7 @@ void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, ////T-B-N-S - if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T)&& connType != none) + if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T)) { if (maxX2==TmaxX2) maxX2 -= 3; if (maxX3==TmaxX3) maxX3 -= 3; diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.cpp deleted file mode 100644 index 09740a2d4..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "D3Q27ETFCVectorConnector.h" diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h deleted file mode 100644 index 6ea987080..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h +++ /dev/null @@ -1,537 +0,0 @@ -/** -* @file D3Q27ETFCVectorConnector.h -* @brief Interpolation from fine level to coarse. -* @author Kostyantyn Kucher -* @date 08.06.2011 -*/ -#ifndef D3Q27ETFCVECTORCONNECTOR_H -#define D3Q27ETFCVECTORCONNECTOR_H - -#include <vector> - -#include "basics/transmitter/TbTransmitter.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernelETD3Q27.h" -#include "D3Q27InterpolationProcessor.h" -#include "MathUtil.hpp" - -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -class Block3D; -enum CFconnectorType {EvenOddNW, EvenEvenSW, OddEvenSE, OddOddNE, none}; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) - -template< typename VectorTransmitter > -class D3Q27ETFCVectorConnector : public Block3DConnector -{ -public: - -protected: - typedef typename VectorTransmitter::value_type vector_type; - typedef boost::shared_ptr< VectorTransmitter > VectorTransmitterPtr; -public: - D3Q27ETFCVectorConnector(Block3DPtr block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, D3Q27InterpolationProcessorPtr iprocessor, CFconnectorType connType); - - bool isLocalConnector(); - bool isRemoteConnector(); - void init(); - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - void fillSendVectors(); - void distributeReceiveVectors(); - - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return true; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - boost::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - //gegenstelle muss "inversen" connector besitzen - - VectorTransmitterPtr sender, receiver; - - D3Q27InterpolationProcessorPtr iprocessor; - - CFconnectorType connType; - - void readICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3) ; - void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC); - void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - void getLocalMinMaxCF(int gMax, int& lMin, int& lMax); - void fillSendVector(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - - void distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF); - void writeICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3); - void readNodeFromVector(vector_type& data, int& index, LBMReal* inode); - void getLocalOffsets(const int& gMax, int& oMin); - void getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3); -}; -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -D3Q27ETFCVectorConnector<VectorTransmitter>::D3Q27ETFCVectorConnector(Block3DPtr block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir, - D3Q27InterpolationProcessorPtr iprocessor, - CFconnectorType connType) - : Block3DConnector(sendDir) - , block(block) - , sender(sender) - , receiver(receiver) - , iprocessor(iprocessor) - , connType(connType) -{ - if( !( sendDir==D3Q27System::E || sendDir==D3Q27System::W || sendDir==D3Q27System::N - || sendDir==D3Q27System::S || sendDir==D3Q27System::T || sendDir==D3Q27System::B ) ) - { - throw UbException(UB_EXARGS,"invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETFCVectorConnector<VectorTransmitter>::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETFCVectorConnector<VectorTransmitter>::isRemoteConnector() -{ - return sender->isRemoteTransmitter() || receiver->isRemoteTransmitter(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::sendTransmitterDataSize() -{ - if(sender) sender->sendDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::receiveTransmitterDataSize() -{ - if(receiver) receiver->receiveDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::prepareForSend() -{ - if(sender) sender->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::sendVectors() -{ - if(sender) sender->sendData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::prepareForReceive() -{ - if(receiver) receiver->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::receiveVectors() -{ - if(receiver) receiver->receiveData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::init() -{ - using namespace D3Q27System; - - int maxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - int maxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - int maxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 1; //size of interpolation cell - - switch(this->sendDir) - { - case E : case W : sendSize = maxX2*maxX3*sendDataPerNode*iCellSize; break; - case N : case S : sendSize = maxX1*maxX3*sendDataPerNode*iCellSize; break; - case T : case B : sendSize = maxX1*maxX2*sendDataPerNode*iCellSize; break; - default: throw UbException(UB_EXARGS,"direction not allowed in this constructor"); - } - sender->getData().resize(sendSize, initValue); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1(); - int maxX2 = (int)fFrom->getNX2(); - int maxX3 = (int)fFrom->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int oMinX1, oMinX2, oMinX3; - getLocalOffsets(maxX1, oMinX1); - getLocalOffsets(maxX2, oMinX2); - getLocalOffsets(maxX3, oMinX3); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int index = 0; - vector_type& data = sender->getData(); - - lMinX1 = minX1+1; lMinX2 = minX2+1; lMinX3 = minX3+1; - lMaxX1 = maxX1-2; lMaxX2 = maxX2-2; lMaxX3 = maxX3-2; - - switch(sendDir) - { - case E: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case W: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = 5; - lMaxX1 = lMinX1 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case N: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case S: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = 5; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case T: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case B: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX3 = 5; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::fillSendVector(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3+=2) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2+=2) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1+=2) - { - LBMReal icellC[27]; - D3Q27ICell icellF; - this->readICellF(fFrom, icellF, ix1, ix2, ix3); - iprocessor->interpolateFineToCoarse(icellF, icellC); - this->writeICellCtoData(data, index, icellC); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::readICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3) -{ - f->getDistribution(icellF.BSW, x1, x2, x3); - f->getDistribution(icellF.BSE, x1+1, x2, x3); - f->getDistribution(icellF.BNW, x1, x2+1, x3); - f->getDistribution(icellF.BNE, x1+1, x2+1, x3); - f->getDistribution(icellF.TSW, x1, x2, x3+1); - f->getDistribution(icellF.TSE, x1+1, x2, x3+1); - f->getDistribution(icellF.TNW, x1, x2+1, x3+1); - f->getDistribution(icellF.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - data[index++] = icellC[i]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::getLocalMinMaxCF(int gMax, int& lMin, int& lMax) -{ - if (Utilities::isOdd(gMax)) - { - if(connType == OddEvenSE || connType == OddOddNE) - { - lMin = 1; - lMax = gMax; - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::distributeReceiveVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fTo->getNX1(); - int maxX2 = (int)fTo->getNX2(); - int maxX3 = (int)fTo->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int index = 0; - vector_type& data = receiver->getData(); - - lMinX1 = minX1; lMinX2 = minX2; lMinX3 = minX3; - lMaxX1 = maxX1-1; lMaxX2 = maxX2-1; lMaxX3 = maxX3-1; - - switch(sendDir) - { - case E: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case W: - lMinX1 = 2; - lMaxX1 = lMinX1 + 1; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case N: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case S: - lMinX2 = 2; - lMaxX2 = lMinX2 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case T: - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case B: - lMinX3 = 2; - lMaxX3 = lMinX3 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3+=2) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2+=2) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1+=2) - { - D3Q27ICell icellF; - this->readICellFfromData(data, index, icellF); - this->writeICellF(fTo, icellF, ix1, ix2, ix3); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::writeICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3) -{ - f->setDistributionInv(icellF.BSW, x1, x2, x3); - f->setDistributionInv(icellF.BSE, x1+1, x2, x3); - f->setDistributionInv(icellF.BNW, x1, x2+1, x3); - f->setDistributionInv(icellF.BNE, x1+1, x2+1, x3); - f->setDistributionInv(icellF.TSW, x1, x2, x3+1); - f->setDistributionInv(icellF.TSE, x1+1, x2, x3+1); - f->setDistributionInv(icellF.TNW, x1, x2+1, x3+1); - f->setDistributionInv(icellF.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF) -{ - readNodeFromVector(data, index, icellF.BSW); - readNodeFromVector(data, index, icellF.BSE); - readNodeFromVector(data, index, icellF.BNW); - readNodeFromVector(data, index, icellF.BNE); - readNodeFromVector(data, index, icellF.TSW); - readNodeFromVector(data, index, icellF.TSE); - readNodeFromVector(data, index, icellF.TNW); - readNodeFromVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::readNodeFromVector(vector_type& data, int& index, LBMReal* inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - inode[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) -{ - using namespace D3Q27System; - - if(block.lock()->hasInterpolationFlagFC(E)) - { - maxX1 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(W)) - { - minX1 += 4; - } - if(block.lock()->hasInterpolationFlagFC(N)) - { - maxX2 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(S)) - { - minX2 += 4; - } - if(block.lock()->hasInterpolationFlagFC(T)) - { - maxX3 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(B)) - { - minX3 += 4; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::getLocalOffsets(const int& gMax, int& oMin) -{ - if (Utilities::isEven(gMax)) - { - oMin = 0; - } - if (Utilities::isOdd(gMax)) - { - oMin = -1; - } - -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3) -{ - using namespace D3Q27System; - - switch(sendDir) - { - case E: case W: - if(connType == OddEvenSE) - minX2 += oMinX2; - if(connType == OddOddNE) - { - minX2 += oMinX2; - minX3 += oMinX3; - } - if(connType == EvenOddNW) - minX3 += oMinX3; - break; - case N: case S: - if(connType == OddEvenSE) - minX1 += oMinX1; - if(connType == OddOddNE) - { - minX1 += oMinX1; - minX3 += oMinX3; - } - if(connType == EvenOddNW) - minX3 += oMinX3; - break; - case T: case B: - if(connType == OddEvenSE) - minX1 += oMinX1; - if(connType == OddOddNE) - { - minX1 += oMinX1; - minX2 += oMinX2; - } - if(connType == EvenOddNW) - minX2 += oMinX2; - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -double D3Q27ETFCVectorConnector<VectorTransmitter>::getSendRecieveTime() -{ - return 0; -} - -#endif diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h.bak b/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h.bak deleted file mode 100644 index aae19e2d5..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFCVectorConnector.h.bak +++ /dev/null @@ -1,511 +0,0 @@ -/** -* @file D3Q27ETFCVectorConnector.h -* @brief Interpolation from fine level to coarse. -* @author Kostyantyn Kucher -* @date 08.06.2011 -*/ -#ifndef D3Q27ETFCVECTORCONNECTOR_H -#define D3Q27ETFCVECTORCONNECTOR_H - -#include <vector> - -#include "basics/transmitter/TbTransmitter.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernelETD3Q27.h" -#include "D3Q27InterpolationProcessor.h" -#include "MathUtil.hpp" - -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -class Block3D; -enum CFconnectorType {EvenOddNW, EvenEvenSW, OddEvenSE, OddOddNE}; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) - -template< typename VectorTransmitter > -class D3Q27ETFCVectorConnector : public Block3DConnector -{ -public: - -protected: - typedef typename VectorTransmitter::value_type vector_type; - typedef boost::shared_ptr< VectorTransmitter > VectorTransmitterPtr; -public: - D3Q27ETFCVectorConnector(Block3DPtr block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, D3Q27InterpolationProcessorPtr iprocessor, CFconnectorType connType); - - bool isLocalConnector(); - bool isRemoteConnector(); - void init(); - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - void fillSendVectors(); - void distributeReceiveVectors(); - - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return true; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - boost::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - //gegenstelle muss "inversen" connector besitzen - - VectorTransmitterPtr sender, receiver; - - D3Q27InterpolationProcessorPtr iprocessor; - - CFconnectorType connType; - - void readICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3) ; - void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC); - void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - void fillSendVector(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - - void distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF); - void writeICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3); - void readNodeFromVector(vector_type& data, int& index, LBMReal* inode); - void getLocalOffsets(const int& gMax, int& oMin); - void getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3); -}; -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -D3Q27ETFCVectorConnector<VectorTransmitter>::D3Q27ETFCVectorConnector(Block3DPtr block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir, - D3Q27InterpolationProcessorPtr iprocessor, - CFconnectorType connType) - : Block3DConnector(sendDir) - , block(block) - , sender(sender) - , receiver(receiver) - , iprocessor(iprocessor) - , connType(connType) -{ - if( !( sendDir==D3Q27System::E || sendDir==D3Q27System::W || sendDir==D3Q27System::N - || sendDir==D3Q27System::S || sendDir==D3Q27System::T || sendDir==D3Q27System::B ) ) - { - throw UbException(UB_EXARGS,"invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETFCVectorConnector<VectorTransmitter>::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETFCVectorConnector<VectorTransmitter>::isRemoteConnector() -{ - return sender->isRemoteTransmitter() || receiver->isRemoteTransmitter(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::sendTransmitterDataSize() -{ - if(sender) sender->sendDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::receiveTransmitterDataSize() -{ - if(receiver) receiver->receiveDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::prepareForSend() -{ - if(sender) sender->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::sendVectors() -{ - if(sender) sender->sendData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::prepareForReceive() -{ - if(receiver) receiver->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::receiveVectors() -{ - if(receiver) receiver->receiveData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector<VectorTransmitter>::init() -{ - using namespace D3Q27System; - - int maxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - int maxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - int maxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 8; //size of interpolation cell - - switch(this->sendDir) - { - case E : case W : sendSize = maxX2*maxX3*sendDataPerNode*iCellSize; break; - case N : case S : sendSize = maxX1*maxX3*sendDataPerNode*iCellSize; break; - case T : case B : sendSize = maxX1*maxX2*sendDataPerNode*iCellSize; break; - default: throw UbException(UB_EXARGS,"direction not allowed in this constructor"); - } - sender->getData().resize(sendSize, initValue); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1(); - int maxX2 = (int)fFrom->getNX2(); - int maxX3 = (int)fFrom->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int oMinX1, oMinX2, oMinX3; - getLocalOffsets(maxX1, oMinX1); - getLocalOffsets(maxX2, oMinX2); - getLocalOffsets(maxX3, oMinX3); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int index = 0; - vector_type& data = sender->getData(); - - lMinX1 = minX1+1; lMinX2 = minX2+1; lMinX3 = minX3+1; - lMaxX1 = maxX1-2; lMaxX2 = maxX2-2; lMaxX3 = maxX3-2; - - switch(sendDir) - { - case E: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case W: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = 5; - lMaxX1 = lMinX1 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case N: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case S: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = 5; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case T: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case B: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX3 = 5; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::fillSendVector(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3+=2) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2+=2) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1+=2) - { - LBMReal icellC[27]; - D3Q27ICell icellF; - this->readICellF(fFrom, icellF, ix1, ix2, ix3); - iprocessor->interpolateFineToCoarse(icellF, icellC); - this->writeICellCtoData(data, index, icellC); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::readICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3) -{ - f->getDistribution(icellF.BSW, x1, x2, x3); - f->getDistribution(icellF.BSE, x1+1, x2, x3); - f->getDistribution(icellF.BNW, x1, x2+1, x3); - f->getDistribution(icellF.BNE, x1+1, x2+1, x3); - f->getDistribution(icellF.TSW, x1, x2, x3+1); - f->getDistribution(icellF.TSE, x1+1, x2, x3+1); - f->getDistribution(icellF.TNW, x1, x2+1, x3+1); - f->getDistribution(icellF.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - data[index++] = icellC[i]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::distributeReceiveVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fTo->getNX1(); - int maxX2 = (int)fTo->getNX2(); - int maxX3 = (int)fTo->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int index = 0; - vector_type& data = receiver->getData(); - - lMinX1 = minX1; lMinX2 = minX2; lMinX3 = minX3; - lMaxX1 = maxX1-1; lMaxX2 = maxX2-1; lMaxX3 = maxX3-1; - - switch(sendDir) - { - case E: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case W: - lMinX1 = 2; - lMaxX1 = lMinX1 + 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case N: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case S: - lMinX2 = 2; - lMaxX2 = lMinX2 + 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case T: - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case B: - lMinX3 = 2; - lMaxX3 = lMinX3 + 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3+=2) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2+=2) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1+=2) - { - D3Q27ICell icellF; - this->readICellFfromData(data, index, icellF); - this->writeICellF(fTo, icellF, ix1, ix2, ix3); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::writeICellF(DistributionArray3DPtr f, D3Q27ICell& icellF, const int& x1, const int& x2, const int& x3) -{ - f->setDistributionInv(icellF.BSW, x1, x2, x3); - f->setDistributionInv(icellF.BSE, x1+1, x2, x3); - f->setDistributionInv(icellF.BNW, x1, x2+1, x3); - f->setDistributionInv(icellF.BNE, x1+1, x2+1, x3); - f->setDistributionInv(icellF.TSW, x1, x2, x3+1); - f->setDistributionInv(icellF.TSE, x1+1, x2, x3+1); - f->setDistributionInv(icellF.TNW, x1, x2+1, x3+1); - f->setDistributionInv(icellF.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF) -{ - readNodeFromVector(data, index, icellF.BSW); - readNodeFromVector(data, index, icellF.BSE); - readNodeFromVector(data, index, icellF.BNW); - readNodeFromVector(data, index, icellF.BNE); - readNodeFromVector(data, index, icellF.TSW); - readNodeFromVector(data, index, icellF.TSE); - readNodeFromVector(data, index, icellF.TNW); - readNodeFromVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::readNodeFromVector(vector_type& data, int& index, LBMReal* inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - inode[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) -{ - using namespace D3Q27System; - - if(block.lock()->hasInterpolationFlagFC(E)) - { - maxX1 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(W)) - { - minX1 += 4; - } - if(block.lock()->hasInterpolationFlagFC(N)) - { - maxX2 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(S)) - { - minX2 += 4; - } - if(block.lock()->hasInterpolationFlagFC(T)) - { - maxX3 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(B)) - { - minX3 += 4; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::getLocalOffsets(const int& gMax, int& oMin) -{ - if (MathUtil::isEven(gMax)) - { - oMin = 0; - } - if (MathUtil::isOdd(gMax)) - { - oMin = -1; - } - -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCVectorConnector< VectorTransmitter>::getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3) -{ - using namespace D3Q27System; - - switch(sendDir) - { - case E: case W: - if(connType == OddEvenSE) - minX2 += oMinX2; - if(connType == OddOddNE) - { - minX2 += oMinX2; - minX3 += oMinX3; - } - if(connType == EvenOddNW) - minX3 += oMinX3; - break; - case N: case S: - if(connType == OddEvenSE) - minX1 += oMinX1; - if(connType == OddOddNE) - { - minX1 += oMinX1; - minX3 += oMinX3; - } - if(connType == EvenOddNW) - minX3 += oMinX3; - break; - case T: case B: - if(connType == OddEvenSE) - minX1 += oMinX1; - if(connType == OddOddNE) - { - minX1 += oMinX1; - minX2 += oMinX2; - } - if(connType == EvenOddNW) - minX2 += oMinX2; - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -double D3Q27ETFCVectorConnector<VectorTransmitter>::getSendRecieveTime() -{ - return 0; -} - -#endif diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp index 871834d19..aa5122fdf 100644 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp +++ b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp @@ -1,6 +1,6 @@ #include "D3Q27ETFullDirectConnector.h" #include "LBMKernelETD3Q27.h" -#include "EsoTwistD3Q27System.h" +#include "D3Q27EsoTwist3DSplittedVector.h" using namespace std; @@ -10,248 +10,201 @@ D3Q27ETFullDirectConnector::D3Q27ETFullDirectConnector(Block3DPtr from, Block3DP { -} -////////////////////////////////////////////////////////////////////////// -D3Q27ETFullDirectConnector::~D3Q27ETFullDirectConnector() -{ - } ////////////////////////////////////////////////////////////////////////// void D3Q27ETFullDirectConnector::init() { - fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); + maxX1 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1; + maxX2 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1; + maxX3 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1; - maxX2 = (int)fFrom->getNX2()-1; - maxX3 = (int)fFrom->getNX3()-1; - maxX1 = (int)fFrom->getNX1()-1; + fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); + fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); } ////////////////////////////////////////////////////////////////////////// void D3Q27ETFullDirectConnector::sendVectors() { + localDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions(); + nonLocalDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions(); + zeroDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions(); + + localDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions(); + nonLocalDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions(); + zeroDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions(); + //EAST - if(sendDir==D3Q27System::E) + if (sendDir == D3Q27System::E) { - for(int x3=1; x3<maxX3; x3++) + for (int x3 = 1; x3 < maxX3; x3++) { - for(int x2=1; x2<maxX2; x2++) + for (int x2 = 1; x2 < maxX2; x2++) { - fillData(fFrom,maxX1-1,x2,x3); - distributeData(fTo,0,x2,x3); + exchangeData(maxX1 - 1, x2, x3, 0, x2, x3); } } } //WEST - else if(sendDir==D3Q27System::W) + else if (sendDir == D3Q27System::W) { - for(int x3=1; x3<maxX3; x3++) + for (int x3 = 1; x3 < maxX3; x3++) { - for(int x2=1; x2<maxX2; x2++) + for (int x2 = 1; x2 < maxX2; x2++) { - fillData(fFrom,1,x2,x3); - distributeData(fTo,maxX1,x2,x3); + exchangeData(1, x2, x3, maxX1, x2, x3); } } } //NORTH - else if(sendDir==D3Q27System::N) + else if (sendDir == D3Q27System::N) { - for(int x3=1; x3<maxX3; x3++) + for (int x3 = 1; x3 < maxX3; x3++) { - for(int x1=1; x1<maxX1; x1++) - { - fillData(fFrom,x1,maxX2-1,x3); - distributeData(fTo,x1,0,x3); + for (int x1 = 1; x1 < maxX1; x1++) + { + exchangeData(x1, maxX2 - 1, x3, x1, 0, x3); } } } //SOUTH - else if(sendDir==D3Q27System::S) + else if (sendDir == D3Q27System::S) { - for(int x3=1; x3<maxX3; x3++) + for (int x3 = 1; x3 < maxX3; x3++) { - for(int x1=1; x1<maxX1; x1++) - { - fillData(fFrom,x1,1,x3); - distributeData(fTo,x1,maxX2,x3); + for (int x1 = 1; x1 < maxX1; x1++) + { + exchangeData(x1, 1, x3, x1, maxX2, x3); } } } //TOP - else if(sendDir==D3Q27System::T) + else if (sendDir == D3Q27System::T) { - for(int x2=1; x2<maxX2; x2++) + for (int x2 = 1; x2 < maxX2; x2++) { - for(int x1=1; x1<maxX1; x1++) - { - fillData(fFrom,x1,x2,maxX3-1); - distributeData(fTo,x1,x2,0); + for (int x1 = 1; x1 < maxX1; x1++) + { + exchangeData(x1, x2, maxX3 - 1, x1, x2, 0); } } } //BOTTOM - else if(sendDir==D3Q27System::B) + else if (sendDir == D3Q27System::B) { - for(int x2=1; x2<maxX2; x2++) + for (int x2 = 1; x2 < maxX2; x2++) { - for(int x1=1; x1<maxX1; x1++) - { - fillData(fFrom,x1,x2,1); - distributeData(fTo,x1,x2,maxX3); + for (int x1 = 1; x1 < maxX1; x1++) + { + exchangeData(x1, x2, 1, x1, x2, maxX3); } } } //NORTHEAST - else if(sendDir==D3Q27System::NE) - { - for(int x3=1; x3<maxX3; x3++) + else if (sendDir == D3Q27System::NE) + { + for (int x3 = 1; x3 < maxX3; x3++) { - fillData(fFrom,maxX1-1,maxX2-1,x3); - distributeData(fTo,0,0,x3); + exchangeData(maxX1 - 1, maxX2 - 1, x3, 0, 0, x3); } } //NORTHWEST - else if(sendDir==D3Q27System::NW) - { - for(int x3=1; x3<maxX3; x3++) + else if (sendDir == D3Q27System::NW) + { + for (int x3 = 1; x3 < maxX3; x3++) { - fillData(fFrom,1,maxX2-1,x3); - distributeData(fTo,maxX1,0,x3); + exchangeData(1, maxX2 - 1, x3, maxX1, 0, x3); } } //SOUTHWEST - else if(sendDir==D3Q27System::SW) - { - for(int x3=1; x3<maxX3; x3++) + else if (sendDir == D3Q27System::SW) + { + for (int x3 = 1; x3 < maxX3; x3++) { - fillData(fFrom,1,1,x3); - distributeData(fTo,maxX1,maxX2,x3); + exchangeData(1, 1, x3, maxX1, maxX2, x3); } } //SOUTHEAST - else if(sendDir==D3Q27System::SE) - { - for(int x3=1; x3<maxX3; x3++) + else if (sendDir == D3Q27System::SE) + { + for (int x3 = 1; x3 < maxX3; x3++) { - fillData(fFrom,maxX1-1,1,x3); - distributeData(fTo,0,maxX2,x3); + exchangeData(maxX1 - 1, 1, x3, 0, maxX2, x3); } } - else if(sendDir==D3Q27System::TE) - for(int x2=1; x2<maxX2; x2++) + else if (sendDir == D3Q27System::TE) + for (int x2 = 1; x2 < maxX2; x2++) { - fillData(fFrom,maxX1-1,x2,maxX3-1); - distributeData(fTo,0,x2,0); + exchangeData(maxX1 - 1, x2, maxX3 - 1, 0, x2, 0); } - else if(sendDir==D3Q27System::BW) - for(int x2=1; x2<maxX2; x2++) + else if (sendDir == D3Q27System::BW) + for (int x2 = 1; x2 < maxX2; x2++) { - fillData(fFrom,1,x2,1); - distributeData(fTo,maxX1,x2,maxX3); + exchangeData(1, x2, 1, maxX1, x2, maxX3); } - else if(sendDir==D3Q27System::BE) - for(int x2=1; x2<maxX2; x2++) + else if (sendDir == D3Q27System::BE) + for (int x2 = 1; x2 < maxX2; x2++) { - fillData(fFrom,maxX1-1,x2,1); - distributeData(fTo,0,x2,maxX3); + exchangeData(maxX1 - 1, x2, 1, 0, x2, maxX3); } - else if(sendDir==D3Q27System::TW) - for(int x2=1; x2<maxX2; x2++) + else if (sendDir == D3Q27System::TW) + for (int x2 = 1; x2 < maxX2; x2++) { - fillData(fFrom,1,x2,maxX3-1); - distributeData(fTo,maxX1,x2,0); + exchangeData(1, x2, maxX3 - 1, maxX1, x2, 0); } - else if(sendDir==D3Q27System::TN) - for(int x1=1; x1<maxX1; x1++) + else if (sendDir == D3Q27System::TN) + for (int x1 = 1; x1 < maxX1; x1++) { - fillData(fFrom,x1,maxX2-1,maxX3-1); - distributeData(fTo,x1,0,0); + exchangeData(x1, maxX2 - 1, maxX3 - 1, x1, 0, 0); } - else if(sendDir==D3Q27System::BS) - for(int x1=1; x1<maxX1; x1++) + else if (sendDir == D3Q27System::BS) + for (int x1 = 1; x1 < maxX1; x1++) { - fillData(fFrom,x1,1,1); - distributeData(fTo,x1,maxX2,maxX3); + exchangeData(x1, 1, 1, x1, maxX2, maxX3); } - else if(sendDir==D3Q27System::BN) - for(int x1=1; x1<maxX1; x1++) + else if (sendDir == D3Q27System::BN) + for (int x1 = 1; x1 < maxX1; x1++) { - fillData(fFrom,x1,maxX2-1,1); - distributeData(fTo,x1,0,maxX3); + exchangeData(x1, maxX2 - 1, 1, x1, 0, maxX3); } - else if(sendDir==D3Q27System::TS) - for(int x1=1; x1<maxX1; x1++) + else if (sendDir == D3Q27System::TS) + for (int x1 = 1; x1 < maxX1; x1++) { - fillData(fFrom,x1,1,maxX3-1); - distributeData(fTo,x1,maxX2,0); + exchangeData(x1, 1, maxX3 - 1, x1, maxX2, 0); } - else if(sendDir==D3Q27System::TSW) - { - fillData(fFrom,1,1,maxX3-1); - distributeData(fTo,maxX1,maxX2,0); - } - else if(sendDir==D3Q27System::TSE) - { - fillData(fFrom,maxX1-1,1,maxX3-1); - distributeData(fTo,0,maxX2,0); - } - else if(sendDir==D3Q27System::TNW) + else if (sendDir == D3Q27System::TSW) { - fillData(fFrom,1,maxX2-1,maxX3-1); - distributeData(fTo,maxX1,0,0); + exchangeData(1, 1, maxX3 - 1, maxX1, maxX2, 0); } - else if(sendDir==D3Q27System::TNE) + else if (sendDir == D3Q27System::TSE) { - fillData(fFrom,maxX1-1,maxX2-1,maxX3-1); - distributeData(fTo,0,0,0); + exchangeData(maxX1 - 1, 1, maxX3 - 1, 0, maxX2, 0); } - else if(sendDir==D3Q27System::BSW) + else if (sendDir == D3Q27System::TNW) { - fillData(fFrom,1,1,1); - distributeData(fTo,maxX1,maxX2,maxX3); + exchangeData(1, maxX2 - 1, maxX3 - 1, maxX1, 0, 0); } - else if(sendDir==D3Q27System::BSE) + else if (sendDir == D3Q27System::TNE) { - fillData(fFrom,maxX1-1,1,1); - distributeData(fTo,0,maxX2,maxX3); + exchangeData(maxX1 - 1, maxX2 - 1, maxX3 - 1, 0, 0, 0); } - else if(sendDir==D3Q27System::BNW) + else if (sendDir == D3Q27System::BSW) { - fillData(fFrom,1,maxX2-1,1); - distributeData(fTo,maxX1,0,maxX3); + exchangeData(1, 1, 1, maxX1, maxX2, maxX3); } - else if(sendDir==D3Q27System::BNE) + else if (sendDir == D3Q27System::BSE) { - fillData(fFrom,maxX1-1,maxX2-1,1); - distributeData(fTo,0,0,maxX3); + exchangeData(maxX1 - 1, 1, 1, 0, maxX2, maxX3); } - else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector::fillData(EsoTwist3DPtr fFrom, const int& x1, const int& x2, const int& x3) -{ - if(invStep) + else if (sendDir == D3Q27System::BNW) { - fFrom->getDistribution(f,x1,x2,x3); + exchangeData(1, maxX2 - 1, 1, maxX1, 0, maxX3); } - else + else if (sendDir == D3Q27System::BNE) { - fFrom->getDistributionInv(f,x1,x2,x3); + exchangeData(maxX1 - 1, maxX2 - 1, 1, 0, 0, maxX3); } + else UB_THROW(UbException(UB_EXARGS, "unknown dir")); } -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector::distributeData(EsoTwist3DPtr fTo, const int& x1, const int& x2, const int& x3) -{ - if(invStep) - { - fTo->setDistributionInv(f,x1,x2,x3); - } - else - { - fTo->setDistribution(f,x1,x2,x3); - } -} -////////////////////////////////////////////////////////////////////////// + diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h index dd93b325d..3dfbbf490 100644 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h +++ b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h @@ -1,39 +1,82 @@ /** * @file D3Q27ETFullDirectConnector.h * @brief Connector send and receive full distribution in shared memory -* -* @author Kostyantyn Kucher -* @date 08.06.2011 +* +* @author Konstantin Kutscher +* @date 28.04.2016 */ #ifndef D3Q27ETFULLDIRECTCONNECTOR_H #define D3Q27ETFULLDIRECTCONNECTOR_H -#include <boost/weak_ptr.hpp> - #include "LocalBlock3DConnector.h" #include "Block3D.h" #include "D3Q27System.h" +#include "basics/container/CbArray3D.h" +#include "basics/container/CbArray4D.h" + +//! \brief Exchange data between blocks. +//! \details Connector send and receive full distributions between two blocks in shared memory. +//! \author Konstantin Kutscher class D3Q27ETFullDirectConnector : public LocalBlock3DConnector { public: D3Q27ETFullDirectConnector(Block3DPtr from, Block3DPtr to, int sendDir); - virtual ~D3Q27ETFullDirectConnector(); - void init(); + void init(); void sendVectors(); - protected: - EsoTwist3DPtr fFrom; - EsoTwist3DPtr fTo; +protected: + inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To); +private: int maxX1; int maxX2; int maxX3; - LBMReal f[D3Q27System::ENDF+1]; - void fillData(EsoTwist3DPtr fFrom, const int& x1, const int& x2, const int& x3); - void distributeData(EsoTwist3DPtr fTo, const int& x1, const int& x2, const int& x3); + CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFrom; + CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFrom; + CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsFrom; + + CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTo; + CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTo; + CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsTo; + + EsoTwist3DPtr fFrom; + EsoTwist3DPtr fTo; }; +////////////////////////////////////////////////////////////////////////// +inline void D3Q27ETFullDirectConnector::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To) +{ + (*this->localDistributionsTo)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1From, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_N, x1From, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_T, x1From, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NE, x1From, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NW, x1From + 1, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TE, x1From, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1From + 1, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TN, x1From, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TS, x1From, x2From + 1, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNE, x1From, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From); + (*this->localDistributionsTo)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From); + + (*this->nonLocalDistributionsTo)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W, x1From + 1, x2From, x3From); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S, x1From, x2From + 1, x3From); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B, x1From, x2From, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE, x1From, x2From + 1, x3From); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE, x1From, x2From, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN, x1From, x2From, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1); + (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1); + + (*this->zeroDistributionsTo)(x1To, x2To, x3To) = (*this->zeroDistributionsFrom)(x1From, x2From, x3From); +} #endif diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp deleted file mode 100644 index 3056fc713..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#include "D3Q27ETFullDirectConnector2.h" -#include "LBMKernelETD3Q27.h" -#include "D3Q27EsoTwist3DSplittedVector.h" - - -using namespace std; - -D3Q27ETFullDirectConnector2::D3Q27ETFullDirectConnector2(Block3DPtr from, Block3DPtr to, int sendDir) - : LocalBlock3DConnector(from, to, sendDir) - -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector2::init() -{ - maxX1 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1()-1; - maxX2 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2()-1; - maxX3 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3()-1; - - fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); - - //localDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getLocalDistributions(); - //nonLocalDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getNonLocalDistributions(); - //zeroDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getZeroDistributions(); - - //localDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getLocalDistributions(); - //nonLocalDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getNonLocalDistributions(); - //zeroDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getZeroDistributions(); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector2::sendVectors() -{ - //EsoTwist3DPtr fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - //EsoTwist3DPtr fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); - - //int maxX1 = (int)fFrom->getNX1()-1; - //int maxX2 = (int)fFrom->getNX2()-1; - //int maxX3 = (int)fFrom->getNX3()-1; - - //LBMReal f[D3Q27System::ENDF+1]; - - //localDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getLocalDistributions(); - //nonLocalDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getNonLocalDistributions(); - //zeroDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getZeroDistributions(); - - //localDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getLocalDistributions(); - //nonLocalDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getNonLocalDistributions(); - //zeroDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getZeroDistributions(); - - localDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions(); - nonLocalDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions(); - zeroDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions(); - - localDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions(); - nonLocalDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions(); - zeroDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions(); - - //EAST - if(sendDir==D3Q27System::E) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fillData(maxX1-1,x2,x3); - distributeData(0,x2,x3); - } - } - } - //WEST - else if(sendDir==D3Q27System::W) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fillData(1,x2,x3); - distributeData(maxX1,x2,x3); - } - } - } - //NORTH - else if(sendDir==D3Q27System::N) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,maxX2-1,x3); - distributeData(x1,0,x3); - } - } - } - //SOUTH - else if(sendDir==D3Q27System::S) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,1,x3); - distributeData(x1,maxX2,x3); - } - } - } - - //TOP - else if(sendDir==D3Q27System::T) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,x2,maxX3-1); - distributeData(x1,x2,0); - } - } - } - //BOTTOM - else if(sendDir==D3Q27System::B) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,x2,1); - distributeData(x1,x2,maxX3); - } - } - } - //NORTHEAST - else if(sendDir==D3Q27System::NE) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(maxX1-1,maxX2-1,x3); - distributeData(0,0,x3); - } - } - //NORTHWEST - else if(sendDir==D3Q27System::NW) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(1,maxX2-1,x3); - distributeData(maxX1,0,x3); - } - } - //SOUTHWEST - else if(sendDir==D3Q27System::SW) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(1,1,x3); - distributeData(maxX1,maxX2,x3); - } - } - //SOUTHEAST - else if(sendDir==D3Q27System::SE) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(maxX1-1,1,x3); - distributeData(0,maxX2,x3); - } - } - else if(sendDir==D3Q27System::TE) - for(int x2=1; x2<maxX2; x2++) - { - fillData(maxX1-1,x2,maxX3-1); - distributeData(0,x2,0); - } - else if(sendDir==D3Q27System::BW) - for(int x2=1; x2<maxX2; x2++) - { - fillData(1,x2,1); - distributeData(maxX1,x2,maxX3); - } - else if(sendDir==D3Q27System::BE) - for(int x2=1; x2<maxX2; x2++) - { - fillData(maxX1-1,x2,1); - distributeData(0,x2,maxX3); - } - else if(sendDir==D3Q27System::TW) - for(int x2=1; x2<maxX2; x2++) - { - fillData(1,x2,maxX3-1); - distributeData(maxX1,x2,0); - } - else if(sendDir==D3Q27System::TN) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,maxX2-1,maxX3-1); - distributeData(x1,0,0); - } - else if(sendDir==D3Q27System::BS) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,1,1); - distributeData(x1,maxX2,maxX3); - } - else if(sendDir==D3Q27System::BN) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,maxX2-1,1); - distributeData(x1,0,maxX3); - } - - else if(sendDir==D3Q27System::TS) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,1,maxX3-1); - distributeData(x1,maxX2,0); - } - - else if(sendDir==D3Q27System::TSW) - { - fillData(1,1,maxX3-1); - distributeData(maxX1,maxX2,0); - } - else if(sendDir==D3Q27System::TSE) - { - fillData(maxX1-1,1,maxX3-1); - distributeData(0,maxX2,0); - } - else if(sendDir==D3Q27System::TNW) - { - fillData(1,maxX2-1,maxX3-1); - distributeData(maxX1,0,0); - } - else if(sendDir==D3Q27System::TNE) - { - fillData(maxX1-1,maxX2-1,maxX3-1); - distributeData(0,0,0); - } - else if(sendDir==D3Q27System::BSW) - { - fillData(1,1,1); - distributeData(maxX1,maxX2,maxX3); - } - else if(sendDir==D3Q27System::BSE) - { - fillData(maxX1-1,1,1); - distributeData(0,maxX2,maxX3); - } - else if(sendDir==D3Q27System::BNW) - { - fillData(1,maxX2-1,1); - distributeData(maxX1,0,maxX3); - } - else if(sendDir==D3Q27System::BNE) - { - fillData(maxX1-1,maxX2-1,1); - distributeData(0,0,maxX3); - } - else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -////////////////////////////////////////////////////////////////////////// -//void D3Q27ETFullDirectConnector2::fillData(/*EsoTwist3DPtr fFrom,*/ int x1, int x2, int x3) -//{ -// if(rfStep) -// { -// fFrom->getDistribution(f,x1,x2,x3); -// } -// else -// { -// fFrom->getDistributionInv(f,x1,x2,x3); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void D3Q27ETFullDirectConnector2::distributeData(/*EsoTwist3DPtr fTo,*/ int x1, int x2, int x3) -//{ -// if(rfStep) -// { -// fTo->setDistributionInv(f,x1,x2,x3); -// } -// else -// { -// fTo->setDistribution(f,x1,x2,x3); -// } -//} -////////////////////////////////////////////////////////////////////////// -//double D3Q27ETFullDirectConnector2::getSendRecieveTime() -//{ -// return 0; -//} diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp_old b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp_old deleted file mode 100644 index 78e0ee255..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.cpp_old +++ /dev/null @@ -1,274 +0,0 @@ -#include "D3Q27ETFullDirectConnector2.h" -#include "LBMKernelETD3Q27.h" -#include "D3Q27EsoTwist3DSplittedVector.h" - - -using namespace std; - -D3Q27ETFullDirectConnector2::D3Q27ETFullDirectConnector2(Block3DPtr from, Block3DPtr to, const int& sendDir) - : Block3DConnector(sendDir) - , from(from) - , to(to) -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector2::init() -{ - maxX1 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1()-1; - maxX2 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2()-1; - maxX3 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3()-1; - - fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector2::sendVectors() -{ - //EsoTwist3DPtr fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - //EsoTwist3DPtr fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); - - //int maxX1 = (int)fFrom->getNX1()-1; - //int maxX2 = (int)fFrom->getNX2()-1; - //int maxX3 = (int)fFrom->getNX3()-1; - - //LBMReal f[D3Q27System::ENDF+1]; - - localDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getLocalDistributions(); - nonLocalDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getNonLocalDistributions(); - zeroDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->from.lock()->getKernel()->getDataSet()->getFdistributions())->getZeroDistributions(); - - localDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getLocalDistributions(); - nonLocalDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getNonLocalDistributions(); - zeroDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->to.lock()->getKernel()->getDataSet()->getFdistributions())->getZeroDistributions(); - - //EAST - if(sendDir==D3Q27System::E) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fillData(maxX1-1,x2,x3); - distributeData(0,x2,x3); - } - } - } - //WEST - else if(sendDir==D3Q27System::W) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fillData(1,x2,x3); - distributeData(maxX1,x2,x3); - } - } - } - //NORTH - else if(sendDir==D3Q27System::N) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,maxX2-1,x3); - distributeData(x1,0,x3); - } - } - } - //SOUTH - else if(sendDir==D3Q27System::S) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,1,x3); - distributeData(x1,maxX2,x3); - } - } - } - - //TOP - else if(sendDir==D3Q27System::T) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,x2,maxX3-1); - distributeData(x1,x2,0); - } - } - } - //BOTTOM - else if(sendDir==D3Q27System::B) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,x2,1); - distributeData(x1,x2,maxX3); - } - } - } - //NORTHEAST - else if(sendDir==D3Q27System::NE) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(maxX1-1,maxX2-1,x3); - distributeData(0,0,x3); - } - } - //NORTHWEST - else if(sendDir==D3Q27System::NW) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(1,maxX2-1,x3); - distributeData(maxX1,0,x3); - } - } - //SOUTHWEST - else if(sendDir==D3Q27System::SW) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(1,1,x3); - distributeData(maxX1,maxX2,x3); - } - } - //SOUTHEAST - else if(sendDir==D3Q27System::SE) - { - for(int x3=1; x3<maxX3; x3++) - { - fillData(maxX1-1,1,x3); - distributeData(0,maxX2,x3); - } - } - else if(sendDir==D3Q27System::TE) - for(int x2=1; x2<maxX2; x2++) - { - fillData(maxX1-1,x2,maxX3-1); - distributeData(0,x2,0); - } - else if(sendDir==D3Q27System::BW) - for(int x2=1; x2<maxX2; x2++) - { - fillData(1,x2,1); - distributeData(maxX1,x2,maxX3); - } - else if(sendDir==D3Q27System::BE) - for(int x2=1; x2<maxX2; x2++) - { - fillData(maxX1-1,x2,1); - distributeData(0,x2,maxX3); - } - else if(sendDir==D3Q27System::TW) - for(int x2=1; x2<maxX2; x2++) - { - fillData(1,x2,maxX3-1); - distributeData(maxX1,x2,0); - } - else if(sendDir==D3Q27System::TN) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,maxX2-1,maxX3-1); - distributeData(x1,0,0); - } - else if(sendDir==D3Q27System::BS) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,1,1); - distributeData(x1,maxX2,maxX3); - } - else if(sendDir==D3Q27System::BN) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,maxX2-1,1); - distributeData(x1,0,maxX3); - } - - else if(sendDir==D3Q27System::TS) - for(int x1=1; x1<maxX1; x1++) - { - fillData(x1,1,maxX3-1); - distributeData(x1,maxX2,0); - } - - else if(sendDir==D3Q27System::TSW) - { - fillData(1,1,maxX3-1); - distributeData(maxX1,maxX2,0); - } - else if(sendDir==D3Q27System::TSE) - { - fillData(maxX1-1,1,maxX3-1); - distributeData(0,maxX2,0); - } - else if(sendDir==D3Q27System::TNW) - { - fillData(1,maxX2-1,maxX3-1); - distributeData(maxX1,0,0); - } - else if(sendDir==D3Q27System::TNE) - { - fillData(maxX1-1,maxX2-1,maxX3-1); - distributeData(0,0,0); - } - else if(sendDir==D3Q27System::BSW) - { - fillData(1,1,1); - distributeData(maxX1,maxX2,maxX3); - } - else if(sendDir==D3Q27System::BSE) - { - fillData(maxX1-1,1,1); - distributeData(0,maxX2,maxX3); - } - else if(sendDir==D3Q27System::BNW) - { - fillData(1,maxX2-1,1); - distributeData(maxX1,0,maxX3); - } - else if(sendDir==D3Q27System::BNE) - { - fillData(maxX1-1,maxX2-1,1); - distributeData(0,0,maxX3); - } - else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -////////////////////////////////////////////////////////////////////////// -//void D3Q27ETFullDirectConnector2::fillData(/*EsoTwist3DPtr fFrom,*/ int x1, int x2, int x3) -//{ -// if(rfStep) -// { -// fFrom->getDistribution(f,x1,x2,x3); -// } -// else -// { -// fFrom->getDistributionInv(f,x1,x2,x3); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void D3Q27ETFullDirectConnector2::distributeData(/*EsoTwist3DPtr fTo,*/ int x1, int x2, int x3) -//{ -// if(rfStep) -// { -// fTo->setDistributionInv(f,x1,x2,x3); -// } -// else -// { -// fTo->setDistribution(f,x1,x2,x3); -// } -//} -////////////////////////////////////////////////////////////////////////// -double D3Q27ETFullDirectConnector2::getSendRecieveTime() -{ - return 0; -} diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h deleted file mode 100644 index 61d2e0fdb..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h +++ /dev/null @@ -1,193 +0,0 @@ -/** -* @file D3Q27ETFullDirectConnector.h -* @brief Connector send and receive full distribution in shared memory -* -* @author Kostyantyn Kucher -* @date 08.06.2011 -*/ -#ifndef D3Q27ETFULLDIRECTCONNECTOR2_H -#define D3Q27ETFULLDIRECTCONNECTOR2_H - -#include <boost/weak_ptr.hpp> - -#include "LocalBlock3DConnector.h" -#include "Block3D.h" -#include "D3Q27System.h" -#include "basics/container/CbArray3D.h" -#include "basics/container/CbArray4D.h" - -class D3Q27ETFullDirectConnector2 : public LocalBlock3DConnector -{ -public: - //D3Q27ETFullDirectConnector2() {} - D3Q27ETFullDirectConnector2(Block3DPtr from, Block3DPtr to, int sendDir); - void init(); - void sendVectors(); - - protected: - //void fillData(EsoTwist3DPtr fFrom, int x1, int x2, int x3); - //void distributeData(EsoTwist3DPtr fTo, int x1, int x2, int x3); - - //void fillData(int x1, int x2, int x3); - //void distributeData(int x1, int x2, int x3); - - inline void fillData(int x1, int x2, int x3); - inline void distributeData(int x1, int x2, int x3); -private: - - LBMReal f[D3Q27System::ENDF+1]; - - int maxX1; - int maxX2; - int maxX3; - - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFrom; - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFrom; - CbArray3D <LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsFrom; - - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTo; - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTo; - CbArray3D <LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsTo; - - EsoTwist3DPtr fFrom; - EsoTwist3DPtr fTo; -}; - -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullDirectConnector2::fillData(int x1, int x2, int x3) -{ - if(invStep) - { - f[D3Q27System::E] = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1,x2,x3); - f[D3Q27System::N] = (*this->localDistributionsFrom)(D3Q27System::ET_N,x1,x2,x3); - f[D3Q27System::T] = (*this->localDistributionsFrom)(D3Q27System::ET_T,x1,x2,x3); - f[D3Q27System::NE] = (*this->localDistributionsFrom)(D3Q27System::ET_NE,x1,x2,x3); - f[D3Q27System::NW] = (*this->localDistributionsFrom)(D3Q27System::ET_NW,x1+1,x2,x3); - f[D3Q27System::TE] = (*this->localDistributionsFrom)(D3Q27System::ET_TE,x1,x2,x3); - f[D3Q27System::TW] = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1+1,x2,x3); - f[D3Q27System::TN] = (*this->localDistributionsFrom)(D3Q27System::ET_TN,x1,x2,x3); - f[D3Q27System::TS] = (*this->localDistributionsFrom)(D3Q27System::ET_TS,x1,x2+1,x3); - f[D3Q27System::TNE] = (*this->localDistributionsFrom)(D3Q27System::ET_TNE,x1,x2,x3); - f[D3Q27System::TNW] = (*this->localDistributionsFrom)(D3Q27System::ET_TNW,x1+1,x2,x3); - f[D3Q27System::TSE] = (*this->localDistributionsFrom)(D3Q27System::ET_TSE,x1,x2+1,x3); - f[D3Q27System::TSW] = (*this->localDistributionsFrom)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - - f[D3Q27System::W ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W,x1+1,x2,x3 ); - f[D3Q27System::S ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S,x1,x2+1,x3 ); - f[D3Q27System::B ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B,x1,x2,x3+1 ); - f[D3Q27System::SW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - f[D3Q27System::SE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE,x1,x2+1,x3 ); - f[D3Q27System::BW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW,x1+1,x2,x3+1 ); - f[D3Q27System::BE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE,x1,x2,x3+1 ); - f[D3Q27System::BS] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS,x1,x2+1,x3+1 ); - f[D3Q27System::BN] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN,x1,x2,x3+1 ); - f[D3Q27System::BSW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - f[D3Q27System::BSE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE,x1,x2+1,x3+1); - f[D3Q27System::BNW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW,x1+1,x2,x3+1); - f[D3Q27System::BNE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE,x1,x2,x3+1); - - f[D3Q27System::ZERO] = (*this->zeroDistributionsFrom)(x1,x2,x3); - } - else - { - f[D3Q27System::INV_E] = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1,x2,x3); - f[D3Q27System::INV_N] = (*this->localDistributionsFrom)(D3Q27System::ET_N,x1,x2,x3); - f[D3Q27System::INV_T] = (*this->localDistributionsFrom)(D3Q27System::ET_T,x1,x2,x3); - f[D3Q27System::INV_NE] = (*this->localDistributionsFrom)(D3Q27System::ET_NE,x1,x2,x3); - f[D3Q27System::INV_NW] = (*this->localDistributionsFrom)(D3Q27System::ET_NW,x1+1,x2,x3); - f[D3Q27System::INV_TE] = (*this->localDistributionsFrom)(D3Q27System::ET_TE,x1,x2,x3); - f[D3Q27System::INV_TW] = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1+1,x2,x3); - f[D3Q27System::INV_TN] = (*this->localDistributionsFrom)(D3Q27System::ET_TN,x1,x2,x3); - f[D3Q27System::INV_TS] = (*this->localDistributionsFrom)(D3Q27System::ET_TS,x1,x2+1,x3); - f[D3Q27System::INV_TNE] = (*this->localDistributionsFrom)(D3Q27System::ET_TNE,x1,x2,x3); - f[D3Q27System::INV_TNW] = (*this->localDistributionsFrom)(D3Q27System::ET_TNW,x1+1,x2,x3); - f[D3Q27System::INV_TSE] = (*this->localDistributionsFrom)(D3Q27System::ET_TSE,x1,x2+1,x3); - f[D3Q27System::INV_TSW] = (*this->localDistributionsFrom)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - - f[D3Q27System::INV_W ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W,x1+1,x2,x3 ); - f[D3Q27System::INV_S ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S,x1,x2+1,x3 ); - f[D3Q27System::INV_B ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B,x1,x2,x3+1 ); - f[D3Q27System::INV_SW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - f[D3Q27System::INV_SE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE,x1,x2+1,x3 ); - f[D3Q27System::INV_BW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW,x1+1,x2,x3+1 ); - f[D3Q27System::INV_BE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE,x1,x2,x3+1 ); - f[D3Q27System::INV_BS] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS,x1,x2+1,x3+1 ); - f[D3Q27System::INV_BN] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN,x1,x2,x3+1 ); - f[D3Q27System::INV_BSW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - f[D3Q27System::INV_BSE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE,x1,x2+1,x3+1); - f[D3Q27System::INV_BNW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW,x1+1,x2,x3+1); - f[D3Q27System::INV_BNE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE,x1,x2,x3+1); - - f[D3Q27System::ZERO] = (*this->zeroDistributionsFrom)(x1,x2,x3); - } -} -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullDirectConnector2::distributeData(int x1, int x2, int x3) -{ - if(invStep) - { - (*this->localDistributionsTo)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; - (*this->localDistributionsTo)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; - (*this->localDistributionsTo)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; - (*this->localDistributionsTo)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; - (*this->localDistributionsTo)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; - (*this->localDistributionsTo)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; - (*this->localDistributionsTo)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; - (*this->localDistributionsTo)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; - (*this->localDistributionsTo)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; - (*this->localDistributionsTo)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; - (*this->localDistributionsTo)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; - (*this->localDistributionsTo)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; - (*this->localDistributionsTo)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; - - (*this->nonLocalDistributionsTo)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::BNE]; - - (*this->zeroDistributionsTo)(x1,x2,x3) = f[D3Q27System::ZERO]; - } - else - { - (*this->localDistributionsTo)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::INV_E]; - (*this->localDistributionsTo)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::INV_N]; - (*this->localDistributionsTo)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::INV_T]; - (*this->localDistributionsTo)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::INV_NE]; - (*this->localDistributionsTo)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::INV_NW]; - (*this->localDistributionsTo)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::INV_TE]; - (*this->localDistributionsTo)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::INV_TW]; - (*this->localDistributionsTo)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::INV_TN]; - (*this->localDistributionsTo)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::INV_TS]; - (*this->localDistributionsTo)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::INV_TNE]; - (*this->localDistributionsTo)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::INV_TNW]; - (*this->localDistributionsTo)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::INV_TSE]; - (*this->localDistributionsTo)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::INV_TSW]; - - (*this->nonLocalDistributionsTo)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::INV_W ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::INV_S ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::INV_B ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::INV_SW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::INV_SE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::INV_BW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::INV_BE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::INV_BS]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::INV_BN]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::INV_BSW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::INV_BSE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::INV_BNW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::INV_BNE]; - - (*this->zeroDistributionsTo)(x1,x2,x3) = f[D3Q27System::ZERO]; - } -} -#endif - diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h_old b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h_old deleted file mode 100644 index 4fd38ce20..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector2.h_old +++ /dev/null @@ -1,226 +0,0 @@ -/** -* @file D3Q27ETFullDirectConnector.h -* @brief Connector send and receive full distribution in shared memory -* -* @author Kostyantyn Kucher -* @date 08.06.2011 -*/ -#ifndef D3Q27ETFULLDIRECTCONNECTOR2_H -#define D3Q27ETFULLDIRECTCONNECTOR2_H - -#include <boost/weak_ptr.hpp> - -#include "Block3DConnector.h" -#include "Block3D.h" -#include "D3Q27System.h" -#include "basics/container/CbArray3D.h" -#include "basics/container/CbArray4D.h" - -class D3Q27ETFullDirectConnector2 : public Block3DConnector -{ -public: - D3Q27ETFullDirectConnector2() {} - D3Q27ETFullDirectConnector2(Block3DPtr from, Block3DPtr to, const int& sendDir); - - void sendTransmitterDataSize() { } - void receiveTransmitterDataSize() { } - void init(); - void prepareForReceive() { } - void prepareForSend() { } - void fillSendVectors() { } - void sendVectors(); - void receiveVectors() { } - - void distributeReceiveVectors() { } - - bool isLocalConnector() { return true; } - bool isRemoteConnector() { return false; } - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - - protected: - //void fillData(EsoTwist3DPtr fFrom, int x1, int x2, int x3); - //void distributeData(EsoTwist3DPtr fTo, int x1, int x2, int x3); - - //void fillData(int x1, int x2, int x3); - //void distributeData(int x1, int x2, int x3); - - inline void fillData(int x1, int x2, int x3); - inline void distributeData(int x1, int x2, int x3); -private: - boost::weak_ptr<Block3D> from; - boost::weak_ptr<Block3D> to; - LBMReal f[D3Q27System::ENDF+1]; - - int maxX1; - int maxX2; - int maxX3; - - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFrom; - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFrom; - CbArray3D <LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsFrom; - - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTo; - CbArray4D <LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTo; - CbArray3D <LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsTo; - - EsoTwist3DPtr fFrom; - EsoTwist3DPtr fTo; -}; - -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullDirectConnector2::fillData(int x1, int x2, int x3) -{ - if(invStep) - { - f[D3Q27System::E] = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1,x2,x3); - f[D3Q27System::N] = (*this->localDistributionsFrom)(D3Q27System::ET_N,x1,x2,x3); - f[D3Q27System::T] = (*this->localDistributionsFrom)(D3Q27System::ET_T,x1,x2,x3); - f[D3Q27System::NE] = (*this->localDistributionsFrom)(D3Q27System::ET_NE,x1,x2,x3); - f[D3Q27System::NW] = (*this->localDistributionsFrom)(D3Q27System::ET_NW,x1+1,x2,x3); - f[D3Q27System::TE] = (*this->localDistributionsFrom)(D3Q27System::ET_TE,x1,x2,x3); - f[D3Q27System::TW] = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1+1,x2,x3); - f[D3Q27System::TN] = (*this->localDistributionsFrom)(D3Q27System::ET_TN,x1,x2,x3); - f[D3Q27System::TS] = (*this->localDistributionsFrom)(D3Q27System::ET_TS,x1,x2+1,x3); - f[D3Q27System::TNE] = (*this->localDistributionsFrom)(D3Q27System::ET_TNE,x1,x2,x3); - f[D3Q27System::TNW] = (*this->localDistributionsFrom)(D3Q27System::ET_TNW,x1+1,x2,x3); - f[D3Q27System::TSE] = (*this->localDistributionsFrom)(D3Q27System::ET_TSE,x1,x2+1,x3); - f[D3Q27System::TSW] = (*this->localDistributionsFrom)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - - f[D3Q27System::W ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W,x1+1,x2,x3 ); - f[D3Q27System::S ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S,x1,x2+1,x3 ); - f[D3Q27System::B ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B,x1,x2,x3+1 ); - f[D3Q27System::SW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - f[D3Q27System::SE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE,x1,x2+1,x3 ); - f[D3Q27System::BW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW,x1+1,x2,x3+1 ); - f[D3Q27System::BE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE,x1,x2,x3+1 ); - f[D3Q27System::BS] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS,x1,x2+1,x3+1 ); - f[D3Q27System::BN] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN,x1,x2,x3+1 ); - f[D3Q27System::BSW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - f[D3Q27System::BSE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE,x1,x2+1,x3+1); - f[D3Q27System::BNW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW,x1+1,x2,x3+1); - f[D3Q27System::BNE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE,x1,x2,x3+1); - - f[D3Q27System::ZERO] = (*this->zeroDistributionsFrom)(x1,x2,x3); - } - else - { - f[D3Q27System::INV_E] = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1,x2,x3); - f[D3Q27System::INV_N] = (*this->localDistributionsFrom)(D3Q27System::ET_N,x1,x2,x3); - f[D3Q27System::INV_T] = (*this->localDistributionsFrom)(D3Q27System::ET_T,x1,x2,x3); - f[D3Q27System::INV_NE] = (*this->localDistributionsFrom)(D3Q27System::ET_NE,x1,x2,x3); - f[D3Q27System::INV_NW] = (*this->localDistributionsFrom)(D3Q27System::ET_NW,x1+1,x2,x3); - f[D3Q27System::INV_TE] = (*this->localDistributionsFrom)(D3Q27System::ET_TE,x1,x2,x3); - f[D3Q27System::INV_TW] = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1+1,x2,x3); - f[D3Q27System::INV_TN] = (*this->localDistributionsFrom)(D3Q27System::ET_TN,x1,x2,x3); - f[D3Q27System::INV_TS] = (*this->localDistributionsFrom)(D3Q27System::ET_TS,x1,x2+1,x3); - f[D3Q27System::INV_TNE] = (*this->localDistributionsFrom)(D3Q27System::ET_TNE,x1,x2,x3); - f[D3Q27System::INV_TNW] = (*this->localDistributionsFrom)(D3Q27System::ET_TNW,x1+1,x2,x3); - f[D3Q27System::INV_TSE] = (*this->localDistributionsFrom)(D3Q27System::ET_TSE,x1,x2+1,x3); - f[D3Q27System::INV_TSW] = (*this->localDistributionsFrom)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - - f[D3Q27System::INV_W ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W,x1+1,x2,x3 ); - f[D3Q27System::INV_S ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S,x1,x2+1,x3 ); - f[D3Q27System::INV_B ] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B,x1,x2,x3+1 ); - f[D3Q27System::INV_SW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - f[D3Q27System::INV_SE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE,x1,x2+1,x3 ); - f[D3Q27System::INV_BW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW,x1+1,x2,x3+1 ); - f[D3Q27System::INV_BE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE,x1,x2,x3+1 ); - f[D3Q27System::INV_BS] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS,x1,x2+1,x3+1 ); - f[D3Q27System::INV_BN] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN,x1,x2,x3+1 ); - f[D3Q27System::INV_BSW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - f[D3Q27System::INV_BSE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE,x1,x2+1,x3+1); - f[D3Q27System::INV_BNW] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW,x1+1,x2,x3+1); - f[D3Q27System::INV_BNE] = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE,x1,x2,x3+1); - - f[D3Q27System::ZERO] = (*this->zeroDistributionsFrom)(x1,x2,x3); - } -} -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullDirectConnector2::distributeData(int x1, int x2, int x3) -{ - if(invStep) - { - (*this->localDistributionsTo)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; - (*this->localDistributionsTo)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; - (*this->localDistributionsTo)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; - (*this->localDistributionsTo)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; - (*this->localDistributionsTo)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; - (*this->localDistributionsTo)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; - (*this->localDistributionsTo)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; - (*this->localDistributionsTo)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; - (*this->localDistributionsTo)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; - (*this->localDistributionsTo)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; - (*this->localDistributionsTo)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; - (*this->localDistributionsTo)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; - (*this->localDistributionsTo)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; - - (*this->nonLocalDistributionsTo)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::BNE]; - - (*this->zeroDistributionsTo)(x1,x2,x3) = f[D3Q27System::ZERO]; - } - else - { - (*this->localDistributionsTo)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::INV_E]; - (*this->localDistributionsTo)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::INV_N]; - (*this->localDistributionsTo)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::INV_T]; - (*this->localDistributionsTo)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::INV_NE]; - (*this->localDistributionsTo)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::INV_NW]; - (*this->localDistributionsTo)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::INV_TE]; - (*this->localDistributionsTo)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::INV_TW]; - (*this->localDistributionsTo)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::INV_TN]; - (*this->localDistributionsTo)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::INV_TS]; - (*this->localDistributionsTo)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::INV_TNE]; - (*this->localDistributionsTo)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::INV_TNW]; - (*this->localDistributionsTo)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::INV_TSE]; - (*this->localDistributionsTo)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::INV_TSW]; - - (*this->nonLocalDistributionsTo)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::INV_W ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::INV_S ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::INV_B ]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::INV_SW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::INV_SE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::INV_BW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::INV_BE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::INV_BS]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::INV_BN]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::INV_BSW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::INV_BSE]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::INV_BNW]; - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::INV_BNE]; - - (*this->zeroDistributionsTo)(x1,x2,x3) = f[D3Q27System::ZERO]; - } -} -#endif - diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.cpp deleted file mode 100644 index fa1798ac4..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "D3Q27ETFullDirectConnector3.h" -#include "LBMKernelETD3Q27.h" -#include "D3Q27EsoTwist3DSplittedVector.h" - - -using namespace std; - -D3Q27ETFullDirectConnector3::D3Q27ETFullDirectConnector3(Block3DPtr from, Block3DPtr to, int sendDir) - : LocalBlock3DConnector(from, to, sendDir) - -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector3::init() -{ - maxX1 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1; - maxX2 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1; - maxX3 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1; - - fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector3::sendVectors() -{ - localDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions(); - nonLocalDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions(); - zeroDistributionsFrom = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions(); - - localDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions(); - nonLocalDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions(); - zeroDistributionsTo = boost::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions(); - - //EAST - if (sendDir == D3Q27System::E) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(maxX1 - 1, x2, x3, 0, x2, x3); - } - } - } - //WEST - else if (sendDir == D3Q27System::W) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(1, x2, x3, maxX1, x2, x3); - } - } - } - //NORTH - else if (sendDir == D3Q27System::N) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, maxX2 - 1, x3, x1, 0, x3); - } - } - } - //SOUTH - else if (sendDir == D3Q27System::S) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, 1, x3, x1, maxX2, x3); - } - } - } - - //TOP - else if (sendDir == D3Q27System::T) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, x2, maxX3 - 1, x1, x2, 0); - } - } - } - //BOTTOM - else if (sendDir == D3Q27System::B) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, x2, 1, x1, x2, maxX3); - } - } - } - //NORTHEAST - else if (sendDir == D3Q27System::NE) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(maxX1 - 1, maxX2 - 1, x3, 0, 0, x3); - } - } - //NORTHWEST - else if (sendDir == D3Q27System::NW) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(1, maxX2 - 1, x3, maxX1, 0, x3); - } - } - //SOUTHWEST - else if (sendDir == D3Q27System::SW) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(1, 1, x3, maxX1, maxX2, x3); - } - } - //SOUTHEAST - else if (sendDir == D3Q27System::SE) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(maxX1 - 1, 1, x3, 0, maxX2, x3); - } - } - else if (sendDir == D3Q27System::TE) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(maxX1 - 1, x2, maxX3 - 1, 0, x2, 0); - } - else if (sendDir == D3Q27System::BW) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(1, x2, 1, maxX1, x2, maxX3); - } - else if (sendDir == D3Q27System::BE) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(maxX1 - 1, x2, 1, 0, x2, maxX3); - } - else if (sendDir == D3Q27System::TW) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(1, x2, maxX3 - 1, maxX1, x2, 0); - } - else if (sendDir == D3Q27System::TN) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, maxX2 - 1, maxX3 - 1, x1, 0, 0); - } - else if (sendDir == D3Q27System::BS) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, 1, 1, x1, maxX2, maxX3); - } - else if (sendDir == D3Q27System::BN) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, maxX2 - 1, 1, x1, 0, maxX3); - } - - else if (sendDir == D3Q27System::TS) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, 1, maxX3 - 1, x1, maxX2, 0); - } - - else if (sendDir == D3Q27System::TSW) - { - exchangeData(1, 1, maxX3 - 1, maxX1, maxX2, 0); - } - else if (sendDir == D3Q27System::TSE) - { - exchangeData(maxX1 - 1, 1, maxX3 - 1, 0, maxX2, 0); - } - else if (sendDir == D3Q27System::TNW) - { - exchangeData(1, maxX2 - 1, maxX3 - 1, maxX1, 0, 0); - } - else if (sendDir == D3Q27System::TNE) - { - exchangeData(maxX1 - 1, maxX2 - 1, maxX3 - 1, 0, 0, 0); - } - else if (sendDir == D3Q27System::BSW) - { - exchangeData(1, 1, 1, maxX1, maxX2, maxX3); - } - else if (sendDir == D3Q27System::BSE) - { - exchangeData(maxX1 - 1, 1, 1, 0, maxX2, maxX3); - } - else if (sendDir == D3Q27System::BNW) - { - exchangeData(1, maxX2 - 1, 1, maxX1, 0, maxX3); - } - else if (sendDir == D3Q27System::BNE) - { - exchangeData(maxX1 - 1, maxX2 - 1, 1, 0, 0, maxX3); - } - else UB_THROW(UbException(UB_EXARGS, "unknown dir")); -} - diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.h b/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.h deleted file mode 100644 index 56aa9746e..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector3.h +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @file D3Q27ETFullDirectConnector.h -* @brief Connector send and receive full distribution in shared memory -* -* @author Konstantin Kutscher -* @date 28.04.2016 -*/ -#ifndef D3Q27ETFULLDIRECTCONNECTOR3_H -#define D3Q27ETFULLDIRECTCONNECTOR3_H - -#include <boost/weak_ptr.hpp> - -#include "LocalBlock3DConnector.h" -#include "Block3D.h" -#include "D3Q27System.h" -#include "basics/container/CbArray3D.h" -#include "basics/container/CbArray4D.h" - -//! \brief Exchange data between blocks. -//! \details Connector send and receive full distributions between two blocks in shared memory. -//! \author Konstantin Kutscher - -class D3Q27ETFullDirectConnector3 : public LocalBlock3DConnector -{ -public: - D3Q27ETFullDirectConnector3(Block3DPtr from, Block3DPtr to, int sendDir); - void init(); - void sendVectors(); - -protected: - inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To); -private: - int maxX1; - int maxX2; - int maxX3; - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFrom; - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFrom; - CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsFrom; - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTo; - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTo; - CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsTo; - - EsoTwist3DPtr fFrom; - EsoTwist3DPtr fTo; -}; - - -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullDirectConnector3::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To) -{ - (*this->localDistributionsTo)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_N, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_T, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NE, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NW, x1From + 1, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TE, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1From + 1, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TN, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TS, x1From, x2From + 1, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNE, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From); - - (*this->nonLocalDistributionsTo)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W, x1From + 1, x2From, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S, x1From, x2From + 1, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B, x1From, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE, x1From, x2From + 1, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE, x1From, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN, x1From, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1); - - (*this->zeroDistributionsTo)(x1To, x2To, x3To) = (*this->zeroDistributionsFrom)(x1From, x2From, x3From); -} -#endif - diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h index 5dd5df079..0398dd146 100644 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h +++ b/source/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h @@ -48,8 +48,6 @@ private: ////////////////////////////////////////////////////////////////////////// inline void D3Q27ETFullVectorConnector::fillData(vector_type& sdata, int& index, int x1, int x2, int x3) { - //vector_type& sdata = sender->getData(); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3); sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3); sdata[index++] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3); @@ -83,8 +81,6 @@ inline void D3Q27ETFullVectorConnector::fillData(vector_type& sdata, int& index, ////////////////////////////////////////////////////////////////////////// inline void D3Q27ETFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3) { - //vector_type& rdata = receiver->getData(); - (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++]; (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++]; (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++]; diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.cpp deleted file mode 100644 index 3923c6c2e..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "D3Q27ETVectorConnector.h" - diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.h deleted file mode 100644 index 34c5fe0c6..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETVectorConnector.h +++ /dev/null @@ -1,720 +0,0 @@ -#ifndef D3Q27VECTORCONNECTOR_H -#define D3Q27VECTORCONNECTOR_H - -#include <vector> - -#include "basics/transmitter/TbTransmitter.h" -#include "basics/container/CbVector.h" -#include "basics/utilities/UbTiming.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernelETD3Q27.h" -#include "EsoTwistD3Q27System.h" - -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -class Block3D; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) -template< typename VectorTransmitter > //TbTransmitter< CbVector<LBMReal> > -class D3Q27ETVectorConnector : public Block3DConnector -{ -public: - //typedef CbVector<LBMReal> DataType; - //typedef boost::shared_ptr< TbTransmitter< DataType > > TransmitterPtr; - typedef typename VectorTransmitter::value_type vector_type; - typedef boost::shared_ptr< VectorTransmitter > VectorTransmitterPtr; -public: - D3Q27ETVectorConnector( Block3DPtr block - , VectorTransmitterPtr sender - , VectorTransmitterPtr receiver - , int sendDir); - - bool isLocalConnector(); - bool isRemoteConnector(); - - void init(); - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - void fillSendVectors(); - void distributeReceiveVectors(); - - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - boost::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - //gegenstelle muss "inversen" connector besitzen - - VectorTransmitterPtr sender; - VectorTransmitterPtr receiver; - UbTiming timer; -}; - -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -D3Q27ETVectorConnector< VectorTransmitter >::D3Q27ETVectorConnector( Block3DPtr block - , VectorTransmitterPtr sender - , VectorTransmitterPtr receiver - , int sendDir ) - : Block3DConnector(sendDir) - , block(block) - , sender(sender) - , receiver(receiver) -{ - if(!block || !sender || !receiver) - UB_THROW( UbException(UB_EXARGS,"sender or receiver == NULL!!") ); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETVectorConnector< VectorTransmitter >::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETVectorConnector< VectorTransmitter >::isRemoteConnector() -{ - return ( ( sender && sender->isRemoteTransmitter() ) - || ( receiver && receiver->isRemoteTransmitter() ) ); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::sendTransmitterDataSize() -{ - assert(sender !=NULL); sender->sendDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::receiveTransmitterDataSize() -{ - assert(receiver!=NULL); receiver->receiveDataSize(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::prepareForSend() -{ - assert(sender !=NULL); sender->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::sendVectors() -{ - assert(sender !=NULL); sender->sendData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::prepareForReceive() -{ - assert(receiver!=NULL); receiver->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::receiveVectors() -{ - assert(receiver!=NULL); receiver->receiveData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::init() -{ - int maxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1()-1; - int maxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2()-1; - int maxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3()-1; - - int anz = 9; - switch(sendDir) - { - case D3Q27System::ZERO : UB_THROW( UbException(UB_EXARGS,"ZERO not allowed") ); break; - case D3Q27System::E : - case D3Q27System::W : sender->getData().resize(maxX2*maxX3*anz, 0.0); break; - case D3Q27System::N : - case D3Q27System::S : sender->getData().resize(maxX1*maxX3*anz, 0.0); break; - case D3Q27System::T : - case D3Q27System::B : sender->getData().resize(maxX1*maxX2*anz, 0.0); break; - - case D3Q27System::NE : - case D3Q27System::SW : - case D3Q27System::SE : - case D3Q27System::NW : sender->getData().resize(maxX3*3, 0.0); break; - - case D3Q27System::TE : - case D3Q27System::BW : - case D3Q27System::BE : - case D3Q27System::TW : sender->getData().resize(maxX2*3, 0.0); break; - - case D3Q27System::TN : - case D3Q27System::BS : - case D3Q27System::BN : - case D3Q27System::TS : sender->getData().resize(maxX1*3, 0.0); break; - - case D3Q27System::TNE : - case D3Q27System::BSW : - case D3Q27System::BNE : - case D3Q27System::TSW : - case D3Q27System::TSE : - case D3Q27System::BNW : - case D3Q27System::BSE : - case D3Q27System::TNW : sender->getData().resize(1, 0.0); break; - - default: UB_THROW( UbException(UB_EXARGS,"unknown sendDir") ); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::fillSendVectors() -{ - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1()-1; - int maxX2 = (int)fFrom->getNX2()-1; - int maxX3 = (int)fFrom->getNX3()-1; - - LBMReal f[D3Q27System::ENDF+1]; - int sendDirForEdge[3]; - - vector_type& data = sender->getData(); - - int index = 0; - //EAST - if(sendDir==D3Q27System::E) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,maxX1-1,x2,x3); - data[index++] = f[D3Q27System::E]; - data[index++] = f[D3Q27System::NE]; - data[index++] = f[D3Q27System::SE]; - data[index++] = f[D3Q27System::TE]; - data[index++] = f[D3Q27System::BE]; - data[index++] = f[D3Q27System::TNE]; - data[index++] = f[D3Q27System::TSE]; - data[index++] = f[D3Q27System::BNE]; - data[index++] = f[D3Q27System::BSE]; - } - } - } - //WEST - else if(sendDir==D3Q27System::W) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fFrom->getDistributionInv(f,1,x2,x3); - data[index++] = f[D3Q27System::W ]; - data[index++] = f[D3Q27System::NW]; - data[index++] = f[D3Q27System::SW]; - data[index++] = f[D3Q27System::TW]; - data[index++] = f[D3Q27System::BW]; - data[index++] = f[D3Q27System::TNW]; - data[index++] = f[D3Q27System::TSW]; - data[index++] = f[D3Q27System::BNW]; - data[index++] = f[D3Q27System::BSW]; - } - } - } - //NORTH - else if(sendDir==D3Q27System::N) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,maxX2-1,x3); - data[index++] = f[D3Q27System::N ]; - data[index++] = f[D3Q27System::NE]; - data[index++] = f[D3Q27System::NW]; - data[index++] = f[D3Q27System::TN]; - data[index++] = f[D3Q27System::BN]; - data[index++] = f[D3Q27System::TNE]; - data[index++] = f[D3Q27System::TNW]; - data[index++] = f[D3Q27System::BNE]; - data[index++] = f[D3Q27System::BNW]; - } - } - } - //SOUTH - else if(sendDir==D3Q27System::S) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,1,x3); - data[index++] = f[D3Q27System::S ]; - data[index++] = f[D3Q27System::SE]; - data[index++] = f[D3Q27System::SW]; - data[index++] = f[D3Q27System::TS]; - data[index++] = f[D3Q27System::BS]; - data[index++] = f[D3Q27System::TSE]; - data[index++] = f[D3Q27System::TSW]; - data[index++] = f[D3Q27System::BSE]; - data[index++] = f[D3Q27System::BSW]; - } - } - } - //TOP - else if(sendDir==D3Q27System::T) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,x2,maxX3-1); - data[index++] = f[D3Q27System::T ]; - data[index++] = f[D3Q27System::TE]; - data[index++] = f[D3Q27System::TW]; - data[index++] = f[D3Q27System::TN]; - data[index++] = f[D3Q27System::TS]; - data[index++] = f[D3Q27System::TNE]; - data[index++] = f[D3Q27System::TNW]; - data[index++] = f[D3Q27System::TSE]; - data[index++] = f[D3Q27System::TSW]; - } - } - } - //BOTTOM - else if(sendDir==D3Q27System::B) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,x2,1); - data[index++] = f[D3Q27System::B ]; - data[index++] = f[D3Q27System::BE]; - data[index++] = f[D3Q27System::BW]; - data[index++] = f[D3Q27System::BN]; - data[index++] = f[D3Q27System::BS]; - data[index++] = f[D3Q27System::BNE]; - data[index++] = f[D3Q27System::BNW]; - data[index++] = f[D3Q27System::BSE]; - data[index++] = f[D3Q27System::BSW]; - } - } - } - //NE NW SW SE - else if(sendDir==D3Q27System::NE || sendDir==D3Q27System::NW || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE) - { - int x1 = 0; - int x2 = 0; - switch(sendDir) - { - case D3Q27System::NE: x1=maxX1-1; x2=maxX2-1; - sendDirForEdge[0]=D3Q27System::NE; - sendDirForEdge[1]=D3Q27System::TNE; - sendDirForEdge[2]=D3Q27System::BNE; - break; - case D3Q27System::NW: x1=1; x2=maxX2-1; - sendDirForEdge[0]=D3Q27System::NW; - sendDirForEdge[1]=D3Q27System::TNW; - sendDirForEdge[2]=D3Q27System::BNW; - break; - case D3Q27System::SW: x1=1; x2=1; - sendDirForEdge[0]=D3Q27System::SW; - sendDirForEdge[1]=D3Q27System::TSW; - sendDirForEdge[2]=D3Q27System::BSW; - break; - case D3Q27System::SE: x1=maxX1-1; x2=1; - sendDirForEdge[0]=D3Q27System::SE; - sendDirForEdge[1]=D3Q27System::TSE; - sendDirForEdge[2]=D3Q27System::BSE; - break; - } - for(int x3=1; x3<maxX3; x3++) - { - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[0]); - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[1]); - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[2]); - } - } - //TE TW BW BE - else if(sendDir==D3Q27System::TE || sendDir==D3Q27System::TW || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE) - { - int x1 = 0; - int x3 = 0; - switch(sendDir) - { - case D3Q27System::TE: x1=maxX1-1; x3=maxX3-1; - sendDirForEdge[0]=D3Q27System::TE; - sendDirForEdge[1]=D3Q27System::TNE; - sendDirForEdge[2]=D3Q27System::TSE; - break; - case D3Q27System::TW: x1=1; x3=maxX3-1; - sendDirForEdge[0]=D3Q27System::TW; - sendDirForEdge[1]=D3Q27System::TNW; - sendDirForEdge[2]=D3Q27System::TSW; - break; - case D3Q27System::BW: x1=1; x3=1; - sendDirForEdge[0]=D3Q27System::BW; - sendDirForEdge[1]=D3Q27System::BNW; - sendDirForEdge[2]=D3Q27System::BSW; - break; - case D3Q27System::BE: x1=maxX1-1; x3=1; - sendDirForEdge[0]=D3Q27System::BE; - sendDirForEdge[1]=D3Q27System::BNE; - sendDirForEdge[2]=D3Q27System::BSE; - break; - } - for(int x2=1; x2<maxX2; x2++) - { - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[0]); - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[1]); - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[2]); - } - } - //TN BN BS TS - else if(sendDir==D3Q27System::TN || sendDir==D3Q27System::BN || sendDir==D3Q27System::BS || sendDir==D3Q27System::TS) - { - int x2 = 0; - int x3 = 0; - switch(sendDir) - { - case D3Q27System::TN: x3=maxX3-1; x2=maxX2-1; - sendDirForEdge[0]=D3Q27System::TN; - sendDirForEdge[1]=D3Q27System::TNE; - sendDirForEdge[2]=D3Q27System::TNW; - break; - case D3Q27System::BN: x3=1; x2=maxX2-1; - sendDirForEdge[0]=D3Q27System::BN; - sendDirForEdge[1]=D3Q27System::BNE; - sendDirForEdge[2]=D3Q27System::BNW; - break; - case D3Q27System::BS: x3=1; x2=1; - sendDirForEdge[0]=D3Q27System::BS; - sendDirForEdge[1]=D3Q27System::BSE; - sendDirForEdge[2]=D3Q27System::BSW; - break; - case D3Q27System::TS: x3=maxX3-1; x2=1; - sendDirForEdge[0]=D3Q27System::TS; - sendDirForEdge[1]=D3Q27System::TSE; - sendDirForEdge[2]=D3Q27System::TSW; - break; - } - for(int x1=1; x1<maxX1; x1++) - { - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[0]); - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[1]); - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDirForEdge[2]); - } - } - //TNE TNW TSW TSE BNE BNW BSW BSE - else if(sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSW || sendDir==D3Q27System::TSE - || sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSW || sendDir==D3Q27System::BSE) - { - int x1 = 0; - int x2 = 0; - int x3 = 0; - switch(sendDir) - { - case D3Q27System::TNE: x1=maxX1-1; x2=maxX2-1; x3=maxX3-1; break; - case D3Q27System::TNW: x1=1; x2=maxX2-1; x3=maxX3-1; break; - case D3Q27System::TSW: x1=1; x2=1; x3=maxX3-1; break; - case D3Q27System::TSE: x1=maxX1-1; x2=1; x3=maxX3-1; break; - case D3Q27System::BNE: x1=maxX1-1; x2=maxX2-1; x3=1; break; - case D3Q27System::BNW: x1=1; x2=maxX2-1; x3=1; break; - case D3Q27System::BSW: x1=1; x2=1; x3=1; break; - case D3Q27System::BSE: x1=maxX1-1; x2=1; x3=1; break; - } - data[index++] = fFrom->getDistributionInvForDirection(x1,x2,x3,sendDir); - } - else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -//////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETVectorConnector< VectorTransmitter >::distributeReceiveVectors() -{ - /*e.g. connector sendet nach EAST --> empfaengt daten aus WEST ;-)*/ - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fTo->getNX1()-1; - int maxX2 = (int)fTo->getNX2()-1; - int maxX3 = (int)fTo->getNX3()-1; - int index = 0; - int sendDirForEdge[3]; - - vector_type& data = receiver->getData(); - - if(sendDir==D3Q27System::W) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::E); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::NE); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::SE); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::TE); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::BE); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::TNE); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::TSE); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::BNE); - fTo->setDistributionForDirection(data[index++],0,x2,x3,D3Q27System::BSE); - } - } - } - else if(sendDir==D3Q27System::E) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::W ); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::NW); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::SW); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::TW); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::BW); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::TNW); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::TSW); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::BNW); - fTo->setDistributionForDirection(data[index++],maxX1,x2,x3,D3Q27System::BSW); - } - } - } - else if(sendDir==D3Q27System::S) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::N ); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::NE); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::NW); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::TN); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::BN); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::TNE); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::TNW); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::BNE); - fTo->setDistributionForDirection(data[index++],x1,0,x3,D3Q27System::BNW); - } - } - } - else if(sendDir==D3Q27System::N) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::S ); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::SE); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::SW); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::TS); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::BS); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::TSE); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::TSW); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::BSE); - fTo->setDistributionForDirection(data[index++],x1,maxX2,x3,D3Q27System::BSW); - } - } - } - else if(sendDir==D3Q27System::B) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::T ); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TE); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TW); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TN); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TS); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TNE); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TNW); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TSE); - fTo->setDistributionForDirection(data[index++],x1,x2,0,D3Q27System::TSW); - } - } - } - else if(sendDir==D3Q27System::T) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::B ); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BE); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BW); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BN); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BS); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BNE); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BNW); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BSE); - fTo->setDistributionForDirection(data[index++],x1,x2,maxX3,D3Q27System::BSW); - } - } - } - //NE NW SW SE - else if(sendDir==D3Q27System::NE || sendDir==D3Q27System::NW || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE) - { - int inversDir = D3Q27System::getInvertDirection(sendDir); - int x1 = 0; - int x2 = 0; - switch(sendDir) //wenn sendir NE dann kommen werte von SW - { - case D3Q27System::NE: x1=maxX1; x2=maxX2; - sendDirForEdge[0]=D3Q27System::SW; - sendDirForEdge[1]=D3Q27System::TSW; - sendDirForEdge[2]=D3Q27System::BSW; - break; - case D3Q27System::NW: x1=0; x2=maxX2; - sendDirForEdge[0]=D3Q27System::SE; - sendDirForEdge[1]=D3Q27System::TSE; - sendDirForEdge[2]=D3Q27System::BSE; - break; - case D3Q27System::SW: x1=0; x2=0; - sendDirForEdge[0]=D3Q27System::NE; - sendDirForEdge[1]=D3Q27System::TNE; - sendDirForEdge[2]=D3Q27System::BNE; - break; - case D3Q27System::SE: x1=maxX1; x2=0; - sendDirForEdge[0]=D3Q27System::NW; - sendDirForEdge[1]=D3Q27System::TNW; - sendDirForEdge[2]=D3Q27System::BNW; - break; - } - for(int x3=1; x3<maxX3; x3++) - { - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[0]); - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[1]); - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[2]); - } - - } - //TE TW BW BE - else if(sendDir==D3Q27System::TE || sendDir==D3Q27System::TW || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE) - - { - int inversDir = D3Q27System::getInvertDirection(sendDir); - int x1 = 0; - int x3 = 0; - switch(sendDir) //wenn sendir NE dann kommen werte von SW - { - case D3Q27System::TE: x1=maxX1; x3=maxX3; - sendDirForEdge[0]=D3Q27System::BW; - sendDirForEdge[1]=D3Q27System::BNW; - sendDirForEdge[2]=D3Q27System::BSW; - break; - case D3Q27System::TW: x1=0; x3=maxX3; - sendDirForEdge[0]=D3Q27System::BE; - sendDirForEdge[1]=D3Q27System::BNE; - sendDirForEdge[2]=D3Q27System::BSE; - break; - case D3Q27System::BW: x1=0; x3=0; - sendDirForEdge[0]=D3Q27System::TE; - sendDirForEdge[1]=D3Q27System::TNE; - sendDirForEdge[2]=D3Q27System::TSE; - break; - case D3Q27System::BE: x1=maxX1; x3=0; - sendDirForEdge[0]=D3Q27System::TW; - sendDirForEdge[1]=D3Q27System::TNW; - sendDirForEdge[2]=D3Q27System::TSW; - break; - } - for(int x2=1; x2<maxX2; x2++) - { - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[0]); - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[1]); - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[2]); - } - } - //TN BN BS TS - else if(sendDir==D3Q27System::TN || sendDir==D3Q27System::BN || sendDir==D3Q27System::BS || sendDir==D3Q27System::TS) - { - int inversDir = D3Q27System::getInvertDirection(sendDir); - int x2 = 0; - int x3 = 0; - switch(sendDir) - { - case D3Q27System::TN: x3=maxX3; x2=maxX2; - sendDirForEdge[0]=D3Q27System::BS; - sendDirForEdge[1]=D3Q27System::BSE; - sendDirForEdge[2]=D3Q27System::BSW; - break; - case D3Q27System::BN: x3=0; x2=maxX2; - sendDirForEdge[0]=D3Q27System::TS; - sendDirForEdge[1]=D3Q27System::TSE; - sendDirForEdge[2]=D3Q27System::TSW; - break; - case D3Q27System::BS: x3=0; x2=0; - sendDirForEdge[0]=D3Q27System::TN; - sendDirForEdge[1]=D3Q27System::TNE; - sendDirForEdge[2]=D3Q27System::TNW; - break; - case D3Q27System::TS: x3=maxX3; x2=0; - sendDirForEdge[0]=D3Q27System::BN; - sendDirForEdge[1]=D3Q27System::BNE; - sendDirForEdge[2]=D3Q27System::BNW; - break; - - } - for(int x1=1; x1<maxX1; x1++) - { - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[0]); - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[1]); - fTo->setDistributionForDirection(data[index++],x1, x2, x3, sendDirForEdge[2]); - } - } - //TNE TNW TSW TSE BNE BNW BSW BSE - else if(sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSW || sendDir==D3Q27System::TSE - || sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSW || sendDir==D3Q27System::BSE) - { - int inversDir = D3Q27System::getInvertDirection(sendDir); - int x1 = 0; - int x2 = 0; - int x3 = 0; - unsigned long int etDir = 0; - switch(sendDir) - { - case D3Q27System::TNE: x1=maxX1; x2=maxX2; x3=maxX3; etDir=EsoTwistD3Q27System::etTNE; break; - case D3Q27System::TNW: x1=0; x2=maxX2; x3=maxX3; etDir=EsoTwistD3Q27System::etTNW; break; - case D3Q27System::TSW: x1=0; x2=0; x3=maxX3; etDir=EsoTwistD3Q27System::etTSW; break; - case D3Q27System::TSE: x1=maxX1; x2=0; x3=maxX3; etDir=EsoTwistD3Q27System::etTSE; break; - case D3Q27System::BNE: x1=maxX1; x2=maxX2; x3=0; etDir=EsoTwistD3Q27System::etBNE; break; - case D3Q27System::BNW: x1=0; x2=maxX2; x3=0; etDir=EsoTwistD3Q27System::etBNW; break; - case D3Q27System::BSW: x1=0; x2=0; x3=0; etDir=EsoTwistD3Q27System::etBSW; break; - case D3Q27System::BSE: x1=maxX1; x2=0; x3=0; etDir=EsoTwistD3Q27System::etBSE; break; - } - fTo->setDistributionForDirection(data[index++],x1, x2, x3, inversDir); - } - else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -double D3Q27ETVectorConnector<VectorTransmitter>::getSendRecieveTime() -{ - return 0; -} - -#endif //D3Q27VECTORCONNECTOR_H diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.cpp b/source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.cpp deleted file mode 100644 index 5c588b8e6..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.cpp +++ /dev/null @@ -1,371 +0,0 @@ -#include "D3Q27ETWithInvDirectConnector.h" -#include "LBMKernelETD3Q27.h" -#include "EsoTwistD3Q27System.h" - - -using namespace std; - -//Im Anschluss sind die Bulkbereiche synchron - -//*==========================================================*/ -void D3Q27ETWithInvDirectConnector::sendVectors() -{ - EsoTwist3DPtr fFrom = boost::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - EsoTwist3DPtr fTo = boost::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); - - int maxX1 = (int)fFrom->getNX1()-1; - int maxX2 = (int)fFrom->getNX2()-1; - int maxX3 = (int)fFrom->getNX3()-1; - - LBMReal f[D3Q27System::ENDF+1]; - - //EAST - if(sendDir==D3Q27System::E) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,x2,x3); - else fFrom->getDistributionInv(f,maxX1-1,x2,x3); - if(invStep) fTo->setDistributionInvForDirection(f,0,x2,x3,EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etE - | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTE - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBSE); - else fTo->setDistributionForDirection(f,0,x2,x3,EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etE - | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTE - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBSE); - } - } - } - //WEST - else if(sendDir==D3Q27System::W) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x2=1; x2<maxX2; x2++) - { - if(invStep) fFrom->getDistribution(f,1,x2,x3); - else fFrom->getDistributionInv(f,1,x2,x3); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,x2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etW - | EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etTW - | EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTSW | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBSW); - else fTo->setDistributionForDirection(f,maxX1,x2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etW - | EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etTW - | EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTSW | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBSW); - } - } - } - //NORTH - else if(sendDir==D3Q27System::N) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - if(invStep) fFrom->getDistribution(f,x1,maxX2-1,x3); - else fFrom->getDistributionInv(f,x1,maxX2-1,x3); - if(invStep) fTo->setDistributionInvForDirection(f,x1,0,x3,EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etN - | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTN - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTNE | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBNE); - else fTo->setDistributionForDirection(f,x1,0,x3,EsoTwistD3Q27System::etNW | EsoTwistD3Q27System::etN - | EsoTwistD3Q27System::etNE | EsoTwistD3Q27System::etTN - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTNE | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBNE); - } - } - } - //SOUTH - else if(sendDir==D3Q27System::S) - { - for(int x3=1; x3<maxX3; x3++) - { - for(int x1=1; x1<maxX1; x1++) - { - if(invStep) fFrom->getDistribution(f,x1,1,x3); - else fFrom->getDistributionInv(f,x1,1,x3); - if(invStep) fTo->setDistributionInvForDirection(f,x1,maxX2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etS - | EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etBS | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - else fTo->setDistributionForDirection(f,x1,maxX2,x3,EsoTwistD3Q27System::etSW | EsoTwistD3Q27System::etS - | EsoTwistD3Q27System::etSE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etBS | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - } - } - } - - //TOP - else if(sendDir==D3Q27System::T) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - if(invStep) fFrom->getDistribution(f,x1,x2,maxX3-1); - else fFrom->getDistributionInv(f,x1,x2,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,x1,x2,0,EsoTwistD3Q27System::etTW | EsoTwistD3Q27System::etT - | EsoTwistD3Q27System::etTE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etTN | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTNW | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE); - else fTo->setDistributionForDirection(f,x1,x2,0,EsoTwistD3Q27System::etTW | EsoTwistD3Q27System::etT - | EsoTwistD3Q27System::etTE | EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etTN | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTNW | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE); - } - } - } - //BOTTOM - else if(sendDir==D3Q27System::B) - { - for(int x2=1; x2<maxX2; x2++) - { - for(int x1=1; x1<maxX1; x1++) - { - if(invStep) fFrom->getDistribution(f,x1,x2,1); - else fFrom->getDistributionInv(f,x1,x2,1); - if(invStep) fTo->setDistributionInvForDirection(f,x1,x2,maxX3,EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etB - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etBS - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBNW | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - else fTo->setDistributionForDirection(f,x1,x2,maxX3,EsoTwistD3Q27System::etBW | EsoTwistD3Q27System::etB - | EsoTwistD3Q27System::etBE | EsoTwistD3Q27System::etBS - | EsoTwistD3Q27System::etBN | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBNW | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - } - } - } - //NORTHEAST - else if(sendDir==D3Q27System::NE) - { - for(int x3=1; x3<maxX3; x3++) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,maxX2-1,x3); - else fFrom->getDistributionInv(f,maxX1-1,maxX2-1,x3); - if(invStep) fTo->setDistributionInvForDirection(f,0,0,x3,EsoTwistD3Q27System::etNE - | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etBNE); - else fTo->setDistributionForDirection(f,0,0,x3,EsoTwistD3Q27System::etNE - | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etBNE); - } - } - //NORTHWEST - else if(sendDir==D3Q27System::NW) - { - for(int x3=1; x3<maxX3; x3++) - { - if(invStep)fFrom->getDistribution(f,1,maxX2-1,x3); - else fFrom->getDistributionInv(f,1,maxX2-1,x3); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,0,x3,EsoTwistD3Q27System::etNW - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etBNW); - else fTo->setDistributionForDirection(f,maxX1,0,x3,EsoTwistD3Q27System::etNW - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etBNW); - } - } - //SOUTHWEST - else if(sendDir==D3Q27System::SW) - { - for(int x3=1; x3<maxX3; x3++) - { - if(invStep) fFrom->getDistribution(f,1,1,x3); - else fFrom->getDistributionInv(f,1,1,x3); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,maxX2,x3,EsoTwistD3Q27System::etSW - | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etBSW); - else fTo->setDistributionForDirection(f,maxX1,maxX2,x3,EsoTwistD3Q27System::etSW - | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etBSW); - } - } - //SOUTHEAST - else if(sendDir==D3Q27System::SE) - { - for(int x3=1; x3<maxX3; x3++) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,1,x3); - else fFrom->getDistributionInv(f,maxX1-1,1,x3); - if(invStep) fTo->setDistributionInvForDirection(f,0,maxX2,x3,EsoTwistD3Q27System::etSE - | EsoTwistD3Q27System::etTSE - | EsoTwistD3Q27System::etBSE); - else fTo->setDistributionForDirection(f,0,maxX2,x3,EsoTwistD3Q27System::etSE - | EsoTwistD3Q27System::etTSE - | EsoTwistD3Q27System::etBSE); - } - } - else if(sendDir==D3Q27System::TE) - for(int x2=1; x2<maxX2; x2++) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,x2,maxX3-1); - else fFrom->getDistributionInv(f,maxX1-1,x2,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,0,x2,0,EsoTwistD3Q27System::etTE - | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTSE); - else fTo->setDistributionForDirection(f,0,x2,0,EsoTwistD3Q27System::etTE - | EsoTwistD3Q27System::etTNE - | EsoTwistD3Q27System::etTSE); - } - else if(sendDir==D3Q27System::BW) - for(int x2=1; x2<maxX2; x2++) - { - if(invStep) fFrom->getDistribution(f,1,x2,1); - else fFrom->getDistributionInv(f,1,x2,1); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,x2,maxX3,EsoTwistD3Q27System::etBW - | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBSW); - else fTo->setDistributionForDirection(f,maxX1,x2,maxX3,EsoTwistD3Q27System::etBW - | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBSW); - } - else if(sendDir==D3Q27System::BE) - for(int x2=1; x2<maxX2; x2++) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,x2,1); - else fFrom->getDistributionInv(f,maxX1-1,x2,1); - if(invStep) fTo->setDistributionInvForDirection(f,0,x2,maxX3,EsoTwistD3Q27System::etBE - | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBSE); - else fTo->setDistributionForDirection(f,0,x2,maxX3,EsoTwistD3Q27System::etBE - | EsoTwistD3Q27System::etBNE - | EsoTwistD3Q27System::etBSE); - } - else if(sendDir==D3Q27System::TW) - for(int x2=1; x2<maxX2; x2++) - { - if(invStep) fFrom->getDistribution(f,1,x2,maxX3-1); - else fFrom->getDistributionInv(f,1,x2,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,x2,0,EsoTwistD3Q27System::etTW - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTSW); - else fTo->setDistributionForDirection(f,maxX1,x2,0,EsoTwistD3Q27System::etTW - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTSW); - } - else if(sendDir==D3Q27System::TN) - for(int x1=1; x1<maxX1; x1++) - { - if(invStep) fFrom->getDistribution(f,x1,maxX2-1,maxX3-1); - else fFrom->getDistributionInv(f,x1,maxX2-1,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,x1,0,0,EsoTwistD3Q27System::etTN - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTNE); - else fTo->setDistributionForDirection(f,x1,0,0,EsoTwistD3Q27System::etTN - | EsoTwistD3Q27System::etTNW - | EsoTwistD3Q27System::etTNE); - } - else if(sendDir==D3Q27System::BS) - for(int x1=1; x1<maxX1; x1++) - { - fFrom->getDistributionInv(f,x1,1,1); - fTo->setDistributionForDirection(f,x1,maxX2,maxX3,EsoTwistD3Q27System::etBS - | EsoTwistD3Q27System::etBSW - | EsoTwistD3Q27System::etBSE); - } - else if(sendDir==D3Q27System::BN) - for(int x1=1; x1<maxX1; x1++) - { - if(invStep) fFrom->getDistribution(f,x1,maxX2-1,1); - else fFrom->getDistributionInv(f,x1,maxX2-1,1); - if(invStep) fTo->setDistributionInvForDirection(f,x1,0,maxX3,EsoTwistD3Q27System::etBN - | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBNE); - else fTo->setDistributionForDirection(f,x1,0,maxX3,EsoTwistD3Q27System::etBN - | EsoTwistD3Q27System::etBNW - | EsoTwistD3Q27System::etBNE); - } - - else if(sendDir==D3Q27System::TS) - for(int x1=1; x1<maxX1; x1++) - { - if(invStep) fFrom->getDistribution(f,x1,1,maxX3-1); - else fFrom->getDistributionInv(f,x1,1,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,x1,maxX2,0,EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE); - else fTo->setDistributionForDirection(f,x1,maxX2,0,EsoTwistD3Q27System::etTS - | EsoTwistD3Q27System::etTSW - | EsoTwistD3Q27System::etTSE); - } - - else if(sendDir==D3Q27System::TSW) - { - if(invStep) fFrom->getDistribution(f,1,1,maxX3-1); - else fFrom->getDistributionInv(f,1,1,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,maxX2,0,EsoTwistD3Q27System::etTSW); - else fTo->setDistributionForDirection(f,maxX1,maxX2,0,EsoTwistD3Q27System::etTSW); - } - else if(sendDir==D3Q27System::TSE) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,1,maxX3-1); - else fFrom->getDistributionInv(f,maxX1-1,1,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,0,maxX2,0,EsoTwistD3Q27System::etTSE); - else fTo->setDistributionForDirection(f,0,maxX2,0,EsoTwistD3Q27System::etTSE); - } - else if(sendDir==D3Q27System::TNW) - { - if(invStep) fFrom->getDistribution(f,1,maxX2-1,maxX3-1); - else fFrom->getDistributionInv(f,1,maxX2-1,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,0,0,EsoTwistD3Q27System::etTNW); - else fTo->setDistributionForDirection(f,maxX1,0,0,EsoTwistD3Q27System::etTNW); - } - else if(sendDir==D3Q27System::TNE) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,maxX2-1,maxX3-1); - else fFrom->getDistributionInv(f,maxX1-1,maxX2-1,maxX3-1); - if(invStep) fTo->setDistributionInvForDirection(f,0,0,0,EsoTwistD3Q27System::etTNE); - else fTo->setDistributionForDirection(f,0,0,0,EsoTwistD3Q27System::etTNE); - } - else if(sendDir==D3Q27System::BSW) - { - if(invStep) fFrom->getDistribution(f,1,1,1); - else fFrom->getDistributionInv(f,1,1,1); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,maxX2,maxX3,EsoTwistD3Q27System::etBSW); - else fTo->setDistributionForDirection(f,maxX1,maxX2,maxX3,EsoTwistD3Q27System::etBSW); - } - else if(sendDir==D3Q27System::BSE) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,1,1); - else fFrom->getDistributionInv(f,maxX1-1,1,1); - if(invStep) fTo->setDistributionInvForDirection(f,0,maxX2,maxX3,EsoTwistD3Q27System::etBSE); - else fTo->setDistributionForDirection(f,0,maxX2,maxX3,EsoTwistD3Q27System::etBSE); - } - else if(sendDir==D3Q27System::BNW) - { - if(invStep) fFrom->getDistribution(f,1,maxX2-1,1); - else fFrom->getDistributionInv(f,1,maxX2-1,1); - if(invStep) fTo->setDistributionInvForDirection(f,maxX1,0,maxX3,EsoTwistD3Q27System::etBNW); - else fTo->setDistributionForDirection(f,maxX1,0,maxX3,EsoTwistD3Q27System::etBNW); - } - else if(sendDir==D3Q27System::BNE) - { - if(invStep) fFrom->getDistribution(f,maxX1-1,maxX2-1,1); - else fFrom->getDistributionInv(f,maxX1-1,maxX2-1,1); - if(invStep) fTo->setDistributionInvForDirection(f,0,0,maxX3,EsoTwistD3Q27System::etBNE); - else fTo->setDistributionForDirection(f,0,0,maxX3,EsoTwistD3Q27System::etBNE); - } - else UB_THROW( UbException(UB_EXARGS,"unknown dir") ); -} -////////////////////////////////////////////////////////////////////////// -double D3Q27ETWithInvDirectConnector::getSendRecieveTime() -{ - return 0; -} diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.h deleted file mode 100644 index 486053eba..000000000 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETWithInvDirectConnector.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef D3Q27ETWithInvDIRECTCONNECTOR_H -#define D3Q27ETWithInvDIRECTCONNECTOR_H - -#include <boost/weak_ptr.hpp> - -#include "Block3DConnector.h" -#include "Block3D.h" - -class D3Q27ETWithInvDirectConnector : public Block3DConnector -{ -public: - D3Q27ETWithInvDirectConnector(Block3DPtr from, Block3DPtr to, const int& sendDir) - : Block3DConnector(sendDir) - , from(from) - , to(to) - { - - } - - void sendTransmitterDataSize() { } - void receiveTransmitterDataSize() { } - void init() { } - void prepareForReceive() { } - void prepareForSend() { } - void fillSendVectors() { } - void sendVectors();// { } - void receiveVectors() { } - - void distributeReceiveVectors() { } - - bool isLocalConnector() { return true; } - bool isRemoteConnector() { return false; } - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - boost::weak_ptr<Block3D> from; - boost::weak_ptr<Block3D> to; -}; - -#endif //D3Q27DIRECTCONNECTOR_H - diff --git a/source/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h b/source/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h index 647b387e0..73f9e9849 100644 --- a/source/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h +++ b/source/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h @@ -18,8 +18,6 @@ #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> -#include "D3Q27ETFCVectorConnector.h" - class Block3D; //daten werden in einen vector (dieser befindet sich im transmitter) kopiert diff --git a/source/VirtualFluidsCore/Grid/Calculator.cpp b/source/VirtualFluidsCore/Grid/Calculator.cpp index bf0cef29d..303367cf9 100644 --- a/source/VirtualFluidsCore/Grid/Calculator.cpp +++ b/source/VirtualFluidsCore/Grid/Calculator.cpp @@ -115,7 +115,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos //exchange data between blocks //Sleep(10000); - exchangeBlockData(straightStartLevel, maxInitLevel, false); + exchangeBlockData(straightStartLevel, maxInitLevel); ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[1] = timer.stop(); @@ -152,7 +152,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); //DOES NOT NEED if(straightStartLevel<maxInitLevel) - exchangeBlockData(straightStartLevel, maxInitLevel, true); + exchangeBlockData(straightStartLevel, maxInitLevel); // //exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); ////////////////////////////////////////////////////////////////////////// #ifdef TIMING @@ -171,7 +171,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// } - if (taValuesCoProcessor && mainThread) + if (taValuesCoProcessor && mainThread && straightStartLevel<maxInitLevel) { taValuesCoProcessor->process(calcStep-1); } @@ -182,7 +182,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos if(mainThread) visScheduler->isDue((double)(calcStep-1)); if((int)visScheduler->getNextDueTime() == calcStep) { - exchangeBlockData(straightStartLevel, maxInitLevel, true); + exchangeBlockData(straightStartLevel, maxInitLevel); } //now ghost nodes have actual values @@ -410,7 +410,7 @@ void Calculator::initConnectors(std::vector<Block3DConnectorPtr>& connectors) UBLOG(logDEBUG1, "Calculator::initConnectors() - end"); } ////////////////////////////////////////////////////////////////////////// -void Calculator::exchangeBlockData(int startLevel, int maxInitLevel, bool invStep) +void Calculator::exchangeBlockData(int startLevel, int maxInitLevel) { sync->wait(); //startLevel bis maxInitLevel @@ -419,16 +419,16 @@ void Calculator::exchangeBlockData(int startLevel, int maxInitLevel, bool invSte connectorsPrepare(localConns[level]); connectorsPrepare(remoteConns[level]); - connectorsSend(localConns[level], invStep); - connectorsSend(remoteConns[level], invStep); + connectorsSend(localConns[level]); + connectorsSend(remoteConns[level]); - connectorsReceive(localConns[level], invStep); - connectorsReceive(remoteConns[level], invStep); + connectorsReceive(localConns[level]); + connectorsReceive(remoteConns[level]); } sync->wait(); } ////////////////////////////////////////////////////////////////////////// -void Calculator::exchangeInterfaceBlockData(int startLevel, int maxInitLevel, bool invStep) +void Calculator::exchangeInterfaceBlockData(int startLevel, int maxInitLevel) { sync->wait(); //startLevel bis maxInitLevel @@ -437,11 +437,11 @@ void Calculator::exchangeInterfaceBlockData(int startLevel, int maxInitLevel, bo connectorsPrepare(localInterfaceBlockConns[level]); connectorsPrepare(remoteInterfaceBlockConns[level]); - connectorsSend(localInterfaceBlockConns[level], invStep); - connectorsSend(remoteInterfaceBlockConns[level], invStep); + connectorsSend(localInterfaceBlockConns[level]); + connectorsSend(remoteInterfaceBlockConns[level]); - connectorsReceive(localInterfaceBlockConns[level], invStep); - connectorsReceive(remoteInterfaceBlockConns[level], invStep); + connectorsReceive(localInterfaceBlockConns[level]); + connectorsReceive(remoteInterfaceBlockConns[level]); } sync->wait(); } @@ -467,34 +467,24 @@ void Calculator::connectorsPrepare(std::vector< Block3DConnectorPtr >& connector } } ////////////////////////////////////////////////////////////////////////// -void Calculator::connectorsSend(std::vector< Block3DConnectorPtr >& connectors, bool invStep) +void Calculator::connectorsSend(std::vector< Block3DConnectorPtr >& connectors) { BOOST_FOREACH(Block3DConnectorPtr c, connectors) { - c->setInvStep(invStep); c->fillSendVectors(); c->sendVectors(); } } ////////////////////////////////////////////////////////////////////////// -void Calculator::connectorsReceive(std::vector< Block3DConnectorPtr >& connectors, bool invStep) +void Calculator::connectorsReceive(std::vector< Block3DConnectorPtr >& connectors) { BOOST_FOREACH(Block3DConnectorPtr c, connectors) { - c->setInvStep(invStep); c->receiveVectors(); c->distributeReceiveVectors(); } } ////////////////////////////////////////////////////////////////////////// -void Calculator::connectorsSetInvStep(std::vector< Block3DConnectorPtr >& connectors, bool invStep) -{ - BOOST_FOREACH(Block3DConnectorPtr c, connectors) - { - c->setInvStep(invStep); - } -} -////////////////////////////////////////////////////////////////////////// void Calculator::interpolation(int startLevel, int maxInitLevel) { sync->wait(); @@ -509,16 +499,16 @@ void Calculator::interpolation(int startLevel, int maxInitLevel) for(int level=startLevel; level<maxInitLevel; level++) { - connectorsSend(localInterConns[level], true); - connectorsSend(remoteInterConns[level], true); + connectorsSend(localInterConns[level]); + connectorsSend(remoteInterConns[level]); } sync->wait(); for(int level=startLevel; level<maxInitLevel; level++) { - connectorsReceive(localInterConns[level], true); - connectorsReceive(remoteInterConns[level], true); + connectorsReceive(localInterConns[level]); + connectorsReceive(remoteInterConns[level]); } sync->wait(); diff --git a/source/VirtualFluidsCore/Grid/Calculator.h b/source/VirtualFluidsCore/Grid/Calculator.h index 494cd72e3..54c5373ec 100644 --- a/source/VirtualFluidsCore/Grid/Calculator.h +++ b/source/VirtualFluidsCore/Grid/Calculator.h @@ -39,12 +39,11 @@ protected: void initConnectors(std::vector<Block3DConnectorPtr>& connectors); virtual void initRemoteConnectors(); void swapDistributions(int startLevel, int maxInitLevel); - virtual void exchangeBlockData(int startLevel, int maxInitLevel, bool invStep); - void exchangeInterfaceBlockData(int startLevel, int maxInitLevel, bool invStep); + virtual void exchangeBlockData(int startLevel, int maxInitLevel); + void exchangeInterfaceBlockData(int startLevel, int maxInitLevel); virtual void connectorsPrepare(std::vector< Block3DConnectorPtr >& connectors); - virtual void connectorsSend(std::vector< Block3DConnectorPtr >& connectors, bool invStep); - virtual void connectorsReceive(std::vector< Block3DConnectorPtr >& connectors, bool invStep); - void connectorsSetInvStep(std::vector< Block3DConnectorPtr >& connectors, bool invStep); + virtual void connectorsSend(std::vector< Block3DConnectorPtr >& connectors); + virtual void connectorsReceive(std::vector< Block3DConnectorPtr >& connectors); void interpolation(int startLevel, int maxInitLevel); void deleteConnectors(std::vector< std::vector< Block3DConnectorPtr > >& conns); //void applyBCs(int startLevel, int maxInitLevel); diff --git a/source/VirtualFluidsCore/Grid/PrePostBcCalculator.cpp b/source/VirtualFluidsCore/Grid/PrePostBcCalculator.cpp index 3eaddbe33..8d01e1e2e 100644 --- a/source/VirtualFluidsCore/Grid/PrePostBcCalculator.cpp +++ b/source/VirtualFluidsCore/Grid/PrePostBcCalculator.cpp @@ -98,7 +98,7 @@ void PrePostBcCalculator::calculate(const double& endTime, CalculationManagerPtr //exchange data between blocks //Sleep(10000); - exchangeBlockData(straightStartLevel, maxInitLevel, false); + exchangeBlockData(straightStartLevel, maxInitLevel); ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[1] = timer.stop(); @@ -119,7 +119,7 @@ void PrePostBcCalculator::calculate(const double& endTime, CalculationManagerPtr swapDistributions(straightStartLevel, maxInitLevel); //pre-collision boundary conditions - exchangeBlockData(straightStartLevel, maxInitLevel, true); + exchangeBlockData(straightStartLevel, maxInitLevel); applyPreCollisionBC(straightStartLevel, maxInitLevel); ////////////////////////////////////////////////////////////////////////// @@ -159,7 +159,7 @@ void PrePostBcCalculator::calculate(const double& endTime, CalculationManagerPtr if(mainThread) visScheduler->isDue((double)(calcStep-1)); if((int)visScheduler->getNextDueTime() == calcStep) { - exchangeBlockData(straightStartLevel, maxInitLevel, true); + exchangeBlockData(straightStartLevel, maxInitLevel); } //now ghost nodes have actual values diff --git a/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.cpp b/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.cpp index 2fa4fe7d6..fe02e9eff 100644 --- a/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.cpp +++ b/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.cpp @@ -1,293 +1,464 @@ -#include "D3Q27IntegrateValuesHelper.h" - -#include <boost/foreach.hpp> -#include <numerics/geometry3d/GbCuboid3D.h> -#include <vector> - -#include "LBMKernelETD3Q27.h" -#include "D3Q27ETBCProcessor.h" - -using namespace std; -////////////////////////////////////////////////////////////////////////// -D3Q27IntegrateValuesHelper::D3Q27IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, - double minX1, double minX2, - double minX3, double maxX1, - double maxX2, double maxX3) : - - grid(grid), - comm(comm), - sVx1(0.0), sVx2(0.0), sVx3(0.0), sRho(0.0), sCellVolume(0.0), - numberOfFluidsNodes(0), - numberOfSolidNodes(0) -{ - boundingBox = GbCuboid3DPtr(new GbCuboid3D(minX1, minX2, minX3, maxX1, maxX2, maxX3)); - init(); -} -////////////////////////////////////////////////////////////////////////// -D3Q27IntegrateValuesHelper::~D3Q27IntegrateValuesHelper() -{ -} -////////////////////////////////////////////////////////////////////////// -void D3Q27IntegrateValuesHelper::init() -{ - double orgX1, orgX2, orgX3; - int gridRank = grid->getRank(); - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - double numSolids = 0.0; - double numFluids = 0.0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, blockVector); - BOOST_FOREACH(Block3DPtr block, blockVector) - { - CalcNodes cn; - cn.block = block; - //Koords bestimmen - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - - orgX1 = val<1>(org); - orgX2 = val<2>(org); - orgX3 = val<3>(org); - - LBMKernelETD3Q27Ptr kernel = boost::dynamic_pointer_cast<LBMKernelETD3Q27>(block->getKernel()); - BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray(); - int ghostLayerWitdh = kernel->getGhostLayerWidth(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - double internX1, internX2, internX3; - - double dx = grid->getDeltaX(block); - UbTupleDouble3 orgDelta = grid->getNodeOffset(block); - - for (int ix3=ghostLayerWitdh; ix3<(int)distributions->getNX3()-ghostLayerWitdh; ix3++) - { - for (int ix2=ghostLayerWitdh; ix2<(int)distributions->getNX2()-ghostLayerWitdh; ix2++) - { - for (int ix1=ghostLayerWitdh; ix1<(int)distributions->getNX1()-ghostLayerWitdh; ix1++) - { - internX1 = orgX1 - val<1>(orgDelta) +ix1 * dx; - internX2 = orgX2 - val<2>(orgDelta) +ix2 * dx; - internX3 = orgX3 - val<3>(orgDelta) +ix3 * dx; - if (boundingBox->isPointInGbObject3D(internX1, internX2, internX3)) - { - if (!bcArray.isSolid(ix1, ix2, ix3) && !bcArray.isUndefined(ix1, ix2, ix3)) - { - cn.nodes.push_back(UbTupleInt3(ix1, ix2, ix3)); - numFluids++; - } - else if (bcArray.isSolid(ix1, ix2, ix3)) - { - numSolids++; - } - } - } - } - } - if (cn.nodes.size() > 0) - cnodes.push_back(cn); - } - } - vector<double> rvalues; - vector<double> values; - values.push_back(numSolids); - values.push_back(numFluids); - rvalues = comm->gather(values); - - if (comm->getProcessID() == comm->getRoot()) - { - numberOfSolidNodes = 0.0; - numberOfFluidsNodes = 0.0; - int rsize = (int)rvalues.size(); - int vsize = (int)values.size(); - for (int i = 0; i < rsize; i += vsize) - { - numberOfSolidNodes += rvalues[i]; - numberOfFluidsNodes += rvalues[i+1]; - } - } - -} -// calculation conventional rho, velocity and averaged data -void D3Q27IntegrateValuesHelper::calculateAV() -{ - clearData(); - //Funktionszeiger - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - CalcMacrosFct calcMacros = NULL; - - BOOST_FOREACH(CalcNodes cn, cnodes) - { - LBMKernel3DPtr kernel = cn.block->getKernel(); - if (kernel->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray(); - int ghostLayerWitdh = kernel->getGhostLayerWidth(); - AverageValuesArray3DPtr averagedValues = kernel->getDataSet()->getAverageValues(); - - BOOST_FOREACH(UbTupleInt3 node, cn.nodes) - { - double Avx = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVx); - double Avy = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVy); - double Avz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVz); - - double Avxx = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVxx); - double Avyy = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVyy); - double Avzz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVzz); - - double Avxz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVxz); - sAvVx1 +=abs(Avx); - sAvVx2 +=abs(Avy); - sAvVx3 +=abs(Avz); - - sTSx1 += sqrt(Avxx); - sTSx2 += sqrt(Avyy); - sTSx3 += sqrt(Avzz); - - sTSx1x3 += Avxz; - numberOfFluidsNodes++; - } - } - vector<double> values; - vector<double> rvalues; - values.push_back(sAvVx1); - values.push_back(sAvVx2); - values.push_back(sAvVx3); - values.push_back(sTSx1); - values.push_back(sTSx2); - values.push_back(sTSx3); - values.push_back(sTSx1x3); - values.push_back(numberOfFluidsNodes); - - rvalues = comm->gather(values); - if (comm->getProcessID() == comm->getRoot()) - { - clearData(); - for (int i = 0; i < (int)rvalues.size(); i+=8) - { - sAvVx1 += rvalues[i]; - sAvVx2 += rvalues[i+1]; - sAvVx3 += rvalues[i+2]; - sTSx1 += rvalues[i+3]; - sTSx2 += rvalues[i+4]; - sTSx3 += rvalues[i+5]; - sTSx1x3 += rvalues[i+6]; - numberOfFluidsNodes += rvalues[i+7]; - } - } -} -////////////////////////////////////////////////////////////////////////// -void D3Q27IntegrateValuesHelper::calculateMQ() -{ - LBMReal f[D3Q27System::ENDF+1]; - LBMReal vx1, vx2, vx3, rho; - clearData(); - - //Funktionszeiger - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - - CalcMacrosFct calcMacros = NULL; - - BOOST_FOREACH(CalcNodes cn, cnodes) - { - LBMKernel3DPtr kernel = cn.block->getKernel(); - LBMReal dx = 1.0 / (LBMReal)(1 << cn.block->getLevel()); - LBMReal cellVolume = dx*dx*dx; - - if (kernel->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - - BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray(); - int ghostLayerWitdh = kernel->getGhostLayerWidth(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - BOOST_FOREACH(UbTupleInt3 node, cn.nodes) - { - distributions->getDistribution(f, val<1>(node), val<2>(node), val<3>(node)); - calcMacros(f, rho, vx1, vx2, vx3); - //press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3); - sRho += rho*cellVolume; - sVx1 += vx1*cellVolume; - sVx2 += vx2*cellVolume; - sVx3 += vx3*cellVolume; - sCellVolume+=cellVolume; - //sPress += press*area; - //sVm += (sqrt(vx1*vx1 + vx2*vx2 + vx3*vx3)*area); - } - } - vector<double> values; - vector<double> rvalues; - values.push_back(sRho); - values.push_back(sVx1); - values.push_back(sVx2); - values.push_back(sVx3); - values.push_back(sCellVolume); - //values.push_back(sPress); - //values.push_back(sVm); - - comm->allGather(values, rvalues); - clearData(); - int rsize = (int)rvalues.size(); - int vsize = (int)values.size(); - for (int i = 0; i < rsize; i+=vsize) - { - sRho += rvalues[i]; - sVx1 += rvalues[i+1]; - sVx2 += rvalues[i+2]; - sVx3 += rvalues[i+3]; - sCellVolume += rvalues[i+4]; - //sPress += rvalues[i+5]; - //sVm += rvalues[i+6]; - } -} -////////////////////////////////////////////////////////////////////////// -void D3Q27IntegrateValuesHelper::clearData() -{ - sRho = 0.0; - sVx1 = 0.0; - sVx2 = 0.0; - sVx3 = 0.0; - sCellVolume= 0.0; - //sVm = 0.0; - //sPress = 0.0; - //numberOfFluidsNodes = 0.0; - sAvVx1 = 0.0; - sAvVx2 = 0.0; - sAvVx3 = 0.0; - sTSx1 = 0.0; - sTSx2 = 0.0; - sTSx3 = 0.0; - sTSx1x3 = 0.0; -} -////////////////////////////////////////////////////////////////////////// -LBMReal D3Q27IntegrateValuesHelper::getNumberOfFluidsNodes() -{ - return this->numberOfFluidsNodes; -} -////////////////////////////////////////////////////////////////////////// -LBMReal D3Q27IntegrateValuesHelper::getNumberOfSolidNodes() -{ - return this->numberOfSolidNodes; -} -////////////////////////////////////////////////////////////////////////// -GbCuboid3DPtr D3Q27IntegrateValuesHelper::getBoundingBox() -{ - return this->boundingBox; -} -////////////////////////////////////////////////////////////////////////// -std::vector<CalcNodes> D3Q27IntegrateValuesHelper::getCNodes() -{ - return cnodes; -} +#include "D3Q27IntegrateValuesHelper.h" + +#include <boost/foreach.hpp> +#include <numerics/geometry3d/GbCuboid3D.h> +#include <vector> + +#include "LBMKernelETD3Q27.h" +#include "D3Q27ETBCProcessor.h" + +using namespace std; +////////////////////////////////////////////////////////////////////////// +D3Q27IntegrateValuesHelper::D3Q27IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, + double minX1, double minX2, + double minX3, double maxX1, + double maxX2, double maxX3) : + + grid(grid), + comm(comm), + sVx1(0.0), sVx2(0.0), sVx3(0.0), sRho(0.0), sCellVolume(0.0), + numberOfFluidsNodes(0), + numberOfSolidNodes(0) +{ + boundingBox = GbCuboid3DPtr(new GbCuboid3D(minX1, minX2, minX3, maxX1, maxX2, maxX3)); + init(-1); +} +////////////////////////////////////////////////////////////////////////// +D3Q27IntegrateValuesHelper::D3Q27IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, + double minX1, double minX2, + double minX3, double maxX1, + double maxX2, double maxX3, + int level) : + + grid(grid), + comm(comm), + sVx1(0.0), sVx2(0.0), sVx3(0.0), sRho(0.0), sCellVolume(0.0), + numberOfFluidsNodes(0), + numberOfSolidNodes(0) +{ + boundingBox = GbCuboid3DPtr(new GbCuboid3D(minX1, minX2, minX3, maxX1, maxX2, maxX3)); + init(level); +} +////////////////////////////////////////////////////////////////////////// +D3Q27IntegrateValuesHelper::~D3Q27IntegrateValuesHelper() +{ +} +////////////////////////////////////////////////////////////////////////// +void D3Q27IntegrateValuesHelper::init(int level) +{ + double orgX1, orgX2, orgX3; + int gridRank = grid->getRank(); + int minInitLevel, maxInitLevel; + if (level < 0) + { + minInitLevel = this->grid->getCoarsestInitializedLevel(); + maxInitLevel = this->grid->getFinestInitializedLevel(); + } + else + { + minInitLevel = level; + maxInitLevel = level; + } + + double numSolids = 0.0; + double numFluids = 0.0; + for (int level = minInitLevel; level<=maxInitLevel; level++) + { + vector<Block3DPtr> blockVector; + grid->getBlocks(level, gridRank, blockVector); + BOOST_FOREACH(Block3DPtr block, blockVector) + { + CalcNodes cn; + cn.block = block; + //Koords bestimmen + UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); + + orgX1 = val<1>(org); + orgX2 = val<2>(org); + orgX3 = val<3>(org); + + LBMKernelETD3Q27Ptr kernel = boost::dynamic_pointer_cast<LBMKernelETD3Q27>(block->getKernel()); + BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray(); + int ghostLayerWitdh = kernel->getGhostLayerWidth(); + DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); + double internX1, internX2, internX3; + + double dx = grid->getDeltaX(block); + UbTupleDouble3 orgDelta = grid->getNodeOffset(block); + + for (int ix3=ghostLayerWitdh; ix3<(int)distributions->getNX3()-ghostLayerWitdh; ix3++) + { + for (int ix2=ghostLayerWitdh; ix2<(int)distributions->getNX2()-ghostLayerWitdh; ix2++) + { + for (int ix1=ghostLayerWitdh; ix1<(int)distributions->getNX1()-ghostLayerWitdh; ix1++) + { + internX1 = orgX1 - val<1>(orgDelta) +ix1 * dx; + internX2 = orgX2 - val<2>(orgDelta) +ix2 * dx; + internX3 = orgX3 - val<3>(orgDelta) +ix3 * dx; + if (boundingBox->isPointInGbObject3D(internX1, internX2, internX3)) + { + if (!bcArray.isSolid(ix1, ix2, ix3) && !bcArray.isUndefined(ix1, ix2, ix3)) + { + cn.nodes.push_back(UbTupleInt3(ix1, ix2, ix3)); + numFluids++; + } + else if (bcArray.isSolid(ix1, ix2, ix3)) + { + numSolids++; + } + } + } + } + } + if (cn.nodes.size() > 0) + cnodes.push_back(cn); + } + } + vector<double> rvalues; + vector<double> values; + values.push_back(numSolids); + values.push_back(numFluids); + rvalues = comm->gather(values); + + if (comm->getProcessID() == comm->getRoot()) + { + numberOfSolidNodes = 0.0; + numberOfFluidsNodes = 0.0; + int rsize = (int)rvalues.size(); + int vsize = (int)values.size(); + for (int i = 0; i < rsize; i += vsize) + { + numberOfSolidNodes += rvalues[i]; + numberOfFluidsNodes += rvalues[i+1]; + } + } + +} +// calculation conventional rho, velocity and averaged data +void D3Q27IntegrateValuesHelper::calculateAV() +{ + clearData(); + + BOOST_FOREACH(CalcNodes cn, cnodes) + { + LBMKernel3DPtr kernel = cn.block->getKernel(); + AverageValuesArray3DPtr averagedValues = kernel->getDataSet()->getAverageValues(); + + BOOST_FOREACH(UbTupleInt3 node, cn.nodes) + { + double Avx = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVx); + double Avy = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVy); + double Avz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVz); + + double Avxx = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVxx); + double Avyy = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVyy); + double Avzz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVzz); + + double Avxz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVxz); + sAvVx1 +=abs(Avx); + sAvVx2 +=abs(Avy); + sAvVx3 +=abs(Avz); + + sTSx1 += sqrt(Avxx); + sTSx2 += sqrt(Avyy); + sTSx3 += sqrt(Avzz); + + sTSx1x3 += Avxz; + numberOfFluidsNodes++; + } + } + vector<double> values; + vector<double> rvalues; + values.push_back(sAvVx1); + values.push_back(sAvVx2); + values.push_back(sAvVx3); + values.push_back(sTSx1); + values.push_back(sTSx2); + values.push_back(sTSx3); + values.push_back(sTSx1x3); + values.push_back(numberOfFluidsNodes); + + rvalues = comm->gather(values); + if (comm->getProcessID() == comm->getRoot()) + { + clearData(); + for (int i = 0; i < (int)rvalues.size(); i+=8) + { + sAvVx1 += rvalues[i]; + sAvVx2 += rvalues[i+1]; + sAvVx3 += rvalues[i+2]; + sTSx1 += rvalues[i+3]; + sTSx2 += rvalues[i+4]; + sTSx3 += rvalues[i+5]; + sTSx1x3 += rvalues[i+6]; + numberOfFluidsNodes += rvalues[i+7]; + } + } +} +// calculation conventional rho, velocity and averaged data +void D3Q27IntegrateValuesHelper::calculateAV2() +{ + saVx = 0; + saVy = 0; + saVz = 0; + + saVxx = 0; + saVyy = 0; + saVzz = 0; + saVxy = 0; + saVxz = 0; + saVyz = 0; + + saVxxx = 0; + saVxxy = 0; + saVxxz = 0; + saVyyy = 0; + saVyyx = 0; + saVyyz = 0; + saVzzz = 0; + saVzzx = 0; + saVzzy = 0; + saVxyz = 0; + + double lsaVx = 0; + double lsaVy = 0; + double lsaVz = 0; + + double lsaVxx = 0; + double lsaVyy = 0; + double lsaVzz = 0; + double lsaVxy = 0; + double lsaVxz = 0; + double lsaVyz = 0; + + double lsaVxxx = 0; + double lsaVxxy = 0; + double lsaVxxz = 0; + double lsaVyyy = 0; + double lsaVyyx = 0; + double lsaVyyz = 0; + double lsaVzzz = 0; + double lsaVzzx = 0; + double lsaVzzy = 0; + double lsaVxyz = 0; + + BOOST_FOREACH(CalcNodes cn, cnodes) + { + LBMKernel3DPtr kernel = cn.block->getKernel(); + AverageVelocityArray3DPtr averagedVelocity = kernel->getDataSet()->getAverageVelocity(); + AverageFluctuationsArray3DPtr averagedFluctuations = kernel->getDataSet()->getAverageFluctuations(); + AverageTriplecorrelationsArray3DPtr averagedTriplecorrelations = kernel->getDataSet()->getAverageTriplecorrelations(); + + BOOST_FOREACH(UbTupleInt3 node, cn.nodes) + { + double aVx = (*averagedVelocity)(Vx, val<1>(node), val<2>(node), val<3>(node)); + double aVy = (*averagedVelocity)(Vy, val<1>(node), val<2>(node), val<3>(node)); + double aVz = (*averagedVelocity)(Vz, val<1>(node), val<2>(node), val<3>(node)); + + double aVxx = (*averagedFluctuations)(Vxx, val<1>(node), val<2>(node), val<3>(node)); + double aVyy = (*averagedFluctuations)(Vyy, val<1>(node), val<2>(node), val<3>(node)); + double aVzz = (*averagedFluctuations)(Vzz, val<1>(node), val<2>(node), val<3>(node)); + double aVxy = (*averagedFluctuations)(Vxy, val<1>(node), val<2>(node), val<3>(node)); + double aVxz = (*averagedFluctuations)(Vxz, val<1>(node), val<2>(node), val<3>(node)); + double aVyz = (*averagedFluctuations)(Vyz, val<1>(node), val<2>(node), val<3>(node)); + + double aVxxx = (*averagedFluctuations)(Vxxx, val<1>(node), val<2>(node), val<3>(node)); + double aVxxy = (*averagedFluctuations)(Vxxy, val<1>(node), val<2>(node), val<3>(node)); + double aVxxz = (*averagedFluctuations)(Vxxz, val<1>(node), val<2>(node), val<3>(node)); + double aVyyy = (*averagedFluctuations)(Vyyy, val<1>(node), val<2>(node), val<3>(node)); + double aVyyx = (*averagedFluctuations)(Vyyx, val<1>(node), val<2>(node), val<3>(node)); + double aVyyz = (*averagedFluctuations)(Vyyz, val<1>(node), val<2>(node), val<3>(node)); + double aVzzz = (*averagedFluctuations)(Vzzz, val<1>(node), val<2>(node), val<3>(node)); + double aVzzx = (*averagedFluctuations)(Vzzx, val<1>(node), val<2>(node), val<3>(node)); + double aVzzy = (*averagedFluctuations)(Vzzy, val<1>(node), val<2>(node), val<3>(node)); + double aVxyz = (*averagedFluctuations)(Vxyz, val<1>(node), val<2>(node), val<3>(node)); + + lsaVx += aVx ; + lsaVy += aVy ; + lsaVz += aVz ; + + lsaVxx += aVxx ; + lsaVyy += aVyy ; + lsaVzz += aVzz ; + lsaVxy += aVxy ; + lsaVxz += aVxz ; + lsaVyz += aVyz ; + + lsaVxxx += aVxxx; + lsaVxxy += aVxxy; + lsaVxxz += aVxxz; + lsaVyyy += aVyyy; + lsaVyyx += aVyyx; + lsaVyyz += aVyyz; + lsaVzzz += aVzzz; + lsaVzzx += aVzzx; + lsaVzzy += aVzzy; + lsaVxyz += aVxyz; + + //numberOfFluidsNodes++; + } + } + vector<double> values; + vector<double> rvalues; + values.push_back(lsaVx ); + values.push_back(lsaVy ); + values.push_back(lsaVz ); + + values.push_back(lsaVxx ); + values.push_back(lsaVyy ); + values.push_back(lsaVzz ); + values.push_back(lsaVxy ); + values.push_back(lsaVxz ); + values.push_back(lsaVyz ); + + values.push_back(lsaVxxx); + values.push_back(lsaVxxy); + values.push_back(lsaVxxz); + values.push_back(lsaVyyy); + values.push_back(lsaVyyx); + values.push_back(lsaVyyz); + values.push_back(lsaVzzz); + values.push_back(lsaVzzx); + values.push_back(lsaVzzy); + values.push_back(lsaVxyz); + + rvalues = comm->gather(values); + if (comm->getProcessID() == comm->getRoot()) + { + clearData(); + for (int i = 0; i < (int)rvalues.size(); i += 19) + { + saVx += rvalues[i]; + saVy += rvalues[i + 1]; + saVz += rvalues[i + 2]; + + saVxx += rvalues[i + 3]; + saVyy += rvalues[i + 4]; + saVzz += rvalues[i + 5]; + saVxy += rvalues[i + 6]; + saVxz += rvalues[i + 7]; + saVyz += rvalues[i + 8]; + + saVxxx += rvalues[i + 9]; + saVxxy += rvalues[i + 10]; + saVxxz += rvalues[i + 11]; + saVyyy += rvalues[i + 12]; + saVyyx += rvalues[i + 13]; + saVyyz += rvalues[i + 14]; + saVzzz += rvalues[i + 15]; + saVzzx += rvalues[i + 16]; + saVzzy += rvalues[i + 17]; + saVxyz += rvalues[i + 18]; + + } + } +} + +////////////////////////////////////////////////////////////////////////// +void D3Q27IntegrateValuesHelper::calculateMQ() +{ + LBMReal f[D3Q27System::ENDF+1]; + LBMReal vx1, vx2, vx3, rho; + clearData(); + + //Funktionszeiger + typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); + + CalcMacrosFct calcMacros = NULL; + + BOOST_FOREACH(CalcNodes cn, cnodes) + { + LBMKernel3DPtr kernel = cn.block->getKernel(); + LBMReal dx = 1.0 / (LBMReal)(1 << cn.block->getLevel()); + LBMReal cellVolume = dx*dx*dx; + + if (kernel->getCompressible()) + { + calcMacros = &D3Q27System::calcCompMacroscopicValues; + } + else + { + calcMacros = &D3Q27System::calcIncompMacroscopicValues; + } + + BCArray3D<D3Q27BoundaryCondition>& bcArray = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray(); + int ghostLayerWitdh = kernel->getGhostLayerWidth(); + DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); + BOOST_FOREACH(UbTupleInt3 node, cn.nodes) + { + distributions->getDistribution(f, val<1>(node), val<2>(node), val<3>(node)); + calcMacros(f, rho, vx1, vx2, vx3); + //press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3); + sRho += rho*cellVolume; + sVx1 += vx1*cellVolume; + sVx2 += vx2*cellVolume; + sVx3 += vx3*cellVolume; + sCellVolume+=cellVolume; + //sPress += press*area; + //sVm += (sqrt(vx1*vx1 + vx2*vx2 + vx3*vx3)*area); + } + } + vector<double> values; + vector<double> rvalues; + values.push_back(sRho); + values.push_back(sVx1); + values.push_back(sVx2); + values.push_back(sVx3); + values.push_back(sCellVolume); + //values.push_back(sPress); + //values.push_back(sVm); + + comm->allGather(values, rvalues); + clearData(); + int rsize = (int)rvalues.size(); + int vsize = (int)values.size(); + for (int i = 0; i < rsize; i+=vsize) + { + sRho += rvalues[i]; + sVx1 += rvalues[i+1]; + sVx2 += rvalues[i+2]; + sVx3 += rvalues[i+3]; + sCellVolume += rvalues[i+4]; + //sPress += rvalues[i+5]; + //sVm += rvalues[i+6]; + } +} +////////////////////////////////////////////////////////////////////////// +void D3Q27IntegrateValuesHelper::clearData() +{ + sRho = 0.0; + sVx1 = 0.0; + sVx2 = 0.0; + sVx3 = 0.0; + sCellVolume= 0.0; + //sVm = 0.0; + //sPress = 0.0; + //numberOfFluidsNodes = 0.0; + sAvVx1 = 0.0; + sAvVx2 = 0.0; + sAvVx3 = 0.0; + sTSx1 = 0.0; + sTSx2 = 0.0; + sTSx3 = 0.0; + sTSx1x3 = 0.0; +} +////////////////////////////////////////////////////////////////////////// +LBMReal D3Q27IntegrateValuesHelper::getNumberOfFluidsNodes() +{ + return this->numberOfFluidsNodes; +} +////////////////////////////////////////////////////////////////////////// +LBMReal D3Q27IntegrateValuesHelper::getNumberOfSolidNodes() +{ + return this->numberOfSolidNodes; +} +////////////////////////////////////////////////////////////////////////// +GbCuboid3DPtr D3Q27IntegrateValuesHelper::getBoundingBox() +{ + return this->boundingBox; +} +////////////////////////////////////////////////////////////////////////// +std::vector<CalcNodes> D3Q27IntegrateValuesHelper::getCNodes() +{ + return cnodes; +} diff --git a/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.h b/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.h index bee613655..fca208ff0 100644 --- a/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.h +++ b/source/VirtualFluidsCore/LBM/D3Q27IntegrateValuesHelper.h @@ -1,63 +1,99 @@ -#ifndef D3Q27INTEGRATEVALUESHELPER_H -#define D3Q27INTEGRATEVALUESHELPER_H - -#include "Grid3D.h" -#include "D3Q27System.h" -#include "Communicator.h" -#include "GbCuboid3D.h" - -struct CalcNodes -{ - Block3DPtr block; - std::vector<UbTupleInt3> nodes; -}; - -class D3Q27IntegrateValuesHelper; -typedef boost::shared_ptr<D3Q27IntegrateValuesHelper> D3Q27IntegrateValuesHelperPtr; - -class D3Q27IntegrateValuesHelper -{ -public: - D3Q27IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, - double minX1, double minX2, double minX3, - double maxX1, double maxX2, double maxX3); - virtual ~D3Q27IntegrateValuesHelper(); - - void calculateMQ(); - void calculateAV(); - void clearData(); - - LBMReal getRho() {return sRho;} - LBMReal getVx1() {return sVx1;} - LBMReal getVx2() {return sVx2;} - LBMReal getVx3() {return sVx3;} - LBMReal getCellsVolume() { return sCellVolume; } - // LBMReal getVm() { return sVm; } - //LBMReal getPress() {return sPress;} - LBMReal getAvVx1(){return sAvVx1;} - LBMReal getAvVx2(){return sAvVx2;} - LBMReal getAvVx3(){return sAvVx3;} - LBMReal getTSx1(){return sTSx1;} - LBMReal getTSx2(){return sTSx2;} - LBMReal getTSx3(){return sTSx3;} - LBMReal getTSx1x3(){return sTSx1x3;} - LBMReal getNumberOfFluidsNodes(); - LBMReal getNumberOfSolidNodes(); - GbCuboid3DPtr getBoundingBox(); - std::vector<CalcNodes> getCNodes(); - -protected: -private: - void init(); - Grid3DPtr grid; - LBMReal sVx1, sVx2, sVx3, sRho, sCellVolume;// sPress, sVm; - LBMReal numberOfFluidsNodes, numberOfSolidNodes; - LBMReal sAvVx1, sAvVx2, sAvVx3, sTSx1, sTSx2, sTSx3, sTSx1x3; - std::vector<CalcNodes> cnodes; - GbCuboid3DPtr boundingBox; - CommunicatorPtr comm; - enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVyz = 7, AvVxz = 8}; - -}; - -#endif +#ifndef D3Q27INTEGRATEVALUESHELPER_H +#define D3Q27INTEGRATEVALUESHELPER_H + +#include "Grid3D.h" +#include "D3Q27System.h" +#include "Communicator.h" +#include "GbCuboid3D.h" + +struct CalcNodes +{ + Block3DPtr block; + std::vector<UbTupleInt3> nodes; +}; + +class D3Q27IntegrateValuesHelper; +typedef boost::shared_ptr<D3Q27IntegrateValuesHelper> D3Q27IntegrateValuesHelperPtr; + +class D3Q27IntegrateValuesHelper +{ +public: + D3Q27IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, + double minX1, double minX2, double minX3, + double maxX1, double maxX2, double maxX3); + D3Q27IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, + double minX1, double minX2, double minX3, + double maxX1, double maxX2, double maxX3, int level); + virtual ~D3Q27IntegrateValuesHelper(); + + void calculateMQ(); + void calculateAV(); + void calculateAV2(); + void clearData(); + + double getRho() {return sRho;} + double getVx1() {return sVx1;} + double getVx2() {return sVx2;} + double getVx3() {return sVx3;} + double getCellsVolume() { return sCellVolume; } + // LBMReal getVm() { return sVm; } + //LBMReal getPress() {return sPress;} + double getAvVx1(){return sAvVx1;} + double getAvVx2(){return sAvVx2;} + double getAvVx3(){return sAvVx3;} + double getTSx1(){return sTSx1;} + double getTSx2(){return sTSx2;} + double getTSx3(){return sTSx3;} + double getTSx1x3(){return sTSx1x3;} + + double getAVx() { return saVx ; } + double getAVy() { return saVy ; } + double getAVz() { return saVz ; } + + double getAVxx() { return saVxx ; } + double getAVyy() { return saVyy ; } + double getAVzz() { return saVzz ; } + double getAVxy() { return saVxy ; } + double getAVxz() { return saVxz ; } + double getAVyz() { return saVyz ; } + + double getAVxxx() { return saVxxx; } + double getAVxxy() { return saVxxy; } + double getAVxxz() { return saVxxz; } + double getAVyyy() { return saVyyy; } + double getAVyyx() { return saVyyx; } + double getAVyyz() { return saVyyz; } + double getAVzzz() { return saVzzz; } + double getAVzzx() { return saVzzx; } + double getAVzzy() { return saVzzy; } + double getAVxyz() { return saVxyz; } + + + LBMReal getNumberOfFluidsNodes(); + LBMReal getNumberOfSolidNodes(); + GbCuboid3DPtr getBoundingBox(); + std::vector<CalcNodes> getCNodes(); + +protected: +private: + void init(int level); + Grid3DPtr grid; + double sVx1, sVx2, sVx3, sRho, sCellVolume;// sPress, sVm; + double numberOfFluidsNodes, numberOfSolidNodes; + double sAvVx1, sAvVx2, sAvVx3, sTSx1, sTSx2, sTSx3, sTSx1x3; + std::vector<CalcNodes> cnodes; + GbCuboid3DPtr boundingBox; + CommunicatorPtr comm; + enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVyz = 7, AvVxz = 8}; + + double saVx, saVy, saVz; + double saVxx, saVyy, saVzz, saVxy, saVxz, saVyz; + double saVxxx, saVxxy, saVxxz, saVyyy, saVyyx, saVyyz, saVzzz, saVzzx, saVzzy, saVxyz; + + enum Velocity { Vx, Vy, Vz }; + enum Fluctuations { Vxx, Vyy, Vzz, Vxy, Vxz, Vyz }; + enum Triplecorrelations { Vxxx, Vxxy, Vxxz, Vyyy, Vyyx, Vyyz, Vzzz, Vzzx, Vzzy, Vxyz }; + +}; + +#endif diff --git a/source/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp b/source/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp index 32e3d4cf7..1960d7076 100644 --- a/source/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp +++ b/source/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp @@ -1,13 +1,5 @@ #include "ConnectorBlockVisitor.h" #include "Grid3DSystem.h" -#include "D3Q27ETDirectConnector.h" -#include <basics/transmitter/TbTransmitterLocal.h> - -#include "D3Q27ETFullVectorConnector.h" -#include "D3Q27ETFullDirectConnector2.h" -#include "CoarseToFineNodeSetBlock3DConnector.h" -#include "FineToCoarseNodeSetBlock3DConnector.h" - ConnectorBlockVisitor::ConnectorBlockVisitor(CommunicatorPtr comm, LBMReal nu, D3Q27InterpolationProcessorPtr iProcessor, ConnectorFactoryPtr cFactory) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), diff --git a/source/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp b/source/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp index 3ebb2925f..e0b8fae8c 100644 --- a/source/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp +++ b/source/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp @@ -73,13 +73,13 @@ void CreateTransmittersHelper::createTransmitters(Block3DPtr sblock, Block3DPtr //////////////////////////////////////////////////////// //DEBUG - int myid = comm->getProcessID(); - FILE * file; - //char * name = "d:/temp/sendPoolKey.csv"; - std::string name = "d:/temp/VectorKey" + UbSystem::toString(myid) + ".csv"; - file = fopen(name.c_str(), "a"); - fprintf(file, "%d;%d%;%d;%d;%d;%u;%d;%d%;%d;%d;%d;%u\n", sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib, keyOfSendCbVectorKey, tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib, keyOfRecvCbVectorKey); - fclose(file); + //int myid = comm->getProcessID(); + //FILE * file; + ////char * name = "d:/temp/sendPoolKey.csv"; + //std::string name = "d:/temp/VectorKey" + UbSystem::toString(myid) + ".csv"; + //file = fopen(name.c_str(), "a"); + //fprintf(file, "%d;%d%;%d;%d;%d;%u;%d;%d%;%d;%d;%d;%u\n", sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib, keyOfSendCbVectorKey, tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib, keyOfRecvCbVectorKey); + //fclose(file); //////////////////////////////////////////////////////// //create sender-/receiver @@ -159,8 +159,8 @@ unsigned int CreateTransmittersHelper::generateVectorKey(int x1, int x2, int x3, str += "#"; str += StringUtil::toString<int>(ib); - //unsigned int key = Utilities::RSHash(str); - unsigned int key = FNV::fnv1a(str); + unsigned int key = Utilities::RSHash(str); + //unsigned int key = FNV::fnv1a(str); return key; diff --git a/source/VirtualFluidsCore/Visitors/D3Q27SetConnectorsBlockVisitor.cpp b/source/VirtualFluidsCore/Visitors/D3Q27SetConnectorsBlockVisitor.cpp index 1b3ae7dd6..999c45d55 100644 --- a/source/VirtualFluidsCore/Visitors/D3Q27SetConnectorsBlockVisitor.cpp +++ b/source/VirtualFluidsCore/Visitors/D3Q27SetConnectorsBlockVisitor.cpp @@ -1,15 +1,9 @@ #include "D3Q27SetConnectorsBlockVisitor.h" -#include "D3Q27ETFullVectorConnector.h" #include "D3Q27ETFullDirectConnector.h" -#include "D3Q27ETFullDirectConnector2.h" -#include "D3Q27ETFullDirectConnector3.h" #include "D3Q27ETFullVectorConnector.h" -#include "D3Q27ETCFVectorConnector.h" -#include "D3Q27ETFCVectorConnector.h" #include "D3Q27ETCFOffVectorConnector.h" #include "D3Q27ETFCOffVectorConnector.h" #include "Grid3DSystem.h" -#include "D3Q27ETDirectConnector.h" #include <basics/transmitter/TbTransmitterLocal.h> D3Q27SetConnectorsBlockVisitor::D3Q27SetConnectorsBlockVisitor(CommunicatorPtr comm, bool fullConnector, int dirs, @@ -74,17 +68,7 @@ void D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors(Grid3DPtr grid, Bloc if(blockRank == neighBlockRank && neighBlock->isActive()) { Block3DConnectorPtr connector; - - //if(block->hasInterpolationFlag()) - ////connector = Block3DConnectorPtr(new ETOrthoFullDirectConnector( block, neighBlock, dir, dirs)); - connector = Block3DConnectorPtr(new D3Q27ETFullDirectConnector3( block, neighBlock, dir)); - //else - //connector = Block3DConnectorPtr(new D3Q27ETDirectConnector( block, neighBlock, dir)); - //D3Q27CreateTransmittersHelper helper; - //D3Q27CreateTransmittersHelper::TransmitterPtr sender, receiver; - //sender = receiver = D3Q27CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - //connector = Block3DConnectorPtr(new D3Q27ETFullVectorConnector< TbTransmitter< CbVector< LBMReal > > >(block, sender, receiver, dir)); - + connector = Block3DConnectorPtr(new D3Q27ETFullDirectConnector( block, neighBlock, dir)); block->setConnector(connector); } else if(blockRank != neighBlockRank && neighBlock->isActive()) @@ -122,12 +106,7 @@ void D3Q27SetConnectorsBlockVisitor::setRemoteConnectors(Block3DPtr sblock, Bloc Block3DConnectorPtr connector; - //if(fullConnector) - //connector = Block3DConnectorPtr(new ETOrthoFullVectorConnector< TbTransmitter< CbVector< LBMReal > > >(sblock, sender, receiver, dir, dirs)); connector = Block3DConnectorPtr(new D3Q27ETFullVectorConnector(sblock, sender, receiver, dir)); - //connector = Block3DConnectorPtr(new D3Q27ETFullVectorConnector< TbTransmitter< std::vector< LBMReal > > >(sblock, sender, receiver, dir)); - //else - // connector = Block3DConnectorPtr(new D3Q27ETVectorConnector< TbTransmitter< CbVector< LBMReal > > >(sblock, sender, receiver, dir)); sblock->setConnector(connector); UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - end"); } -- GitLab