def __call__( self, points ):
        '''Return the global coordinates of the supplied local points.
        '''

        # number of local grid points for each coordinate direction
        # values must range between 0 and 1
        #
        xi, yi, zi = points[:, 0], points[:, 1], points[:, 2]
        print "xi", xi
        print "xi.shape", xi.shape

        # size of total structure
        #
        # @todo: move to class definition of "mushroof_model" and send to "__call__"
        scale_size = self.scale_size
        print "scale_size", scale_size

        # @todo: add "_quarter" (see above)
        length_x_tot = self.length_x * scale_size
        length_y_tot = self.length_y * scale_size
        n_elems_xy_quarter = self.n_elems_xy_quarter

        # distance from origin for each mushroof_part
        #
        def d_origin_fn( self, coords ):
#            if self.mushroof_part == 'quarter':
#                return coords
#            if self.mushroof_part == 'one':
#                return abs( 2.0 * coords - 1.0 )

            if self.mushroof_part == 'detail':
                print 'in d_origin_fn'
                return abs( 1.0 * coords - 0.5 ) * scale_size

#            # @todo: corresponding "scale_factor" needs to be added 
#            #        in order for this to work
#            if self.mushroof_part == 'four':
#                return  where( coords < 0.5, abs( 4 * coords - 1 ), abs( -4 * coords + 3 ) )


        # values are used to calculate the z-coordinate using RBF-function of the quarter
        # (= values of the distance to the origin as absolute value)
        #
        xi_rbf = d_origin_fn( self, xi )
        print 'xi_rbf', xi_rbf
        yi_rbf = d_origin_fn( self, yi )

        # normalized coordinates of the vertices for lower- and upperface
        # NOTE: the underline character indicates a normalized value 
        #
        vl_arr_, vu_arr_ = normalize_rsurfaces( self.vl_arr,
                                                self.vu_arr )

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the lower face
        #
        x_ = vl_arr_[:, 0]

        # flip the orientation of the local coordinate system in the
        # corresponding y-direction depending on the data file
        #
        geo_input_name = self.geo_input_name
        if geo_input_name == '4x4m':
            y_ = vl_arr_[:, 1]
        else:
            y_ = 1 - vl_arr_[:, 1]

        z_ = vl_arr_[:, 2]
        rbf = Rbf( x_, y_, z_, function = 'cubic' )

        # get the z-value at the supplied local grid points
        # of the lower face
        #
        zi_lower_ = rbf( xi_rbf, yi_rbf )

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the upper face
        #
        x_ = vu_arr_[:, 0]

        # flip the orientation of the local coordinate system in the
        # corresponding y-direction depending on the data file
        #
        geo_input_name = self.geo_input_name
        if geo_input_name == '4x4m':
            y_ = vu_arr_[:, 1]
        else:
            y_ = 1 - vu_arr_[:, 1]

        z_ = vu_arr_[:, 2]
        rbf = Rbf( x_, y_, z_, function = 'cubic' )

        # get the z-value at the supplied local grid points
        # of the upper face
        # 
        # note that zi_upper_ is a normalized coordinate!
        #
        zi_upper_ = rbf( xi_rbf, yi_rbf )

        # thickness is multiplied by the supplied zi coordinate
        #
        z_ = ( zi_lower_ + ( zi_upper_ - zi_lower_ ) * zi / self.delta_h_scalefactor ) * self.delta_h_scalefactor

        # coordinates of origin
        #
        X, Y, Z = self.X0

        print '--- geometric transformation done ---'

        # multiply the local grid points with the real dimensions in order to obtain the 
        # global coordinates of the mushroof_part:
        #
        return c_[ X + xi * length_x_tot, Y + yi * length_y_tot, Z + z_ * self.length_z ]
    def __call__( self, points ):
        '''Return the global coordinates of the supplied local points.
        '''

        # number of local grid points for each coordinate direction
        # values must range between 0 and 1

        Xc, Yc, Zc = self.center

        Xi, Yi, Zi = points[:, 0] - Xc, points[:, 1] - Yc, points[:, 2] - Zc

        sxi, syi = sign( Xi ), sign( Yi )
        xi, yi, zi = fabs( Xi ), fabs( Yi ), Zi

        # normalized coordinates of the vertices for lower- and upperface
        # NOTE: the underline character indicates a normalized value 
        vl_arr_, vu_arr_ = normalize_rsurfaces( self.vl_arr,
                                                self.vu_arr )

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the lower face
        x_ = vl_arr_[:, 0] * self.length_x

        # for file 'upperface02.robj' and 'lowerface02.robj' the 
        # orientation of the local coordinate system in the
        # corresponding y-direction needs to be fliped
        # e.g. y_ = 1 - vl_arr_[:, 1]
        # for the file 'upperface_4x4m.robj' and 'lowerface_4x4m.robj'
        # this is not the case!
        #
        y_ = vl_arr_[:, 1] * self.length_y

        z_ = vl_arr_[:, 2] * self.length_z

        rbf = Rbf( x_, y_, z_, function = 'cubic' )
        # get the z-value at the supplied local grid points
        # of the lower face
        zi_lower_ = rbf( xi, yi )

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the upper face
        x_ = vu_arr_[:, 0] * self.length_x

        # flip the orientation of the local coordinate system in the
        # corresponding y-direction 
        # for file 'upperface02.robj' and 'lowerface02.robj' the 
        # orientation of the local coordinate system in the
        # corresponding y-direction needs to be fliped
        # e.g. y_ = 1 - vl_arr_[:, 1]
        # for the file 'upperface_4x4m.robj' and 'lowerface_4x4m.robj'
        # this is not the case!
        #
        y_ = vu_arr_[:, 1] * self.length_y

        z_ = vu_arr_[:, 2] * self.length_z

        rbf = Rbf( x_, y_, z_, function = 'cubic' )
        # get the z-value at the supplied local grid points
        # of the upper face
        zi_upper_ = rbf( xi, yi )

        # thickness is multiplied by the supplied zi coordinate
        z_ = zi_lower_ + ( zi_upper_ - zi_lower_ ) * zi

        # multiply the local grid points with the real dimensions in order to obtain the 
        # global coordinates of the structure:
        #
        Xi, Yi, Zi = sxi * xi, syi * yi, z_ # * self.length_z
        return c_[ Xi + Xc, Yi + Yc , Zi + Zc  ]
Example #3
0
 def _get_vu_arr_(self):
     vl_arr_, vu_arr_ = normalize_rsurfaces(self.vl_arr, self.vu_arr)
     return vu_arr_
def get_mid_surface_and_thickness( hp_shell, points, perpendicular_t = True ):
    '''Return the global coordinates of the supplied local points.
    '''
    print '*** get mid surface and thickness ***'

    #-----------------------------------------------
    # get the global coordinates as defined in the 
    # input file and transform them to the coordinate
    # system of the master quarter
    #-----------------------------------------------

    # 
    if hp_shell.geo_input_name == '350x350cm':
#        X0 = [3.50, 3.50, 0.]
        X0 = [0., 0., 0.]
    else:
        X0 = [0., 0., 0.]

    # number of global grid points for each coordinate direction
    #
    xi, yi = points[:, 0] - X0[0], points[:, 1] - X0[1]

    # NOTE:
    # -- The available rbf-function is only defined for a quarter of one shell.
    # in order to get z and t values for an entire shell the abs-function 
    # is used. The coordinate system of the quarter must be defined in the 
    # lower left corner; the coordinate systemn of the entire one shell must 
    # be defined in the center of the shell so that the coordinate system
    # for the master quarter remains unchanged. 
    # -- The transformation is performed based on the defined class attributes
    # of hp_shell_stb: length_xy_quarter, length_xy_quarter, length_z, delta_h, scalefactor_delta_h
    # characterizing the properties of the master quarter 

    # number of local grid points for each coordinate direction
    # values must range between 0 and 1
    #         
    points_tilde_list = []
    for i_row in range( points.shape[0] ):
        # get the x, y coordinate pair defined in the input 
        # file in global coordinates
        #
        x = xi[i_row]
        y = yi[i_row]

        # transform values to local coordinate system, 
        # i.e. move point to the 'master roof' containing the 
        # global coordinate system:
        #
        if x <= hp_shell.length_xy_quarter and y <= hp_shell.length_xy_quarter:
            # point lays in first (master) roof 
            #
            x_tilde = x
            y_tilde = y

        elif x >= hp_shell.length_xy_quarter and y <= hp_shell.length_xy_quarter:
            # point lays in second roof:
            #
            # roof length = 2* length of the master quarter
            # (e.g. 2*4,0m = 8,00m for obj-file "4x4m")
            x_tilde = x - 2 * hp_shell.length_xy_quarter
            y_tilde = y

        elif x <= hp_shell.length_xy_quarter and y >= hp_shell.length_xy_quarter:
            # point lays in third roof:
            #
            x_tilde = x
            y_tilde = y - 2 * hp_shell.length_xy_quarter

        elif x >= hp_shell.length_xy_quarter and y >= hp_shell.length_xy_quarter:
            # point lays in fourth roof:
            #
            x_tilde = x - 2 * hp_shell.length_xy_quarter
            y_tilde = y - 2 * hp_shell.length_xy_quarter

        points_tilde_list.append( [x_tilde, y_tilde] )

    points_tilde_arr = array( points_tilde_list, dtype = 'float_' )
    xi_tilde = points_tilde_arr[:, 0]
    yi_tilde = points_tilde_arr[:, 1]
    #        print 'points_tilde_arr', points_tilde_arr


    xi_ = abs( xi_tilde ) / hp_shell.length_xy_quarter
    yi_ = abs( yi_tilde ) / hp_shell.length_xy_quarter

    #-----------------------------------------------
    # get the normalized rbf-function for the upper 
    # and lower face of the master quarter
    #-----------------------------------------------
    # NOTE: the underline character indicates a normalized value 

    # normalized coordinates of the vertices for lower- and upper-face
    #
    vl_arr_, vu_arr_ = normalize_rsurfaces( hp_shell.vl_arr,
                                            hp_shell.vu_arr )

    # use a radial basis function approximation (rbf) (i.e. interpolation of
    # scattered data) based on the normalized vertex points of the lower face
    #
    x_ = vl_arr_[:, 0]
    y_ = vl_arr_[:, 1]

    if hp_shell.geo_input_name == '350x350cm':
        x_ = 1 - vl_arr_[:, 0]

    z_l_ = vl_arr_[:, 2]
    rbf_l = Rbf( x_, y_, z_l_, function = 'cubic' )

    # get the z-value at the supplied local grid points
    # of the lower face
    #
    zi_lower_ = rbf_l( xi_, yi_ )

    # use a radial basis function approximation (rbf) (i.e. interpolation of
    # scattered data) based on the normalized vertex points of the upper face
    #
    x_ = vu_arr_[:, 0]
    y_ = vu_arr_[:, 1]

    if hp_shell.geo_input_name == '350x350cm':
        x_ = 1 - vu_arr_[:, 0]

    z_u_ = vu_arr_[:, 2]
    rbf_u = Rbf( x_, y_, z_u_ , function = 'cubic' )

    # get the z-value at the supplied local grid points
    # of the upper face 
    #
    zi_upper_ = rbf_u( xi_, yi_ )

    # approach of the slope to get thickness perpendicular to slope
    #
    # thickness is multiplied by the supplied zi coordinate
    # and z value of mid plane
    #
    t_ = zi_upper_ - zi_lower_

    z_middle_ = ( zi_lower_ + ( zi_upper_ - zi_lower_ ) * 0.5 / hp_shell.scalefactor_delta_h ) * hp_shell.scalefactor_delta_h

    if perpendicular_t == True:
        # delta shift of x and y for estimation of slope will be done in 4 direction
        # 0, 45, 90 and 135 degrees 
        print "--- perpendicular ---"
        delta = 0.000001

        # shift in x

        dz_x_p_ = ( rbf_u( xi_ + delta, yi_ ) + rbf_l( xi_ + delta, yi_ ) ) / 2.0
        dz_x_m_ = ( rbf_u( xi_ - delta, yi_ ) + rbf_l( xi_ - delta, yi_ ) ) / 2.0

        slope_x_ = ( dz_x_p_ - dz_x_m_ ) / ( 2.0 * delta )
        angle_x = arctan( slope_x_ * hp_shell.length_z / hp_shell.length_xy_quarter )
        f_1 = cos( angle_x )

        # shift in y 

        dz_y_p_ = ( rbf_u( xi_, yi_ + delta ) + rbf_l( xi_, yi_ + delta ) ) / 2.0
        dz_y_m_ = ( rbf_u( xi_, yi_ - delta ) + rbf_l( xi_, yi_ - delta ) ) / 2.0

        slope_y_ = ( dz_y_p_ - dz_y_m_ ) / ( 2.0 * delta )
        angle_y = arctan( slope_y_ * hp_shell.length_z / hp_shell.length_xy_quarter )
        f_2 = cos( angle_y )

        #shift +x +y; -x -y

        dz_x_p_y_p_ = ( rbf_u( xi_ + delta, yi_ + delta ) + rbf_l( xi_ + delta, yi_ + delta ) ) / 2.0
        dz_x_m_y_m_ = ( rbf_u( xi_ - delta, yi_ - delta ) + rbf_l( xi_ - delta, yi_ - delta ) ) / 2.0

        slope_x_p_y_p_ = ( dz_x_p_y_p_ - dz_x_m_y_m_ ) / ( 2.0 * sqrt( 2 ) * delta )
        angle_x_p_y_p = arctan( slope_x_p_y_p_ * hp_shell.length_z /
                                   ( hp_shell.length_xy_quarter ** 2 + hp_shell.length_xy_quarter ** 2 ) ** 0.5 )
        f_3 = cos( angle_x_p_y_p )

        # shift in +x,-y ; -x and +y

        dz_x_p_y_m_ = ( rbf_u( xi_ + delta, yi_ - delta ) + rbf_l( xi_ + delta, yi_ - delta ) ) / 2.0
        dz_x_m_y_p_ = ( rbf_u( xi_ - delta, yi_ + delta ) + rbf_l( xi_ - delta, yi_ + delta ) ) / 2.0

        slope_x_p_y_m_ = ( dz_x_p_y_m_ - dz_x_m_y_p_ ) / ( sqrt( 2 ) * 2.0 * delta )
        angle_x_p_y_m = arctan( slope_x_p_y_m_ * hp_shell.length_z /
                               ( hp_shell.length_xy_quarter ** 2 + hp_shell.length_xy_quarter ** 2 ) ** 0.5 )
        f_4 = cos( angle_x_p_y_m )

        # obtain minimum factor for good estimate of maximum slope

        factor = min( [f_1, f_2, f_3, f_4], axis = 0 )
        t_ = t_ * factor

    return  xi, yi, z_middle_ * hp_shell.length_z, t_ * hp_shell.length_z
Example #5
0
    def get_mid_surface_and_thickness(self, points, perpendicular_t=True):
        '''Return the global coordinates of the supplied local points.
        '''
        print '*** get mid surface and thickness ***'

        #-----------------------------------------------
        # get the global coordinates as defined in the
        # input file and transform them to the coordinate
        # system of the master quarter
        #-----------------------------------------------

        #
        if self.geo_input_name == '350x350cm':
            X0 = [3.50, 3.50, 0.]
        else:
            X0 = [0., 0., 0.]

        # number of global grid points for each coordinate direction
        #
        xi, yi = points[:, 0] - X0[0], points[:, 1] - X0[1]

        # NOTE:
        # -- The available rbf-function is only defined for a quarter of one shell.
        # in order to get z and t values for an entire shell the abs-function
        # is used. The coordinate system of the quarter must be defined in the
        # lower left corner; the coordinate systemn of the entire one shell must
        # be defined in the center of the shell so that the coordinate system
        # for the master quarter remains unchanged.
        # -- The transformation is performed based on the defined class attributes
        # of hp_shell_stb: length_x, length_y, length_z, delta_h, delta_h_scalefactor
        # characterizing the properties of the master quarter

        # number of local grid points for each coordinate direction
        # values must range between 0 and 1
        #
        points_tilde_list = []
        for i_row in range(points.shape[0]):
            # get the x, y coordinate pair defined in the input
            # file in global coordinates
            #
            x = xi[i_row]
            y = yi[i_row]

            # transform values to local coordinate system,
            # i.e. move point to the 'master roof' containing the
            # global coordinate system:
            #
            if x <= self.length_x and y <= self.length_y:
                # point lays in first (master) roof
                #
                x_tilde = x
                y_tilde = y

            elif x >= self.length_x and y <= self.length_y:
                # point lays in second roof:
                #
                # roof length = 2* length of the master quarter
                # (e.g. 2*4,0m = 8,00m for obj-file "4x4m")
                x_tilde = x - 2 * self.length_x
                y_tilde = y

            elif x <= self.length_x and y >= self.length_y:
                # point lays in third roof:
                #
                x_tilde = x
                y_tilde = y - 2 * self.length_y

            elif x >= self.length_x and y >= self.length_y:
                # point lays in fourth roof:
                #
                x_tilde = x - 2 * self.length_x
                y_tilde = y - 2 * self.length_y

            points_tilde_list.append([x_tilde, y_tilde])

        points_tilde_arr = array(points_tilde_list, dtype='float_')
        xi_tilde = points_tilde_arr[:, 0]
        yi_tilde = points_tilde_arr[:, 1]
        #        print 'points_tilde_arr', points_tilde_arr

        xi_ = abs(xi_tilde) / self.length_x
        yi_ = abs(yi_tilde) / self.length_y

        #-----------------------------------------------
        # get the normalized rbf-function for the upper
        # and lower face of the master quarter
        #-----------------------------------------------
        # NOTE: the underline character indicates a normalized value

        # normalized coordinates of the vertices for lower- and upper-face
        #
        vl_arr_, vu_arr_ = normalize_rsurfaces(self.vl_arr, self.vu_arr)

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the lower face
        #
        x_ = vl_arr_[:, 0]
        y_ = vl_arr_[:, 1]

        if self.geo_input_name == '350x350cm':
            x_ = 1 - vl_arr_[:, 0]

        z_l_ = vl_arr_[:, 2]
        rbf_l = Rbf(x_, y_, z_l_, function='cubic')

        # get the z-value at the supplied local grid points
        # of the lower face
        #
        zi_lower_ = rbf_l(xi_, yi_)

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the upper face
        #
        x_ = vu_arr_[:, 0]
        y_ = vu_arr_[:, 1]

        if self.geo_input_name == '350x350cm':
            x_ = 1 - vu_arr_[:, 0]

        z_u_ = vu_arr_[:, 2]
        rbf_u = Rbf(x_, y_, z_u_, function='cubic')

        # get the z-value at the supplied local grid points
        # of the upper face
        #
        zi_upper_ = rbf_u(xi_, yi_)

        # approach of the slope to get thickness perpendicular to slope
        #
        # thickness is multiplied by the supplied zi coordinate
        # and z value of mid plane
        #
        t_ = zi_upper_ - zi_lower_

        z_middle_ = (zi_lower_ + (zi_upper_ - zi_lower_) * 0.5 /
                     self.delta_h_scalefactor) * self.delta_h_scalefactor

        if perpendicular_t == True:
            # delta shift of x and y for estimation of slope will be done in 4 direction
            # 0, 45, 90 and 135 degrees
            print "--- perpendicular ---"
            delta = 0.000001

            # shift in x

            dz_x_p_ = (rbf_u(xi_ + delta, yi_) + rbf_l(xi_ + delta, yi_)) / 2.0
            dz_x_m_ = (rbf_u(xi_ - delta, yi_) + rbf_l(xi_ - delta, yi_)) / 2.0

            slope_x_ = (dz_x_p_ - dz_x_m_) / (2.0 * delta)
            angle_x = arctan(slope_x_ * self.length_z / self.length_x)
            f_1 = cos(angle_x)

            # shift in y

            dz_y_p_ = (rbf_u(xi_, yi_ + delta) + rbf_l(xi_, yi_ + delta)) / 2.0
            dz_y_m_ = (rbf_u(xi_, yi_ - delta) + rbf_l(xi_, yi_ - delta)) / 2.0

            slope_y_ = (dz_y_p_ - dz_y_m_) / (2.0 * delta)
            angle_y = arctan(slope_y_ * self.length_z / self.length_x)
            f_2 = cos(angle_y)

            #shift +x +y; -x -y

            dz_x_p_y_p_ = (rbf_u(xi_ + delta, yi_ + delta) +
                           rbf_l(xi_ + delta, yi_ + delta)) / 2.0
            dz_x_m_y_m_ = (rbf_u(xi_ - delta, yi_ - delta) +
                           rbf_l(xi_ - delta, yi_ - delta)) / 2.0

            slope_x_p_y_p_ = (dz_x_p_y_p_ - dz_x_m_y_m_) / (2.0 * sqrt(2) *
                                                            delta)
            angle_x_p_y_p = arctan(slope_x_p_y_p_ * self.length_z /
                                   (self.length_x**2 + self.length_y**2)**0.5)
            f_3 = cos(angle_x_p_y_p)

            # shift in +x,-y ; -x and +y

            dz_x_p_y_m_ = (rbf_u(xi_ + delta, yi_ - delta) +
                           rbf_l(xi_ + delta, yi_ - delta)) / 2.0
            dz_x_m_y_p_ = (rbf_u(xi_ - delta, yi_ + delta) +
                           rbf_l(xi_ - delta, yi_ + delta)) / 2.0

            slope_x_p_y_m_ = (dz_x_p_y_m_ - dz_x_m_y_p_) / (sqrt(2) * 2.0 *
                                                            delta)
            angle_x_p_y_m = arctan(slope_x_p_y_m_ * self.length_z /
                                   (self.length_x**2 + self.length_y**2)**0.5)
            f_4 = cos(angle_x_p_y_m)

            # obtain minimum factor for good estimate of maximum slope

            factor = min([f_1, f_2, f_3, f_4], axis=0)
            t_ = t_ * factor

        return xi, yi, z_middle_ * self.length_z, t_ * self.length_z
Example #6
0
 def _get_vu_arr_(self):
     vl_arr_, vu_arr_ = normalize_rsurfaces(self.vl_arr, self.vu_arr)
     return vu_arr_
Example #7
0
    def __call__(self, points):
        '''Return the global coordinates of the supplied local points.
        '''

        # number of local grid points for each coordinate direction
        # values must range between 0 and 1
        #
        xi, yi, zi = points[:, 0], points[:, 1], points[:, 2]
        print "xi", xi
        print "xi.shape", xi.shape

        # size of total structure
        #
        # @todo: move to class definition of "mushroof_model" and send to "__call__"
        scale_size = self.scale_size
        print "scale_size", scale_size

        # @todo: add "_quarter" (see above)
        length_x_tot = self.length_x * scale_size
        length_y_tot = self.length_y * scale_size
        n_elems_xy_quarter = self.n_elems_xy_quarter

        # distance from origin for each mushroof_part
        #
        def d_origin_fn(self, coords):
            #            if self.mushroof_part == 'quarter':
            #                return coords
            #            if self.mushroof_part == 'one':
            #                return abs( 2.0 * coords - 1.0 )

            if self.mushroof_part == 'detail':
                print 'in d_origin_fn'
                return abs(1.0 * coords - 0.5) * scale_size


#            # @todo: corresponding "scale_factor" needs to be added
#            #        in order for this to work
#            if self.mushroof_part == 'four':
#                return  where( coords < 0.5, abs( 4 * coords - 1 ), abs( -4 * coords + 3 ) )

# values are used to calculate the z-coordinate using RBF-function of the quarter
# (= values of the distance to the origin as absolute value)
#

        xi_rbf = d_origin_fn(self, xi)
        print 'xi_rbf', xi_rbf
        yi_rbf = d_origin_fn(self, yi)

        # normalized coordinates of the vertices for lower- and upperface
        # NOTE: the underline character indicates a normalized value
        #
        vl_arr_, vu_arr_ = normalize_rsurfaces(self.vl_arr, self.vu_arr)

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the lower face
        #
        x_ = vl_arr_[:, 0]

        # flip the orientation of the local coordinate system in the
        # corresponding y-direction depending on the data file
        #
        geo_input_name = self.geo_input_name
        if geo_input_name == '4x4m':
            y_ = vl_arr_[:, 1]
        else:
            y_ = 1 - vl_arr_[:, 1]

        z_ = vl_arr_[:, 2]
        rbf = Rbf(x_, y_, z_, function='cubic')

        # get the z-value at the supplied local grid points
        # of the lower face
        #
        zi_lower_ = rbf(xi_rbf, yi_rbf)

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the upper face
        #
        x_ = vu_arr_[:, 0]

        # flip the orientation of the local coordinate system in the
        # corresponding y-direction depending on the data file
        #
        geo_input_name = self.geo_input_name
        if geo_input_name == '4x4m':
            y_ = vu_arr_[:, 1]
        else:
            y_ = 1 - vu_arr_[:, 1]

        z_ = vu_arr_[:, 2]
        rbf = Rbf(x_, y_, z_, function='cubic')

        # get the z-value at the supplied local grid points
        # of the upper face
        #
        # note that zi_upper_ is a normalized coordinate!
        #
        zi_upper_ = rbf(xi_rbf, yi_rbf)

        # thickness is multiplied by the supplied zi coordinate
        #
        z_ = (zi_lower_ + (zi_upper_ - zi_lower_) * zi /
              self.delta_h_scalefactor) * self.delta_h_scalefactor

        # coordinates of origin
        #
        X, Y, Z = self.X0

        print '--- geometric transformation done ---'

        # multiply the local grid points with the real dimensions in order to obtain the
        # global coordinates of the mushroof_part:
        #
        return c_[X + xi * length_x_tot, Y + yi * length_y_tot,
                  Z + z_ * self.length_z]
Example #8
0
    def __call__(self, points):
        '''Return the global coordinates of the supplied local points.
        '''

        # number of local grid points for each coordinate direction
        # values must range between 0 and 1

        Xc, Yc, Zc = self.center

        Xi, Yi, Zi = points[:, 0] - Xc, points[:, 1] - Yc, points[:, 2] - Zc

        sxi, syi = sign(Xi), sign(Yi)
        xi, yi, zi = fabs(Xi), fabs(Yi), Zi

        # normalized coordinates of the vertices for lower- and upperface
        # NOTE: the underline character indicates a normalized value
        vl_arr_, vu_arr_ = normalize_rsurfaces(self.vl_arr, self.vu_arr)

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the lower face
        x_ = vl_arr_[:, 0] * self.length_x

        # for file 'upperface02.robj' and 'lowerface02.robj' the
        # orientation of the local coordinate system in the
        # corresponding y-direction needs to be fliped
        # e.g. y_ = 1 - vl_arr_[:, 1]
        # for the file 'upperface_4x4m.robj' and 'lowerface_4x4m.robj'
        # this is not the case!
        #
        y_ = vl_arr_[:, 1] * self.length_y

        z_ = vl_arr_[:, 2] * self.length_z

        rbf = Rbf(x_, y_, z_, function='cubic')
        # get the z-value at the supplied local grid points
        # of the lower face
        zi_lower_ = rbf(xi, yi)

        # use a radial basis function approximation (rbf) (i.e. interpolation of
        # scattered data) based on the normalized vertex points of the upper face
        x_ = vu_arr_[:, 0] * self.length_x

        # flip the orientation of the local coordinate system in the
        # corresponding y-direction
        # for file 'upperface02.robj' and 'lowerface02.robj' the
        # orientation of the local coordinate system in the
        # corresponding y-direction needs to be fliped
        # e.g. y_ = 1 - vl_arr_[:, 1]
        # for the file 'upperface_4x4m.robj' and 'lowerface_4x4m.robj'
        # this is not the case!
        #
        y_ = vu_arr_[:, 1] * self.length_y

        z_ = vu_arr_[:, 2] * self.length_z

        rbf = Rbf(x_, y_, z_, function='cubic')
        # get the z-value at the supplied local grid points
        # of the upper face
        zi_upper_ = rbf(xi, yi)

        # thickness is multiplied by the supplied zi coordinate
        z_ = zi_lower_ + (zi_upper_ - zi_lower_) * zi

        # multiply the local grid points with the real dimensions in order to obtain the
        # global coordinates of the structure:
        #
        Xi, Yi, Zi = sxi * xi, syi * yi, z_  # * self.length_z
        return c_[Xi + Xc, Yi + Yc, Zi + Zc]