s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
73 lines • 2.44 kB
TypeScript
import type { Satellite } from '../sat';
/**
* # SGP4GPU
*
* ## Description
* A GPU implementation of the SGP4 algorithm.
* Note: After creating the class you must call `await bfGPU.init()`
*
* ## Usage
* ```ts
* const bfGPU = new SGP4GPU(device);
* await bfGPU.init();
* const gpuBufferOut = bfGPU.prepareData({ ... })
* ...
* bfGPU.run(passEncoder)
* passEncoder.end()
* bfGPU.createReadDistBuffer(gpuBufferOut)
* device.queue.submit([commandEncoder.finish()])
* await gpuReadBufferDist.mapAsync(GPUMapMode.READ)
* const resultDist = gpuReadBufferDist.getMappedRange()
* const resultAB = new Float32Array(resultDist)
* ```
*/
export declare class SGP4GPU {
#private;
/** @param device - The GPU device */
constructor(device: GPUDevice);
/** Initialize the GPU */
init(): Promise<void>;
/**
* @param sats - an array of Satellites
* @returns - the distance GPU Buffer incase you want to use it
*/
prepareData(sats: Satellite[]): GPUBuffer;
/**
* Sets the current time for future calculations
* @param tsince - seconds
*/
setTime(tsince: number): void;
/**
* Runner for the GPU
* ```ts
* const commandEncoder = device.createCommandEncoder()
* const passEncoder = commandEncoder.beginComputePass()
* do stuff...
* this.run(passEncoder)
* do stuff...
* passEncoder.end()
* ```
* @param passEncoder - GPUComputePassEncoder
* @param blockSize - number to use as block size on the GPU for parallel computations
*/
run(passEncoder: GPUComputePassEncoder, blockSize?: number): void;
/**
* run this command after sending all instructions to passEncoder but BEFORE submitting to the queue
* ```ts
* const gpuBufferOut = this.prepareData({ ... })
* ...
* this.run(passEncoder)
* passEncoder.end()
* this.createReadDistBuffer(gpuBufferOut)
* device.queue.submit([commandEncoder.finish()])
* await gpuReadBufferDist.mapAsync(GPUMapMode.READ)
* const resultDist = gpuReadBufferDist.getMappedRange()
* const resultAB = new Float32Array(resultDist)
* ```
* @param commandEncoder - GPUCommandEncoder
* @param gpuBufferOut - source GPU Buffer
* @returns - the resultant GPU Buffer
*/
createReadDistBuffer(commandEncoder: GPUCommandEncoder, gpuBufferOut: GPUBuffer): GPUBuffer;
}
//# sourceMappingURL=index.d.ts.map