Example #1
0
    def get_fargs_eval( self, diff_var = None, chunk_size = None, **kwargs ):
        mat, par1, par2 = self.get_args( **kwargs )
        ap, vg = par1.get_approximation( self.get_current_group(), 'Volume' )

        self.set_data_shape( ap )

        cache = self.get_cache( 'state_in_volume_qp', 0 )
        vec1_qp = cache( 'state', self.get_current_group(), 0,
                         state = par1, get_vector = self.get_vector )
        cache = self.get_cache( 'state_in_volume_qp', 1 )
        vec2_qp = cache( 'state', self.get_current_group(), 0,
                         state = par2, get_vector = self.get_vector )

        if mat.ndim == 1:
            mat = mat[...,nm.newaxis]

        n_el, n_qp, dim, n_ep = self.data_shape

        cache = self.get_cache( 'mat_in_qp', 0 )
        mat_qp = cache( 'matqp', self.get_current_group(), 0,
                       mat = mat, ap = ap,
                       assumed_shapes = [(1, n_qp, 1, 1),
                                        (n_el, n_qp, 1, 1)],
                       mode_in = None )

        mat_qp = fix_mat_qp_shape( mat_qp, chunk_size )

        return (vec1_qp, vec2_qp, mat_qp, vg), (chunk_size, 1, 1, 1), 0
Example #2
0
    def get_fargs_weak( self, diff_var = None, chunk_size = None, **kwargs ):
        mat, virtual, state = self.get_args( **kwargs )
        ap, vg = virtual.get_approximation( self.get_current_group(), 'Volume' )

        self.set_data_shape( ap )
        shape, mode = self.get_shape( diff_var, chunk_size )

        cache = self.get_cache( 'state_in_volume_qp', 0 )
        vec_qp = cache( 'state', self.get_current_group(), 0,
                        state = state, get_vector = self.get_vector )

        if mat.ndim == 1:
            mat = mat[...,nm.newaxis]

        n_el, n_qp, dim, n_ep = self.data_shape

        cache = self.get_cache( 'mat_in_qp', 0 )
        mat_qp = cache( 'matqp', self.get_current_group(), 0,
                       mat = mat, ap = ap,
                       assumed_shapes = [(1, n_qp, 1, 1),
                                        (n_el, n_qp, 1, 1)],
                       mode_in = None )

        mat_qp = fix_mat_qp_shape( mat_qp, chunk_size )

        bf = ap.get_base( 'v', 0, self.integral_name )

        return (vec_qp, bf, mat_qp, vg), shape, mode
Example #3
0
    def prepare_data( self, chunk_size = None, **kwargs ):
        mat, par, mat_shape, mode = self.get_args( **kwargs )
        ap, vg = par.get_approximation( self.get_current_group(), 'Volume' )
        n_el, n_qp, dim, n_ep = ap.get_v_data_shape( self.integral_name )

        cache = self.get_cache( 'mat_in_qp', 0 )
        mat_qp = cache( 'matqp', self.get_current_group(), 0,
                       mat = mat, ap = ap,
                       assumed_shapes = [(1, n_qp) + mat_shape,
                                        (n_el, n_qp) + mat_shape],
                       mode_in = mode )

        mat_qp = fix_mat_qp_shape( mat_qp, chunk_size )
        shape = (chunk_size, 1) + mat_qp.shape[2:]

        return vg, mat_qp, shape
Example #4
0
    def mat_to_qp( self, mat, ap ):
        n_el, n_qp, dim, n_ep = self.data_shape

        mat = nm.asarray( mat )
        if mat.ndim == 0:
            mat = mat[nm.newaxis,nm.newaxis]

        cache = self.get_cache( 'mat_in_qp', 0 )
        mat_qp = cache( 'matqp', self.get_current_group(), 0,
                        mat = mat, ap = ap,
                        assumed_shapes =  [(1, n_qp, 1, 1),
                                           (n_el, n_qp, 1, 1)],
                        mode_in = None )

        mat_qp = fix_mat_qp_shape( mat_qp, n_el )

        return mat_qp