示例#1
0
    def compute_cat( self, ret_iw_dir=False ):
        """Compute the Christoffel acoustic tensor, given the incident wave
        direction."""
        opts = self.app_options
        iw_dir = nm.array( opts.incident_wave_dir, dtype = nm.float64 )

        dim = self.problem.get_dim()
        assert_( dim == iw_dir.shape[0] )

        iw_dir = iw_dir / nla.norm( iw_dir )

        if self.cached_christoffel is not None:
            christoffel = self.cached_christoffel

        else:
            coefs = self.eval_homogenized_coefs()
            christoffel = compute_cat( coefs, iw_dir,
                                       self.app_options.dispersion )
            report_iw_cat( iw_dir, christoffel )

            self.cached_christoffel = christoffel

        if ret_iw_dir:
            return christoffel, iw_dir

        else:
            return christoffel