[MOAB-dev] commit/MOAB: danwu: Current MPAS reader will pad all cells to 10-vertex polygons. Per Iulian's suggestion, it can use the local maxEdgesPerCell on each processor, instead of the global one (usually 10) reported in the MPAS file. If an MPAS file has only pentagons and hexagons, only 12 pentagons need to be padded to hexagons. This will greatly reduce memory usage when reading huge MPAS files.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Oct 8 10:52:56 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/886d36f9f2e5/
Changeset:   886d36f9f2e5
Branch:      master
User:        danwu
Date:        2013-10-08 17:52:44
Summary:     Current MPAS reader will pad all cells to 10-vertex polygons. Per Iulian's suggestion, it can use the local maxEdgesPerCell on each processor, instead of the global one (usually 10) reported in the MPAS file. If an MPAS file has only pentagons and hexagons, only 12 pentagons need to be padded to hexagons. This will greatly reduce memory usage when reading huge MPAS files.

Affected #:  1 file

diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index 42eeca0..a676dfa 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -311,6 +311,9 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
   success = NCFUNCAG(_vara_int)(_fileId, nEdgesOnCellVarId, tmp_starts_1, tmp_counts_1, &num_edges_on_local_cells[0]);
   ERRORS(success, "Failed to read variable values of nEdgesOnCell.");
 
+  // Get local maxEdgesPerCell on this proc, to replace the global one reported in the MPAS file
+  maxEdgesPerCell = *(std::max_element(num_edges_on_local_cells.begin(), num_edges_on_local_cells.end()));
+
   // Read vertices on each local cell (connectivity)
   int verticesOnCellVarId;
   success = NCFUNC(inq_varid)(_fileId, "verticesOnCell", &verticesOnCellVarId);
@@ -451,9 +454,11 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
       }
 
       // Padding: fill connectivity array with last vertex handle
-      EntityHandle last_vert_id = conn_arr_local_cells[cell_idx * maxEdgesPerCell + num_edges - 1];
-      for (int i = num_edges; i < maxEdgesPerCell; i++)
-        conn_arr_local_cells[cell_idx * maxEdgesPerCell + i] = last_vert_id;
+      if (num_edges < maxEdgesPerCell) {
+        EntityHandle last_vert_id = conn_arr_local_cells[cell_idx * maxEdgesPerCell + num_edges - 1];
+        for (int i = num_edges; i < maxEdgesPerCell; i++)
+          conn_arr_local_cells[cell_idx * maxEdgesPerCell + i] = last_vert_id;
+      }
     }
   } // if (noMixedElements)
   else {

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list