Page 22 - 中国仿真学会通讯2020第1期
P. 22

C  = (px        +     a) ( pz4       -  pz1 )         +  px( pz2  -  pz3 ) ,
                                                                a2

                        D   = px py( pz3            -  pz2   +     pz1  -     pz4 )  +    a[ px( pz1  -  pz2 )  +  py( pz3  -  pz2 )  -  apz2 ] .
                                                                                               a2

    Based on the equations of the LoS segment kgn                                            3. Algorithm Implementation on GPU
and terrain surface, the simultaneous equation of

intersection points can be derived as                                                                    Because of the parallelism of GPU threads,

                     M(  k  n  )  2  +  Nk       n  +  T    =   0,                           the intervisibility computing in every RSG can be
                            g                    g                                           executed concurrently in a kernel function called

where

M    =  A(  x  n     -  x1n ) ( y2n     -  y  n  )  ,                                        by all threads after computing all of intersection
               2                              1                                              points as formal parameters of the kernel function.
                                                                                             Before executing kernel function, the memories of
N = A[ ( x2n - x1n ) y1n + ( y2n - y1n ) x1n ]                                               these intersection points should be allocated firstly
                                                                                             and then copied to GPU( device end) from CPU
     +  B(  x     n  -  x1n )     +  C(       y  n  -  y1n )    -  (    z  n  -  z1n ) ,     ( host end ) using cudaMalloc function and
                  2                              2                         2                 cudaMemcpy function respectively. Two
                                                                                             parameters described by the symbol of “ < < < > >
T    = Ax1n y1n      +  Bx1n      +  Cy    n  +     D  -    z1n .                            >” indicate the number of blocks and the number
                                           1                                                 of threads per block. The pseudo⁃code of CUDA
                                                                                             parallel implementation of intervisibility algorithm
    The intervisibility of one RSG can be got by                                             is shown in Figure 2.

solving this simultaneous equation. The result is

not  intervisible        when        k  n  ∈     (  0,1   )    and      M = 0∨N2
                                        g

≥4MT while is intervisible in other cases. The

intervisibility of one GCS tile can be acquired by

merging the results of RSGs in this GCS tile.

Similarly, the intervisibility of the LoS can be

acquired by merging the results of GCS tiles either.

                           Fig.2. The pseudo⁃code of CUDA parallel implementation of intervisibility algorithm.

                                                                                                                                                   19
   17   18   19   20   21   22   23   24   25   26   27