magneticalc.Backend_CUDA.Backend_CUDA

# ``magneticalc`.`Backend_CUDA`.`Backend_CUDA``

class documentation

`class Backend_CUDA:`

Constructor: `Backend_CUDA(field_type, distance_limit, length_scale, dc, ...)`

View In Hierarchy

Implements the Biot-Savart law for calculating the magnetic flux density (B-field) and vector potential (A-field). Backend: JIT + CUDA.

Static Method | `worker` | Applies the Biot-Savart law for calculating the magnetic flux density (B-field) or vector potential (A-field) for all sampling volume points.
Method | `__init__` | Initializes the class attributes.
Method | `get_result` | Calculates the field at every point of the sampling volume.
Instance Variable | `_current_elements` | Undocumented
Instance Variable | `_dc` | Undocumented
Instance Variable | `_distance_limit` | Undocumented
Instance Variable | `_field_type` | Undocumented
Instance Variable | `_length_scale` | Undocumented
Instance Variable | `_progress_callback` | Undocumented
Instance Variable | `_sampling_volume_permeabilities` | Undocumented
Instance Variable | `_sampling_volume_points` | Undocumented

@staticmethod
@cuda.jit
def worker(field_type: `int`, distance_limit: `float`, length_scale: `float`, element_centers: `np.ndarray`, element_directions: `np.ndarray`, sampling_volume_points: `np.ndarray`, sampling_volume_permeabilities: `np.ndarray`, field_vectors: `np.ndarray`, total_calculations: `np.ndarray`, total_skipped_calculations: `np.ndarray`):

Applies the Biot-Savart law for calculating the magnetic flux density (B-field) or vector potential (A-field) for all sampling volume points.

Parameters
field_type: `int` | Field type
distance_limit: `float` | Distance limit (mitigating divisions by zero)
length_scale: `float` | Length scale (m)
element_centers: `np.ndarray` | Ordered list of current elements centers
element_directions: `np.ndarray` | Ordered list of current elements directions
sampling_volume_points: `np.ndarray` | Sampling volume points
sampling_volume_permeabilities: `np.ndarray` | Ordered list of sampling volume's relative permeabilities µ_r
field_vectors: `np.ndarray` | Field vectors (output array)
total_calculations: `np.ndarray` | Total number of calculations (output array)
total_skipped_calculations: `np.ndarray` | Total number of skipped calculations (output array)

def __init__(self, field_type: `int`, distance_limit: `float`, length_scale: `float`, dc: `float`, current_elements: `np.ndarray`, sampling_volume_points: `np.ndarray`, sampling_volume_permeabilities: `np.ndarray`, progress_callback: `Callable`):

Initializes the class attributes.

Parameters
field_type: `int` | Field type
distance_limit: `float` | Distance limit (mitigating divisions by zero)
length_scale: `float` | Length scale (m)
dc: `float` | Wire current (A)
current_elements: `np.ndarray` | Ordered list of current elements (pairs: [element center, element direction])
sampling_volume_points: `np.ndarray` | Ordered list of sampling volume points
sampling_volume_permeabilities: `np.ndarray` | Ordered list of sampling volume's relative permeabilities µ_r
progress_callback: `Callable` | Progress callback

def get_result(self) -> `tuple[int, int, np.ndarray] | None`:

Calculates the field at every point of the sampling volume.

Returns
`tuple[int, int, np.ndarray] | None` | (Total # of calculations, total # of skipped calculations, field) if successful, None if interrupted

_current_elements =

Undocumented

_dc =

Undocumented

_distance_limit =

Undocumented

_field_type =

Undocumented

_length_scale =

Undocumented

_progress_callback =

Undocumented

_sampling_volume_permeabilities =

Undocumented

_sampling_volume_points =

Undocumented