@@ -386,15 +386,14 @@ void MPMesh::T2LTracking(Vec2dView dx){
386386}
387387
388388void MPMesh::reconstructSlices () {
389- if (reconstructSlice.size () == 0 ) return ;
390- Kokkos::Timer timer;
391- calcBasis (true );
392- resetPreComputeFlag ();
393- for (auto const & [index, reconstruct] : reconstructSlice) {
394- if (reconstruct) reconstruct ();
395- }
396- reconstructSlice.clear ();
397- pumipic::RecordTime (" PolyMPO_Reconstruct" , timer.seconds ());
389+ if (reconstructSlice.size () == 0 ) return ;
390+ Kokkos::Timer timer;
391+ calcBasis (true );
392+ for (auto const & [index, reconstruct] : reconstructSlice) {
393+ if (reconstruct) reconstruct ();
394+ }
395+ reconstructSlice.clear ();
396+ pumipic::RecordTime (" PolyMPO_Reconstruct" , timer.seconds ());
398397}
399398
400399bool getAnyIsMigrating (MaterialPoints* p_MPs, bool isMigrating) {
@@ -448,9 +447,7 @@ void MPMesh::push_swap_pos(){
448447 p_MPs->updateMPSlice <MPF_Cur_Pos_Rot_Lat_Lon, MPF_Tgt_Pos_Rot_Lat_Lon>();
449448}
450449
451-
452- void MPMesh::push (){
453-
450+ void MPMesh::push (){
454451 Kokkos::Timer timer;
455452
456453 p_mesh->computeRotLatLonIncr ();
@@ -483,43 +480,43 @@ void MPMesh::push(){
483480}
484481
485482void MPMesh::printVTP_mesh (int printVTPIndex){
486- auto vtxCoords = p_mesh->getMeshField <polyMPO::MeshF_VtxCoords>();
487- auto elm2VtxConn = p_mesh->getElm2VtxConn ();
483+ auto vtxCoords = p_mesh->getMeshField <polyMPO::MeshF_VtxCoords>();
484+ auto elm2VtxConn = p_mesh->getElm2VtxConn ();
488485
489- auto MPsPosition = p_MPs->getPositions ();
486+ auto MPsPosition = p_MPs->getPositions ();
490487
491- char * fileOutput = (char *)malloc (sizeof (char ) * 256 );
492- sprintf (fileOutput," polyMPO_MPMesh_mesh_%d.vtp" , printVTPIndex);
493- FILE * pFile = fopen (fileOutput," w" );
494- free (fileOutput);
495-
496- auto h_vtxCoords = Kokkos::create_mirror_view (vtxCoords);
497- IntVtx2ElmView::HostMirror h_elm2VtxConn = Kokkos::create_mirror_view (elm2VtxConn);
498- const int nCells = p_mesh->getNumElements ();
499- const int nVertices = p_mesh->getNumVertices ();
500- Kokkos::deep_copy (h_vtxCoords,vtxCoords);
501- Kokkos::deep_copy (h_elm2VtxConn,elm2VtxConn);
502- fprintf (pFile, " <VTKFile type=\" PolyData\" version=\" 1.0\" byte_order=\" LittleEndian\" header_type=\" UInt64\" >\n <PolyData>\n <Piece NumberOfPoints=\" %d\" NumberOfVerts=\" 0\" NumberOfLines=\" 0\" NumberOfStrips=\" 0\" NumberOfPolys=\" %d\" >\n <Points>\n <DataArray type=\" Float32\" Name=\" Points\" NumberOfComponents=\" 3\" format=\" ascii\" >\n " ,nVertices,nCells);
503- for (int i=0 ; i<nVertices; i++){
504- fprintf (pFile, " %f %f %f\n " ,h_vtxCoords (i,0 ),h_vtxCoords (i,1 ),h_vtxCoords (i,2 ));
505- }
506- fprintf (pFile, " </DataArray>\n </Points>\n <Polys>\n <DataArray type=\" Int64\" Name=\" connectivity\" format=\" ascii\" >\n " );
507- for (int i=0 ; i<nCells; i++){
508- fprintf (pFile, " " );
509- for (int j=0 ; j< h_elm2VtxConn (i,0 ); j++){
510- fprintf (pFile, " %d " , h_elm2VtxConn (i,j+1 )-1 );
511- }
512- fprintf (pFile, " \n " );
513- }
514- fprintf (pFile, " </DataArray>\n <DataArray type=\" Int64\" Name=\" offsets\" format=\" ascii\" >\n " );
488+ char * fileOutput = (char *)malloc (sizeof (char ) * 256 );
489+ sprintf (fileOutput," polyMPO_MPMesh_mesh_%d.vtp" , printVTPIndex);
490+ FILE * pFile = fopen (fileOutput," w" );
491+ free (fileOutput);
492+
493+ auto h_vtxCoords = Kokkos::create_mirror_view (vtxCoords);
494+ IntVtx2ElmView::HostMirror h_elm2VtxConn = Kokkos::create_mirror_view (elm2VtxConn);
495+ const int nCells = p_mesh->getNumElements ();
496+ const int nVertices = p_mesh->getNumVertices ();
497+ Kokkos::deep_copy (h_vtxCoords,vtxCoords);
498+ Kokkos::deep_copy (h_elm2VtxConn,elm2VtxConn);
499+ fprintf (pFile, " <VTKFile type=\" PolyData\" version=\" 1.0\" byte_order=\" LittleEndian\" header_type=\" UInt64\" >\n <PolyData>\n <Piece NumberOfPoints=\" %d\" NumberOfVerts=\" 0\" NumberOfLines=\" 0\" NumberOfStrips=\" 0\" NumberOfPolys=\" %d\" >\n <Points>\n <DataArray type=\" Float32\" Name=\" Points\" NumberOfComponents=\" 3\" format=\" ascii\" >\n " ,nVertices,nCells);
500+ for (int i=0 ; i<nVertices; i++){
501+ fprintf (pFile, " %f %f %f\n " ,h_vtxCoords (i,0 ),h_vtxCoords (i,1 ),h_vtxCoords (i,2 ));
502+ }
503+ fprintf (pFile, " </DataArray>\n </Points>\n <Polys>\n <DataArray type=\" Int64\" Name=\" connectivity\" format=\" ascii\" >\n " );
504+ for (int i=0 ; i<nCells; i++){
505+ fprintf (pFile, " " );
506+ for (int j=0 ; j< h_elm2VtxConn (i,0 ); j++){
507+ fprintf (pFile, " %d " , h_elm2VtxConn (i,j+1 )-1 );
508+ }
509+ fprintf (pFile, " \n " );
510+ }
511+ fprintf (pFile, " </DataArray>\n <DataArray type=\" Int64\" Name=\" offsets\" format=\" ascii\" >\n " );
515512
516- int count = 0 ;
517- for (int i=0 ;i<nCells; i++){
518- count += h_elm2VtxConn (i,0 );
519- fprintf (pFile, " %d\n " ,count);
520- }
521- fprintf (pFile, " </DataArray>\n </Polys>\n </Piece>\n </PolyData>\n </VTKFile>\n " );
522- fclose (pFile);
513+ int count = 0 ;
514+ for (int i=0 ;i<nCells; i++){
515+ count += h_elm2VtxConn (i,0 );
516+ fprintf (pFile, " %d\n " ,count);
517+ }
518+ fprintf (pFile, " </DataArray>\n </Polys>\n </Piece>\n </PolyData>\n </VTKFile>\n " );
519+ fclose (pFile);
523520}
524521
525522}
0 commit comments