pyfvcom2.weights_calculator module
- class pyfvcom2.weights_calculator.ExponentialWeightsCalculator
Bases:
WeightsCalculatorExponential weights calculator for different grid bands within a nest
- calculate_weights(n: int, n_bands: int, grid_band_index: int) ndarray
Calculate exponential weights based on the grid band index
- Parameters:
n (int) – Number of nodes/elements
n_bands (int) – Total number of grid bands
grid_band_index (int) – Index of the grid band
- Returns:
Array of weights.
- class pyfvcom2.weights_calculator.LinearWeightsCalculator
Bases:
WeightsCalculatorLinear weights calculator for different grid bands within a nest
- calculate_weights(n: int, n_bands: int, grid_band_index: int) ndarray
Calculate linear weights based on the grid band index
- Parameters:
n (int) – Number of nodes/elements
n_bands (int) – Total number of grid bands
grid_band_index (int) – Index of the grid band
- Returns:
Array of weights.
- class pyfvcom2.weights_calculator.WeightsCalculator
Bases:
object- calculate_weights(n: int, n_bands: int, grid_band_index: int) ndarray
Calculate inverse weights based on the grid band index
- Parameters:
n (int) – Number of nodes/elements
n_bands (int) – Total number of grid bands
grid_band_index (int) – Index of the grid band
- Returns:
Array of weights.
- pyfvcom2.weights_calculator.get_weights_calculator(calculation_method: str) WeightsCalculator
Factory function to get the appropriate WeightsCalculator instance.
- Parameters:
calculation_method (str) – The method of weight calculation (“linear”, “inverse”, “exponential”).
- Returns:
An instance of the corresponding WeightsCalculator subclass.
- Return type:
- Raises:
ValueError – If an unknown calculation method is provided.