From e6d766366045a1fab09d5c160b169379a4b0ecfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Wed, 14 Dec 2016 21:09:47 +0200 Subject: [PATCH] Little progress in objective approach to the general scattering problem. Former-commit-id: b5775d0d4deab4c41986b28762364932d1815299 --- qpms/lattices.py | 53 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/qpms/lattices.py b/qpms/lattices.py index 94abed2..aaf2dbe 100644 --- a/qpms/lattices.py +++ b/qpms/lattices.py @@ -1,13 +1,16 @@ ''' Object oriented approach for the classical multiple scattering problem. ''' - import numpy as np +import time +import scipy +import sys from qpms_c import * # TODO be explicit about what is imported -from .qpms_p import * # TODO be explicit about what is imported +from .qpms_p import nelem2lMax # TODO be explicit about what is imported -class Scatterers(object): +class Scattering(object): ''' + This is the most general class for a system of scatterers in a non-lossy homogeneous background to be solved with the multiple_scattering method. The scatterers, @@ -22,6 +25,50 @@ class Scatterers(object): the object can be recycled for many incident field shapes at the given frequency. + Attributes should be perhaps later redefined to be read-only + (or make descriptors for them). + + Args: + positions: (N,3)-shaped real array + TMatrices: (N,2,nelem,2,nelem)-shaped array + k_0 (float): Wave number for the space between scatterers. + + Attributes: + positions: + TMatrices: + k_0 (float): Wave number for the space between scatterers. + lMax (int): Absolute maximum l for all scatterers. Depending on implementation, + lMax can be smaller for some individual scatterers in certain subclasses. + prepared (bool): Keeps information whether the interaction matrix has + already been built and factorized. + ''' + def __init__(self, positions, TMatrices, k_0, lMax = None, verbose=False): + self.positions = positions + self.TMatrices = TMatrices + self.k_0 = k_0 + self.lMax = lMax ? lMax : nelem2lMax(TMatrices.shape[-1]) + self.prepared = False + + def prepare(self, keep_interaction_matrix = False, verbose=False): + if not self.prepared: + if not self.interaction_matrix: + self.build_interaction_matrix(verbose=verbose) + self.lupiv = scipy.linalg_lu_factor(interaction_matrix) + if not keep_interaction_matrix: + self.interaction_matrix = None + self.prepared = True + + def build_interaction_matrix(verbose = False): + pass + + def scatter(pq_0_c, verbose = False): + self.prepare(verbose=verbose) + + + pass + + +