A recursive search method for spatial points on a given grid area

By building a balanced binary tree search structure in implicit assembly of large-scale overlapping grids, the rapid pairing of spatial points and contribution units is achieved, solving the problem of low retrieval efficiency in the existing technology, and significantly improving the speed of numerical simulation of flow fields.

CN119358464BActive Publication Date: 2025-03-21CALCULATION AERODYNAMICS INST CHINA AERODYNAMICS RES & DEV CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411935669.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-03-21
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The prior art has the problem of low retrieval efficiency in large-scale overlapping grid implicit assembly, especially in a multiprocessor environment, which leads to a long time for automatic hole digging, affecting the speed of numerical simulation of the flow field.

Method used

A recursive search method of spatial points on a given grid area is adopted to quickly pair space points and contributing units by building a balanced binary tree search structure. The method includes initializing the balanced binary tree parameters, calculating critical bounding box parameters, recursively constructing the binary tree structure, global regulation of the spatial point data to be retrieved, recursively retrieving the contribution unit covering the spatial point, and returning the pairing relationship between the spatial point and the contribution unit.

Benefits of technology

By building a balanced binary tree structure, the difference in tree retrieval depth on different processors is reduced, the synchronization wait time and backtracking frequency is reduced, and the automatic hole digging time across processors is significantly reduced, thereby improving the numerical simulation speed of non-constant flow field of computational fluid mechanics software under multi-body separation conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119358464B_ABST
    Figure CN119358464B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of computational fluid dynamics and computational geometry, and discloses a recursive retrieval method for a spatial point on a given grid area, comprising the following steps: S1, initializing the parameters of a balanced binary tree retrieval structure; S2, opening up a dynamic memory of internal members in the binary tree structure; S3, calculating critical bounding box parameters in background grid body units; S4, recursively constructing the link relationship of balanced binary tree nodes; S5, globally reducing the geometric data of the spatial point to be retrieved; S6, recursively retrieving the contribution units covering the spatial point; S7, returning the pairing relationship between the spatial point and the contribution unit. The present invention solves the problems of low retrieval efficiency in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of computational fluid dynamics and computational geometry, and in particular to a 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 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 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, recursively construct the link relationship of the balanced binary tree nodes;

[0012] S5, global reduction of geometric data of the spatial points to be retrieved;

[0013] S6, recursively retrieve the contributing units covering the 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 form 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 recursively 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 a binary tree recursive generation function without a return type and its parameter list: Suppose the binary tree recursive generation function is called , The input parameters are: ① Subtree root node pointer ;② The generalized point subset elements contained in the node are The starting subscript in ③ The generalized point subset elements contained in the node are The end subscript in ④ Decomposition direction number of the node's extended bounding box ; The form of the binary tree recursive generation function is:

[0032] ;

[0033] S42, Initialization A parameter list of In the global root node pointer The initial value is the empty address , the contents of the initialization operation include: ① Passed by reference to The first parameter of ;②Order parameter and The values ​​are 0 and ;③Set the decomposition direction number of the global root node's extended bounding box The value is 0; For vector Total length;

[0034] S43, establishing a link relationship between nodes at each level of the balanced binary tree.

[0035] As a preferred technical solution, in step S43, if the condition If established, Return, otherwise continue to execute step S431 to step S434 and then jump out of the current recursion;

[0036] Step S43 includes the following steps:

[0037] S431, along the root node The decomposition direction of the extended bounding box is based on the coordinate components of the generalized point element The rules from small to large are currently The generalized point element address value contained in the object Sort by; among them, ;

[0038] S432, define a signed integer register variable For use in sequence Mark the median element on The root node parameters The value of ;

[0039] S433, calculate the root node of the current subtree The upper and lower bounds of the extended bounding box: along coordinate axis directions, respectively calculate the current The point elements contained in the object The coordinate components of The infimum of Supremum ;in, for The first elements, for The first elements, is the geometric tolerance of the balanced binary tree calculated in step S1, , ;

[0040] S434, establish a link relationship between the current subtree and its next-level subtree: define a signed integer register variable , if the cutting direction number of the extended bounding box of the current subtree node is Satisfy the equality condition , then let Otherwise, , the cutting direction number of the extended bounding box of the next level subtree root node is ; Among them, for the generation of the left subtree, The first parameter value is set to the current root node The left child pointer , the second parameter is set to , the third parameter is set to , the fourth parameter is set to ;②For the generation of the right subtree, The first parameter value is set to the current root node The right child pointer , the second parameter is set to , the third parameter is set to , the fourth parameter is set to .

[0041] As a preferred technical solution, step S6 includes the following steps:

[0042] S61, call Member functions of Clear ;in, Represents a vector container, Represents the clear function, Represents a node address collection container;

[0043] S62, in The spatial points to be retrieved are passed in the function one by one The first address of the coordinate array and the global root node of the binary tree Pointer, recursive search coverage The binary tree node first address sequence where the critical bounding box of the point is located is stored in middle;

[0044] S63, identifying the spatial point to be retrieved Contribution unit: If the balanced binary tree 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 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.

[0045] As a preferred technical solution, recursive search covers The binary tree node first address sequence of the critical bounding box of the point includes the following steps:

[0046] S621, if the current root node If it is a non-empty node, then the spatial point to be retrieved is determined and The coverage relationship between the corresponding critical bounding boxes: The physical coordinate array is , current root node parameters The generalized coordinates of the corresponding critical bounding box are , combined with the equality condition , 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;

[0047] S622, if the current root node The left child pointer is a non-null pointer, and The infimum of the extended bounding box of the corresponding node Supremum Make the condition and conditions If both are true, the recursive function is called. , The first parameter value is still the spatial point to be retrieved The first address of the physical coordinate array , the first parameter value is the current root node The left child pointer ;in, ;

[0048] S623, if the current root node Right child pointer is a non-null pointer, and The infimum of the extended bounding box of the corresponding node Supremum Make the condition and conditions If both are true, the recursive function is called. , The first parameter value is still the spatial point to be retrieved The first address of the physical coordinate array , the first parameter value is the current root node The right child pointer ;in, .

[0049] As a preferred technical solution, the method further comprises the following steps:

[0050] S8, releases the dynamic memory of internal members in the binary tree structure.

[0051] Compared with the prior art, the present invention has the following beneficial effects:

[0052] In the parallel assembly process of large-scale overlapping grids, the recursive retrieval model of spatial points in a given grid area is able to more 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 overall 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

[0053] Figure 1 It is a schematic diagram of the wall distance criterion for implicit hole digging with overlapping grids;

[0054] Figure 2 It is a schematic diagram of the recursive retrieval process of a spatial point on a given grid area;

[0055] 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;

[0056] Figure 4 It is a schematic diagram of the link relationship and generation order of each node of a balanced binary tree;

[0057] Figure 5 It is a schematic diagram of the protocol of the background grid processor group to be queried spatial point;

[0058] Figure 6 It is a schematic diagram of the process of returning and extracting cross-processor pairing query results. DETAILED DESCRIPTION

[0059] 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.

[0060] Example 1

[0061] like Figures 1 to 6 As shown in the figure, the present invention discloses a recursive search method for spatial points on a given grid area. According to the execution order, it is divided into two 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 recursively constructed in combination with the sorting algorithm 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.

[0062] Definitions of terms used in this invention:

[0063] ① 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

[0064]

[0065] 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.

[0066] ②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

[0067]

[0068] 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.

[0069] ③ 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 .

[0070] In view of the problems existing in the prior art, the present invention provides a 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:

[0071] 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 cells 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 cell 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, represents the scale factor. 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.

[0072] Step S2: allocate dynamic memory for internal members in the binary tree structure. Figure 3The 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 In the attached Figure 3 In the example, the box pointed by the arrow is the type. It is composed of data that 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 .

[0073] 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.

[0074] Step S4: recursively construct the link relationship of each subtree of the balanced binary tree. In the current step, it is necessary 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 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.

[0075] Furthermore, step S4 can be divided into the following three steps:

[0076] Step S41: Declare a binary tree recursive generation function without a return type and its parameter list. Suppose the binary tree recursive generation function is named , its input parameters are: ① subtree root node pointer (reference pointer transfer);② The generalized point subset elements contained in the node are The starting subscript in (Signed integer value transfer); ③ The generalized point subset elements contained in the node are The end subscript in (Signed integer value transfer);④ Decomposition direction number of the node's extended bounding box (Signed integer value is passed). Therefore, the form of this binary tree recursive generation function is

[0077] .

[0078] Step S42: Initialization The parameter list of In the global root node pointer The initial value is the empty address In the current step, ① Passed by reference to The first parameter of ,②Let the formal parameter and The values ​​are 0 and ( For vector ③ Set the decomposition direction number of the global root node's extended bounding box The value is 0. Here That is, the geometric tolerance of the balanced binary tree calculated in step S1.

[0079] Step S43: Establish the link relationship between nodes at all levels of the balanced binary tree. Established, then Return immediately, otherwise continue to execute steps S431 to S434 and then jump out of the current recursion.

[0080] Step S431: along the root node The decomposition direction of the extended bounding box is based on the coordinate components of the generalized point element The rules from small to large are currently The generalized point element address value contained in the object (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 the recursive construction process of the balanced binary tree.

[0081] Step S432: Define a signed integer register variable For use in sequence Mark the median element on The root node parameters The value of .

[0082] Step S433: Calculate the root node of the current subtree The upper and lower bounds of the extended bounding box. coordinate axis directions, respectively calculate the current The point elements contained in the object (Continuous subscript The range is ) The infimum of Supremum , (subscript The range is ). The present invention directly calls the C++ standard template library and The generic algorithm completes this calculation process. In particular, in order to ensure that the generalized coordinates corresponding to each node of the binary tree are the inner points of the extended bounding box, it is necessary to calculate the lower bound array With the supremum array Tolerance correction: ① Each Corrected to (Subscript The range is ); ② Each Corrected to (Subscript The range is ).here That is, the geometric tolerance of the balanced binary tree calculated in step S1.

[0083] Step S434: Establish a link relationship between the current subtree and its next-level subtree. Define a signed integer register variable , if the cutting direction number of the extended bounding box of the current subtree node is Satisfy the equality condition , then let , otherwise let , the cutting direction number of the extended bounding box of the next-level subtree root node determined by this is ① For the generation of the left subtree, The first parameter value is set to the current root node The left child pointer , the second parameter is set to , the third parameter is set to , the fourth parameter is set to ② For the generation of the right subtree, The first parameter value is set to the current root node The right child pointer , the second parameter is set to , the third parameter is set to , the fourth parameter is set to .

[0084] 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 diagram shows the reduction of the query space point to the background grid processor group, 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.

[0085] Step S6: Recursively search the 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 Declare the existence of the contribution unit of each element in and locate it. Declare a binary tree recursive query function without a return type and its parameter list. Suppose the recursive function is named Its input parameters are: ① The first address of the physical coordinate array of the spatial point to be retrieved (Double-precision floating-point pointer value transfer); ②Subtree root node pointer (Pointer value passing). Therefore, this recursive function form is expressed as . Combined with the vector container in the C++ Standard Template Library ,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 Recursive search of contribution units.

[0086] Step S61: Call Member functions of Clear ;in, Represents a vector container, Represents the clear function, Represents a node address collection container.

[0087] Step S62: The spatial points to be retrieved are passed in the function one by one The first address of the coordinate array and the global root node of the binary tree Pointer, according to step S621 to step S623 recursively 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 middle.

[0088] Step S621: If the current root node is a non-empty node, then determine the spatial point to be retrieved and The coverage relationship between the corresponding critical bounding boxes. The physical coordinate array is , current root node parameters 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 a function that performs the operation of adding a data at the end of the array.

[0089] Step S622: If the current root node Left child pointer is a non-null pointer, and The infimum of the extended bounding box of the corresponding node Supremum Condition ① (Integer number Range of variation ② (Integer number Range of variation ) are both true, then the recursive function is called , its first parameter value is still the spatial point to be retrieved The first address of the physical coordinate array , the first parameter value is the current root node Left child pointer .

[0090] Step S623: If the current root node Right child pointer is a non-null pointer, and The infimum of the extended bounding box of the corresponding node Supremum Condition ① (Integer number Range of variation ② (Integer number Range of variation ) are both true, then the recursive function is called , its first parameter value is still the spatial point to be retrieved The first address of the physical coordinate array , the first parameter value is the current root node Right child pointer .

[0091] Step S63: Accurately identify the spatial point to be searched If the balanced binary tree 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.

[0092] Step S7: Return the pairing relationship between the spatial point and the contributing unit. Figure 6 The following figure shows the process of returning and extracting cross-processor pairing query results. 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.

[0093] Step S8: Release the dynamic memory of internal members in the binary tree structure.

[0094] 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.

[0095] As described above, the present invention can be preferably implemented.

[0096] 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.

[0097] 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 recursive search 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, recursively construct the link relationship of the balanced binary tree nodes; S5, global reduction of geometric data of the spatial points to be retrieved; S6, recursively retrieve the contributing units covering the spatial points; S7, returns the pairing relationship between the spatial point and the contributing unit; Step S4 includes the following steps: S41, declare a binary tree recursive generation function without a return type and its parameter list: Suppose the binary tree recursive generation function is called , The input parameters are: ① Subtree root node pointer ;② The generalized point subset elements contained in the node are The starting subscript in ; ③ The generalized point subset elements contained in the node are The end subscript in ④ Decomposition direction number of the extended bounding box of the node ; The form of the binary tree recursive generation function is: ; in, Represents the binary tree node address vector; S42, Initialization A parameter list of In the global root node pointer The initial value is the empty address , the contents of the initialization operation include: ① Passed by reference to The first parameter of ;②Order parameter and The values ​​are 0 and ;③Set the decomposition direction number of the global root node's extended bounding box The value is 0; For vector Total length; S43, establishing a link relationship between nodes at all levels of the balanced binary tree; In step S43, if the condition If established, Return, otherwise continue to execute step S431 to step S434 and then jump out of the current recursion; Step S43 includes the following steps: S431, along the root node The decomposition direction of the extended bounding box is based on the coordinate components of the generalized point element The rules from small to large are currently The generalized point element address value contained in the object Sort by; among them, ; S432, define a signed integer register variable For use in sequence Mark the median element on The root node parameters The value of ; S433, calculate the root node of the current subtree The upper and lower bounds of the extended bounding box: along coordinate axis directions, respectively calculate the current The point elements contained in the object The coordinate components of The infimum of Supremum ;in, for The first elements, for The first elements, is the geometric tolerance of the balanced binary tree calculated in step S1, , ; S434, establish a link relationship between the current subtree and its next-level subtree: define a signed integer register variable , if the cutting direction number of the extended bounding box of the current subtree node is Satisfy the equality condition , then let Otherwise, , the cutting direction number of the extended bounding box of the next level subtree root node is ; Among them, for the generation of the left subtree, The first parameter value is set to the current root node The left child pointer , the second parameter is set to , the third parameter is set to , the fourth parameter is set to ;②For the generation of the right subtree, The first parameter value is set to the current root node The right child pointer , the second parameter is set to , the third parameter is set to , the fourth parameter is set to .

2. A recursive search method for spatial points on 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 a double-precision floating-point variable , 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 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 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 recursive search method for spatial points on a given grid area according to claim 4, characterized in that: In step S4, Each element in the vector is linked to form 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 recursively 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 recursive search method for spatial points on a given grid area according to claim 5, 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, in The function passes the spatial points to be retrieved in sequence The first address of the coordinate array and the global root node of the binary tree Pointer, recursive search coverage The binary tree node first address sequence where the critical bounding box of the point is located is stored in middle; S63, identifying the spatial point to be retrieved Contribution unit: If the balanced binary tree 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 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.

7. A recursive search method for spatial points on a given grid area according to claim 6, characterized in that: Recursive search coverage The binary tree node first address sequence of the critical bounding box of the point includes the following steps: S621, if the current root node If it is a non-empty node, then the spatial point to be retrieved is determined and The coverage relationship between the corresponding critical bounding boxes: The physical coordinate array is , current root node parameters The generalized coordinates of the corresponding critical bounding box are , combined with the equality condition , 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; S622, if the current root node The left child pointer is a non-null pointer, and The infimum of the extended bounding box of the corresponding node Supremum Make the condition and conditions If both are true, the recursive function is called. , The first parameter value is still the spatial point to be retrieved The first address of the physical coordinate array , the first parameter value is the current root node The left child pointer ;in, ; S623, if the current root node Right child pointer is a non-null pointer, and The infimum of the extended bounding box of the corresponding node Supremum Make the condition and conditions If both are true, the recursive function is called. , The first parameter value is still the spatial point to be retrieved The first address of the physical coordinate array , the first parameter value is the current root node The right child pointer ;in, .

8. A recursive search method for spatial points in a given grid area according to any one of claims 1 to 7, 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

  • Balanced binary tree-based method for detecting collisions in large-scale virtual environment

    CN101593366A

  • Non-recursive high-performance construction method of balanced binary tree

    CN113326271A