A grid cell data query method and system

CN116842228BActive Publication Date: 2026-09-25PERA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310826042.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2026-09-25
Estimated Expiration
2043-07-06

AI Technical Summary

Technical Problem

[0005]鉴于上述的分析,本发明实施例旨在提供一种网格单元数据查询方法及系统,用以解决现有大规模的网格数据占用的存储空间大且读写和传输占用时间长的问题

Benefits of technology

[0023]与现有技术相比,本发明至少可实现如下有益效果之一:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116842228B_ABST
    Figure CN116842228B_ABST
Patent Text Reader

Abstract

The application relates to a grid unit data query method and system, and belongs to the technical field of data processing. The method solves the problems that the storage space occupied by large-scale grid data is large, and the read-write and transmission occupation time is long in the prior art. The method comprises the following steps: receiving an index of a grid unit to be queried and a grid grouping ID to which the grid unit belongs; acquiring each grid unit set contained in a grid grouping according to the grid grouping ID; the grid unit set is a data set of the same type of grid unit, and comprises a unit type, a unit quantity, a starting index and a unit topology array; sequentially calculating the grid unit set to which the index of the grid unit to be queried belongs according to the starting index and the unit quantity of each grid unit set, and taking the grid unit set as a target unit set; extracting the index of each grid point in the grid unit to be queried from the unit topology array of the target unit set, and obtaining the coordinates of each grid point of the grid unit to be queried in a global grid point array. Efficient access of grid unit data is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method and system for querying grid cell data. Background Technology

[0002] In the field of CAE, the number of grid nodes and cells can be very large. When the number of grid cells reaches hundreds of millions, the storage and memory space occupied by the grid data will be enormous, and reading, writing, and editing will also consume a lot of time.

[0003] Complete grid data is relatively complex, storing a large number of grid cells, grid faces, grid edges, and the adjacency relationships of points, resulting in a complex storage format and a large storage space.

[0004] When processing mixed-type grids, different types of grid data are randomly arranged. Since the lengths of different types of cell data are inconsistent and subscript access to grid data is not supported, the amount of data exchanged between the front-end and back-end is large, and the efficiency of adding, modifying, deleting and querying is very low. Summary of the Invention

[0005] Based on the above analysis, the embodiments of the present invention aim to provide a grid cell data query method and system to solve the problems of large storage space occupied by existing large-scale grid data and long reading, writing and transmission time.

[0006] On one hand, embodiments of the present invention provide a grid cell data query method, including the following steps:

[0007] Receive the index of the grid cell to be queried and the ID of the grid group to which it belongs, and obtain the set of grid cells contained in the grid group based on the grid group ID; the set of grid cells is a dataset of grid cells of the same type, including cell type, number of cells, starting index and cell topology array;

[0008] Based on the starting index and number of cells of each grid cell set, the grid cell set to which the index of the grid cell to be queried belongs is calculated, which is then used as the target cell set. The index of each grid point in the grid cell to be queried is extracted from the cell topology array of the target cell set, and the coordinates of each grid point in the grid cell to be queried are obtained from the global grid point array.

[0009] Based on a further improvement of the above method, the grid grouping includes a grid grouping ID and a dynamic array container, which is used to store pointers to the grid cell sets that are put in sequentially.

[0010] Based on the further improvement of the above method, each set of grid cells corresponds to a unique cell type, which can be any polygon or polyhedron.

[0011] Based on the further improvement of the above method, according to the cell type of the grid cell set, the index of each grid point in the global grid point array in the same type of grid cell is saved to the cell topology array, which is a one-dimensional array.

[0012] Based on a further improvement of the above method, the starting index of the grid cell set is obtained through the following steps:

[0013] Based on the grid group to which the current grid cell set belongs, obtain the grid cell sets that have been placed in its dynamic array container; calculate the sum of the number of cells in each grid cell set that has been placed, and obtain the starting index of the current grid cell set.

[0014] Based on a further improvement to the above method, the grid cell set to which the index of the grid cell to be queried belongs is calculated according to the starting index and the number of cells in each grid cell set, and this set is used as the target cell set, including:

[0015] The maximum index of each grid cell set is obtained by adding the starting index and the number of cells of each set together and then subtracting 1.

[0016] When the index of the grid cell to be queried is within the range of the starting index and the maximum index of the grid cell set, the corresponding grid cell set is the target cell set.

[0017] Based on a further improvement to the above method, the indices of each grid point in the grid cell to be queried, extracted from the cell topology array of the target cell set, include:

[0018] Subtract the starting index of the target cell set from the index of the cell to be queried to obtain the index difference; according to the cell type of the target cell set, obtain the number of grid points in a single cell as the cell point count; multiply the index difference by the cell point count to obtain the index of the first grid point in the cell topology array of the cell to be queried; based on this index and the cell point count, sequentially retrieve the indices of each grid point in the cell to be queried from the cell topology array of the target cell set.

[0019] Based on the further improvement of the above method, when the cell topology array of the grid cell set changes, the number of cells in the grid cell set and the starting index of each grid cell set in the dynamic array container of the grid group that is larger than the starting index of the grid cell set are modified synchronously.

[0020] On the other hand, embodiments of the present invention provide a grid cell data query system, the system comprising: a data query module, configured to receive the index of the grid cell to be queried and the grid group ID to which it belongs, and obtain the grid cell sets contained in the grid group according to the grid group ID; the grid cell set is a dataset of grid cells of the same type, including cell type, number of cells, starting index and cell topology array; the grid cell set to which the index of the grid cell to be queried belongs is calculated according to the starting index and number of cells of each grid cell set, and is used as the target cell set; the index of each grid point in the grid cell to be queried is extracted from the cell topology array of the target cell set, and the coordinates of each grid point of the grid cell to be queried are obtained in the global grid point array.

[0021] Based on further improvements to the above system, the system also includes:

[0022] The data storage module receives grid engine data, saves the coordinates of each grid point to a global grid point array, and obtains the index of each grid point. Based on the grid groups in the grid engine data, it constructs each grid group, extracts the grid cells from each grid group in sequence, constructs each grid cell set according to the grid cell type, saves the index of each grid point in the same type of grid cell to the cell topology array of the corresponding grid cell set, and puts each grid cell set of the same grid group into the corresponding grid group.

[0023] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0024] 1. By storing the same type of grid cell data in a large one-dimensional array, there is no duplicate data or redundant space. It also avoids the construction of multi-layer complex data objects and the operation of constructing objects and allocating memory multiple times, which simplifies the serialization and deserialization process and improves data read and write efficiency.

[0025] 2. Using a one-dimensional array for storage simplifies the data structure. By using the index of the stored grid cell data as the subscript, data can be quickly retrieved, improving data access efficiency.

[0026] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0027] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0028] Figure 1 This is a flowchart of a grid cell data query method according to Embodiment 1 of the present invention;

[0029] Figure 2 This is an example diagram of grid cell data storage in Embodiment 1 of the present invention. Detailed Implementation

[0030] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0031] Example 1

[0032] A specific embodiment of the present invention discloses a method for querying grid cell data, such as... Figure 1 As shown, it includes the following steps:

[0033] S11. Receive the index of the grid cell to be queried and the ID of the grid group to which it belongs. Obtain the set of grid cells contained in the grid group according to the grid group ID. The set of grid cells is a dataset of grid cells of the same type, including cell type, number of cells, starting index and cell topology array.

[0034] S12. Calculate the grid cell set to which the index of the grid cell to be queried belongs based on the starting index and the number of cells in each grid cell set, and use it as the target cell set. Extract the index of each grid point in the grid cell to be queried from the cell topology array of the target cell set, and obtain the coordinates of each grid point in the grid cell to be queried from the global grid point array.

[0035] During implementation, based on the already stored global grid point array, grid groups and their contained grid cell sets, the grid point index of the grid cell to be queried can be obtained by simple addition and subtraction and access to the one-dimensional array according to the index of the grid cell to be queried and the ID of the grid group to which it belongs in the query conditions. This index can be directly used as the subscript to quickly retrieve the data, avoiding the cascading processing of multi-layer complex data and improving data access efficiency.

[0036] It should be noted that the global grid point array, grid groups, and their respective sets of grid cells are stored through the following steps:

[0037] Receive grid engine data, save the coordinates of each grid point to the global grid point array, and obtain the index of each grid point; construct each grid group according to the grid grouping in the grid engine data, extract the grid cells in each grid group in turn, construct each grid cell set according to the grid cell type, save the index of each grid point in the same type of grid cell to the cell topology array of the corresponding grid cell set; put each grid cell set of the same grid group into the corresponding grid group.

[0038] Specifically, a mesh group consists of a mesh group ID and a dynamic array container. The dynamic array container stores pointers to the mesh cell sets that are sequentially added. Each mesh cell set corresponds to a unique cell type, and all mesh cells within each set are of the same type. The cell type can be any polygon or polyhedron, and the number of mesh points in a single mesh cell is the number of vertices corresponding to the cell type. For example, when the cell type is a triangle, the number of mesh points in a single mesh cell is 3; when the cell type is a quadrilateral, the number of mesh points in a single mesh cell is 4; and when the cell type is a tetrahedron, the number of mesh points in a single mesh cell is 4. In other words, the number of mesh points in a single mesh cell can be determined based on each cell type, and each mesh cell in each set contains the same number of mesh points.

[0039] Furthermore, based on the cell type of the grid cell set, the indices of each grid point in the global grid point array within the same type of grid cell are sequentially saved to the cell topology array, which is a one-dimensional array.

[0040] It should be noted that each set of grid cells contained in each grid group has a different starting index, which is obtained through the following steps: based on the grid group to which the current set of grid cells belongs, obtain the set of grid cells that have been placed in its dynamic array container; calculate the sum of the number of cells in each set of grid cells that have been placed in the array to obtain the starting index of the current set of grid cells.

[0041] For example, such as Figure 2 As shown, a grid group G is constructed based on the global grid point array Q. Two grid cell sets A and B are placed in the dynamic array container within G. Grid cell set A has triangular cells, and grid cell set B has quadrilateral cells. The data stored in the cell topology array a of grid cell set A is: {0,2,3,3,4,5,1,5,6,1,6,7,6,7,8}, and the data stored in the cell topology array b of grid cell set B is: {9,12,13,14,12,14,5,16,17,21,15,16}. It can be seen that:

[0042] ① In the cell topology array a, three values ​​correspond to one grid cell. The cell topology array a stores a total of 5 grid cells, and the number of cells is 5.

[0043] ② In the cell topology array b, four values ​​correspond to one grid cell. The cell topology array b stores a total of three grid cells, and the number of cells is 3.

[0044] ③ If the starting index of grid cell set A is 0, then the 5 grid cells correspond to indices 0 to 4 in sequence; if the starting index of grid cell set B is 5, then the 3 grid cells correspond to indices 5 to 7 in sequence.

[0045] ④ As long as the values ​​stored in the cell topology arrays a and b are retrieved, they can be used as the index of the global grid point array Q to obtain the corresponding grid point coordinates. For example, if the value 8 is retrieved from the cell topology array a, the grid point coordinates with index 8 in the global grid point array Q can be retrieved through Q[8].

[0046] It should be noted that since the topology of each grid cell is fixed, the data of the face and edge of the grid cell can be obtained by constructing a static table from the fixed topology and then looking up the table. Therefore, in this embodiment, it is only necessary to store the information of the grid points through the cell topology array, and there is no need to store the data of the grid face and edge.

[0047] It is worth noting that when displaying the mesh model, the arrangement order of the mesh cells in the displayed data is consistent with the arrangement attribute of the mesh cells in the topology array of each cell. That is, the index of each mesh cell in the same mesh group in the displayed data is consistent with the index of the mesh cell in the topology array of each cell in memory.

[0048] In step S11, the dynamic array container of the grid group is obtained according to the grid group ID, and the set of each grid cell contained therein is obtained.

[0049] In step S12, based on the starting index and number of cells in each grid cell set, the grid cell set to which the index of the grid cell to be queried belongs is calculated, which serves as the target cell set, including:

[0050] The maximum index of each grid cell set is obtained by adding the starting index and the number of cells of each set together and then subtracting 1.

[0051] When the index of the grid cell to be queried is within the range of the starting index and the maximum index of the grid cell set, the corresponding grid cell set is the target cell set.

[0052] For example, if the index of the grid cell to be queried is 6, then combining the above example, the maximum index of grid cell set A is: 0+5-1=4, and the maximum index of grid cell set B is 5+3-1=7; 6 is between the starting index 5 and the maximum index 7 of grid cell set B, so the target cell set is grid cell set B.

[0053] Next, the indices of each grid point in the grid cell to be queried are extracted from the cell topology array of the target cell set, including:

[0054] Subtract the starting index of the target cell set from the index of the cell to be queried to obtain the index difference; according to the cell type of the target cell set, obtain the number of grid points in a single cell as the cell point count; multiply the index difference by the cell point count to obtain the index of the first grid point in the cell topology array of the cell to be queried; based on this index and the cell point count, sequentially retrieve the indices of each grid point in the cell to be queried from the cell topology array of the target cell set.

[0055] Finally, based on the indices retrieved in sequence, the coordinates of each grid point of the grid cell to be queried are obtained from the global grid point array.

[0056] For example, if the index of the grid cell to be queried is 6 and the starting index of the grid cell set B is 5, then the index difference is 6-5=1. The number of cell points in the grid cell set B is 4. Therefore, the index of the first grid point in the grid cell to be queried in the cell topology array b is 1×4=4. Then, according to the number of cell points, the values ​​with indices 4 to 7 are taken out from the cell topology array b of the target cell set in sequence, that is, b[4], b[5], b[6] and b[7] are taken out to obtain the indices 12, 14, 5 and 16 corresponding to the coordinates of the four grid points of the grid cell to be queried. Finally, the coordinates of each grid point of the grid cell to be queried are obtained according to Q

[12] , Q

[14] , Q[5] and Q

[16] .

[0057] It should be noted that when the cell topology array of a grid cell set is changed, the number of cells in the grid cell set and the starting index of each grid cell set in the dynamic array container of the grid group that is larger than the starting index of the grid cell set are modified synchronously.

[0058] Specifically, when a new grid cell is added, a grid cell set is obtained according to its corresponding cell type. At the end of the cell topology array of the grid cell set, the indices of the new grid points in the global grid point array are stored sequentially. The number of new grid cells, the number of cells in the new grid cell set, and the starting indices of all grid cell sets in the dynamic array container of the grid group that are larger than the starting index of the new grid cell set are used.

[0059] Similarly, when deleting a grid cell, the index of the grid point of the grid cell to be deleted is found in the cell topology array of the cell to which it belongs, according to the query method. The corresponding data is deleted, and the index of the subsequent grid cells is updated. The number of cells in the grid cell set is reduced, as are the starting indices of all grid cell sets in the dynamic array container of the grid group that are larger than the starting index of the grid cell set.

[0060] For example, based on the above example, when a new triangular mesh cell is added, 3 mesh point indices are added to the end of the cell topology array a of mesh cell set A, and the number of cells in mesh cell set A is modified to 6. Since the starting index of mesh cell set B is greater than the starting index of mesh cell set A, the starting index of mesh cell set B is modified to 6.

[0061] Compared with existing technologies, the grid cell data query method provided in this embodiment stores grid cell data of the same type in a large one-dimensional array, eliminating duplicate data and redundant space. It also avoids the construction of multi-layered complex data and multiple memory allocation operations, simplifying the serialization and deserialization process and improving data read and write efficiency. Using a one-dimensional array for storage simplifies the data structure, and the index of the stored grid cell data can be directly used as the subscript to quickly query the data, thus improving data access efficiency.

[0062] Example 2

[0063] Another embodiment of the present invention discloses a grid cell data query system, thereby implementing the grid cell data query method in Embodiment 1. The specific implementation of each module is described in the corresponding description in Embodiment 1. The system includes:

[0064] The data query module receives the index of the grid cell to be queried and the ID of its grid group. Based on the grid group object ID, it obtains the set of grid cells contained in the grid group. The set of grid cells is a dataset of grid cells of the same type, including cell type, number of cells, starting index, and cell topology array. Based on the starting index and number of cells of each set of grid cells, it calculates the set of grid cells to which the index of the grid cell to be queried belongs, which is used as the target set. The index of each grid point in the grid cell to be queried is extracted from the cell topology array of the target set, and the coordinates of each grid point in the grid cell to be queried are obtained from the global grid point array.

[0065] Furthermore, it also includes:

[0066] The data storage module receives grid engine data, saves the coordinates of each grid point to a global grid point array, and obtains the index of each grid point. Based on the grid groups in the grid engine data, it constructs each grid group, extracts the grid cells from each grid group in sequence, constructs each grid cell set according to the grid cell type, saves the index of each grid point in the same type of grid cell to the cell topology array of the corresponding grid cell set, and puts each grid cell set of the same grid group into the corresponding grid group.

[0067] Since the grid cell data query system of this embodiment and the aforementioned grid cell data query method are related and can be referenced from each other, and this is a repetition, it will not be repeated here. Because the principle of this system embodiment is the same as that of the above method embodiment, this system embodiment also has the corresponding technical effects of the above method embodiment.

[0068] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0069] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for querying grid cell data, characterized in that, Includes the following steps: The system receives the index of the grid cell to be queried and the ID of the grid group to which it belongs. Based on the ID of the grid group, it obtains the set of grid cells contained in the grid group. The set of grid cells is a dataset of grid cells of the same type, including cell type, number of cells, starting index and cell topology array. The cell topology array is a one-dimensional array used to store the index of each grid point in the global grid point array in the same type of grid cell according to the cell type of the grid cell set. Based on the starting index and number of cells of each grid cell set, calculate the grid cell set to which the index of the grid cell to be queried belongs, and use it as the target cell set; extract the index of each grid point in the grid cell to be queried from the cell topology array of the target cell set, and obtain the coordinates of each grid point in the grid cell to be queried from the global grid point array, including: subtracting the starting index of the target cell set from the index of the grid cell to be queried to obtain the index difference; Based on the cell type of the target cell set, obtain the number of grid points in a single grid cell as the cell point count; multiply the index difference by the cell point count to obtain the index of the first grid point in the cell topology array of the grid cell to be queried; based on this index and the cell point count, sequentially retrieve the indices of each grid point in the grid cell to be queried from the cell topology array of the target cell set; use the sequentially retrieved indices as the subscripts of the global grid point array to obtain the coordinates of each grid point in the grid cell to be queried.

2. The grid cell data query method according to claim 1, characterized in that, The grid group includes a grid group ID and a dynamic array container, which stores pointers to the grid cell sets that are sequentially placed into the array.

3. The grid cell data query method according to claim 2, characterized in that, Each set of grid cells corresponds to a unique cell type, which can be any polygon or polyhedron.

4. The grid cell data query method according to claim 3, characterized in that, The starting index of the grid cell set is obtained through the following steps: Based on the grid group to which the current grid cell set belongs, obtain the grid cell sets that have been placed in its dynamic array container; calculate the sum of the number of cells in each grid cell set that has been placed, and obtain the starting index of the current grid cell set.

5. The grid cell data query method according to claim 4, characterized in that, The step of calculating the grid cell set to which the index of the grid cell to be queried belongs, based on the starting index and the number of cells in each grid cell set, and using this as the target cell set, includes: The maximum index of each grid cell set is obtained by adding the starting index and the number of cells of each set together and then subtracting 1. When the index of the grid cell to be queried is within the range of the starting index and the maximum index of the grid cell set, the corresponding grid cell set is the target cell set.

6. The grid cell data query method according to claim 4, characterized in that, When the cell topology array of the grid cell set changes, the number of cells in the grid cell set and the starting index of each grid cell set in the dynamic array container of the grid group that is larger than the starting index of the grid cell set are modified synchronously.

7. A grid cell data query system, characterized in that, The system includes: The data query module receives the index and grid group ID of the grid cell to be queried, and obtains the sets of grid cells contained in the grid group based on the grid group ID. The grid cell set is a dataset of grid cells of the same type, including cell type, number of cells, starting index, and cell topology array. The cell topology array is a one-dimensional array used to store the index of each grid point in the global grid point array based on the cell type of the grid cell set. The module calculates the grid cell set to which the index of the grid cell to be queried belongs based on the starting index and number of cells in each grid cell set, and uses this as the target cell set. The module then extracts the grid cells to be queried from the cell topology array of the target cell set. The process involves obtaining the coordinates of each grid point in the queried grid cell from the global grid point array. This includes: subtracting the starting index of the target cell set from the index of the queried grid cell to obtain the index difference; determining the number of grid points in a single grid cell based on the cell type of the target cell set, which is then used as the cell point count; multiplying the index difference by the cell point count to obtain the index of the first grid point in the queried grid cell in the cell topology array; retrieving the stored indices of each grid point in the queried grid cell sequentially from the cell topology array of the target cell set based on this index and the cell point count; and using these sequentially retrieved indices as indices in the global grid point array to obtain the coordinates of each grid point in the queried grid cell.

8. The grid cell data query system according to claim 7, characterized in that, The system also includes: The data storage module receives grid engine data, saves the coordinates of each grid point to a global grid point array, and obtains the index of each grid point. Based on the grid groups in the grid engine data, it constructs each grid group, extracts the grid cells from each grid group in sequence, constructs each grid cell set according to the grid cell type, saves the index of each grid point in the same type of grid cell to the cell topology array of the corresponding grid cell set, and puts each grid cell set of the same grid group into the corresponding grid group.

Citation Information

Patent Citations

  • Method for rapidly searching for multi-block structured grid docking relations

    CN103838852A

  • Data query method and device, server and storage medium

    CN110765138A