Esempio n. 1
0
    def init_data( self, key, ckey, **kwargs ):
        state, = self.get_args( **kwargs )

        n_el, n_qp = state.get_data_shapes( ckey )[:2]
        shape = (n_el, n_qp, 1, 1)

#        print self.name, key, ig, shape
        DataCache.init_data( self, key, ckey, shape )
Esempio n. 2
0
    def init_data(self, key, ckey, term, **kwargs):
        state, = self.get_args( **kwargs )

        region_name, ig = term.get_current_group()[1:]
        n_fa, n_qp = state.get_data_shapes(term.integral, ig, region_name)[:2]
        shape = (n_fa, n_qp, state.n_components, 1)

        DataCache.init_data( self, key, ckey, shape )
Esempio n. 3
0
    def init_data(self, key, ckey, term, **kwargs):
        state, = self.get_args( **kwargs )

        n_el, n_qp, dim = state.get_data_shapes(term.integral, ckey[-1])[:3]
        shape = (n_el, n_qp, dim, dim)

#        print self.name, key, ckey, shape
        DataCache.init_data( self, key, ckey, shape )
Esempio n. 4
0
    def init_data(self, key, ckey, term, **kwargs):
        state, aux = self.get_args( **kwargs )

        n_el, n_qp = state.get_data_shapes(term.integral, ckey[-1])[:2]
        shape = (n_el, n_qp, state.n_components, 1)

#        print self.name, key, ckey, shape
        DataCache.init_data( self, key, ckey, shape )
Esempio n. 5
0
    def init_data( self, key, ckey, **kwargs ):
        state, aux = self.get_args( **kwargs )

        n_el, n_qp, dim = state.get_data_shapes( ckey )[:3]
        sym = dim * (dim + 1) / 2
        shape = (n_el, n_qp, sym, 1)

#        print self.name, key, ckey, shape
        DataCache.init_data( self, key, ckey, shape )
Esempio n. 6
0
    def init_data( self, key, ckey, **kwargs ):
        state, = self.get_args( **kwargs )
        n_fa, n_qp = state.get_data_shapes( ckey, kind = 'Surface' )[:2]
        shape = (n_fa, n_qp, state.dpn, 1)

        DataCache.init_data( self, key, ckey, shape )
Esempio n. 7
0
    def init_data( self, key, ckey, **kwargs ):
        mat, ap, assumed_shapes, mode_in = self.get_args( **kwargs )
        if mode_in is None:
            if mat.ndim == 3:
                ig = ckey[1]
                rshape = ap.region.shape[ig]
                if rshape.n_vertex == rshape.n_cell:
                    msg = ('cannot determine mode_in! (%d nodes, %d cells ' +
                           'material data shape: %s)') \
                           % (rshape.n_vertex, rshape.n_cell, mat.shape)
                    raise ValueError( msg )
                if mat.shape[0] == rshape.n_vertex:
                    mode_in = 'vertex'
                elif mat.shape[0] == rshape.n_cell:
                    mode_in = 'element_avg'
                else:
                    msg = ('cannot determine mode_in! (%d nodes, %d cells ' +
                           'material data shape: %s)') \
                           % (rshape.n_vertex, rshape.n_cell, mat.shape)
                    raise ValueError( msg )
            elif mat.ndim == 2:
                ashape = assumed_shapes[0]
                if ashape[2:] != mat.shape:
                    mode_in = 'vertex'
                else:
                    mode_in = 'const'
            else:
                raise ValueError

        shape = None
        for ashape in assumed_shapes:
            if ashape[0] == 1:
                if ashape[1] == 1:
                    mode_out = 'const'
                else:
                    mode_out = 'const_in_qp'
            else:
                if ashape[1] == 1:
                    mode_out = 'variable'
                else:
                    mode_out = 'variable_in_qp'

            if mode_in == 'const':
                shape = ashape
                break
            elif mode_in == 'element_avg':
                if mode_out in ['variable_in_qp', 'variable']:
                    shape = ashape
                    break
            elif mode_in == 'vertex':
                if mode_out in ['variable_in_qp']:
                    shape = ashape
                    break

        if shape is None:
            raise ValueError

        self.mode_in[ckey] = mode_in
        self.mode_out[ckey] = mode_out
        self.shape[ckey] = shape
        DataCache.init_data( self, key, ckey, shape )
Esempio n. 8
0
    def init_data( self, key, ckey, **kwargs ):
        shape = (1, 1, 1, 1)

        DataCache.init_data( self, key, ckey, shape )