From 67b0c88f17edab986eb4a04d1dfafee7c69bfae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kl=C3=B6fkorn?= <robertk@mathematik.uni-stuttgart.de> Date: Fri, 10 Nov 2006 12:45:58 +0000 Subject: [PATCH] disabled not working communication method git-svn-id: https://dune.mathematik.uni-freiburg.de/svn/alugrid/trunk@748 0d966ed9-3843-0410-af09-ebfb50bd7c74 --- src/duneinterface/gitter_dune_impl.cc | 145 ++++++++++++++++++++++++++ src/duneinterface/gitter_dune_impl.h | 20 ++++ 2 files changed, 165 insertions(+) diff --git a/src/duneinterface/gitter_dune_impl.cc b/src/duneinterface/gitter_dune_impl.cc index d30f96b7f..677602fad 100644 --- a/src/duneinterface/gitter_dune_impl.cc +++ b/src/duneinterface/gitter_dune_impl.cc @@ -313,9 +313,154 @@ bool GitterDuneBasis :: duneAdapt (AdaptRestrictProlongType & arp) return refined; } +#if 0 +void GitterDuneBasis :: ALUcomm ( + GatherScatterType & vertexData , + GatherScatterType & edgeData, + GatherScatterType & faceData , + GatherScatterType & elementData, + const CommunicationType commType ) +{ + const int nl = mpAccess ().nlinks (); + + const bool containsVertices = vertexData.contains(3,3); + const bool containsEdges = edgeData.contains(3,2); + const bool containsFaces = faceData.contains(3,1); + const bool containsElements = elementData.contains(3,0); + const bool haveHigherCodimData = containsVertices || + containsEdges || + containsFaces ; + + const bool containsSomeThing = containsElements || haveHigherCodimData; + + if(!containsSomeThing) + { + cerr << "WARNING: communication called with empty data set, all contains methods returned false! \n"; + return ; + } + assert ((debugOption (5) && containsVertices) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsVertices)=true " << endl, 1) : 1) ; + assert ((debugOption (5) && containsEdges) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsEdges)=true " << endl, 1) : 1) ; + assert ((debugOption (5) && containsFaces) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsFaces)=true " << endl, 1) : 1) ; + assert ((debugOption (5) && containsElements) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsElements)=true " << endl, 1) : 1) ; + // create vector of message buffers + // this vector is created here, that the buffer is allocated only once + vector < ObjectStream > vec (nl) ; + + // if data on entities of higer codim exists + // then communication if more complicated + if ( haveHigherCodimData ) + { + doBorderBorderComm( vec, vertexData, edgeData, faceData ); + } + if( commType != Border_Border_Comm ) // otherwise only border border + { + doInteriorGhostComm( vec, vertexData, edgeData, faceData, elementData , commType ); + } + return ; +} +void GitterDunePll :: doInteriorGhostComm( + vector< ObjectStream > & osvec , + GatherScatterType & vertexData , + GatherScatterType & edgeData, + GatherScatterType & faceData, + GatherScatterType & elementData , + const CommunicationType commType ) +{ + //Entwurf der periodischen R"ander-Ghost-Kommunikation: + /* + it = Iterator "uber alle periodischen R"ander + for (it = begin; !.it.done(); it++) { + periodic & per = it.item() + osvec[0].clear(); + per.myneighbour(0).gather (osvec[0]); + per.getGhost(1).scatter (osvec[0]); + osvec[0].clear(); + per.myneighbour(1).gather(osvec[0]); + per.getGhost(0).scatter(osvec[0]); + } + */ + + const int nl = mpAccess ().nlinks (); + + const bool containsVertices = vertexData.contains(3,3); + const bool containsEdges = edgeData.contains(3,2); + const bool containsFaces = faceData.contains(3,1); + const bool containsElements = elementData.contains(3,0); + + const bool containsSomeThing = containsVertices || + containsEdges || containsFaces || containsElements ; + + const bool packInterior = (commType == All_All_Comm) || + (commType == Interior_Ghost_Comm); + + const bool packGhosts = (commType == All_All_Comm) || + (commType == Ghost_Interior_Comm); + + assert( !packGhosts ); + + if(!containsSomeThing) + { + cerr << "WARNING: communication called with empty data set, all contains methods returned false! \n"; + return ; + } + + for (int link = 0 ; link < nl ; ++link ) + { + ObjectStream & sendBuff = osvec[link]; + sendBuff.clear(); + + { + hface_STI * determType = 0; // only for type determination + pair < IteratorSTI < hface_STI > * , IteratorSTI < hface_STI > * > + iterpair = borderIteratorTT( determType , link ); + + // write all data belong to interior of master faces + sendInteriorGhostData( sendBuff, iterpair.first , + vertexData, edgeData, + faceData, elementData, + packInterior , packGhosts ); + // write all data belong to interior of slave faces + sendInteriorGhostData( sendBuff, iterpair.second , + vertexData, edgeData, + faceData, elementData , + packInterior , packGhosts ); + delete iterpair.first; + delete iterpair.second; + } + } + /////////////////////////////////////////// + // exchange data + /////////////////////////////////////////// + osvec = mpAccess ().exchange (osvec) ; + + //all ghost cells get new data + for (int link = 0 ; link < nl ; ++link ) + { + ObjectStream & recvBuff = osvec[link]; + { + hface_STI * determType = 0; // only for type determination + pair < IteratorSTI < hface_STI > * , IteratorSTI < hface_STI > * > + iterpair = borderIteratorTT( determType , link ); + // first unpack slave data, because this has been pack from master + // first , see above + unpackInteriorGhostData( recvBuff, iterpair.second , + vertexData, edgeData, + faceData, elementData ); + // now unpack data sended from slaves to master + unpackInteriorGhostData( recvBuff, iterpair.first , + vertexData, edgeData, + faceData, elementData ); + delete iterpair.first; + delete iterpair.second; + } + } + // end element communication + return ; +} +#endif #endif diff --git a/src/duneinterface/gitter_dune_impl.h b/src/duneinterface/gitter_dune_impl.h index ca3016c5a..c4ff03e8b 100644 --- a/src/duneinterface/gitter_dune_impl.h +++ b/src/duneinterface/gitter_dune_impl.h @@ -79,6 +79,26 @@ public: // done call notify and loadBalancer bool duneAdapt (AdaptRestrictProlongType & arp); + +private: + /* + // communication of data + void ALUcomm ( + GatherScatterType & vertexData , + GatherScatterType & edgeData, + GatherScatterType & faceData , + GatherScatterType & elementData , + const CommunicationType commType); + + // communication of interior data + void doInteriorGhostComm( + vector< ObjectStream > & osvec , + GatherScatterType & vertexData , + GatherScatterType & edgeData, + GatherScatterType & faceData, + GatherScatterType & elementData , + const CommunicationType commType ); + */ }; class GitterDuneImpl : public GitterBasisImpl , public GitterDuneBasis -- GitLab