Grid file analysis method and device, equipment and storage medium
By building structures and defining map functions to parse mesh files, the problem of inconsistent parsing of files in multiple formats is solved, and the generalized processing of data and memory optimization is realized, and data input and reconstruction of the flow field solver is supported.
Patent Information
- Application Number
- CN202510302363.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-03-14
AI Technical Summary
The prior art is difficult to parse grid information files in multiple formats into common forms, resulting in difficulty in reading and reconstructing data.
By constructing a structure that stores the surface unit information, defining a map function, analyzing the boundary surface and body unit information in the mesh file, obtaining the target key value, and updating the surface unit information to complete the analysis, abandoning the relationship between the non-structural mesh mesh unit body and vertices to reduce memory overhead.
It realizes the parsing of grid information files in multiple formats into a common form, reducing memory overhead, and providing geometric data input for flow field solvers, making it easier to read and reconstruct data.
Smart Images

Figure CN119808661A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of grid data processing, and in particular to a grid file parsing method, device, equipment and storage medium. Background Art
[0002] Unstructured grids have the advantages of high automation, short generation cycle, and flexible distribution control. They are often used to discretize the spatial regions of complex engineering shapes. They are widely used in computational fluid dynamics (CFD) of complex shapes. Unstructured linear units are currently used in most CFD numerical simulations. The grid information storage file formats generated by commercial software are diverse. Taking CGNS (CFD General Notation System) as an example, the CGNS format is a common format output by unstructured grid software. The CGNS format contains the relationship between the unit body and the point, as well as the coordinate values of the point. Therefore, how to parse grid information files of various formats into a common form is a problem that needs to be solved urgently. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a grid file parsing method, device, equipment and storage medium, which can parse grid information files of various formats into a common form to facilitate data reading and reconstruction. The specific scheme is as follows:
[0004] In a first aspect, the present application discloses a grid file parsing method, comprising:
[0005] Read the basic information in the grid file, construct a structure to store the surface unit information, and define the map function through the structure; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface;
[0006] Parsing the composition information of the boundary surface in the grid file, obtaining the target information of the boundary surface, determining the target key value based on the target information, and inputting the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number and the number of points on the surface;
[0007] Parsing the composition information of the volume unit in the grid file, obtaining the numbers of the points on each surface of the volume unit after orientation arrangement, and judging whether each surface of the volume unit exists in the map function based on the numbers of the points on each surface of the volume unit;
[0008] If it exists, update the information of each face unit to obtain each updated subsequent unit, and based on each updated subsequent unit, obtain the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of point numbers that constitute the face to complete the parsing of the grid file.
[0009] Optionally, constructing a structure for storing surface unit information and defining a map function through the structure includes:
[0010] Constructing a first structure for storing numbers of points on a surface; wherein the numbers of the points on the surface stored in the first structure are numbers obtained by sorting the numbers of the points based on a preset size order;
[0011] Constructing a second structure for storing the surface unit number, the surface left unit number, the surface right unit number, the surface point number and the number of constituent points of the surface;
[0012] The map function is defined by determining the first structure and the second structure as a key and a value respectively.
[0013] Optionally, determining the target key value based on the target information includes:
[0014] Arrange the numbers of the points on the surface in descending order to obtain a number information array, and determine the number information array as a target key;
[0015] The surface unit number, the number of constituent points of the surface, and the boundary surface type number are determined as target values.
[0016] Optionally, after judging whether each surface of the volume unit exists in the map function based on the numbers of the points on each surface of the volume unit, the method further includes:
[0017] If the face of the body unit does not exist in the map function, a key-value pair is constructed based on the target information of the non-existent face, and the key-value pair is written into the map function.
[0018] Optionally, updating the information of each surface unit includes:
[0019] The order of the surface points of each surface unit and the information of the left and right surface units are updated.
[0020] Optionally, the obtaining of the number array of points on the surface, the arrays of left and right units to which the surface belongs, and the array of point numbers constituting the surface based on each of the updated subsequent units includes:
[0021] The data corresponding to each updated cell is stored in the array storing the grid data to obtain the array of the number of points on the surface, the array of the left and right cells to which the surface belongs, and the array of the point numbers constituting the surface.
[0022] Optionally, after obtaining the array of the number of points on the surface, the arrays of the left and right units to which the surface belongs, and the array of the number of points constituting the surface based on each of the updating subsequent units, the method further includes:
[0023] Delete the key-value pairs corresponding to the data of the face unit that has been stored in the array in the map function.
[0024] In a second aspect, the present application discloses a grid file parsing device, comprising:
[0025] A function definition module is used to read basic information in a grid file, construct a structure to store surface unit information, and define a map function through the structure; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface;
[0026] A key value input module is used to parse the composition information of the boundary surface in the grid file, obtain the target information of the boundary surface, determine the target key value based on the target information, and input the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number and the number of points on the surface;
[0027] A judgment module, used to parse the composition information of the body unit in the grid file, obtain the numbers of the points on each surface of the body unit after the directional arrangement, and judge whether each surface of the body unit exists in the map function based on the numbers of the points on each surface of the body unit;
[0028] The array acquisition module is used to update the information of each face unit if it exists, so as to obtain each updated subsequent unit, and based on each updated subsequent unit, obtain the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of point numbers that constitute the face, so as to complete the parsing of the grid file.
[0029] In a third aspect, the present application discloses an electronic device, comprising:
[0030] Memory, used to store computer programs;
[0031] The processor is used to execute the computer program to implement the grid file parsing method as described above.
[0032] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the grid file parsing method as described above is implemented.
[0033] When parsing a grid file, the present application first reads the basic information in the grid file, constructs a structure to store the surface unit information, and defines a map function through the structure; the basic information includes the body unit type and composition information, point number and coordinates, and the type and composition information of the boundary surface; secondly, the composition information of the boundary surface in the grid file is parsed to obtain the target information of the boundary surface, determine the target key value based on the target information, and input the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number, and the number of the points on the surface; then the composition information of the body unit in the grid file is parsed to obtain the numbers of the points on each surface of the body unit after directional arrangement, and judge whether the faces of the body unit exist in the map function based on the numbers of the points on each surface of the body unit; finally, if it exists, the information of each surface unit is updated to obtain each updated subsequent unit, and based on each updated subsequent unit, the number array of the points on the surface, the array of the left and right units to which the surface belongs, and the array of the point numbers constituting the surface are obtained to complete the parsing of the grid file. It can be seen that the present application utilizes the map function to parse the mesh information file, discards the relationship between the unstructured mesh unit body and its vertices to reduce memory overhead, parses mesh information files of various formats into a common form, provides geometric data input for the flow field solver, and facilitates data reading and reconstruction. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0035] Figure 1 A flow chart of a grid file parsing method disclosed in this application;
[0036] Figure 2 A schematic diagram of a grid unit disclosed in this application;
[0037] FIG3 (a) is a schematic diagram of a hexahedral grid unit disclosed in the present application; FIG3 (b) is a schematic diagram of a triangular prism grid unit disclosed in the present application; FIG3 (c) is a schematic diagram of a pyramid grid unit disclosed in the present application; FIG3 (d) is a schematic diagram of a tetrahedral grid unit disclosed in the present application;
[0038] Figure 4 A schematic diagram of the structure of a grid file parsing device disclosed in this application;
[0039] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] Currently, the formats of mesh information storage files generated by commercial software are diverse. Taking CGNS (CFD General Notation System) as an example, the CGNS format is a commonly used format output by unstructured mesh software. The mesh format of the CGNS format contains the relationship between units and points, as well as the coordinate values of the points. However, the file formats parsed from mesh information files in various formats are not universal. In order to solve the above technical problems, the present application discloses a mesh file parsing method, device, equipment and storage medium, which can parse mesh information files in various formats into a universal format to facilitate data reading and reconstruction.
[0042] See also Figure 1 As shown, an embodiment of the present invention discloses a grid file parsing method, comprising:
[0043] Step S11, read the basic information in the grid file, construct a structure to store the surface unit information, and define the map function through the structure; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface.
[0044] In this embodiment, the present application first reads the basic information in the grid file, including data such as the type and composition information of the volume unit, the point number and coordinates, the type and composition information of the boundary surface, etc. Take a grid composed of a hexahedron and a pyramid unit as an example. Figure 2 As shown, the hexahedron is the volume unit No. 0, and the pyramid unit is the volume unit No. 1. The number of boundary faces is 9, the boundary type number of the triangular boundary face is 1, the boundary type number of the quadrilateral boundary face is 2, and the number of points is 9.
[0045] Then, a first structure is constructed to store the numbers of points on the face; wherein, the numbers of the points on the face stored in the first structure are the numbers after sorting the numbers of each point based on a preset size order; a second structure is constructed to store the face unit number, the left side unit number of the face, the right side unit number of the face, the number of points on the face, and the number of points that make up the face; a map function is defined by defining the first structure and the second structure as keys and values, respectively. Specifically, a structure is constructed to store face unit information. The first structure FaceOrder is used to store the four point numbers on the face, and the values in the input array facenode[4] are compared in sequence to ensure their uniqueness; the second structure FaceInfor includes the face number face_id, the left side unit number f2cl of the face, the right side unit number f2cr of the face (when the face is a boundary face, the value is a negative number), the number of points on the face f2n_tmp[4], the number of points on the face nNPF, and other information. Using these two structures as keys and values, a map function FacesInfor1 is defined:
[0046] typedef std::map<FaceOrder, FaceInfor> FacesInfor1.
[0047] Step S12, parse the composition information of the boundary surface in the grid file, obtain the target information of the boundary surface, determine the target key value based on the target information, and input the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number and the number of points on the surface.
[0048] In this embodiment, the boundary surface information in the grid file is processed, that is, the composition information of the boundary surface in the grid file is parsed, and its composition key-value pairs are written into the map function FacesInfor1. The boundary surface types include triangles and quadrilaterals. An array f2ntmp[4] is established to temporarily store the numbering information of the points on the surface, and the numbers face_id of the boundary surface units are arranged from zero. All units of the grid file are looped. According to the CGNS library function, it can be determined whether the current unit is a body unit or a face unit, and the body unit is skipped. When the current unit is determined to be a quadrilateral boundary surface unit, the point numbering information is stored in f2ntmp[4] according to the read information. When the current unit is determined to be a triangle boundary surface unit, the point numbering information is stored in f2ntmp[4] according to the read information, and f2ntmp[3] is set to -1. In other words, according to the CGNS library function, the following can be obtained: ① face unit number findex; ② number of constituent points of each face nodeofface; ③ boundary surface type number bct; ④ numbering information f2ntmp[4] of the points on the surface. When the current cell is determined to be a triangular boundary surface cell, since there are only three point numbers in f2ntmp, set f2ntmp[3] = -1. For the key in FacesInfor1, create a new f2ntmp_[4] array, use the ReorderPnts function to change the arrangement order of f2ntmp[4] to be arranged from large to small, and assign it to f2ntmp_[4], and set f2ntmp_[4] as a structure as the key (unique) of FacesInfor1.
[0049] For the value in FacesInfor1, assign nodeofface to face Infor.nNPF, assign the negative value of bct as the unit number on the left side of the face unit to face_infor.f2cl, use the ReorderPnts function to change the order of f2ntmp[4] so that the value with the smallest point number is in the first place, and then assign its value to face_Infor.f2n_tmp. Finally, use the insert function to add the key-value pair to the structure FacesInfor1.
[0050] Take the storage information of a unit as an example:
[0051] IntType f2ntmp_[4];
[0052] Reorderpnts_(f2ntmp_,f2ntmp,4);
[0053] if (f2ntmp_[3]==-1) nodeofface=3;
[0054] else nodeofface =4;
[0055] face_Infor.face_id = findex;
[0056] face_Infor.f2cl = -bct[findex];
[0057] face_Infor.nNPF = nodeofface;
[0058] ReorderPnts(f2ntmp, nodeofface);
[0059] for (IntType ii = 0; ii < nodeofface; ii++)
[0060] {
[0061] face_Infor.f2n_tmp[ii] = f2ntmp[ii];
[0062] }
[0063] FaceOrder faceorder(f2ntmp_);
[0064] FacesInfor1.insert(std::make_pair(faceorder, face_Infor));
[0065] findex++;
[0066] Based on this, the numbers of the points on the surface are arranged in order from large to small to obtain a number information array, and the number information array is determined as the target key; the surface unit number, the number of points constituting the surface, and the boundary surface type number are determined as the target value. Then, the target key value determined according to the target value and the target key is input into the map function, and the above process is repeated. After all the boundary surfaces are processed, they are input into the map function to obtain the information table shown in Table 1.
[0067] Table 1
[0068]
[0069] Step S13, parsing the composition information of the volume unit in the grid file, obtaining the numbers of the points on each surface of the volume unit after directional arrangement, and judging whether each surface of the volume unit exists in the map function based on the numbers of the points on each surface of the volume unit.
[0070] In this embodiment, the volume unit face information in the grid file is processed. After the above steps, the boundary face units have been processed, and their numbers face_id are all placed in the front. Now the volume unit grid is processed. The non-structural volume unit is generally divided into hexahedron, triangular prism, pyramid and tetrahedron. According to the vertex information, the volume unit is divided into six faces, five faces, five faces and four faces in turn. Taking the hexahedron as an example, the CGNS library function can construct a C2N[cell][8] two-dimensional array. The first dimension is the hexahedral unit number, and the second dimension represents its 8 vertices. The order of the points is as follows: Figure 2 As shown in the hexahedron in , the point numbering information of the six faces can be constructed, and the array f2ntmp can be used to record the point numbering information of each face in turn:
[0071] f2ntmp[0] = C2N[cindex][0];
[0072] f2ntmp[1] = C2N[cindex][4];
[0073] f2ntmp[2] = C2N[cindex][7];
[0074] f2ntmp[3] = C2N[cindex][3];
[0075] Then, f2ntmp[4] is reordered, and the point numbers are arranged from large to small to obtain f2ntmp_[4]. The FaceOrder structure is used to construct a key with a unique value. Then, the search function of the map function is used to search FacesInfor1 to see if there is a key that is the same as f2ntmp_[4].
[0076] Step S14, if it exists, update the information of each face unit to obtain each updated subsequent unit, and based on each updated subsequent unit, obtain the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of point numbers that constitute the face to complete the parsing of the grid file.
[0077] In this embodiment, if the face of the body unit does not exist in the map function, a key-value pair is constructed based on the target information of the non-existent face, and the key-value pair is written into the map function. If it exists, the information of each face unit is updated to obtain each updated subsequent unit. Specifically, if the same key as f2ntmp_[4] does not exist in FacesInfor1, it means that the information of the face does not exist in FacesInfor1. At this time, the key-value pair is constructed and written into FacesInfor1 in the same way as in the above-mentioned step of obtaining the target information of the boundary face and determining the target key value based on the target information, where face_id starts from nBFace (the number of boundary faces) and f2cl starts from zero, which is the body unit number. If the same key as f2ntmp_[4] is searched in FacesInfor1, it means that the information of the face already exists in FacesInfor1, and it also means that the left and right units of the face have been found. At this time, it is necessary to update the order of the points on the face and exchange the information of the left and right units of the face.
[0078] ReorderPnts(f2ntmp, nodeofface);
[0079] facetype = iter->second.f2cl;
[0080] face_Infor.f2cl = cindex;
[0081] face_Infor.f2cr = facetype;
[0082] face_Infor.nNPF = nodeofface;
[0083] face_Infor.face_id = iter->second.face_id;
[0084] for (IntType ii = 0; ii < nodeofface; ii++)
[0085] {
[0086] face_Infor.f2n_tmp[ii] = f2ntmp[ii];
[0087] }.
[0088] To obtain the information table shown in Table 2.
[0089] Table 2
[0090]
[0091] Then, the data corresponding to each updated unit is stored in the array storing the mesh data to obtain the array of the number of points on the surface, the array of the left and right units to which the surface belongs, and the array of the point numbers that constitute the surface. Specifically, the array of the number of points on the surface nNPF[nTFace] is obtained. nTFace is the total number of surfaces, nT_tet is the number of tetrahedral units, nT_pyr is the number of pyramid units, nT_pris is the number of triangular prism units, nT_hex is the number of hexahedral units, nT_tri is the number of triangular face units, and nT_quad is the number of quadrilateral unit faces. In the array nNPF, the boundary faces are arranged in front and the internal faces are arranged in the back. The order is consistent with the input in the map. Then, the values stored in the map can be obtained:
[0092] nTFace = 4 * nT_tet + 5 * nT_pyr + 5 * nT_pris + 6 * nT_hex + nT_tri+ nT_quad;
[0093] nTFace = nTFace / 2;
[0094] nNPF[iter->second. face_id] = iter->second. nNPF;
[0095] In this example, nTFace = 10, and the array nNPF is shown in Table 2.
[0096] Get the array f2c[nTFace*2] of the left and right units to which the face belongs. nTFace is the total number of faces, and the number information of the left and right units to which each face belongs is arranged in sequence. For different types of boundary faces, f2cr is a different negative value.
[0097] f2c[iter->second.face_id * 2] = iter->second.f2cl;
[0098] f2c[iter->second. face_id * 2 + 1] = iter->second. f2cr;
[0099] In this example, the length of the array with f2c is 20, and the array is shown in Table 2.
[0100] Get the point number array f2n[nnodes] that constitutes all faces. Among them, f2n_tmp[inode] is the points on the unit arranged in order, pointing to the outside of the unit according to the right-hand rule, nnodes is the number of all points that constitute nTFace faces, and the f2n array can be constructed based on the nNPF array and FacesInfor1.
[0101] Nnodes = 6 * nT_tet + 8 * nT_pyr + 9 * nT_pris + 12 * nT_hex + (4 *nT_quad + 3 * nT_tri) / 2;
[0102] facnod[iface+ 1] = facnod[iface] + nNPF[iface];
[0103] for (IntType inode = 0; inode < nNPF[iter->second.face_id]; inode++);
[0104] {
[0105] f2n[facnod[iter->second.face_id] + inode] = iter->second.f2n_tmp[inode];
[0106] }.
[0107] In this example, the length of the array with f2n is 36, and the array is shown in Table 2.
[0108] At the same time, after obtaining the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of the point numbers that constitute the face based on each updated subsequent unit, delete the key-value pairs of the left and right unit information that have been determined in FacesInfor1. Through steps 5 to 8, the face whose face point information has been written into the above arrays is deleted from FacesInfor1. In this way, the number of searches is reduced when searching for the next face, which can save time.
[0109] In summary, when parsing a grid file, the present application first reads the basic information in the grid file, constructs a structure to store the surface unit information, and defines a map function through the structure; the basic information includes the body unit type and composition information, point number and coordinates, and the type and composition information of the boundary surface; secondly, the composition information of the boundary surface in the grid file is parsed to obtain the target information of the boundary surface, determine the target key value based on the target information, and input the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number, and the number of the points on the surface; then the composition information of the body unit in the grid file is parsed to obtain the numbers of the points on each surface of the body unit after the directional arrangement, and judge whether the faces of the body unit exist in the map function based on the numbers of the points on each surface of the body unit; finally, if it exists, the information of each surface unit is updated to obtain each updated subsequent unit, and based on each updated subsequent unit, the number array of the points on the surface, the array of the left and right units to which the surface belongs, and the array of the point numbers that constitute the surface are obtained to complete the parsing of the grid file. It can be seen that the present application utilizes the map function to parse the mesh information file, discards the relationship between the unstructured mesh unit body and its vertices to reduce memory overhead, parses mesh information files of various formats into a common form, provides geometric data input for the flow field solver, and facilitates data reading and reconstruction.
[0110] Based on the above embodiment, it can be known that the present application discloses a grid file parsing method, which can parse grid information files of various formats into a common form. Next, a specific grid file parsing method will be described in detail.
[0111] In a specific embodiment, the configuration of the CFD simulation is a simple wing of an aircraft, the calculated Mach number is Ma=0.6, the calculated temperature is T=288.15K, the calculated static pressure is P=101325Pa, the calculated incoming flow angle of attack and sideslip angle are both 0°, and the calculation grid is composed of an unstructured hexahedron as shown in Figure 3 (a), a triangular prism as shown in Figure 3 (b), a pyramid as shown in Figure 3 (c), and a tetrahedral grid unit as shown in Figure 3 (d).
[0112] When parsing the CGNS format mesh file generated by the above CFD numerical simulation, first read the basic information in the mesh file. Through the CGNS library function, you can get the data in the file including the unit type and composition information, point number and coordinates, boundary surface type and composition information, etc. Then build a structure to store the surface unit information. The first structure FaceOrder is used to store the four point numbers on the surface, and the second structure FaceInfor stores the surface unit data. Define a map function FacesInfor1 with FaceOrder and FaceInfor as key-value pairs. Then parse the boundary surface in the mesh to get the rearrangement number, right unit number, constituent point number, face point number, etc. of the boundary surface, and input the point directional arrangement of the surface and these values as key-value pairs into FacesInfor1. Then parse the unit surface in the mesh. Loop through all the faces that make up the volume unit, and judge whether the face already exists in FacesInfor1 by comparing the directional arrangement of the points that make up the face as the value of the key. If it already exists, update the face information and update the left unit number. If it does not exist, generate a key-value pair and input it into FacesInfor1, just like in the process of parsing the boundary surface in the grid. For the face units that have been updated and all information is obtained, their data is stored in an array that specifically stores grid data, including the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of the point numbers that make up the face. For the key-value pairs in FacesInfor1 that have entered the information, perform a deletion operation to save subsequent search time and improve efficiency. Finally, loop through all the volume units to obtain a complete grid data array, complete the parsing, and partition the grid data obtained by the parsing. The flow field solver uses the partitioned grid data to perform grid reconstruction, calculate the unit body center, volume and other data, and carry out CFD simulation to obtain the flow field characteristics of the simple wing under this calculation condition. Using the analyzed grid data as input, the residual error in the calculation process reaches the order of 10-4 at 5000 steps. Finally, it can be determined that the numerical calculation results and the experimental results are well matched.
[0113] It can be seen that the present application utilizes the map function to parse the mesh information file, discards the relationship between the unstructured mesh unit body and its vertices to reduce memory overhead, parses mesh information files of various formats into a common form, provides geometric data input for the flow field solver, and facilitates data reading and reconstruction.
[0114] See also Figure 4 As shown, an embodiment of the present invention discloses a grid file parsing device, comprising:
[0115] A function definition module 11 is used to read basic information in a grid file, construct a structure to store surface unit information, and define a map function through the structure; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface;
[0116] A key value input module 12 is used to parse the composition information of the boundary surface in the grid file, obtain the target information of the boundary surface, determine the target key value based on the target information, and input the target key value into the map function; the target information includes the surface unit number, the number of constituent points on the surface, the boundary surface type number and the number of points on the surface;
[0117] A judgment module 13 is used to parse the composition information of the volume unit in the grid file, obtain the numbers of the points on each surface of the volume unit after the directional arrangement, and judge whether each surface of the volume unit exists in the map function based on the numbers of the points on each surface of the volume unit;
[0118] The array acquisition module 14 is used to update the information of each face unit if it exists, so as to obtain each updated subsequent unit, and based on each updated subsequent unit, obtain the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of point numbers constituting the face, so as to complete the parsing of the grid file.
[0119] In summary, when parsing a grid file, the present application first reads the basic information in the grid file, constructs a structure to store the surface unit information, and defines a map function through the structure; the basic information includes the body unit type and composition information, point number and coordinates, and the type and composition information of the boundary surface; secondly, the composition information of the boundary surface in the grid file is parsed to obtain the target information of the boundary surface, determine the target key value based on the target information, and input the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number, and the number of the points on the surface; then the composition information of the body unit in the grid file is parsed to obtain the numbers of the points on each surface of the body unit after the directional arrangement, and judge whether the faces of the body unit exist in the map function based on the numbers of the points on each surface of the body unit; finally, if it exists, the information of each surface unit is updated to obtain each updated subsequent unit, and based on each updated subsequent unit, the number array of the points on the surface, the array of the left and right units to which the surface belongs, and the array of the point numbers that constitute the surface are obtained to complete the parsing of the grid file. It can be seen that the present application utilizes the map function to parse the mesh information file, discards the relationship between the unstructured mesh unit body and its vertices to reduce memory overhead, parses mesh information files of various formats into a common form, provides geometric data input for the flow field solver, and facilitates data reading and reconstruction.
[0120] In some specific embodiments, the function definition module 11 may specifically include:
[0121] A first structure constructing unit, used to construct a first structure for storing numbers of points on a surface; wherein the numbers of the points on the surface stored in the first structure are numbers obtained by sorting the numbers of the points based on a preset size order;
[0122] A second structure constructing unit, used to construct a second structure for storing the surface unit number, the surface left unit number, the surface right unit number, the surface point number and the number of constituent points of the surface;
[0123] A function definition unit is used to define the map function by respectively determining the first structure and the second structure as a key and a value.
[0124] In some specific embodiments, the key value input module 12 may specifically include:
[0125] A target key determination unit, configured to arrange the numbers of the points on the surface in descending order to obtain a number information array, and determine the number information array as a target key;
[0126] The target value determination unit is used to determine the surface unit number, the number of constituent points of the surface and the boundary surface type number as target values.
[0127] In some specific embodiments, the device may further include:
[0128] A key-value writing module is used to construct a key-value pair based on the target information of the non-existent surface if the surface of the body unit does not exist in the map function, and write the key-value pair into the map function.
[0129] In some specific embodiments, the array acquisition module 14 may specifically include:
[0130] The updating unit is used to update the order of the points on each surface unit and the information of the left and right surfaces.
[0131] In some specific embodiments, the array acquisition module 14 may specifically include:
[0132] The array acquisition unit is used to store the data corresponding to each updated subsequent unit into the array storing the grid data, so as to obtain the array of the number of points on the surface, the array of the left and right units to which the surface belongs, and the array of the point numbers constituting the surface.
[0133] In some specific embodiments, the device may further include:
[0134] A key-value pair deletion module is used to delete the key-value pairs corresponding to the data of the surface unit that has been stored in the array in the map function.
[0135] Furthermore, the present application also discloses an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0136] Figure 5 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the grid file parsing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0137] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0138] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0139] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the grid file parsing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0140] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed grid file parsing method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0141] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0142] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0143] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0144] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0145] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A grid file parsing method, characterized in that: include: Read the basic information in the grid file, construct a structure to store the surface unit information, and define the map function through the structure; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; Parsing the composition information of the boundary surface in the grid file, obtaining the target information of the boundary surface, determining the target key value based on the target information, and inputting the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number and the number of points on the surface; Parsing the composition information of the volume unit in the grid file, obtaining the numbers of the points on each surface of the volume unit after orientation arrangement, and judging whether each surface of the volume unit exists in the map function based on the numbers of the points on each surface of the volume unit; If it exists, update the information of each face unit to obtain each updated subsequent unit, and based on each updated subsequent unit, obtain the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of point numbers that constitute the face to complete the parsing of the grid file.
2. The grid file parsing method according to claim 1, characterized in that: The step of constructing a structure for storing surface unit information and defining a map function through the structure includes: Constructing a first structure for storing numbers of points on a surface; wherein the numbers of the points on the surface stored in the first structure are numbers obtained by sorting the numbers of the points based on a preset size order; Constructing a second structure for storing the surface unit number, the surface left unit number, the surface right unit number, the surface point number and the number of constituent points of the surface; The map function is defined by determining the first structure and the second structure as a key and a value respectively.
3. The grid file parsing method according to claim 1, characterized in that: The determining the target key value based on the target information includes: Arrange the numbers of the points on the surface in descending order to obtain a number information array, and determine the number information array as a target key; The surface unit number, the number of constituent points of the surface, and the boundary surface type number are determined as target values.
4. The grid file parsing method according to claim 1, characterized in that: After judging whether each surface of the volume unit exists in the map function based on the number of the points on each surface of the volume unit, the method further includes: If the face of the body unit does not exist in the map function, a key-value pair is constructed based on the target information of the non-existent face, and the key-value pair is written into the map function.
5. The grid file parsing method according to claim 1, characterized in that: The updating of information of each surface unit includes: The order of the surface points of each surface unit and the information of the left and right surface units are updated.
6. The grid file parsing method according to any one of claims 1 to 5, characterized in that: The method of obtaining the number array of points on the surface, the arrays of left and right units to which the surface belongs, and the array of point numbers constituting the surface based on each of the updated subsequent units includes: The data corresponding to each updated cell is stored in the array storing the grid data to obtain the array of the number of points on the surface, the array of the left and right cells to which the surface belongs, and the array of the point numbers constituting the surface.
7. The grid file parsing method according to claim 6, characterized in that: After obtaining the array of the number of points on the surface, the arrays of the left and right units to which the surface belongs, and the array of the number of points constituting the surface based on each of the updated subsequent units, the method further includes: Delete the key-value pairs corresponding to the data of the face unit that has been stored in the array in the map function.
8. A grid file parsing device, characterized in that: include: A function definition module is used to read basic information in a grid file, construct a structure to store surface unit information, and define a map function through the structure; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; A key value input module is used to parse the composition information of the boundary surface in the grid file, obtain the target information of the boundary surface, determine the target key value based on the target information, and input the target key value into the map function; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number and the number of points on the surface; A judgment module, used to parse the composition information of the body unit in the grid file, obtain the numbers of the points on each surface of the body unit after the directional arrangement, and judge whether each surface of the body unit exists in the map function based on the numbers of the points on each surface of the body unit; The array acquisition module is used to update the information of each face unit if it exists, so as to obtain each updated subsequent unit, and based on each updated subsequent unit, obtain the array of the number of points on the face, the array of the left and right units to which the face belongs, and the array of point numbers that constitute the face, so as to complete the parsing of the grid file.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the grid file parsing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the grid file parsing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Three-dimensional model data processing method and device based on protocol way
CN107918646A
Method for generating static grid model
CN115512024A
Road network data processing method and device, computer equipment and storage medium
CN116028457A
Method and system for reconstructing geometric model in fluid simulation software
CN117332572A