[cig-commits] r18856 - short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology

brad at geodynamics.org brad at geodynamics.org
Fri Aug 26 11:07:10 PDT 2011


Author: brad
Date: 2011-08-26 11:07:09 -0700 (Fri, 26 Aug 2011)
New Revision: 18856

Modified:
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Distributor.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/MeshRefiner.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineEdges2.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineFace4Edges2.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineVol8Face4Edges2.cc
Log:
Merge from trunk (new overlap stuff).

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Distributor.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Distributor.cc	2011-08-26 16:50:23 UTC (rev 18855)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Distributor.cc	2011-08-26 18:07:09 UTC (rev 18856)
@@ -206,8 +206,8 @@
   int localRecvOverlapSize = 0, recvOverlapSize;
   const int commSize = sendMeshOverlap->commSize();
   for (int p = 0; p < commSize; ++p) {
-    localSendOverlapSize += sendMeshOverlap->cone(p)->size();
-    localRecvOverlapSize += recvMeshOverlap->support(p)->size();
+    localSendOverlapSize += sendMeshOverlap->getConeSize(p);
+    localRecvOverlapSize += recvMeshOverlap->getSupportSize(p);
   } // for
   MPI_Allreduce(&localSendOverlapSize, &sendOverlapSize, 1, MPI_INT, MPI_SUM,
 		sendMeshOverlap->comm());

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/MeshRefiner.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/MeshRefiner.cc	2011-08-26 16:50:23 UTC (rev 18855)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/MeshRefiner.cc	2011-08-26 18:07:09 UTC (rev 18856)
@@ -692,9 +692,10 @@
   Obj<mesh_type::recv_overlap_type> newRecvOverlap = newMesh->getRecvOverlap();
   const Obj<mesh_type::send_overlap_type>& sendOverlap = mesh->getSendOverlap();
   const Obj<mesh_type::recv_overlap_type>& recvOverlap = mesh->getRecvOverlap();
-  Obj<mesh_type::send_overlap_type::traits::capSequence> sendPoints  = sendOverlap->cap();
   const mesh_type::send_overlap_type::source_type localOffsetNormal = newVerticesStartNormal - oldVerticesStartNormal;
   const mesh_type::send_overlap_type::source_type localOffsetFault  = newVerticesStartFault  - oldVerticesStartFault;
+#if 0
+  Obj<mesh_type::send_overlap_type::traits::capSequence> sendPoints  = sendOverlap->cap();
   
   for(mesh_type::send_overlap_type::traits::capSequence::iterator p_iter = sendPoints->begin(); p_iter != sendPoints->end(); ++p_iter) {
     const Obj<mesh_type::send_overlap_type::traits::supportSequence>& ranks      = sendOverlap->support(*p_iter);
@@ -738,6 +739,56 @@
       }
     } // for
   } // for
+#else
+  mesh_type::send_overlap_type::baseSequence::iterator sendRanksBegin = sendOverlap->baseBegin();
+  mesh_type::send_overlap_type::baseSequence::iterator sendRanksEnd   = sendOverlap->baseEnd();
+
+  for(mesh_type::send_overlap_type::baseSequence::iterator r_iter = sendRanksBegin; r_iter != sendRanksEnd; ++r_iter) {
+    const int                                                  rank               = *r_iter;
+    const mesh_type::send_overlap_type::source_type            remoteOffsetNormal = newVerticesStartNormalP[rank] - oldVerticesStartNormalP[rank];
+    const mesh_type::send_overlap_type::source_type            remoteOffsetFault  = newVerticesStartFaultP[rank]  - oldVerticesStartFaultP[rank];
+    const mesh_type::send_overlap_type::coneSequence::iterator pointsBegin        = sendOverlap->coneBegin(rank);
+    const mesh_type::send_overlap_type::coneSequence::iterator pointsEnd          = sendOverlap->coneEnd(rank);
+
+    for(mesh_type::send_overlap_type::coneSequence::iterator p_iter = pointsBegin; p_iter != pointsEnd; ++p_iter) {
+      const mesh_type::send_overlap_type::source_type& localPoint  = *p_iter;
+      const mesh_type::send_overlap_type::source_type& remotePoint = p_iter.color();
+
+      if (localPoint >= oldVerticesStartNormal && localPoint < oldVerticesStartFault) {
+        assert(remotePoint >= oldVerticesStartNormalP[rank] && remotePoint < oldVerticesStartFaultP[rank]);
+        newSendOverlap->addArrow(localPoint+localOffsetNormal, rank, remotePoint+remoteOffsetNormal);
+      } else {
+        assert(localPoint  >= oldVerticesStartFault);
+        assert(remotePoint >= oldVerticesStartFaultP[rank]);
+        newSendOverlap->addArrow(localPoint+localOffsetFault,  rank, remotePoint+remoteOffsetFault);
+      }
+    }
+  }
+  mesh_type::recv_overlap_type::capSequence::iterator recvRanksBegin = recvOverlap->capBegin();
+  mesh_type::recv_overlap_type::capSequence::iterator recvRanksEnd   = recvOverlap->capEnd();
+
+  for(mesh_type::recv_overlap_type::capSequence::iterator r_iter = recvRanksBegin; r_iter != recvRanksEnd; ++r_iter) {
+    const int                                                     rank               = *r_iter;
+    const mesh_type::send_overlap_type::source_type               remoteOffsetNormal = newVerticesStartNormalP[rank] - oldVerticesStartNormalP[rank];
+    const mesh_type::send_overlap_type::source_type               remoteOffsetFault  = newVerticesStartFaultP[rank]  - oldVerticesStartFaultP[rank];
+    const mesh_type::recv_overlap_type::supportSequence::iterator pointsBegin        = recvOverlap->supportBegin(rank);
+    const mesh_type::recv_overlap_type::supportSequence::iterator pointsEnd          = recvOverlap->supportEnd(rank);
+
+    for(mesh_type::recv_overlap_type::supportSequence::iterator p_iter = pointsBegin; p_iter != pointsEnd; ++p_iter) {
+      const mesh_type::send_overlap_type::source_type& localPoint  = *p_iter;
+      const mesh_type::send_overlap_type::source_type& remotePoint = p_iter.color();
+
+      if (localPoint >= oldVerticesStartNormal && localPoint < oldVerticesStartFault) {
+        assert(remotePoint >= oldVerticesStartNormalP[rank] && remotePoint < oldVerticesStartFaultP[rank]);
+        newRecvOverlap->addArrow(rank, localPoint+localOffsetNormal, remotePoint+remoteOffsetNormal);
+      } else {
+        assert(localPoint  >= oldVerticesStartFault);
+        assert(remotePoint >= oldVerticesStartFaultP[rank]);
+        newRecvOverlap->addArrow(rank, localPoint+localOffsetFault, remotePoint+remoteOffsetFault);
+      }
+    }
+  }
+#endif
   newMesh->setCalculatedOverlap(true);
   delete [] oldVerticesStartNormalP; oldVerticesStartNormalP = PETSC_NULL;
   delete [] oldVerticesStartFaultP;  oldVerticesStartFaultP  = PETSC_NULL;
@@ -745,6 +796,9 @@
   delete [] newVerticesStartFaultP;  newVerticesStartFaultP  = PETSC_NULL;
 
   refiner.overlapAddNewVertices(newMesh, *_orderNewMesh, mesh, *_orderOldMesh);
+  // We have to do flexible assembly since we add the new vertices separately
+  newSendOverlap->assemble();
+  newRecvOverlap->assemble();
 } // _calcNewOverlap
 
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineEdges2.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineEdges2.cc	2011-08-26 16:50:23 UTC (rev 18855)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineEdges2.cc	2011-08-26 18:07:09 UTC (rev 18856)
@@ -187,10 +187,10 @@
     const point_type right = e_iter->first.second;
     
     if (oldSendOverlap->capContains(left) && oldSendOverlap->capContains(right)) {
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanksSeq = oldSendOverlap->support(left);
+      const Obj<mesh_type::send_overlap_type::supportSequence>& leftRanksSeq = oldSendOverlap->support(left);
       assert(!leftRanksSeq.isNull());
       std::set<int> leftRanks(leftRanksSeq->begin(), leftRanksSeq->end());
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanksSeq = oldSendOverlap->support(right);
+      const Obj<mesh_type::send_overlap_type::supportSequence>& rightRanksSeq = oldSendOverlap->support(right);
       assert(!rightRanksSeq.isNull());
       std::set<int> rightRanks(rightRanksSeq->begin(), rightRanksSeq->end());
       std::set<int> ranks;
@@ -257,16 +257,16 @@
       const int  rank       = *r_iter;
       
       const int localFirstOffset = (orderOldMesh.verticesNormal().hasPoint(e_iter->first.first)) ? localNormalOffset : localCensoredOffset;
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localFirstOffset);
-      for(mesh_type::send_overlap_type::traits::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
+      const Obj<mesh_type::send_overlap_type::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localFirstOffset);
+      for(mesh_type::send_overlap_type::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
         if (rank == *lr_iter) {
           remoteLeft = lr_iter.color();
           break;
         } // if
       } // for
       const int localSecondOffset = (orderOldMesh.verticesNormal().hasPoint(e_iter->first.second)) ? localNormalOffset : localCensoredOffset;
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localSecondOffset);
-      for(mesh_type::send_overlap_type::traits::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
+      const Obj<mesh_type::send_overlap_type::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localSecondOffset);
+      for(mesh_type::send_overlap_type::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
         if (rank == *rr_iter) {
           remoteRight = rr_iter.color();
           break;

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineFace4Edges2.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineFace4Edges2.cc	2011-08-26 16:50:23 UTC (rev 18855)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineFace4Edges2.cc	2011-08-26 18:07:09 UTC (rev 18856)
@@ -255,10 +255,10 @@
     const point_type right = e_iter->first.second;
     
     if (oldSendOverlap->capContains(left) && oldSendOverlap->capContains(right)) {
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanksSeq  = oldSendOverlap->support(left);
+      const Obj<mesh_type::send_overlap_type::supportSequence>& leftRanksSeq  = oldSendOverlap->support(left);
       assert(!leftRanksSeq.isNull());
       std::set<int> leftRanks(leftRanksSeq->begin(), leftRanksSeq->end());
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanksSeq = oldSendOverlap->support(right);
+      const Obj<mesh_type::send_overlap_type::supportSequence>& rightRanksSeq = oldSendOverlap->support(right);
       assert(!rightRanksSeq.isNull());
       std::set<int> rightRanks(rightRanksSeq->begin(), rightRanksSeq->end());
       std::set<int> ranks;
@@ -311,16 +311,16 @@
       const int  rank         = *r_iter;
       const int  localOffsetL = orderOldMesh.verticesNormal().hasPoint(e_iter->first.first) ? localNormalOffset : localCensoredOffset;
       
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localOffsetL);
-      for(mesh_type::send_overlap_type::traits::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
+      const Obj<mesh_type::send_overlap_type::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localOffsetL);
+      for(mesh_type::send_overlap_type::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
         if (rank == *lr_iter) {
           remoteLeft = lr_iter.color();
           break;
         } // if
       } // for
       const int  localOffsetR = orderOldMesh.verticesNormal().hasPoint(e_iter->first.second) ? localNormalOffset : localCensoredOffset;
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localOffsetR);
-      for(mesh_type::send_overlap_type::traits::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
+      const Obj<mesh_type::send_overlap_type::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localOffsetR);
+      for(mesh_type::send_overlap_type::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
         if (rank == *rr_iter) {
           remoteRight = rr_iter.color();
           break;

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineVol8Face4Edges2.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineVol8Face4Edges2.cc	2011-08-26 16:50:23 UTC (rev 18855)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/RefineVol8Face4Edges2.cc	2011-08-26 18:07:09 UTC (rev 18856)
@@ -323,10 +323,10 @@
     const point_type right = e_iter->first.second;
     
     if (oldSendOverlap->capContains(left) && oldSendOverlap->capContains(right)) {
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanksSeq  = oldSendOverlap->support(left);
+      const Obj<mesh_type::send_overlap_type::supportSequence>& leftRanksSeq  = oldSendOverlap->support(left);
       assert(!leftRanksSeq.isNull());
       std::set<int> leftRanks(leftRanksSeq->begin(), leftRanksSeq->end());
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanksSeq = oldSendOverlap->support(right);
+      const Obj<mesh_type::send_overlap_type::supportSequence>& rightRanksSeq = oldSendOverlap->support(right);
       assert(!rightRanksSeq.isNull());
       std::set<int> rightRanks(rightRanksSeq->begin(), rightRanksSeq->end());
       std::set<int> ranks;
@@ -386,7 +386,7 @@
       const point_type first     = f_iter->first.points[0];
       point_type       minVertex = first;
 
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& firstRanksSeq  = oldSendOverlap->support(first);
+      const Obj<mesh_type::send_overlap_type::supportSequence>& firstRanksSeq  = oldSendOverlap->support(first);
       assert(!firstRanksSeq.isNull());
       std::set<int> firstRanks(firstRanksSeq->begin(), firstRanksSeq->end());
       std::set<int> ranks, curRanks;
@@ -395,7 +395,7 @@
       for(int i = 1; i < 4; ++i) {
         const point_type nextVertex = f_iter->first.points[i];
 
-        const Obj<mesh_type::send_overlap_type::traits::supportSequence>& nextRanksSeq = oldSendOverlap->support(nextVertex);
+        const Obj<mesh_type::send_overlap_type::supportSequence>& nextRanksSeq = oldSendOverlap->support(nextVertex);
         assert(!nextRanksSeq.isNull());
         std::set<int> nextRanks(nextRanksSeq->begin(), nextRanksSeq->end());
 
@@ -482,8 +482,8 @@
       const int  localOffsetL = orderOldMesh.verticesNormal().hasPoint(e_iter->first.first) ? localNormalOffset : localCensoredOffset;
 
       // Find the rank which owns the left edge point, and return the remotePoint in the new mesh
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localOffsetL);
-      for(mesh_type::send_overlap_type::traits::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
+      const Obj<mesh_type::send_overlap_type::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localOffsetL);
+      for(mesh_type::send_overlap_type::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
         if (rank == *lr_iter) {
           remoteLeft = lr_iter.color();
           break;
@@ -493,8 +493,8 @@
       const int  localOffsetR = orderOldMesh.verticesNormal().hasPoint(e_iter->first.second) ? localNormalOffset : localCensoredOffset;
 
       // Find the rank which owns the right edge point, and return the remotePoint in the new mesh
-      const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localOffsetR);
-      for(mesh_type::send_overlap_type::traits::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
+      const Obj<mesh_type::send_overlap_type::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localOffsetR);
+      for(mesh_type::send_overlap_type::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
         if (rank == *rr_iter) {
           remoteRight = rr_iter.color();
           break;
@@ -521,15 +521,15 @@
         for(int d = 0; d < remoteSize; ++d) {
           std::cout << "["<<oldMesh->commRank()<<"]     remote val " << remoteVals[d] << std::endl;
         }
-        const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanks2 = oldSendOverlap->support(e_iter->first.first);
-        for(mesh_type::send_overlap_type::traits::supportSequence::iterator lr_iter = leftRanks2->begin(); lr_iter != leftRanks2->end(); ++lr_iter) {
+        const Obj<mesh_type::send_overlap_type::supportSequence>& leftRanks2 = oldSendOverlap->support(e_iter->first.first);
+        for(mesh_type::send_overlap_type::supportSequence::iterator lr_iter = leftRanks2->begin(); lr_iter != leftRanks2->end(); ++lr_iter) {
           if (rank == *lr_iter) {
             std::cout << "["<<oldMesh->commRank()<<"]     left match:  old vertex " << lr_iter.color() << std::endl;
             break;
           }
         }
-        const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks2 = oldSendOverlap->support(e_iter->first.second);
-        for(mesh_type::send_overlap_type::traits::supportSequence::iterator rr_iter = rightRanks2->begin(); rr_iter != rightRanks2->end(); ++rr_iter) {
+        const Obj<mesh_type::send_overlap_type::supportSequence>& rightRanks2 = oldSendOverlap->support(e_iter->first.second);
+        for(mesh_type::send_overlap_type::supportSequence::iterator rr_iter = rightRanks2->begin(); rr_iter != rightRanks2->end(); ++rr_iter) {
           if (rank == *rr_iter) {
             std::cout << "["<<oldMesh->commRank()<<"]     right match: old vertex " << rr_iter.color() << std::endl;
             break;
@@ -554,8 +554,8 @@
 
       for(int i = 0; i < 4; ++i) {
         const int localOffset = orderOldMesh.verticesNormal().hasPoint(f_iter->first.points[i]) ? localNormalOffset : localCensoredOffset;
-        const Obj<mesh_type::send_overlap_type::traits::supportSequence>& faceRanks = newSendOverlap->support(f_iter->first.points[i]+localOffset);
-        for(mesh_type::send_overlap_type::traits::supportSequence::iterator fr_iter = faceRanks->begin(); fr_iter != faceRanks->end(); ++fr_iter) {
+        const Obj<mesh_type::send_overlap_type::supportSequence>& faceRanks = newSendOverlap->support(f_iter->first.points[i]+localOffset);
+        for(mesh_type::send_overlap_type::supportSequence::iterator fr_iter = faceRanks->begin(); fr_iter != faceRanks->end(); ++fr_iter) {
           if (rank == *fr_iter) {
             remoteVertices.points[i] = fr_iter.color();
             break;



More information about the CIG-COMMITS mailing list