A concurrent divide-and-conquer grid generation method based on graph theory and related equipment
Through the concurrent divide-and-conquer meshing method based on graph theory, the problem of uneven distribution in traditional divide-and-conquer meshing is solved, the parallel computing efficiency and resource utilization are improved, and the parallel computing environment is adapted to different scales and achieved. Efficient handling of meshing tasks.
Patent Information
- Application Number
- CN202411021356.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-07-29
AI Technical Summary
The traditional divide-and-conquer meshing algorithm has imbalanced distribution problems when processing some complex models, resulting in a waste of computing resources and low parallel efficiency, and prolongs program execution time.
The concurrent divide-and-conquer meshing method based on graph theory is used to abstract sub-problems by constructing a directed graph model, manage node status, set start and end conditions, and execute nodes in topological sorting order to optimize task allocation and resource utilization.
It significantly improves parallel computing efficiency, shortens the overall processing time, improves resource utilization and algorithm scalability, and enhances adaptability to parallel computing environments of different scales.
Smart Images

Figure CN118551854B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of simulation design, and in particular to a concurrent divide-and-conquer grid generation method based on graph theory and related equipment. Background Art
[0002] The divide-and-conquer meshing algorithm is an algorithm design strategy for dealing with complex problems. It decomposes a complex problem into several identical or similar small problems to solve, and then combines the solutions to these small problems to obtain the solution to the original problem. Chinese patent CN117892602B proposes a meshing method for a 2.5D model based on industrial simulation software, which divides the entire 2.5D model in parallel by region, and finally generates a 3D unstructured mesh.
[0003] Generally, the divide-and-conquer meshing algorithm includes the following processes: 1. Model simplification; 2. Generation of surface meshes; 3. Dividing sub-problems according to different attributes; 4. Generating sub-volume meshes; 5. Merging sub-volume meshes; 6. Mesh file output. In traditional divide-and-conquer meshing, these six major steps are serial, and each major step can be performed in parallel, which is the origin of the divide-and-conquer concept. This design applies the divide-and-conquer strategy to the algorithm, because each major step can be regarded as a finer-grained division and processing of the problem, while the parallel operations within each major step are the decomposition and solution of the sub-problems. By dividing the task into smaller sub-tasks and using parallel processing to speed up the processing, the efficiency and performance of the divide-and-conquer algorithm can be improved. Therefore, this method of executing large steps serially and small steps in parallel is a common practice in the design of divide-and-conquer algorithms.
[0004] However, if only part of a model is complex, then in each large step, you have to wait for the most complex part to be completed before you can proceed to the next large step. This creates a serious problem of unbalanced allocation. Although users have a lot of thread resources, they cannot be used in a timely manner, which wastes computing resources, reduces the overall parallel efficiency of the divide-and-conquer approach, and prolongs the execution time of the program. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a concurrent divide-and-conquer grid partitioning method and related equipment based on graph theory. Under the theoretical framework of graph theory, a variety of strategies and concurrent computing technologies are combined and applied to the divide-and-conquer grid partitioning algorithm to improve its efficiency and performance, thereby solving the problem of unbalanced distribution in divide-and-conquer partitioning to the greatest extent and accelerating the overall partitioning speed.
[0006] The present invention proposes a concurrent divide-and-conquer grid generation method based on graph theory, comprising:
[0007] Constructing a graph theory model: abstracting the divide-and-conquer meshing algorithm into a directed graph, where each subproblem in the divide-and-conquer meshing algorithm is abstracted into a node in the directed graph, and the dependency relationship between the subproblems is abstracted into directed unweighted edges in the graph. The subproblems are the problems that need to be solved to execute the divide-and-conquer meshing algorithm.
[0008] Manage node status: Set the initial status of each node to open. After the subproblem is completed, change the node status corresponding to the subproblem to closed. Each node has two states: open and closed. A node with an open status indicates that the subproblem has not been processed, and a node with a closed status indicates that the subproblem has been processed.
[0009] Set the starting and ending conditions: take a node without an open in-degree as the starting node, and add the starting node to the list of nodes to be executed; take a node without an out-degree as the ending node, and start execution from the starting node. The execution ends when the status of the ending node is closed or there is no node in the list of nodes to be executed;
[0010] Take out nodes from the list of nodes to be executed in the order of topological sorting: execute the current node, set the state of the current node to closed after the execution of the current node is completed, and traverse all the out-degree nodes of the current node, and check the states of all the in-degree nodes of all the out-degree nodes of the current node. If the states of all the in-degree nodes of all the out-degree nodes of the current node are closed, then add all the out-degree nodes of the current node to the list of nodes to be executed.
[0011] In one embodiment, the graph theory model construction further includes: assigning a weight to each node, where the weight of the node represents the complexity of the sub-problem corresponding to the node.
[0012] In one embodiment, in the management node status, each node has two states: open and closed. A node in the open state indicates that the sub-problem has not been processed, and a node in the closed state indicates that the sub-problem has been processed.
[0013] In one embodiment, the concurrent divide-and-conquer grid generation method based on graph theory further includes checking the status of all nodes, wherein the checking the status of all nodes is:
[0014] After the end condition is met, traverse the directed graph;
[0015] If all nodes are closed, the execution is successful and exits;
[0016] If there are nodes with an open state, extract the path of the graph containing the nodes with an open state, set the states of the node with the lowest complexity and all its out-degree nodes to open, re-execute the node and check the states of all nodes until the states of all nodes are closed.
[0017] In one embodiment, the sub-problems in constructing the graph theory model include: loading of boundary files, segmentation of surface meshes in different domains, division of surface meshes, volumetricization of surface meshes, and merging of volume meshes of various domains.
[0018] The present invention also proposes a computer-readable medium storing a computer program code, which, when executed by a processor, implements the graph-theory-based concurrent divide-and-conquer grid partitioning method as described above.
[0019] The present invention also proposes a concurrent divide-and-conquer grid generation device based on graph theory, comprising:
[0020] a memory for storing instructions executable by a processor; and
[0021] A processor is used to execute the instructions to implement the concurrent divide-and-conquer grid partitioning method based on graph theory as described above.
[0022] The present invention also proposes a computer program product, comprising a computer program, which, when executed by a processor, implements the graph-theory-based concurrent divide-and-conquer grid partitioning method as described above.
[0023] The concurrent divide-and-conquer grid generation method and related devices based on graph theory of the present invention have the following beneficial effects:
[0024] 1. Significantly improve parallel computing efficiency: By optimizing task allocation and reducing waiting time between threads, the present invention greatly improves the overall parallel efficiency of the divide-and-conquer program and speeds up algorithm execution.
[0025] 2. Shorten the overall processing time: By evenly distributing the sub-problem processing tasks, the present invention effectively reduces the total time required for divide-and-conquer partitioning and improves the rapid response capability of computing tasks.
[0026] 3. Enhanced resource utilization and algorithm scalability: The present invention improves the utilization of computing resources and makes the algorithm more adaptable to parallel computing environments of different scales, thereby enhancing its scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 The figure is a flowchart of a concurrent divide-and-conquer grid partitioning method based on graph theory according to an embodiment of the present invention.
[0028] Figure 2 It is a directed graph abstracted by a divide-and-conquer grid partitioning algorithm in one embodiment of the present invention.
[0029] Figure 3 The figure is a directed graph abstracted from a two-layer case according to an embodiment of the present invention.
[0030] Figure 4 A grid diagram of a model file parsing in a two-layer case according to an embodiment of the present invention.
[0031] Figure 5 It is a schematic diagram of generating a volume mesh of the first layer in a two-layer case according to an embodiment of the present invention.
[0032] Figure 6 It is a schematic diagram of generating a surface mesh of the lower half of the second layer in a two-layer case according to an embodiment of the present invention.
[0033] Figure 7 FIG. 1 is a schematic diagram of a mesh of a second stitched layer in a two-layer case according to an embodiment of the present invention.
[0034] Figure 8 The figure is a schematic diagram of a grid after merging grids in a two-layer case according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the invention and are not used to limit the invention.
[0036] In order to solve the problem of unbalanced distribution in divide-and-conquer partitioning, the present invention proposes a concurrent divide-and-conquer grid partitioning method based on graph theory, such as Figure 1 Shown include:
[0037] Constructing a graph theory model: The divide-and-conquer mesh algorithm is abstracted into a directed graph. Each subproblem in the divide-and-conquer mesh algorithm is abstracted into a node in the directed graph, and the dependencies between subproblems are abstracted into directed unweighted edges in the graph. Subproblems are problems that need to be solved to execute the divide-and-conquer mesh algorithm. A weight is assigned to each node, and the weight of the node represents the complexity of the subproblem corresponding to the node. Through graphical representation, the overall structure of the divide-and-conquer mesh algorithm and the dependencies between the subproblems can be clearly seen, which helps to understand the process and logic of the algorithm. For example, by analyzing the directed graph, the longest path and the node with the highest complexity can be identified.
[0038] like Figure 2 As shown, this step abstracts the entire divide-and-conquer process into a directed graph (from left to right by default, Figure 2All edge arrows are omitted in the figure), each subproblem in the divide-and-conquer decomposition is abstracted as a node of the graph, node A is the loading of the boundary file, node B (including B1, B2, B3, B4, B5) is the decomposition of the surface mesh in different domains, node C (including C1, C2, C3, C4) is the division of the surface mesh, node D (including D1, D2, D3, D4, D5, D6, D7, D8) is the volume of the surface mesh, node E is the volume mesh of the merged domains, the weight of the node refers to the complexity of the current subproblem (omitted in the figure), and the "dependency" of the subproblem is abstracted as a directed unweighted edge in the graph.
[0039] Manage node status: Set the initial state of each node to open. After the subproblem is completed, change the node state corresponding to the subproblem to closed. Each node has two states: open and closed. A node with an open state indicates that the subproblem has not been processed, and a node with a closed state indicates that the subproblem has been processed. Through the state of the node, the processing progress of each subproblem can be tracked in real time, which helps to understand the overall execution of the algorithm. In complex algorithms, especially those involving recursion or parallelism, it is easy to repeatedly process the same subproblem. Managing node status helps reduce unnecessary calculations and improve the efficiency of the algorithm.
[0040] Set the starting and ending conditions: take the node without open in-degree as the starting node, and add the starting node to the list of nodes to be executed, and the node without out-degree as the ending node. Start execution from the starting node and end when the state of the ending node is closed or there is no node in the list of nodes to be executed. The correct selection of the starting node can ensure the correct order of algorithm execution, which avoids processing some sub-problems in advance when the data or dependencies are not ready, thereby ensuring the logical correctness and sequentiality of algorithm execution. The correct selection of the starting node also helps to reduce waiting time and idle resources during the execution of the algorithm. The clear ending condition provides a clear termination signal for the execution of the algorithm. At the same time, checking whether there is a node in the list of nodes to be executed as another ending condition ensures that the algorithm stops after all possible work is completed even in the absence of an explicit termination node (such as loops or special cases that may exist in some complex graph structures). This avoids infinite loops or unnecessary additional calculations.
[0041] Take out nodes from the list of nodes to be executed in the order of topological sorting: execute the current node Ci, and set the state of the current node to closed after the execution of the current node Ci is completed. And traverse all out-degree nodes of Ci (that is, all nodes pointed to by Ci) after the execution of the current node Ci is completed. Check the status of all in-degree nodes of all out-degree nodes of the current node Ci. If the status of all in-degree nodes of all out-degree nodes of Ci are closed, then add all out-degree nodes of Ci to the list of nodes to be executed, because they can now start execution. For example, when the C3 node is executed, traverse the four nodes pointed to by C3, namely D5, D6, D7, and D8, and check the parent nodes of these four nodes (C3 and C4 on the left) respectively. If C3 and C4 are both closed, then add these four nodes to the list of nodes to be executed, see Figure 2 .
[0042] Check the status of all nodes: After the end condition is met, traverse the directed graph. If all nodes are closed, the execution is successful and exits. If there are nodes with an open state, extract the path of the graph containing the nodes with an open state, set the states of the node with the lowest complexity and all its out-degree nodes to open, re-execute the node and check the states of all nodes until all nodes are closed. This step ensures that the algorithm can handle various abnormal situations, such as failure to execute subproblems, inconsistent data, or unexpected interruptions in the algorithm execution path. This step provides a mechanism to resume the execution of the algorithm and ensure that all necessary subproblems are eventually processed.
[0043] by Figures 3 to 8 Take this application as an example to introduce it in detail. Figure 3 The directed graph formed by the concurrent divide-and-conquer meshing method based on graph theory in a two-layer case according to an embodiment of the present invention is described. Among them, one layer is a complex layer, which is mainly responsible for generating triangular prism meshes. The other layer is a simple layer, which generates tetrahedral meshes. As described above, each subproblem in the divide-and-conquer algorithm is abstracted as a node of the graph, the A node is the loading of the boundary file, the B node is the division of the surface mesh in different domains, the C node is the division of the surface mesh, the D node is the volume of the surface mesh, and the E node is the volume mesh of each domain. In the two-layer case, the A node includes the model file parsing, see Figure 4 The B-type nodes include the generation of the first-level volume mesh (see Figure 5 ) and generate the surface mesh of the lower part of layer 2 (see Figure 6 ), where the first layer is the complex layer described above, and the second layer is the simple layer described above. Class C nodes include stitching the second layer, see Figure 7 The D-type node includes four volumetric layer 2 meshes. The E-type node includes merging meshes and outputting them, see Figure 8The arrows between sub-problems indicate dependencies. You can see that there are 4 nodes in "Volume 2 mesh" because it is calculated in parallel. Figure 3 It clearly shows the complete process from generating triangular prism meshes of complex layers to parallel processing of tetrahedral mesh generation and volumetric tasks of simple layers, and finally merging all meshes for output. At this point, the directed graph has been constructed.
[0044] Next, set the initial status of all nodes to "open". Find all nodes with no in-degree (that is, no other subproblems depend on it) and a status of "open". These nodes are the nodes where the algorithm can start first, and add them to the todo list. When a node is executed, set its status to "closed". Take out the nodes from the to-be-executed node list in the order of topological sorting, and traverse all the out-degree nodes of the current node after the current node is executed. And check the status of all in-degree nodes of the current node. If the status of all in-degree nodes is closed, add the current node to the to-be-executed node list. If the status of a node with no out-degree (that is, no other task depends on its output) is "closed" or the to-be-executed list is empty, it ends.
[0045] After the completion, the entire directed graph is traversed to check the status of all nodes. If all nodes are closed, the execution is successful and exits. If there are nodes with an open status, an exception or circular dependency may have occurred. At this time, the path of the graph containing the nodes with an open status is extracted, and the status of the node with the lowest complexity and all its out-degree nodes are set to open. The node is re-executed and the status of all nodes is checked until the status of all nodes is closed.
[0046] The present invention also proposes a computer-readable medium storing a computer program code, which, when executed by a processor, implements the graph-theory-based concurrent divide-and-conquer grid generation method as described above.
[0047] The present invention also proposes a concurrent divide-and-conquer grid generation device based on graph theory, comprising: a memory and a processor. The memory is used to store instructions executable by the processor. The processor is used to execute the instructions to implement the concurrent divide-and-conquer grid generation method based on graph theory as described above.
[0048] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the concurrent divide-and-conquer grid generation method based on graph theory as described above is implemented.
[0049] The concurrent divide-and-conquer grid generation method and related devices based on graph theory of the present invention have the following beneficial effects:
[0050] 1. Significantly improve parallel computing efficiency: By optimizing task allocation and reducing waiting time between threads, the present invention greatly improves the overall parallel efficiency of the divide-and-conquer program and speeds up algorithm execution.
[0051] 2. Shorten the overall processing time: By evenly distributing the sub-problem processing tasks, the present invention effectively reduces the total time required for divide-and-conquer partitioning and improves the rapid response capability of computing tasks.
[0052] 3. Enhanced resource utilization and algorithm scalability: The present invention improves the utilization of computing resources and makes the algorithm more adaptable to parallel computing environments of different scales, thereby enhancing its scalability.
[0053] In summary, the present invention effectively solves the problems existing in traditional divide-and-conquer partitioning by combining graph theory and divide-and-conquer partitioning theory, significantly improves the performance and efficiency of the algorithm, and has important practical application value for complex mesh partitioning tasks that require efficient parallel processing.
[0054] Although the above methods are illustrated and described as a series of actions for simplicity of explanation, it should be understood and appreciated that these methods are not limited by the order of the actions, because according to one or more embodiments, some actions may occur in a different order and / or concurrently with other actions from those illustrated and described herein or not illustrated and described herein but understandable to those skilled in the art.
[0055] The above-described embodiments are only further explanations of the present invention, and are not intended to limit the present invention in other forms. The present invention may also have other various embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art may make various corresponding modifications and changes according to the present invention, but these corresponding modifications and changes should all fall within the protection scope of the present invention.
Claims
1. A concurrent divide-and-conquer grid generation method based on graph theory, characterized in that: include: Constructing a graph theory model: abstracting the divide-and-conquer meshing algorithm into a directed graph, abstracting each subproblem in the divide-and-conquer meshing algorithm into a node in the directed graph, and abstracting the dependency between subproblems into directed unweighted edges in the graph. The subproblems are the problems that need to be solved to execute the divide-and-conquer meshing algorithm, and the subproblems include: loading boundary files, dividing surface meshes in different domains, dividing surface meshes, volumetricizing surface meshes, and merging volume meshes of various domains; Manage node status: Set the initial status of each node to open, and after the sub-problem is completed, change the node status corresponding to the sub-problem to closed; Set the starting and ending conditions: take a node without an open in-degree as the starting node, and add the starting node to the list of nodes to be executed; take a node without an out-degree as the ending node, and start execution from the starting node. The execution ends when the status of the ending node is closed or there is no node in the list of nodes to be executed; Take out nodes from the list of nodes to be executed in the order of topological sorting: execute the current node, set the state of the current node to closed after the execution of the current node is completed, and traverse all the out-degree nodes of the current node, and check the states of all the in-degree nodes of all the out-degree nodes of the current node. If the states of all the in-degree nodes of all the out-degree nodes of the current node are closed, then add all the out-degree nodes of the current node to the list of nodes to be executed.
2. The concurrent divide-and-conquer grid generation method based on graph theory according to claim 1, characterized in that: The graph theory model construction also includes: assigning a weight to each node, and the weight of the node represents the complexity of the sub-problem corresponding to the node.
3. The concurrent divide-and-conquer grid generation method based on graph theory according to claim 1, characterized in that: In the management node status, each node has two states: open and closed. A node in the open state indicates that the sub-problem has not been processed, and a node in the closed state indicates that the sub-problem has been processed.
4. The concurrent divide-and-conquer grid generation method based on graph theory according to claim 2, characterized in that: The concurrent divide-and-conquer grid generation method based on graph theory further includes checking the status of all nodes, wherein the checking the status of all nodes is: After the end condition is met, traverse the directed graph; If all nodes are closed, the execution is successful and exits; If there are nodes with an open state, extract the path of the graph containing the nodes with an open state, set the states of the node with the lowest complexity and all its out-degree nodes to open, re-execute the node and check the states of all nodes until the states of all nodes are closed.
5. A computer readable medium storing computer program code, characterized in that: When the computer program code is executed by a processor, the computer program code implements the concurrent divide-and-conquer grid partitioning method based on graph theory according to any one of claims 1 to 4.
6. A concurrent divide-and-conquer grid generation device based on graph theory, characterized in that: include: a memory for storing instructions executable by a processor; as well as A processor, configured to execute the instructions to implement the concurrent divide-and-conquer grid partitioning method based on graph theory as described in any one of claims 1 to 4.
7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the concurrent divide-and-conquer grid partitioning method based on graph theory as described in any one of claims 1 to 4 is implemented.
