A method, device, equipment and storage medium for parsing grid files

By building structures and defining map functions to parse mesh files, the problem of unified parsing of mesh information files in multiple formats is solved, and efficient data reading and reconstruction is achieved.

CN119808661BActive Publication Date: 2025-05-27CALCULATION AERODYNAMICS INST CHINA AERODYNAMICS RES & DEV CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510302363.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-05-27
Estimated Expiration
2045-03-14

AI Technical Summary

Technical Problem

The prior art is difficult to parse grid information files in multiple formats into common forms, resulting in difficulty in reading and reconstructing data.

Method used

By constructing a structure that stores the surface unit information, defining map functions, analyzing the boundary surface and body unit information in the mesh file, obtaining target key values, updating the surface unit information, obtaining the array of points on the face and the array of left and right units to belong to, realizing unified analysis of grid information of multiple formats.

Benefits of technology

It reduces memory overhead, provides unified input of geometric data, facilitates data reading and reconstruction, and improves data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119808661B_ABST
    Figure CN119808661B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, device and storage medium for parsing grid files, relating to the field of grid data processing, including: reading basic information in the grid file, constructing a structure for storing surface unit information, and defining a map function through the structure; 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; parsing the composition information of the volume units in the grid file, obtaining the numbers of the points on each surface of the volume units after directional arrangement, and judging whether each surface of the volume units exists in the map function based on the numbers of the points on each surface of the volume units; if it exists, updating the information of each surface unit to obtain each updated surface unit, and obtaining an array of the numbers of the points on the surface, an array of the left and right units to which the surface belongs, and an array of the numbers of the points forming the surface based on each updated surface unit, so as to complete the parsing of the grid file. The parsing of the grid file is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of grid data processing, and particularly to a method, device, equipment and storage medium for parsing grid files. Background Art

[0002] Unstructured grids have the advantages of high automation, short generation cycle, flexible distribution control, etc., and are often used to discretize the spatial regions of complex engineering shapes. They are widely used in computational fluid dynamics (CFD) of complex shapes. Currently, the vast majority of CFD numerical simulations use unstructured linear elements. At present, 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 commonly used format output by unstructured grid software. The grid format of the CGNS format contains the relationship between cell bodies and points, as well as the coordinate values of points. Therefore, how to parse grid information files of various formats into a general form is an urgent problem to be solved at present. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a method, device, equipment and storage medium for parsing grid files, which can parse grid information files of multiple formats into a general form to facilitate data reading and reconstruction. The specific solutions are as follows:

[0004] In a first aspect, the present application discloses a method for parsing grid files, including:

[0005] Reading the basic information in the grid file, constructing a structure for storing surface element information, and defining a map function through the structure; the basic information includes the cell body type and composition information, point numbers 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 to obtain 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 element number, the number of points forming the surface, the boundary surface type number, and the numbers of points on the surface;

[0007] Parsing the composition information of the cell body in the grid file to obtain the numbers of points on each surface of the cell body after directional arrangement, and judging whether each surface of the cell body exists in the map function based on the numbers of points on each surface of the cell body;

[0008] If it exists, update the information of each face unit to obtain each updated face unit, and based on each of the updated face units, obtain an array of the number of points on the face, an array of the left and right units to which the face belongs, and an array of the point numbers that make up the face, so as to complete the parsing of the mesh file.

[0009] Optionally, the structure for storing face unit information is constructed, and the map function is defined through the structure, including:

[0010] Construct a first structure for storing the numbers of points on the face; wherein, the numbers of points on the face stored in the first structure are the numbers after sorting the numbers of each point in a preset size order;

[0011] Construct a second structure for storing the face unit number, the left unit number of the face, the right unit number of the face, the number of points on the face, and the number of points that make up the face;

[0012] Define the map function by taking the first structure and the second structure as keys and values respectively.

[0013] Optionally, the determining the target key-value based on the target information includes:

[0014] Arrange the numbers of points on the face in descending order to obtain an array of number information, and determine the array of number information as the target key;

[0015] Determine the face unit number, the number of points that make up the face, and the boundary face type number as the target value.

[0016] Optionally, after determining whether the map function contains each face of the volume unit based on the numbers of points on each face of the volume unit, it further includes:

[0017] If the map function does not contain the face of the volume unit, construct a key-value pair based on the target information of the non-existent face, and write the key-value pair into the map function.

[0018] Optionally, the updating the information of each face unit includes:

[0019] Update the order of the points on each face unit and the information of the left and right units of the face.

[0020] Optionally, the 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 make up the face based on each of the updated face units includes:

[0021] Store the data corresponding to each updated face unit into an array for storing mesh data, so as to obtain an array of the number of points on the face, an array of the left and right units to which the face belongs, and an array of the point numbers that make up the face.

[0022] Optionally, after obtaining the array of the number of surface points, the array of the left and right units to which the surface belongs, and the array of the point numbers forming the surface based on each of the updated subsequent units, the following steps are further included:

[0023] Delete the key-value pair corresponding to the data of the surface 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, including:

[0025] A function definition module, configured to read basic information in a grid file, construct a structure for storing surface unit information, and define a map function through the structure; the basic information includes the type and composition information of volume units, point numbers and coordinates, and the type and composition information of boundary surfaces;

[0026] A key-value input module, configured to parse the composition information of the boundary surface in the grid file, obtain target information of the boundary surface, determine a target key-value based on the target information, and input the target key-value into the map function; the target information includes surface unit numbers, the number of points forming the surface, boundary surface type numbers, and the numbers of points on the surface;

[0027] A judgment module, configured to parse the composition information of the volume units in the grid file, obtain the numbers of points on each surface of the volume units after directional arrangement, and judge whether each surface of the volume units exists in the map function based on the numbers of points on each surface of the volume units;

[0028] An array obtaining module, configured to, if it exists, update the information of each surface unit to obtain each updated surface unit, and obtain an array of the number of surface points, an array of the left and right units to which the surface belongs, and an array of the point numbers forming the surface based on each of the updated surface units, so as to complete the parsing of the grid file.

[0029] In a third aspect, the present application discloses an electronic device, including:

[0030] A memory, configured to store a computer program;

[0031] A processor, configured 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, configured to store 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 the mesh file in this application, first, the basic information in the mesh file is read, a structure for storing surface element information is constructed, and a map function is defined through the structure; the basic information includes the volume element type and composition information, point numbers and coordinates, and the type and composition information of the boundary surface; second, the composition information of the boundary surface in the mesh file is parsed to obtain the target information of the boundary surface, a target key value is determined based on the target information, and the target key value is input into the map function; the target information includes the surface element number, the number of points forming the surface, the boundary surface type number, and the numbers of points on the surface; then, the composition information of the volume element in the mesh file is parsed to obtain the numbers of points on each surface of the volume element after directional arrangement, and based on the numbers of points on each surface of the volume element, it is determined whether each surface of the volume element exists in the map function; finally, if it exists, the information of each surface element is updated to obtain each updated surface element, and based on each updated surface element, an array of the number of points on the surface, an array of the left and right units to which the surface belongs, and an array of the numbers of points forming the surface are obtained to complete the parsing of the mesh file. It can be seen that in this application, by using the map function to parse the mesh information file, the relationship between the unstructured mesh volume cells and their vertices is discarded to reduce the memory overhead, and mesh information files in various formats are parsed into a general form to provide geometric data input for the flow field solver, facilitating data reading and reconstruction. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without creative efforts.

[0035] Figure 1 It is a flowchart of a method for parsing a mesh file disclosed in this application;

[0036] Figure 2 It is a schematic diagram of a mesh unit disclosed in this application;

[0037] Figure 3(a) is a schematic diagram of a hexahedron mesh unit disclosed in this application; Figure 3(b) is a schematic diagram of a triangular prism mesh unit disclosed in this application; Figure 3(c) is a schematic diagram of a pyramid mesh unit disclosed in this application; Figure 3(d) is a schematic diagram of a tetrahedron mesh unit disclosed in this application;

[0038] Figure 4 It is a schematic structural diagram of a mesh file parsing device disclosed in this application;

[0039] Figure 5 It is a structural diagram of an electronic device disclosed in this application. Detailed implementation manners

[0040] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0041] Currently, 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 commonly used format output by unstructured grid software. The grid format of the CGNS format includes the relationship between cell bodies and points, as well as the coordinate values of points. However, the file forms parsed from grid information files in multiple formats are not universal. To solve the above technical problems, this application discloses a grid file parsing method, device, equipment and storage medium, which can parse grid information files in multiple formats into a universal form, facilitating data reading and reconstruction.

[0042] See Figure 1 As shown, an embodiment of the present invention discloses a grid file parsing method, including:

[0043] Step S11: Read the basic information in the grid file, construct a structure for storing surface cell information, and define a map function through the structure; the basic information includes the type and composition information of volume cells, point numbers and coordinates, and the type and composition information of boundary surfaces.

[0044] In this embodiment, the application first reads the basic information in the grid file. It includes data such as the type and composition information of volume cells, point numbers and coordinates, and the type and composition information of boundary surfaces. Taking a grid composed of a hexahedron and a pyramid cell as an example, as Figure 2 shown, the hexahedron is volume cell No. 0, and the pyramid cell is volume cell No. 1. The number of boundary surfaces is 9, the boundary type number of the triangular boundary surface is 1, the boundary type number of the quadrilateral boundary surface is 2, and the number of points is 9.

[0045] Then, construct a first structure for storing the numbers of the points on the surface; wherein, the numbers of the points on the surface stored in the first structure are the numbers obtained by sorting the numbers of each point based on a preset size order; construct a second structure for storing the surface element number, the number of the left unit of the surface, the number of the right unit of the surface, the numbers of the points on the surface, and the number of points forming the surface; define a map function by taking the first structure and the second structure as the key and the value respectively. Specifically, construct a structure for storing surface element information. The first structure FaceOrder is used to store the numbers of the four points on the surface, and the values in the input array facenode[4] are compared in sequence to ensure their uniqueness. The second structure FaceInfor includes information such as the surface number face_id, the label of the left unit of the surface f2cl, the number of the right unit of the surface f2cr (when the surface is a boundary surface, this value is negative), the numbers of the points on the surface f2n_tmp[4], and the number of points on the surface nNPF. Taking these two structures as the key and the value, define a map function FacesInfor1:

[0046] typedef std::map<FaceOrder, FaceInfor> FacesInfor1;

[0047] Step S12: Parse the composition information of the boundary surfaces in the grid file, obtain the target information of the boundary surfaces, 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 element number, the number of points forming the surface, the boundary surface type number, and the numbers of the 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 surfaces 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 number information of the points on the surface, and the number face_id of the boundary surface unit is arranged starting from zero. Loop through all the units in the grid file. According to the CGNS library function, it can be determined whether the current unit is a volume unit or a surface unit. Skip the volume unit. When it is determined that the current unit is a quadrilateral boundary surface unit, store the point number information into f2ntmp[4] according to the read information. When it is determined that the current unit is a triangular boundary surface unit, store the point number information into f2ntmp[4] according to the read information, and set f2ntmp[3] = -1. In other words, according to the CGNS library function, the following can be obtained: ① the surface unit number findex; ② the number of points forming each surface nodeofface; ③ the boundary surface type number bct; ④ the point number information f2ntmp[4] on the surface. When it is determined that the current unit is a triangular boundary surface unit, since there are only three point numbers in f2ntmp, set f2ntmp[3]=-1. For the keys in FacesInfor1, a new f2ntmp_[4] array is created. Use the ReorderPnts function to arrange the order of f2ntmp[4] from largest to smallest and assign it to f2ntmp_[4]. Set f2ntmp_[4] as a structure to be the key (unique) of FacesInfor1.

[0049] For the values in FacesInfor1, assign nodeofface to face Infor.nNPF, assign the negative value of bct as the number of the unit on the left side of the surface unit to face_infor.f2cl, use the ReorderPnts function to arrange the order of f2ntmp[4] so that the value of the smallest point number is in the first place, and then assign its value to face_Infor.f2n_tmp. Finally, add the key-value pair to the structure FacesInfor1 through the inser function.

[0050] Taking the storage information of one 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] Accordingly, the numbers of the points on the face are arranged in descending order to obtain an array of numbering information, and the array of numbering information is determined as the target key; the face element number, the number of points forming the face, and the boundary face type number are determined as the target values. Furthermore, 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 to process all the boundary faces and input them into the map function to obtain the information table shown in Table 1.

[0067] Table 1

[0068]

[0069] Step S13: Analyze the composition information of the volume elements in the grid file, obtain the numbers of the points on each face of the volume elements after directional arrangement, and determine whether each face of the volume elements exists in the map function based on the numbers of the points on each face of the volume elements.

[0070] In this embodiment, the surface element information in the grid file is processed. After the processing of the above steps, the boundary surface elements have been processed, and their numbers face_id are all arranged in the front. Now, the volume element grid is processed. Non-structural elements are generally divided into hexahedrons, triangular prisms, pyramids, and tetrahedrons. According to the vertex information, the volume elements are divided into six faces, five faces, five faces, and four faces in sequence. Taking the hexahedron as an example, a two-dimensional array C2N[cell][8] can be constructed through the CGNS library function. The first dimension is the hexahedron element number, and the second dimension represents its 8 vertices. The arrangement order of the points is as shown in the hexahedron in Figure 2 and the point number information of the six faces can be constructed. The array f2ntmp is used to record the point number information of each face in sequence:

[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 re-ordered, and the point numbers are arranged from largest to smallest to obtain f2ntmp_[4]. Through the structure FaceOrder, it is formed into a key with a unique value. Then, through the search function of the map function, it is searched in FacesInfor1 whether there is a key the same as f2ntmp_[4].

[0076] Step S14: If it exists, update the information of each surface element to obtain each updated surface element. Based on each of the updated surface elements, obtain the array of the number of points on the surface, the array of the left and right elements to which the surface belongs, and the array of the point numbers forming the surface, so as to complete the parsing of the grid file.

[0077] In this embodiment, if there is no face of the volume element 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 element is updated to obtain each updated face element. Specifically, if a key the same as f2ntmp_[4] cannot be found in FacesInfor1, it indicates that the information of this face does not exist in FacesInfor1. At this time, a key-value pair is constructed and written into FacesInfor1 in the same way as in the 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 volume element number. If a key the same as f2ntmp_[4] is found in FacesInfor1, it indicates that the information of this face already exists in FacesInfor1, and it also means that the left and right elements of this face are found. At this time, the order of the points on the face needs to be updated, and the information of the left and right elements of the updated face is exchanged.

[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 as shown in Table 2.

[0089] Table 2

[0090]

[0091] Then, 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. Specifically, obtain the array of the number of points on the surface nNPF[nTFace]. nTFace is the total number of faces, 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 face units. The boundary faces in the array nNPF are arranged in the front, and the internal faces are arranged in the back, and the order is the same as that input in the map. Then, through the values stored in the map, we can get:

[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] Obtain the array f2c[nTFace * 2] of the left and right units to which the surface belongs. nTFace is the total number of faces, and arrange the number information of the left and right units to which each face belongs in sequence. Among them, for different types of boundary faces, f2cr is different negative values.

[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 of f2c is 20, and the array is shown in Table 2.

[0100] Obtain the array f2n[nnodes] of the point numbers constituting all faces. Among them, f2n_tmp[inode] is the points on the unit arranged in sequence and pointing to the outside of the unit according to the right-hand rule. nnodes is the number of all points constituting nTFace faces. The f2n array can be constructed according to 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 array length of f2n is 36, and the array is shown in Table 2.

[0108] After obtaining the array of the number of points on the face, the array of the left and right elements to which the face belongs, and the array of the point numbers forming the face based on each updated subsequent element, the key-value pairs in FacesInfor1 that have already determined the left and right element information are deleted. Through Steps Five to Eight, the faces whose point information has been written into the above arrays are deleted from FacesInfor1. In this way, the search times are reduced when searching for the next face, and time can be saved.

[0109] In summary, when parsing the grid file in this application, the basic information in the grid file is first read, a structure for storing surface element information is constructed, and the map function is defined through the structure; the basic information includes the volume element type and composition information, point numbers 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, the target key value is determined based on the target information, and the target key value is input into the map function; the target information includes the surface element number, the number of points forming the surface, the boundary surface type number, and the numbers of points on the surface; then, the composition information of the volume element in the grid file is parsed to obtain the numbers of points on each surface of the volume element after directional arrangement, and it is judged whether each surface of the volume element exists in the map function based on the numbers of points on each surface of the volume element; finally, if it exists, the information of each surface element is updated to obtain each updated surface element, and based on each of the updated surface elements, an array of the numbers of points on the surface, an array of the left and right units to which the surface belongs, and an array of the numbers of points forming the surface are obtained to complete the parsing of the grid file. It can be seen that in this application, the grid information file is parsed by using the map function, the relationship between the unstructured grid volume grid element body and its vertices is discarded to reduce the memory overhead, and the grid information files in various formats are parsed into a general form to provide geometric data input for the flow field solver, facilitating data reading and reconstruction.

[0110] As can be seen from the previous embodiment, this application discloses a method for parsing a grid file, which can parse grid information files in various formats into a general form. Next, the specific method for parsing the grid file 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 T = 288.15 K, the calculated static pressure P = 101325 Pa, the calculated incoming flow angle of attack and sideslip angle are both 0°, and the calculation grid is composed of unstructured hexahedrons shown in Figure 3(a), triangular prisms shown in Figure 3(b), pyramids shown in Figure 3(c), and tetrahedral grid elements 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 functions, data such as the volume element type and composition information, point numbers and coordinates, and the type and composition information of the boundary surface can be obtained in the file. Then construct a structure for storing face element information. The first structure FaceOrder is used to store the four point numbers on the face, and the second structure FaceInfor stores the face element data. Define a map function FacesInfor1 with FaceOrder and FaceInfor as key-value pairs. Next, first parse the boundary surface in the mesh to obtain the rearranged number, the right-side element number, the composition point number, the number of face points, etc. of the boundary surface, and form the point-oriented arrangement of the face and these values as key-value pairs and input them into FacesInfor1. Then parse the face of the volume element in the mesh. Loop through all the faces that make up the volume element. By comparing the point-oriented arrangement of the face as the key value, determine whether the face already exists in FacesInfor1. When it already exists, update the face information and update the left-side element number. If it does not exist, generate key-value pairs and input them into FacesInfor1 in the same way as in the process of parsing the boundary surface in the mesh. For the face elements whose information has been updated and all information has been obtained, store their data sequentially into an array dedicated to storing mesh data, specifically including the array of the number of points on the face, the array of the left and right elements to which the face belongs, the array of the point numbers that make up the face, etc. For the key-value pairs in FacesInfor1 for which the information has been entered, perform a delete operation to save subsequent search time and improve efficiency. Finally, loop through all the volume elements to obtain the complete mesh data array, complete the parsing, and partition the mesh data obtained from this parsing. The flow field solver calculates data such as mesh reconstruction, the centroid of the unit body, and the volume through the partitioned mesh data, and conducts a CFD simulation to obtain the flow field characteristics of the simple wing under this calculation condition. Using the parsed mesh data as input, the residual in the calculation process reaches the order of 10-4 at 5000 steps. Finally, it can be determined that the numerical calculation results fit well with the experimental results.

[0113] It can be seen that in this application, by using the map function to parse the mesh information file, the relationship between the non-structured mesh volume elements and their vertices is discarded to reduce the memory overhead, and the mesh information files in various formats are parsed into a general form to provide geometric data input for the flow field solver, facilitating data reading and reconstruction.

[0114] See Figure 4 As shown, an embodiment of the present invention discloses a mesh file parsing device, including:

[0115] The function definition module 11 is used to read the basic information in the mesh file, construct a structure for storing surface element information, and define a map function through the structure; the basic information includes the volume element type and composition information, point numbers and coordinates, and the type and composition information of the boundary surface;

[0116] The key-value input module 12 is used to parse the composition information of the boundary surface in the mesh 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 element number, the number of points forming the surface, the boundary surface type number, and the numbers of the points on the surface;

[0117] The judgment module 13 is used to parse the composition information of the volume elements in the mesh file, obtain the numbers of the points on each surface of the volume elements after directional arrangement, and judge whether each surface of the volume elements exists in the map function based on the numbers of the points on each surface of the volume elements;

[0118] The array acquisition module 14 is used to, if it exists, update the information of each surface element to obtain each updated surface element, and obtain an array of the numbers of points on the surface, an array of the left and right units to which the surface belongs, and an array of the numbers of the points forming the surface based on each of the updated surface elements, so as to complete the parsing of the mesh file.

[0119] In summary, when parsing the mesh file in this application, first, the basic information in the mesh file is read, a structure for storing surface element information is constructed, and a map function is defined through the structure; the basic information includes the volume element type and composition information, point numbers and coordinates, and the type and composition information of the boundary surface; second, the composition information of the boundary surface in the mesh file is parsed, the target information of the boundary surface is obtained, the target key value is determined based on the target information, and the target key value is input into the map function; the target information includes the surface element number, the number of points forming the surface, the boundary surface type number, and the numbers of the points on the surface; then, the composition information of the volume elements in the mesh file is parsed, the numbers of the points on each surface of the volume elements after directional arrangement are obtained, and it is judged whether each surface of the volume elements exists in the map function based on the numbers of the points on each surface of the volume elements; finally, if it exists, the information of each surface element is updated to obtain each updated surface element, and an array of the numbers of points on the surface, an array of the left and right units to which the surface belongs, and an array of the numbers of the points forming the surface are obtained based on each of the updated surface elements, so as to complete the parsing of the mesh file. It can be seen that in this application, the mesh information file is parsed by using the map function, the relationship between the non-structured mesh volume elements and their vertices is discarded to reduce the memory overhead, and the mesh information files in various formats are parsed into a general form, providing geometric data input for the flow field solver and facilitating the reading and reconstruction of data.

[0120] In some specific embodiments, the function definition module 11 may specifically include:

[0121] A first structure construction unit, configured to construct a first structure for storing the numbers of points on the surface; wherein, the numbers of points on the surface stored in the first structure are the numbers obtained by sorting the numbers of each point based on a preset size order;

[0122] A second structure construction unit, configured to construct a second structure for storing the surface unit number, the left unit number of the surface, the right unit number of the surface, the number of points on the surface, and the number of points constituting the surface;

[0123] A function definition unit, configured to define the map function by respectively determining the first structure and the second structure as the key and the 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 points on the surface in descending order to obtain an array of number information, and determine the array of number information as the target key;

[0126] A target value determination unit, configured to determine the surface unit number, the number of points constituting the surface, and the boundary surface type number as the target value.

[0127] In some specific embodiments, the device may further include:

[0128] A key-value writing module, configured to, if the surface of the body unit does not exist in the map function, construct a key-value pair based on the target information of the non-existent surface, and write the key-value pair into the map function.

[0129] In some specific embodiments, the array acquisition module 14 may specifically include:

[0130] An update unit, configured to update the order of points on each surface unit and the information of the left and right units of the surface.

[0131] In some specific embodiments, the array acquisition module 14 may specifically include:

[0132] An array acquisition unit, configured to store the data corresponding to each updated surface unit into an array for storing grid data, so as to obtain an array of the number of points on the surface, an array of the left and right units to which the surface belongs, and an array of the numbers of points constituting the surface.

[0133] In some specific embodiments, the device may further include:

[0134] The key-value pair deletion module is used to delete the key-value pairs corresponding to the data of the face units that have been stored in the array in the map function.

[0135] Furthermore, an embodiment of the present application also discloses an electronic device. Figure 5 It is a structural diagram of an electronic device 20 shown according to an exemplary embodiment. The content in the figure should not be considered as any limitation on the scope of use of the present application.

[0136] Figure 5 It is a schematic structural diagram of an electronic device 20 provided by 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. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the grid file parsing method disclosed in any of the foregoing 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 operating 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 external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of the present application, and no specific limitation is imposed on it here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application needs, and no specific limitation is imposed here.

[0138] In addition, as a carrier for resource storage, the memory 22 may be a read-only memory, a random access memory, a magnetic disk, or an optical disc, 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] Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device 20, and it may be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the grid file parsing method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may 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, when the computer program is executed by a processor, the grid file parsing method disclosed above is implemented. For the specific steps of this method, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated herein.

[0141] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference may be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and reference may be made to the method part for relevant details.

[0142] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0143] The steps of the methods or algorithms described in combination with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0144] Finally, it should also be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0145] The above has introduced the technical solution provided by this application in detail. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to this 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 rear unit, and obtain the number array of points on the face, the array of left and right units to which the face belongs, and the array of point numbers constituting the face based on each updated rear unit to complete the parsing of the grid file; 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.

2. 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.

3. 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.

4. 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.

5. The grid file parsing method according to any one of claims 1 to 4, 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.

6. The grid file parsing method according to claim 5, 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.

7. 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; An array acquisition module is used to update the information of each face unit if it exists, so as to obtain each updated rear unit, and obtain the number array of points on the face, the array of left and right units to which the face belongs, and the array of point numbers constituting the face based on each updated rear unit, so as to complete the parsing of the grid file; The function definition module includes: 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; 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; 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.

8. 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 6.

9. 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 6 is implemented.

Citation Information

Patent Citations

  • 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