# Real-Time Interactive Parallel Visualization of Large-Scale Flow-Field Data
## 3 Data-Partitioning Strategy Based on Grid Segmentation
### Preprocessing of File Data
#### 3.1.3 Grid Segmentation  
Each part typically comprises multiple types of elements, composed of 15 topologies such as quadrilaterals and pyramids. The number and topology of each type of element are explicitly represented, while the unique identifier for each grid cell (Cell) within different types is implicitly expressed. During the construction of metadata for the geometric model file, we further divide the grid based on the number of processes. To facilitate this, we design a data structure called CellTypes to represent grid division. This data structure provides an accurate description of the number and topology of different types of elements, enabling more efficient management and processing of geometric model files. For instance, consider \(\text{part}_{i}\) with N different types of elements and \(\text{c}_{i}\) cells for the i-th type of element. \(\text{part}_{i}\) has a total of \(\text{C}=\sum\limits_{i=1}^{\text{N}}\text{c}_{i}\) cells. We launch P processes and assign these cells to them. Initially, we evenly distribute these cells among the P processes. The remaining \(\text{r}=\text{C}\text{mod}\text{P}\) cells are assigned sequentially to processes 0 to \(\text{r}-1\) to achieve a static load-balanced configuration. Let vBlock be a vector of length P, where its p-th element  
Figure 2: The EnSight Gold data format. (**a**) Organization of the format, and the internal structure of the geometric model file **Test.geo**. **Test.Nvec** is a representative attribute file that stores attribute data corresponding to **Test.geo** and is organized by the Test.case file. (**b**) Supported grid types. represents the number of cells assigned to process \(\mathrm{p}\). Using Formula (1), we can calculate the value of each element in vector vBlock based on the above division method. \[\mathrm{vBlock_{p}}=\left\{ \begin{aligned} &\left\lfloor\frac{\mathrm{C}}{ \mathrm{P}}\right\rfloor,\mathrm{p}\geq\mathrm{r}\\ &\left\lfloor\frac{\mathrm{C}}{\mathrm{P}}\right\rfloor+1, \mathrm{p}<\mathrm{r}\end{aligned} \right. \tag{1}\]  
Binary geometric model files typically consist of a sequence of bytecodes, with each integer represented as an int type. The mesh partition data calculated cannot be directly utilized by the file pointer. Thus, additional calculations are required to determine the starting and ending byte positions of the partitioned sub-meshes within the file. According to the EnSight Gold data format, each part usually comprises multiple types of elements, with each element type consisting of tens of thousands to tens of millions of cells. Our mesh partitioning strategy involves each process handling a portion of all elements' cells. Therefore, to calculate the sub-meshes' positions, we must separately compute the starting and ending positions of cells under each element. To further calculate the bytecode sequence that the process must handle after partitioning the mesh, we must separately compute the starting and ending positions of cells under each element. Initially, we employ the vector vBlock to compute the total number of cells allocated by processes 0 to \(\mathrm{i}-1\), as demonstrated in Expression (2), where vBlock[\(\mathrm{s}\)] denotes a vector component. \[\mathrm{preBlock}\ =\sum_{\mathrm{s}=0}^{\mathrm{i}-1}\mathrm{vBlock[\mathrm{s}]} \tag{2}\]  
Subsequently, we employ the value of vBlock[\(\mathrm{i}\)] to determine the number of cells (curBlock) allocated by process \(\mathrm{i}\). We utilize pointers realStartPos\({}_{\mathrm{ijk}}\) and realEndPos\({}_{\mathrm{ijk}}\) to represent the starting and ending byte positions of cells under element\({}_{\mathrm{k}}\) in \(\mathrm{part}\) that process \(\mathrm{i}\) must handle. Specifically, the calculation method for a sub-mesh's starting position is demonstrated in Expression (3), whereas the calculation method for a sub-mesh's ending position is demonstrated in Expression (4).