@@ -128,22 +128,16 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
128128 auto MPs2Proc = p_MPs->getData <MPF_Tgt_Proc_ID>();
129129 auto elm2Process = p_mesh->getElm2Process ();
130130 auto elm2global = p_mesh->getElmGlobal ();
131- auto mpAppID = p_MPs->getData <polyMPO::MPF_MP_APP_ID>();
132131
133- MPI_Comm comm = p_MPs->getMPIComm ();
134- int comm_rank;
135- MPI_Comm_rank (comm, &comm_rank);
136-
137132 // Since Mesh is static print pnly for 1 time step
138- if (printVTPIndex= =0 ) {
139- printVTP_mesh (comm_rank );
133+ if (printVTPIndex> =0 ) {
134+ printVTP_mesh (printVTPIndex );
140135 }
141136
142137 Vec3dView history (" positionHistory" ,numMPs);
143138 Vec3dView resultLeft (" positionResult" ,numMPs);
144139 Vec3dView resultRight (" positionResult" ,numMPs);
145140 Vec3dView mpTgtPosArray (" positionTarget" ,numMPs);
146- Kokkos::View<int *> counter (" counter" ,1 );
147141
148142 auto CVTElmCalc = PS_LAMBDA (const int & elm, const int & mp, const int &mask){
149143 Vec3d MP (mpPositions (mp,0 ),mpPositions (mp,1 ),mpPositions (mp,2 ));
@@ -176,7 +170,8 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
176170
177171 if (closestElm<0 ){
178172 MPs2Elm (mp) = iElm;
179- MPs2Proc (mp) = elm2Process (iElm);
173+ if (elm2Process.size () > 0 )
174+ MPs2Proc (mp) = elm2Process (iElm);
180175 break ;
181176 }else {
182177 iElm = closestElm;
@@ -194,31 +189,28 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
194189 Vec3d shift = dx.cross (r) * ((1.0 -0.7 )*dx.magnitude ()/(dx.cross (r)).magnitude ());
195190 Vec3d MPLeft = MParrow + shift;
196191 Vec3d MPRight = MParrow - shift;
197- auto xx=Kokkos::atomic_fetch_add (&counter (0 ), 1 );
198- history (xx) = MP;
199- resultLeft (xx) = MPLeft;
200- resultRight (xx) = MPRight;
201- mpTgtPosArray (xx) = MPnew;
192+ history (mp) = MP;
193+ resultLeft (mp) = MPLeft;
194+ resultRight (mp) = MPRight;
195+ mpTgtPosArray (mp) = MPnew;
202196 }
203197 }
204198 };
205199 p_MPs->parallel_for (CVTElmCalc," CVTTrackingElmCenterBasedCalc" );
206200
207- if (printVTPIndex>=0 && numMPs> 0 ){
201+ if (printVTPIndex>=0 ){
208202 Vec3dView::HostMirror h_history = Kokkos::create_mirror_view (history);
209203 Vec3dView::HostMirror h_resultLeft = Kokkos::create_mirror_view (resultLeft);
210204 Vec3dView::HostMirror h_resultRight = Kokkos::create_mirror_view (resultRight);
211205 Vec3dView::HostMirror h_mpTgtPos = Kokkos::create_mirror_view (mpTgtPosArray);
212- Kokkos::View<int *>::HostMirror h_counter = Kokkos::create_mirror_view (counter);
213206
214207 Kokkos::deep_copy (h_history, history);
215208 Kokkos::deep_copy (h_resultLeft, resultLeft);
216209 Kokkos::deep_copy (h_resultRight, resultRight);
217210 Kokkos::deep_copy (h_mpTgtPos, mpTgtPosArray);
218- Kokkos::deep_copy (h_counter, counter);
219211 // printVTP file
220212 char * fileOutput = (char *)malloc (sizeof (char ) * 256 );
221- sprintf (fileOutput, " polyMPOCVTTrackingElmCenter_MPtracks_%d_% d.vtp" , comm_rank , printVTPIndex);
213+ sprintf (fileOutput, " polyMPOCVTTrackingElmCenter_MPtracks_%d.vtp" , printVTPIndex);
222214 FILE * pFile = fopen (fileOutput," w" );
223215 free (fileOutput);
224216 fprintf (pFile, " <VTKFile type=\" PolyData\" version=\" 1.0\" byte_order=\" LittleEndian\" header_type=\" UInt64\" >\n <PolyData>\n <Piece NumberOfPoints=\" %d\" NumberOfVerts=\" 0\" NumberOfLines=\" %d\" NumberOfStrips=\" 0\" NumberOfPolys=\" 0\" >\n <Points>\n <DataArray type=\" Float32\" Name=\" Points\" NumberOfComponents=\" 3\" format=\" ascii\" >\n " ,numMPs*4 ,numMPs*2 );
@@ -378,7 +370,6 @@ void MPMesh::push(){
378370 bool anyIsMigrating = false ;
379371 do {
380372 CVTTrackingElmCenterBased (); // move to Tgt_XYZ
381- assert (cudaDeviceSynchronize () == cudaSuccess);
382373 p_MPs->updateMPSlice <MPF_Cur_Pos_XYZ, MPF_Tgt_Pos_XYZ>(); // Tgt_XYZ becomes Cur_XYZ
383374 p_MPs->updateMPSlice <MPF_Cur_Pos_Rot_Lat_Lon, MPF_Tgt_Pos_Rot_Lat_Lon>(); // Tgt becomes Cur
384375
0 commit comments