A method and system for identifying and repairing holes in geometric models for fluid simulation.
By integrating hole information, selection, and repair tool property panels into fluid simulation, and utilizing hash tables and ring arrays to construct new surfaces, the problem of unfriendly and inefficient hole identification and repair operations in geometric models is solved, achieving a highly efficient and low-memory-consumption repair process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PERA
- Filing Date
- 2022-09-22
- Publication Date
- 2026-05-26
AI Technical Summary
Existing fluid simulation methods for hole identification and repair in geometric models are unfriendly, inefficient, consume a lot of memory, and have complex storage structures.
By integrating hole information, selection, location, and repair tools into a single property panel, and using a hash table to record the edge index of the hole, the data structure is simplified by recording only the ID of the first edge of the hole. By combining the hash table and the ring array to construct a new face, rapid repair can be achieved.
It improves repair efficiency, reduces memory consumption, lowers storage complexity and error rate, and simplifies the operation path.
Smart Images

Figure CN115421636B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fluid simulation technology, and in particular to a method and system for identifying and repairing holes in geometric models used in fluid simulation. Background Technology
[0002] In the preprocessing stage of fluid simulation, the opened and imported 3D geometric models often contain errors or omissions. These errors can affect the post-processing results, ranging from minor inaccuracies in local calculations to rendering the results unusable for the entire model. In either case, the results do not meet expectations. Therefore, checking and repairing the 3D geometric model is a necessary process in the preprocessing stage of fluid simulation.
[0003] Currently, when repairing geometric defects in the industry, on the one hand, the operation requires clicking the corresponding repair button for different geometric defects in the Ribbon area of the UI panel, and then moving the mouse to the property page pop-up window to perform the repair operation; on the other hand, the storage structure of defect data is complex when repairing defects.
[0004] Existing methods for identifying and repairing defects are not user-friendly, are complex to operate, consume a lot of memory, and have low repair efficiency. Summary of the Invention
[0005] Based on the above analysis, the embodiments of the present invention aim to provide a method and system for identifying and repairing holes in geometric models for fluid simulation, in order to solve the problems of unfriendly operation and low repair efficiency of existing methods.
[0006] On one hand, embodiments of the present invention provide a method for identifying and repairing holes in geometric models for fluid simulation, comprising the following steps:
[0007] Obtain the geometric model for fluid simulation, and map the geometric model to obtain model data;
[0008] Receive instructions to identify holes, identify holes based on model data, obtain a set of hole data, and display the number of holes, location buttons, and repair buttons in the hole repair attribute panel;
[0009] Upon receiving an instruction from any positioning button, the system displays the hole in the geometric model of the view area according to the hole corresponding to the positioning button; upon receiving an instruction from any repair button, the system repairs the corresponding hole according to the repair button and updates the model data.
[0010] Based on the further improvement of the above method, the model data includes: array data of points, edges and faces. In the array data of edges, the data of each edge includes: edge ID, data pointers of the start endpoint of the edge and the other edges it points to, data pointers of the end endpoint and the other edges it points to, and data pointers of the face to which it belongs; in the array data of faces, the data of each face includes: face ID, data pointers of all edges of the face and data pointers of adjacent faces.
[0011] Based on further improvements to the above method, holes are identified according to model data, and a set of hole data is obtained, including:
[0012] Iterate through the array of edges, take out the edges that belong to only one face, and put them into the edge set;
[0013] One edge is taken from the edge set in turn as the edge to be identified. Based on the data of the edge to be identified, it is determined whether there is a subset that forms a closed loop. If there is, the ID of the edge to be identified is used as the hole ID and put into the hole data set.
[0014] A further improvement to the above method is made by constructing a hash table based on the hole data set, where the hole ID is used as the key value and the data pointer index of the edge corresponding to the hole ID is used as the code value.
[0015] Based on further improvements to the above method, the positioning buttons include: a previous button and a next button; the repair buttons include: repair hole and repair all.
[0016] Based on the above method, further improvements are made to the corresponding holes according to the repair button, including:
[0017] When the repair button is "Repair Hole", obtain the hole ID to be repaired based on the holes currently displayed in the view area, and repair the hole based on the hole ID using a hash table;
[0018] When the repair button is "Repair All", iterate through the hole data set, extract each hole ID as the hole ID to be repaired, and repair the hole based on the hole ID to be repaired according to the hash table.
[0019] A further improvement to the above method involves repairing holes based on a hash table and the hole ID to be repaired, including:
[0020] Query the hash table based on the hole ID to obtain the data pointer index of the edge corresponding to that hole ID;
[0021] The edge is obtained based on the data pointer index of the edge, and is used as the starting edge of the hole;
[0022] Based on the end point of the starting edge of the hole and the data pointers of other edges it points to, obtain the adjacent edge that has only one corresponding face, and then find other adjacent edges in turn based on the adjacent edge until a closed loop is formed with the starting edge. All obtained edges are put into the loop array.
[0023] Construct new faces based on the ring array and add them to the face array.
[0024] Based on the above method, a new face is constructed from the ring array, including:
[0025] Create a new face and generate a new face ID; traverse the ring array, use the data pointer of each edge in the ring array as the edge that constitutes the new face, and get the other faces to which each edge belongs as the adjacent faces of the new face.
[0026] Based on the above method, the properties panel for repairing holes also includes undo and redo buttons.
[0027] On the other hand, embodiments of the present invention provide a geometric model hole identification and repair system for fluid simulation, comprising:
[0028] The data preprocessing module is used to acquire the geometric model of the fluid simulation and map the geometric model to obtain model data;
[0029] The hole recognition module is used to receive instructions to recognize holes, identify holes based on model data, obtain a set of hole data, and display the number of holes, the location button, and the repair button in the hole repair attribute panel;
[0030] The hole repair module is used to receive instructions from any positioning button, display the hole in the geometric model of the view area according to the hole corresponding to the positioning button, and receive instructions from any repair button to repair the corresponding hole and update the model data.
[0031] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0032] 1. Combine the repair operations of the geometric model into the same property panel, which shortens the operation path and increases the repair efficiency;
[0033] 2. By only recording the ID of the first edge of the hole, the data structure of the hole is greatly simplified, memory consumption is reduced, and storage complexity and error rate are lowered;
[0034] 3. Use a hash table to record the index of the edge of the hole to improve query efficiency.
[0035] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description
[0036] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0037] Figure 1 This is a flowchart of a method for identifying and repairing holes in a geometric model for fluid simulation according to Embodiment 1 of the present invention;
[0038] Figure 2 This is a structural diagram of a geometric model hole identification and repair system for fluid simulation according to Embodiment 2 of the present invention. Detailed Implementation
[0039] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0040] Example 1
[0041] A specific embodiment of the present invention discloses a method for identifying and repairing holes in geometric models for fluid simulation, such as... Figure 1 As shown, it includes the following steps:
[0042] S11: Obtain the geometric model for fluid simulation and map the geometric model to obtain model data.
[0043] It should be noted that when opening or importing a geometric model for fluid simulation, the geometric model is mapped to model data, including arrays of points, edges, and faces. Points are the most basic data units, and edges consist of two endpoints. During the mapping process, one endpoint is set as the start endpoint and the other as the end endpoint, according to a preset order. To improve the efficiency of subsequent hole identification, when constructing the data for each edge, the adjacent edges at both ends and the face to which the edge belongs are simultaneously acquired. When constructing the data for a face, all edges of the face are acquired, along with adjacent faces obtained based on the other faces to which the edges constituting the face belong.
[0044] Specifically, the data for each edge in the edge array includes: edge ID, the start endpoint of the edge and its pointers to other edges, the end endpoint and its pointers to other edges, and a pointer to the face it belongs to; the data for each face in the face array includes: face ID, pointers to all edges of the face, and pointers to adjacent faces. Edge ID and face ID are unique identifiers.
[0045] S12: Receive the instruction to identify holes, identify holes based on model data, obtain the data set of holes, and display the number of holes, the location button, and the repair button in the hole repair attribute panel.
[0046] It should be noted that receiving the instruction to identify holes, i.e., clicking the "Identify Holes" button in the menu bar, identifies holes based on the model data and obtains the hole data set, including:
[0047] Iterate through the array of edges, take out the edges that belong to only one face, and put them into the edge set;
[0048] One edge is taken from the edge set in turn as the edge to be identified. Based on the data of the edge to be identified, it is determined whether there is a subset that forms a closed loop. If there is, the ID of the edge to be identified is used as the hole ID and put into the hole data set.
[0049] It should be noted that since each edge stores the start endpoint of the edge and the data pointers to other edges it points to, as well as the end endpoint and the data pointers to other edges it points to, when determining whether there is a subset that forms a closed loop starting from the edge to be identified, two adjacent edges can be obtained from each end, with each of the two adjacent edges having only one corresponding face, until the two adjacent edges have the same endpoint; alternatively, adjacent edges with only one corresponding face can be obtained sequentially starting from the end endpoint of the edge to be identified, until the end endpoint of the adjacent edges is the same as the start endpoint of the edge to be identified, forming a closed loop. The edge of this closed loop is the edge of the hole.
[0050] Normal edges typically belong to two faces. In this embodiment, normal edges are first filtered out based on the number of faces they belong to, reducing the number of edges to be identified. Compared to existing technologies, only the ID of the first edge forming each closed loop is recorded, i.e., the ID of the edge to be identified initially extracted during the traversal process described above. This processing method greatly simplifies the hole data structure, eliminating the need for complex data structures to store the model's holes and reducing memory consumption. For users of hole data, this reduces complexity and error rate.
[0051] Furthermore, a hash table is constructed based on the hole data set, where the hole ID is used as the key value and the data pointer index of the edge corresponding to the hole ID is used as the code value for hole repair.
[0052] It is worth noting that the property panel for repairing holes in this embodiment is a property configuration interface based on an extension of QT controls. This property panel displays the number of holes in the hole dataset and provides location and repair buttons. The location buttons include a previous button and a next button; the repair buttons include repair hole and repair all.
[0053] Compared with the prior art, the attribute panel for repairing holes in this embodiment integrates hole information, hole selection, location, and repair tools, solving the problems of unfriendly interactive operation and long and inefficient operation path for repairing geometric defects in the prior art.
[0054] S13: Receive instructions from any positioning button, and display the hole in the geometric model of the view area according to the hole corresponding to the positioning button; receive instructions from any repair button, repair the corresponding hole according to the repair button, and update the model data.
[0055] It should be noted that the positioning button corresponds to the data set of the hole, and is used to select the corresponding hole based on the clicked positioning button, and display the corresponding hole in the geometric model of the view area.
[0056] Preferably, displaying the selected hole at the forefront of the geometric model includes: obtaining all the edges that make up the hole based on the selected hole ID, and saving these edges to the list of selected objects; calculating the normal of the plane where the hole is located based on the endpoints of these edges, and setting the camera direction based on the normal; calculating the camera's view frustum region based on the edge corresponding to the hole ID, and after rendering, the currently selected hole will be displayed at the forefront.
[0057] The "Repair Holes" button is used to repair holes selected by the user, while the "Repair All" button is used to repair all holes in the current geometry model with one click.
[0058] Specifically, repair the corresponding holes according to the repair button, including:
[0059] When the repair button is "Repair Hole", obtain the hole ID to be repaired based on the holes currently displayed in the view area, and repair the hole based on the hole ID using a hash table;
[0060] When the repair button is "Repair All", iterate through the hole data set, extract each hole ID as the hole ID to be repaired, and repair the hole based on the hole ID to be repaired according to the hash table.
[0061] Furthermore, based on a hash table, holes are repaired according to the hole ID to be repaired, including:
[0062] Query the hash table based on the hole ID to obtain the data pointer index of the edge corresponding to that hole ID;
[0063] The edge is obtained based on the data pointer index of the edge, and is used as the starting edge of the hole;
[0064] Based on the end point of the starting edge of the hole and the data pointers of other edges it points to, obtain the adjacent edge that has only one corresponding face, and then find other adjacent edges in turn based on the adjacent edge until a closed loop is formed with the starting edge. All obtained edges are put into the loop array.
[0065] Construct new faces based on the ring array and add them to the face array.
[0066] Specifically, constructing a new face includes: creating a new face and generating a new face ID; traversing the ring array, using the data pointer of each edge in the ring array as the edge that constitutes the new face, and obtaining the other faces to which each edge belongs as the adjacent faces of the new face.
[0067] By adding the new face corresponding to each hole to the face array in the model data in turn, and re-rendering the geometric model in the view area, the repaired closed geometric model is obtained.
[0068] Preferably, the property panel for repairing holes also includes an undo button and a redo button, used to undo and redo the previous operation, respectively.
[0069] For example, if the repair hole operation is not performed as expected, you can manually select an edge or face in the geometric model to delete or create it, or click the undo button to undo the most recent operation on the geometric model, or click the redo button to restore the geometric model to the state before the most recent undo operation.
[0070] Compared with existing technologies, this embodiment provides a method for identifying and repairing geometric model holes for fluid simulation. It combines the repair operations of the geometric model into the same attribute panel, resulting in a shorter operation path and higher repair efficiency. It only records the ID of the first edge of the hole, which greatly simplifies the hole's data structure, reduces memory consumption, and lowers storage complexity and error rate. It uses a hash table to record the index of the hole's edges, improving query efficiency.
[0071] Example 2
[0072] Another embodiment of the present invention discloses a geometric model hole identification and repair system for fluid simulation, thereby implementing the identification and repair method in Embodiment 1. The specific implementation of each module is described in the corresponding description in Embodiment 1. Figure 2 As shown, the system includes:
[0073] The data preprocessing module 101 is used to acquire the geometric model of the fluid simulation and map the geometric model to obtain model data;
[0074] The hole recognition module 102 is used to receive instructions to recognize holes, identify holes based on model data, obtain a set of hole data, and display the number of holes, the location button, and the repair button in the hole repair attribute panel.
[0075] The hole repair module 103 is used to receive instructions from any positioning button, display the hole in the geometric model of the view area according to the hole corresponding to the positioning button, and receive instructions from any repair button to repair the corresponding hole and update the model data.
[0076] Since the geometric model hole identification and repair system in this embodiment can draw on the relevant aspects of the aforementioned geometric model hole identification and repair method, and this description is redundant, it will not be repeated here. Because this system embodiment shares the same principle as the above method embodiment, it also possesses the corresponding technical effects of the above method embodiment.
[0077] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0078] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for identifying and repairing holes in geometric models used in fluid simulation, characterized in that, Includes the following steps: Obtain the geometric model for fluid simulation, and map the geometric model to obtain model data; the model data includes: array data of points, edges, and faces, wherein the data of each edge in the array data of edges includes: edge ID, data pointers of the start endpoint of the edge and other edges it points to, data pointers of the end endpoint and other edges it points to, and data pointers of the face to which it belongs; the data of each face in the array data of faces includes: face ID, data pointers of all edges of the face and data pointers of adjacent faces; Upon receiving the instruction to identify holes, the system identifies holes based on the fact that only one edge in the model data belongs to a face. It records only the ID of the first edge of the hole as the hole ID, obtains the hole data set, and constructs a hash table based on the hole data set, where the hole ID is used as the key value and the data pointer index of the edge corresponding to the hole ID is used as the code value. The system also displays the number of holes, the location button, and the repair button in the hole repair attribute panel. Upon receiving an instruction from any positioning button, the system displays the hole in the geometric model of the view area according to the hole corresponding to the positioning button. This includes: obtaining all the edges that make up the hole based on the selected hole ID and saving these edges to the selected object list; calculating the normal of the plane where the hole is located based on the endpoints of these edges and setting the camera direction based on the normal; calculating the camera's view frustum region based on the edge corresponding to the hole ID, and after rendering, displaying the selected hole at the forefront of the geometric model; and upon receiving an instruction from any repair button, repairing the corresponding hole based on the repair button and the hash table, and updating the model data. Based on a hash table, the hole is repaired according to the hole ID, including: querying the hash table according to the hole ID to obtain the data pointer index of the edge corresponding to the hole ID; obtaining the edge according to the data pointer index of the edge, which serves as the starting edge of the hole; obtaining the adjacent edge with only one corresponding face according to the ending endpoint of the starting edge of the hole and the data pointers of other edges it points to, and sequentially searching for other adjacent edges according to the adjacent edge until a closed loop is formed with the starting edge, and putting all the obtained edges into a loop array; constructing a new face according to the loop array and adding it to the face array.
2. The method for identifying and repairing holes in geometric models for fluid simulation according to claim 1, characterized in that, The method involves identifying holes based on edges belonging to only one face in the model data, recording only the ID of the first edge of the hole as the hole ID, and obtaining the hole data set, including: Iterate through the array of edges, take out the edges that belong to only one face, and put them into the edge set; One edge is taken from the edge set in turn as the edge to be identified. Based on the data of the edge to be identified, it is determined whether there is a subset that forms a closed loop. If there is, the ID of the edge to be identified is used as the hole ID and put into the hole data set.
3. The method for identifying and repairing holes in geometric models for fluid simulation according to claim 2, characterized in that, The positioning buttons include a previous button and a next button; the repair buttons include repair hole and repair all.
4. The method for identifying and repairing holes in geometric models for fluid simulation according to claim 3, characterized in that, The process of repairing the corresponding hole based on the repair button and hash table includes: When the repair button is "Repair Hole", obtain the hole ID to be repaired based on the holes currently displayed in the view area, and repair the hole based on the hole ID using a hash table; When the repair button is "Repair All", iterate through the hole data set, extract each hole ID as the hole ID to be repaired, and repair the hole based on the hole ID to be repaired using a hash table.
5. The method for identifying and repairing holes in geometric models for fluid simulation according to claim 1, characterized in that, The construction of a new face based on the ring array includes: Create a new face and generate a new face ID; traverse the ring array, use the data pointer of each edge in the ring array as the edge that constitutes the new face, and get the other faces to which each edge belongs as the adjacent faces of the new face.
6. The method for identifying and repairing holes in geometric models for fluid simulation according to claim 1, characterized in that, The properties panel for repairing holes also includes undo and redo buttons.
7. A system for identifying and repairing holes in geometric models for fluid simulation, characterized in that, include: The data preprocessing module is used to acquire the geometric model of the fluid simulation and map the geometric model to obtain model data; The model data includes arrays of points, edges, and faces. In the edge array, each edge includes: edge ID, the start endpoint of the edge and its pointers to other edges, the end endpoint and its pointers to other edges, and the pointer to the face it belongs to. In the face array, each face includes: face ID, pointers to all edges of the face, and pointers to adjacent faces. The hole identification module receives instructions to identify holes, identifies holes based on edges belonging to only one face in the model data, records only the ID of the first edge of the hole as the hole ID, obtains the hole data set, constructs a hash table based on the hole data set, where the hole ID is used as the key value and the data pointer index of the edge corresponding to the hole ID is used as the code value; and displays the number of holes, the location button, and the repair button in the hole repair attribute panel. The hole repair module receives instructions from any positioning button and displays the hole in the geometric model of the view area according to the hole corresponding to the positioning button. This includes: obtaining all edges constituting the hole based on the selected hole ID and saving these edges to a list of selected objects; calculating the normal of the plane containing the hole based on the endpoints of these edges and setting the camera direction based on the normal; calculating the camera's frustum region based on the edge corresponding to the hole ID, rendering it, and displaying the selected hole at the forefront of the geometric model; receiving instructions from any repair button and repairing the corresponding hole according to the repair button and a hash table, updating the model data; repairing the hole based on the hole ID using the hash table, including: querying the hash table based on the hole ID to obtain the data pointer index of the edge corresponding to that hole ID; obtaining the edge based on the edge's data pointer index, using it as the starting edge of the hole; obtaining adjacent edges with only one corresponding face based on the ending endpoint of the starting edge and the data pointers of other edges it points to, and sequentially searching for other adjacent edges based on this adjacent edge until a closed loop is formed with the starting edge, placing all obtained edges into a loop array; constructing a new face based on the loop array and adding it to the face array.