A non-recursive search method for spatial points on a given grid area
By using the non-recursive generation of balanced binary trees during the implicit assembly of large-scale overlapping mesh, the problem of low retrieval efficiency is solved, and the rapid pairing across processors is realized, which significantly improves the computing performance of computational fluid mechanics software.
Patent Information
- Application Number
- CN202411935691.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-12-26
AI Technical Summary
The prior art has low retrieval efficiency during the implicit assembly of large-scale overlapping mesh, resulting in a long automatic hole digging time across processors, affecting the numerical simulation speed of the non-static flow field of calculation fluid mechanics software under multi-body separation conditions.
The non-recursive generation of balanced binary trees is adopted to calculate the critical bounding box parameters of the background mesh unit to build a balanced binary tree structure, and realize cross-processor pairing of spatial points and contribution units.
It reduces the difference in tree retrieval depth on different processors, reduces synchronous waiting time, reduces the backtracking frequency during the retrieval process, significantly reduces the automatic hole digging time across processors, and improves the computing performance of computational fluid mechanics software.
Smart Images

Figure CN119358467B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of computational fluid dynamics and computational geometry, and in particular to a non-recursive retrieval method for space points on a given grid area. Background Art
[0002] With the in-depth application of high-performance computing technology in the field of computational fluid dynamics, a large number of unsteady flow field simulation problems involving multi-body relative motion situations have continued to emerge in people's field of vision, such as the aerodynamic interference between the rotor slipstream and the helicopter fuselage, the spreading of cluster bombs, the low-altitude high-dynamic pressure hood separation of the launch vehicle, the hydrostatic gliding of amphibious aircraft, and the air launch of external missiles. At this time, the flow field simulator needs to perform numerical simulation of the spatial vortex structure and aerodynamics based on the dynamic grid, and the parallel assembly of the multi-component overlapping grid system has become one of the key means of unsteady flow field simulation under multi-body relative motion. In each sub-area, it completes the division of the flow field calculation unit, the hole unit and the overlapping interpolation unit by cutting the hole boundary, and realizes the flow field information interaction through the interpolation technology in the overlapping area, thereby completing the loading of the flow field simulator on the dynamic grid system.
[0003] In the process of hole boundary cutting, if artificial auxiliary grids are involved, the overlapping grid assembly method is called an explicit method, otherwise it is called an implicit method. For explicit methods, auxiliary hole boundary grids around complex geometric configurations are difficult to generate, and the overlapping relationship matrix between different component grids must be manually specified, which leads to a low level of automation in the assembly algorithm and brings inconvenience to the numerical simulation of flow fields under the condition of relative motion of many component grids. In contrast, although the implicit method effectively improves the automation level of overlapping grid assembly, under the distributed memory management mode, with the increase of grid scale, total number of components and overlapping area, the total amount of information query involved in the algorithm and the multi-processor synchronization cost rise sharply, which brings unprecedented difficulties to the high-performance implementation of implicit assembly algorithms. According to Figure 1 The wall distance criterion of implicit hole digging in overlapping grids is expressed as follows: ① In the component , The solid and dotted lines around the components are used to identify the non-structured grids to which they belong. Take the mesh as an example (component Similarly), take any spatial grid point , remember the grid points The distance to the solid wall point set of its own component is , grid points The distance to the fixed wall point set of other components is ③ Distance comparison conditions ④Unit coverage conditions : There is a volume element on other parts that is not adjacent to the artificial boundary surface ,make become ⑤Solid wall covering condition : The solid wall interior area where other components exist ,make become ⑥If ,So is an inactive node, otherwise ⑦ The body unit that contains both active nodes and inactive nodes is a transition unit, and the transition unit extends to the inactive node set to form a digging boundary. Because in the case of relative motion of the component mesh, remain unchanged, while Need to be constantly updated, so Figure 1 In the spatial grid point The distance parameter The calculation is done directly according to the definition, and the distance parameter Required in parts Find the overlay on the background grid Contribution Unit , according to the parameter value , , Here, the geometric interpolation process better ensures the reuse of existing data in the implicit hole digging process.
[0004] The performance test based on the large-scale overlapping grid implicit assembly example shows that for a given sequence of spatial points, the contribution unit retrieval algorithm on the background grid area has a decisive influence on the time cost of digging holes. The reasons are as follows: ① In the parallel computing mode, the background grid is distributed to different processors in the form of multiple sub-blocks. If the traditional alternating direction cutting tree is used to establish the retrieval structure, the depth of the tree structure on each processor is difficult to reach the minimum, and the average retrieval depth of the critical bounding box of the contribution unit will also vary greatly, which will increase the synchronization waiting time overhead of multiple processors. ② In the process of establishing the alternating direction cutting tree, the extended bounding boxes of the same-level subtrees come into contact at the cutting surface, which results in a large amount of backtracking of the critical bounding box of the contribution unit during the retrieval process. Therefore, constructing an efficient grid retrieval algorithm has important application value for the parallel implementation of large-scale overlapping grid implicit assembly. Summary of the invention
[0005] In order to overcome the deficiencies of the prior art, the present invention provides a non-recursive retrieval method for spatial points in a given grid area, which solves the problems of low retrieval efficiency and the like in the prior art.
[0006] The technical solution adopted by the present invention to solve the above problems is:
[0007] A non-recursive retrieval method for spatial points on a given grid area comprises the following steps:
[0008] S1, initialize the parameters of the balanced binary tree retrieval structure;
[0009] S2, opens up dynamic memory for internal members in the binary tree structure;
[0010] S3, calculating the critical bounding box parameters in the background grid unit;
[0011] S4, non-recursively generate the link relationship of balanced binary tree nodes;
[0012] S5, global reduction of geometric data of the spatial points to be retrieved;
[0013] S6, non-recursive retrieval of contributing units covering spatial points;
[0014] S7, returns the pairing relationship between the spatial point and the contributing unit.
[0015] As a preferred technical solution, in step S1, initialization includes the following operations:
[0016] S11, declare a signed integer variable As an internal data member of a balanced binary tree, The value is set to ,remember is the generalized The spatial dimension; among them, Indicates the dimension of the physical space where the overlapping grids are located;
[0017] S12, declare a signed integer variable Stores the total number of cells in the background grid sub-block on the current processor and uses Become an internal data member of a balanced binary tree;
[0018] S13, first calculate the minimum resolution of the volume unit scale of the background grid sub-block on the current processor ; then use The specification function is obtained The global minimum of ; Finally declare double precision floating point variables , and make Become the internal data member of the balanced binary tree; among them, represents the geometric tolerance of a balanced binary tree, represents the scale factor;
[0019] S14, declare the binary tree node as custom Type, the global root node pointer of the binary tree Points to a null address .
[0020] As a preferred technical solution, in step S2, in each During the object construction process, the dynamic memory that needs to be opened up includes:
[0021] S21, index value stored in a signed integer variable , Keep consistent with the traversal subscript of the cell sequence in the background grid sub-block;
[0022] S22, generalized coordinate array stored as double-precision floating-point array , The length and Stay consistent;
[0023] S23, the infimum array of the extended bounding box stored in a double-precision floating-point array With the supremum array , , The length is equal to ;
[0024] S24, each The link relationship between the object and its left child and right child; the link relationship is described by a binary linked list, and the pointer variables of the left child and the right child are , , , Both point to empty address values .
[0025] As a preferred technical solution, step S3 includes the following steps:
[0026] S31, let the number of the volume unit of the current background grid be , Contained Three-dimensional physical coordinate system of spatial grid points Next axis, axis, The axis coordinates are ;
[0027] S32, along axis, axis, The direction of the axis, calculation The minimum and maximum values of the coordinate components of the space grid points are recorded as , consisting of 6 spatial planes The critical bounding box cut out; Treated as six-dimensional The generalized coordinates in the space form a one-to-one mapping relationship with the critical bounding box; among them, express The coordinate components of the space grid points are The minimum value in the axis direction, express The coordinate components of the space grid points are The minimum value in the axis direction, express The coordinate components of the space grid points are The minimum value in the axis direction, express The coordinate components of the spatial grid points are The maximum value in the axial direction, express The coordinate components of the space grid points are The maximum value in the axial direction, express The coordinate components of the space grid points are Maximum value in the axis direction;
[0028] S33, take vector The subscript is Elements , copy the generalized coordinate components corresponding to the critical bounding box of the current volume unit to Member variables of In the array.
[0029] As a preferred technical solution, in step S4, Each element in the vector is linked to a balanced binary tree structure through its left child pointer and right child pointer. Each element in the vector is linked to form a balanced binary tree structure through its left child pointer and right child pointer; combined with the sorting algorithm, it is completed in a non-recursive form The elements in the vector are divided layer by layer from top to bottom until all terminal nodes of the binary tree are connected.
[0030] As a preferred technical solution, step S4 includes the following steps:
[0031] S41, declare the register array required for the non-recursive generation process of the balanced binary tree; wherein the content of the declaration operation includes:
[0032] ①Binary tree node The pointer type declares a fixed length Register array ;
[0033] ②Declare 4 fixed-length signed integer types Register array ;
[0034] ③With signed integer register variables Identify the top position of the stack of the above 5 register arrays, The initial value of is set to 0;
[0035] ④ Initialize the top element value of the stack in sequence ; ; ; ; ;
[0036] S42, declare temporary location identification variables required for the non-recursive generation process of the balanced binary tree; wherein the content of the declaration operation includes:
[0037] ①Binary tree node Declare a register variable of pointer type , and let The initial value is an empty address ;
[0038] ②Declare 4 register variables with signed integer type , , , , and let , , , The initialization value is -1;
[0039] S43, combined The non-recursive linking pattern of the type of cycle links the nodes at each level of the balanced binary tree; among them, The logical condition for the execution of the loop is: register pointer variable The address value pointed to is not empty or a register variable The value is not equal to -1; under the premise of satisfying the logical conditions for execution, the address value sequence of the generalized point is sorted according to the sorting algorithm of the coordinate components. Perform permutation operations, and complete the calculation of the supremum parameters and infimum parameters of the extended bounding box of each node of the balanced binary tree and the links between the nodes; when When the type loop terminates, the construction process of the balanced binary tree is completed;
[0040] S44, determining the address pointed to by the global root node pointer of the balanced binary tree; wherein the content of the declaration operation includes:
[0041] ①Declare a signed integer variable , and let ;
[0042] ② Order , complete the identification of the global root node pointer.
[0043] As a preferred technical solution, step S43 includes the following steps:
[0044] S431, calculating the geometric parameters of the critical bounding box of the node, including the following steps:
[0045] S4311, extract current The infimum array of the extended bounding box of the node pointed to by the pointer With the supremum array , along The generalized point subsets are calculated in the directions of the coordinate axes. The supremum and infimum of The array stores the infimum, using The array stores the supremum; where ;
[0046] S4312, along The directions of the coordinate axes are Arrays and The array is corrected for tolerance. and Updated to and , so that each generalized point contained in the current node and its child nodes becomes an inner point of the extended bounding box of the current node; among them, for The first elements, for The first elements, ;
[0047] S4313, calculate the cutting direction number of the current node: If the equality condition If established, then , otherwise let ;
[0048] S4314, calculate the right child node parameters and push them into the stack container: if the inequality If true, first set the register variable The value of is accumulated by 1, and then , , , , ;
[0049] S4315, calculate the left child node parameters and push them into the stack container: if the inequality If true, first set the register variable The value of is accumulated by 1, and then , , , , ;
[0050] S4316, will Set the variable to a null address value ;
[0051] S432: Linking the current node and its left child node and right child node, including the following steps:
[0052] S4321, Order , , , along the numbered The coordinate axis direction is based on the generalized point coordinate component The rules from small to large are The generalized point address value contained in the subtree of the root node Sort by; among them, Indicates the starting number variable, Indicates the termination number variable, Indicates the coordinate axis direction serial number variable, ;
[0053] S4322, Order ,make ;
[0054] S4323, if the equality condition If established, The left child of the node is linked to The address referred to; if the equality condition If established, The right child of the node is linked to the address referred to;
[0055] S4324, register variable Decrease the value of ;
[0056] S44, determining the address pointed to by the global root node pointer of the balanced binary tree, including the following steps:
[0057] S441, Declaration of signed integer variable , and let ;
[0058] S442, Order , complete the identification of the global root node pointer.
[0059] As a preferred technical solution, step S6 includes the following steps:
[0060] S61, call Member functions of Clear ;in, Represents a vector container, Represents the clear function, Represents a node address collection container;
[0061] S62, with Declare a register variable of pointer type , and use Points to an address-value pair Initialize;
[0062] S63, declare the register array required for the binary tree non-recursive traversal process, and the declaration operation includes:
[0063] ① Pointer type declares a fixed length Register array ;
[0064] ②With signed integer register variables Identifies the top position of the stack. The initial value of is -1;
[0065] S64, combined Type loop mode non-recursive search coverage The binary tree node first address sequence where the critical bounding box of the point is located is stored in Among them, Logical condition for loop execution: register variable The value is a non-empty address value, or a register variable The value of is not equal to -1; when At the end of the loop, the The critical bounding box sequence of the points is determined;
[0066] S65, identifying the spatial point to be retrieved Contribution unit: If If it is empty, it does not exist on the background grid sub-block associated with the current processor. Contribution unit; otherwise, traverse ,extract The index value of each element , then according to Iteration method determines Individual Unit and the spatial point to be retrieved The coverage relationship; if the volume unit Cover the spatial points to be retrieved , then record the pairing relationship , and jump out of the traversal process; among them, The iteration method represents Newton's iteration method.
[0067] As a preferred technical solution, step S64 includes the following steps: S641, S642; When the loop is executed, the register variable When the value of is a non-empty address value, execute step S641, otherwise execute step S642;
[0068] Among them, S641 and S642 are:
[0069] S641, query the nodes to which the critical bounding box of the contributing unit belongs: if Points to a non-empty node in a balanced binary tree, then judge The extended bounding box and spatial point of the node pointed to Covering relationship: If the supremum of the extended bounding box and infimum Make the condition and At the same time, first set the register variable The value is accumulated by 1, and then , and finally The value of is updated to the left child node address pointed to by itself; otherwise, let Points to a null address ;in, ;
[0070] S642, identifying the critical bounding box address covering the known spatial point and pushing it into the vector sequence, including the following steps:
[0071] S6421, Order ;
[0072] S6422, register variable Decrement value ;
[0073] S6423, determine the spatial point to be searched and The coverage relationship between the corresponding critical bounding boxes: The physical coordinate array is , remember the current The generalized coordinates of the corresponding critical bounding box are , combined with the equation conditions in step S1 , if the condition With conditions Corresponding If both inequalities hold true, then we think The corresponding critical bounding box covers the spatial point to be retrieved ,Will The address value pointed to by the vector Function added to Among them, , The function represents a function that adds a data at the end of the array;
[0074] S6424, will The value of is updated to the address of the right child node pointed to by itself.
[0075] As a preferred technical solution, the method further comprises the following steps:
[0076] S8, releases the dynamic memory of internal members in the binary tree structure.
[0077] Compared with the prior art, the present invention has the following beneficial effects:
[0078] In the parallel assembly process of large-scale overlapping grids, the present invention can quickly realize the cross-processor pairing process of interpolation points and contribution units; compared with the traditional tree based on alternating direction cutting, the binary tree constructed by the present invention has better balance, which not only reduces the difference in tree retrieval depth on different processors and reduces the synchronization waiting time, but also the extension bounding box of each node is more independent, which greatly reduces the backtracking frequency in the retrieval process; therefore, in the implicit parallel assembly process of ultra-large-scale overlapping grids, the present invention can greatly reduce the automatic hole digging time across processors, and comprehensively improve the speed of computational fluid dynamics software in performing numerical simulation of unsteady flow fields under multi-body separation conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 It is a schematic diagram of the wall distance criterion for implicit hole digging with overlapping grids;
[0080] Figure 2 It is a schematic diagram of the non-recursive retrieval process of a spatial point on a given grid area;
[0081] Figure 3 It is a schematic diagram of the initialization vector composed of the addresses of nodes at all levels inside the balanced binary tree;
[0082] Figure 4 It is a schematic diagram of the link relationship and generation order of each node of a balanced binary tree;
[0083] Figure 5 It is a schematic diagram of the protocol of the background grid processor group to be queried spatial point;
[0084] Figure 6 It is a schematic diagram of the process of returning and extracting cross-processor pairing query results. DETAILED DESCRIPTION
[0085] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0086] Example 1
[0087] like Figures 1 to 6 As shown in the figure, the present invention discloses a non-recursive retrieval method for spatial points on a given grid area. According to the execution order, it is divided into two non-recursive processes: index tree construction and contribution unit search. In the index tree construction stage, the critical bounding box of each volume unit on the grid area is mapped into a multidimensional The generalized points in the space are generated by combining the sorting algorithm with a non-recursive binary tree structure to realize the division and storage of the generalized point set. In the search phase of the contribution unit, the critical bounding box set covering the current space point is first retrieved on the binary tree based on the pre-order traversal algorithm, and then The iterative method further identifies the covering relationship between the relevant body units and the current spatial point. Compared with the traditional retrieval method based on the alternating direction cutting tree, the binary tree constructed by the present invention is a balanced binary tree, and the average retrieval depth of random spatial points is lower; at the same time, the generalized point neighborhoods with different coordinates do not intersect with each other, which reduces the backtracking frequency during the retrieval process. These factors make the overall performance of the present invention significantly exceed the retrieval algorithm based on the alternating direction cutting tree. In the implicit parallel assembly process of large-scale overlapping grids, the present invention can significantly reduce the automatic hole digging time across processors, and overall improve the speed of computational fluid dynamics software in performing unsteady numerical simulations under multi-body separation conditions.
[0088] Definitions of terms used in this invention:
[0089] ① The critical bounding box of the point set: dimension Given a rectangular coordinate system in space , with a limited set , where the subscript is The element coordinates are expressed as , if the order , ( ), then by Planes and ( ) is a rectangular area enclosed in space
[0090]
[0091] Point Set The critical bounding box of Represents the AND relationship of multiple logical expressions. From the definition, we can see that the point set The critical bounding box of is unique.
[0092] ②Extension bounding box of point set: define ① midpoint set The planes where the critical bounding boxes of each surface are located are translated outward to obtain a new set of planes and ( ), the rectangular area they enclose in space
[0093]
[0094] Point Set The extended bounding box of It is called the extended bounding box. The infimum of the coordinate components, It is called the extended bounding box. The supremum of the coordinate components; where Represents the AND relationship of multiple logical expressions. From the definition, we can see that the point set The extended bounding box of is not unique.
[0095] ③ The extended bounding box of the node: In the binary tree of the present invention, the current node The extended bounding box corresponding to the point set contained in the subtree of the root node is also called a node. The extended bounding box of .
[0096] In view of the problems of the prior art, the present invention provides a non-recursive search method for spatial points on a given grid area. Compared with the traditional search method based on alternating direction cutting tree, the binary tree constructed by the present invention is a balanced binary tree, and the average search depth of random spatial points is lower; at the same time, the generalized point neighborhoods with different coordinates do not intersect with each other, which reduces the backtracking frequency in the search process. In the standard C++ programming environment, such as Figure 2 As shown, its implementation process includes the following 8 steps:
[0097] Step S1: Initialize the basic parameters of the balanced binary tree retrieval structure. ① If the dimension of the physical space where the overlapping grid is located is , then declare a signed integer variable As an internal data member of the balanced binary tree, and set its value to , called the generalized ②Declare a signed integer variable Store the total number of volume units of the background grid sub-block on the current processor and make it an internal data member of the balanced binary tree. ③ First calculate the minimum resolution of the volume unit scale of the background grid sub-block on the current processor , then use The specification function is obtained The global minimum of , and finally declare a double-precision floating-point variable , and make it the internal data member of the balanced binary tree; among them, Represents the geometric tolerance of a balanced binary tree, the scale factor is a positive real number much smaller than 1. In the embodiment of the present invention, the empirical value is taken ④ Set the global root node pointer of the binary tree Points to a null address , where the binary tree node declaration is a custom one of the present invention Type, its internal structure will be described in the subsequent step S2.
[0098] Step S2: allocate dynamic memory for internal members in the binary tree structure. Figure 3 The initialization vector composed of the node addresses at each level in the balanced binary tree of the present invention is shown. In the binary tree search structure of the present invention, the node set and the body unit set form a one-to-one mapping. Because according to step S1, the total number of body units of the background grid sub-block on the current processor is , so the vector The length is equal to .exist Figure 3 In the example, the box pointed by the arrow is the type. It describes the binding relationship between each body unit and the binary tree node. During the object construction process, the dynamic memory that needs to be opened includes: ① The index value stored in a signed integer variable , which is consistent with the traversal subscript of the volume unit sequence in the background grid sub-block. ② Generalized coordinate array stored in double-precision floating-point array , its length is the same as the generalized Space Dimension Keep consistent. ③ The lower bound array of the extended bounding box stored in a double-precision floating-point array With the supremum array , their length is equal to ④ The present invention describes each The link relationship between the object and its left and right children, where the pointer variables of the left and right children are and , at the current step, they all point to empty address values .
[0099] Step S3: Calculate the critical bounding box parameters in the background grid unit. The following is an example of the traversal process of the background grid: ① Assume that the number of the current volume unit is , which contains The coordinates of the space grid points are ② Calculate along the three physical coordinate axes in turn The minimum and maximum values of the coordinate components of the space grid points are recorded as , thus forming a space composed of 6 planes The critical bounding box is cut out. At the same time, It can also be regarded as six-dimensional The generalized coordinates in space form a one-to-one mapping relationship with the critical bounding box. ③ Take the vector The subscript is Elements , copy the generalized coordinate components corresponding to the critical bounding box of the current volume unit to Member variables of In the array.
[0100] Step S4: Generate the link relationship of the balanced binary tree node non-recursively. In the current step, you need to Each element in the vector is linked to form a balanced binary tree structure through its left and right child pointers, thus providing data support for the subsequent spatial point retrieval process. Figure 4 The figure shows the link relationship and generation order of each node of the balanced binary tree in the present invention, where the ellipse represents the node of the binary tree, and the internal digital number identifies the node infimum array and supremum array The calculation order of the dotted arrows indicates the process of completing the linking of nodes at all levels of the balanced binary tree through pre-order traversal. In the current step, the present invention combines the sorting algorithm in the C++ standard template library and completes it in a non-recursive form. The elements in the vector are divided layer by layer from top to bottom until all terminal nodes of the binary tree are connected.
[0101] Furthermore, step S4 can be divided into the following four steps:
[0102] Step S41: Declare the register array required for the non-recursive generation process of the balanced binary tree. The pointer type declares a fixed length Register array ② Declare 4 fixed lengths as signed integer types Register array ③ With signed integer register variables Identify the top position of the stack of the above 5 register arrays, The initial value of is set to 0. ④ Initialize the top element of the stack to ; ; ; ; In an embodiment of the present invention, The value of is a constant 32. Combined with the subsequent non-recursive generation steps, it can be seen that the length of each register array can be no less than the depth of the balanced binary tree. , then the maximum total number of nodes in a balanced binary tree on a single processor is , which exceeds the upper limit of the value of a computer signed integer variable, so the length of these register arrays is sufficient.
[0103] Step S42: Declare temporary position identification variables required for the non-recursive generation process of a balanced binary tree. Declare a register variable of pointer type , and set its initial value to be an empty address ②Declare 4 register variables as signed integer types , , , , and set their initial value to -1.
[0104] Step S43: Combination The type of loop pattern non-recursively links the nodes at each level of the balanced binary tree. Here The logical condition for the execution of the loop is the register pointer variable The address value pointed to is not empty or a register variable The value of is not equal to -1 (that is, the register array Non-empty stack). Under this premise, the address value sequence of the generalized point is sorted according to the sorting algorithm of the coordinate components. Perform permutation operations, and complete the calculation of the upper and lower bounding parameters of the extended bounding box of each node of the balanced binary tree and the links between the nodes. The process can be described as follows: when the register pointer variable When the address value of is not empty, execute step S431, otherwise execute step S432. When the loop terminates, the construction process of the balanced binary tree is completed.
[0105] Step S431: Calculate the geometric parameters of the node critical bounding box. ① Extract the current The infimum array of the extended bounding box of the node pointed to by the pointer With the supremum array , along The generalized point subsets are calculated in the directions of the coordinate axes. (Continuous subscript The range is ) and use and Array storage. ② Along The directions of the coordinate axes are and Array tolerance correction, and Updated to and (Continuous subscript The range is ), so that each generalized point contained in the current node and its child nodes becomes an inner point of the extended bounding box of the current node. Here This is the geometric tolerance of the balanced binary tree calculated in step S1. ③ Calculate the cutting direction number of the current node: If the equality condition Established, then let , otherwise let ④ Calculate the right child node parameters and push them into the stack container: If the inequality If true, then first set the register variable The value of is accumulated by 1, and then , , , , ⑤ Calculate the left child node parameters and push them into the stack container: If the inequality If true, then first set the register variable The value of is accumulated by 1, and then , , , , ⑥ Set the variable to a null address value .
[0106] Step S432: Link the current node and its left and right child nodes. , , , along the numbered The coordinate axis direction is based on the generalized point coordinate component The rules from small to large are The generalized point address value contained in the subtree of the root node (Continuous subscript The range is ) to sort. The present invention directly calls the C++ standard template library The generic algorithm completes this sorting process to achieve the optimal combination of quick sort, heap sort, and insertion sort, thereby reducing the time cost of non-recursive generation of a balanced binary tree. ② First, let , then let ③If the equality condition Established, then The left child of the node is linked to The address referred to; otherwise if the equality condition Established, then The right child of the node is linked to ④ Register variable The value of is decremented by 1.
[0107] Step S44: Determine the address pointed to by the global root node pointer of the balanced binary tree. ① Declare a signed integer variable , and let , here the variable The vector defined in step S2 ②Let That is, the identification of the global root node pointer is completed.
[0108] Step S5: Globally reduce the geometric data of the spatial points to be retrieved. For implicit assembly of large-scale overlapping grids, a distributed memory management mode is needed to alleviate data storage pressure and improve the overall geometric analysis speed. Figure 5 The reduction of the query space point to the background grid processor group is shown, where the space points to be retrieved are distributed in processors (starting communication domain ), the background grid sub-blocks are distributed in processors (target communication domain ). The present invention is achieved by The set communication function obtains the union of the spatial points to be retrieved on the starting communication domain , and implement it on the target communication domain Information sharing is used to prepare for subsequent parallel retrieval.
[0109] Step S6: Non-recursively search for contribution units covering the spatial points. On each processor, traverse the sequence of spatial points to be searched obtained by step S5. , check in turn on the current background grid sub-block The existence of the contribution unit of each element in the C++ standard template library is determined and located. ,Add node collector to balanced binary tree structure As a member variable, used to store the overlay The first address of the binary tree node where the critical bounding box of the point is located. The coordinate array is ( is the physical space dimension defined in step S1), then the Non-recursive search of contribution units.
[0110] Step S61: Call Member functions of Clear ;in, Represents a vector container, Represents the clear function, Represents a node address collection container.
[0111] Step S62: Declare a register variable of pointer type , and use Initializes the value of the address pointed to.
[0112] Step S63: Declare the register array required for the binary tree non-recursive traversal process. Pointer type declares a fixed length Register array ② With signed integer register variables Identifies the top position of the stack. The initial value of is -1. In the embodiment of the present invention, consistent with step S41, The value in the current function scope is still the constant 32.
[0113] Step S64: Combination Type loop mode non-recursive search coverage The first address sequence of the binary tree node where the critical bounding box of the point is located, and the result is stored in In. Here The logical condition of the loop execution is a register variable The value is a non-empty address value, or a register variable The value of is not equal to -1. The process can be described as follows: when the register variable When the value of is not a null address value, execute step S641, otherwise execute step S642. At the end of the loop, the The critical bounding box sequence of the points is determined.
[0114] Step S641: Query the nodes to which the critical bounding box of the contributing unit belongs. Points to a non-empty node in a balanced binary tree, then judge The extended bounding box and spatial point of the node pointed to Coverage relationship: If the upper and lower bounds of the extended bounding box and Make the condition and ( ) are both true, then first let the register variable The value is accumulated by 1, and then , and finally The value of is updated to the left child node address pointed to by itself; otherwise, let Points to a null address .
[0115] Step S642: Identify the critical bounding box address covering the known spatial point and push it into the vector sequence: ① Let ②Let register variable The value decreases by 1. ③ Determine the spatial point to be searched and The coverage relationship between the corresponding critical bounding boxes. The physical coordinate array is ,current The generalized coordinates of the corresponding critical bounding box are , combined with the equation conditions in step S1 , if condition ① (Integer number Range of variation ) and condition ② (Integer number Range of variation ) corresponding to inequalities hold simultaneously, then we assume that The corresponding critical bounding box covers the spatial point to be retrieved , at this time will The address value pointed to by the vector Function added to Among them, Function represents the function that adds a data at the end of the array. The value of is updated to the address of the right child node pointed to by itself.
[0116] Step S65: Accurately identify the spatial point to be searched If If it is empty, it does not exist on the background grid sub-block associated with the current processor. Contribution unit, otherwise traverse ,extract The index value of each element (See the binary tree node type in step S2 ), and then according to Iteration method (Newton iteration method) accurately determines the Individual Unit and the spatial point to be retrieved If the volume unit Cover the spatial points to be retrieved , then record the pairing relationship , and jump out of the traversal process.
[0117] Step S7: Return the pairing relationship between the spatial point and the contributing unit. Figure 6 The process of returning and extracting cross-processor pairing query results is shown. According to the direction of data flow, Figure 6 and Figure 5 The starting communication domain and the target communication domain in the are reversed. Figure 6 In the present invention, The set communication function obtains the union of the retrieved point and unit pairing information on the starting communication domain , and implement it on the target communication domain Information is shared, and each processor in the target communication domain extracts the necessary retrieval results based on the matching relationship between the spatial point and the current process.
[0118] Step S8: Release the dynamic memory of internal members in the binary tree structure.
[0119] The application of the present invention can reduce the time cost of parallel assembly of large overlapping grids and improve the computing performance of fluid simulation software.
[0120] As described above, the present invention can be preferably implemented.
[0121] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.
[0122] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. According to the technical essence of the present invention, within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.
Claims
1. A non-recursive retrieval method for spatial points on a given grid area, characterized in that: The following steps are involved: S1, initialize the parameters of the balanced binary tree retrieval structure; S2, opens up dynamic memory for internal members in the binary tree structure; S3, calculating the critical bounding box parameters in the background grid unit; S4, non-recursively generate the link relationship of balanced binary tree nodes; Step S4 includes the following steps: S41, declare the register array required for the non-recursive generation process of the balanced binary tree; wherein the content of the declaration operation includes: ①Binary tree node The pointer type declares a fixed length Register array ; ②Declare 4 fixed-length signed integer types Register array ; ③With signed integer register variables Identify the top position of the stack of the above 5 register arrays, The initial value of is set to 0; ④ Initialize the top element value of the stack in sequence ; ; ; ; ;in, Indicates the total number of volume cells in the background grid sub-block on the current processor; S42, declare temporary location identification variables required for the non-recursive generation process of the balanced binary tree; wherein the content of the declaration operation includes: ①Binary tree node Declare a register variable of pointer type , and let The initial value is an empty address ; ②Declare 4 register variables with signed integer type , , , , and let , , , The initialization value is -1; S43, combined The non-recursive linking pattern of the type of cycle links the nodes at each level of the balanced binary tree; among them, The logical condition for the execution of the loop is: register pointer variable The address value pointed to is not empty or a register variable The value is not equal to -1; under the premise of satisfying the logical conditions for execution, the address value sequence of the generalized point is sorted according to the sorting algorithm of the coordinate components. Perform permutation operations, and complete the calculation of the supremum parameters and infimum parameters of the extended bounding box of each node of the balanced binary tree and the links between the nodes; when When the type loop terminates, the construction process of the balanced binary tree is completed; S44, determining the address pointed to by the global root node pointer of the balanced binary tree; wherein the content of the declaration operation includes: ①Declare a signed integer variable , and let ; ② Order , complete the identification of the global root node pointer; S5, global reduction of geometric data of the spatial points to be retrieved; S6, non-recursive retrieval of contributing units covering spatial points; S7, returns the pairing relationship between the spatial point and the contributing unit.
2. A non-recursive search method for spatial points in a given grid area according to claim 1, characterized in that: In step S1, initialization includes the following operations: S11, declare a signed integer variable As an internal data member of a balanced binary tree, The value is set to ,remember is the generalized The spatial dimension; among them, Indicates the dimension of the physical space where the overlapping grids are located; S12, declare a signed integer variable Stores the total number of cells in the background grid sub-block on the current processor and uses Become an internal data member of a balanced binary tree; S13, first calculate the minimum resolution of the volume unit scale of the background grid sub-block on the current processor ; then use The specification function is obtained The global minimum of ; Finally declare double precision floating point variables , and make Become the internal data member of the balanced binary tree; among them, represents the geometric tolerance of a balanced binary tree, represents the scale factor; S14, declare the binary tree node as custom Type, the global root node pointer of the binary tree Points to a null address .
3. A non-recursive search method for spatial points in a given grid area according to claim 2, characterized in that: In step S2, at each During the object construction process, the dynamic memory that needs to be opened up includes: S21, index value stored in a signed integer variable , Keep consistent with the traversal subscript of the cell sequence in the background grid sub-block; S22, generalized coordinate array stored as double-precision floating-point array , The length and Stay consistent; S23, the infimum array of the extended bounding box stored in a double-precision floating-point array With the supremum array , , The length is equal to ; S24, each The link relationship between the object and its left child and right child; the link relationship is described by a binary linked list, and the pointer variables of the left child and the right child are , , , Both point to empty address values .
4. A non-recursive search method for spatial points in a given grid area according to claim 3, characterized in that: Step S3 includes the following steps: S31, let the number of the volume unit of the current background grid be , Contained Three-dimensional physical coordinate system of spatial grid points Next axis, axis, The axis coordinates are ; S32, along axis, axis, The direction of the axis, calculation The minimum and maximum values of the coordinate components of the space grid points are recorded as , consisting of 6 spatial planes The critical bounding box cut out; Treated as six-dimensional The generalized coordinates in the space form a one-to-one mapping relationship with the critical bounding box; among them, express The coordinate components of the space grid points are The minimum value in the axis direction, express The coordinate components of the space grid points are The minimum value in the axis direction, express The coordinate components of the space grid points are The minimum value in the axis direction, express The coordinate components of the space grid points are The maximum value in the axial direction, express The coordinate components of the space grid points are The maximum value in the axial direction, express The coordinate components of the space grid points are Maximum value in the axis direction; S33, take vector The subscript is Elements , copy the generalized coordinate components corresponding to the critical bounding box of the current volume unit to Member variables of In the array.
5. A non-recursive search method for spatial points in a given grid area according to claim 4, characterized in that: In step S4, Each element in the vector is linked to a balanced binary tree structure through its left child pointer and right child pointer. Each element in the vector is linked to form a balanced binary tree structure through its left child pointer and right child pointer; combined with the sorting algorithm, it is completed in a non-recursive form The elements in the vector are divided layer by layer from top to bottom until all terminal nodes of the binary tree are connected.
6. A non-recursive search method for spatial points in a given grid area according to claim 1, characterized in that: Step S43 includes the following steps: S431, calculating the geometric parameters of the critical bounding box of the node, including the following steps: S4311, extract current The infimum array of the extended bounding box of the node pointed to by the pointer With the supremum array , along The generalized point subsets are calculated in the directions of the coordinate axes. The supremum and infimum of The array stores the infimum, using The array stores the supremum; where ; S4312, along The directions of the coordinate axes are Arrays and The array is corrected for tolerance. and Updated to and , so that each generalized point contained in the current node and its child nodes becomes an inner point of the extended bounding box of the current node; among them, for The first elements, for The first elements, ; S4313, calculate the cutting direction number of the current node: If the equality condition If established, then , otherwise let ; S4314, calculate the right child node parameters and push them into the stack container: if the inequality If true, first set the register variable The value of is accumulated by 1, and then , , , , ; S4315, calculate the left child node parameters and push them into the stack container: if the inequality If true, first set the register variable The value of is accumulated by 1, and then , , , , ; S4316, will Set the variable to a null address value ; S432: Linking the current node and its left child node and right child node, including the following steps: S4321, Order , , , along the numbered The coordinate axis direction is based on the generalized point coordinate component The rules from small to large are The generalized point address value contained in the subtree of the root node Sort by; among them, Indicates the starting number variable, Indicates the termination number variable, Indicates the coordinate axis direction serial number variable, ; S4322, Order ,make ; S4323, if the equality condition If established, The left child of the node is linked to The address referred to; if the equality condition If established, The right child of the node is linked to the address referred to; S4324, register variable Decrease the value of ; S44, determining the address pointed to by the global root node pointer of the balanced binary tree, including the following steps: S441, Declaration of signed integer variable , and let ; S442, Order , complete the identification of the global root node pointer.
7. A non-recursive search method for spatial points in a given grid area according to claim 6, characterized in that: Step S6 includes the following steps: S61, call Member functions of Clear ;in, Represents a vector container, Represents the clear function, Represents a node address collection container; S62, with Declare a register variable of pointer type , and use Points to an address-value pair Initialize; S63, declare the register array required for the binary tree non-recursive traversal process, and the declaration operation includes: ① Pointer type declares a fixed length Register array ; ②With signed integer register variables Identifies the top position of the stack. The initial value of is -1; S64, combined Type loop mode non-recursive search coverage The binary tree node first address sequence where the critical bounding box of the point is located is stored in Among them, Logical condition for loop execution: register variable The value is a non-empty address value, or a register variable The value is not equal to ;when At the end of the loop, the The critical bounding box sequence of the points is determined; S65, identifying the spatial point to be retrieved Contribution unit: If If it is empty, it does not exist on the background grid sub-block associated with the current processor. Contribution unit; otherwise, traverse ,extract The index value of each element , then according to Iteration method determines Individual Unit and the spatial point to be retrieved The coverage relationship; if the volume unit Cover the spatial points to be retrieved , then record the pairing relationship , and jump out of the traversal process; among them, The iteration method represents Newton's iteration method.
8. A non-recursive search method for spatial points in a given grid area according to claim 7, characterized in that: Step S64 includes the following steps: S641, S642; When the loop is executed, the register variable When the value of is a non-empty address value, execute step S641, otherwise execute step S642; Among them, S641 and S642 are: S641, query the nodes to which the critical bounding box of the contributing unit belongs: if Points to a non-empty node in a balanced binary tree, then judge The extended bounding box and spatial point of the node pointed to Covering relationship: If the supremum of the extended bounding box and infimum Make the condition and At the same time, first set the register variable The value is accumulated by 1, and then , and finally The value of is updated to the address of the left child node pointed to by itself; otherwise, let Points to a null address ;in, ; S642, identifying the critical bounding box address covering the known spatial point and pushing it into the vector sequence, including the following steps: S6421, Order ; S6422, register variable Decrement value ; S6423, determine the spatial point to be searched and The coverage relationship between the corresponding critical bounding boxes: The physical coordinate array is , remember the current The generalized coordinates of the corresponding critical bounding box are , combined with the equation conditions in step S1 , if the condition With conditions Corresponding If both inequalities hold, then we think The corresponding critical bounding box covers the spatial point to be retrieved ,Will The address value pointed to by the vector Function added to Among them, , The function represents a function that adds a data at the end of the array; S6424, will The value of is updated to the address of the right child node pointed to by itself.
9. A non-recursive search method for spatial points in a given grid area according to any one of claims 1 to 8, characterized in that: The following steps are also included: S8, releases the dynamic memory of internal members in the binary tree structure.
Citation Information
Patent Citations
Block adaptive type Cartesian grid rapid graph mapping method and system
CN113689556A
Method and system for identifying topological relation between spatial point set and multi-connected grid region
CN116894282A