示例#1
0
 def test_gui_csv_02(self):
     """tests solid_bending_multi_node.txt"""
     csv_filename = os.path.join(MODEL_PATH, 'solid_bending',
                                 'solid_bending_multi_node.txt')
     with self.assertRaises(ValueError):
         load_deflection_csv(csv_filename)  # bad shape
     load_csv(csv_filename)
示例#2
0
    def _load_deflection_force(self,
                               out_filename,
                               is_deflection=False,
                               is_force=False):
        out_filename_short = os.path.basename(out_filename)
        A, nids_index, fmt_dict, headers = load_deflection_csv(out_filename)
        #nrows, ncols, fmts
        header0 = headers[0]
        result0 = A[header0]
        nrows = result0.shape[0]

        nnodes = self.gui.nnodes
        if nrows != nnodes:
            #'nrows=%s nnodes=%s' % (nrows, self.gui.nnodes)
            self.log.warning(
                'The deflection CSV has %i rows, but there are %i nodes in the model.'
                "  Verify that the result is for the correct model and that it's "
                'not an elemental result.' % (nrows, nnodes))
            A = _resize_array(A, nids_index, self.gui.node_ids, nrows, nnodes)

        result_type = 'node'
        self._add_cases_to_form(A,
                                fmt_dict,
                                headers,
                                result_type,
                                out_filename_short,
                                update=True,
                                is_scalar=False,
                                is_deflection=is_deflection,
                                is_force=is_force)
示例#3
0
    def test_gui_deflection_csv_01b(self):
        """tests solid_bending_multi_deflection_node.txt with deflection loader"""
        csv_filename = os.path.join(MODEL_PATH, 'solid_bending',
                                    'solid_bending_multi_deflection_node.txt')
        A, nids_index, fmt_dict, headers = load_deflection_csv(csv_filename)
        result_type = 'node'

        header0 = headers[0]
        unused_result0 = A[header0]
        #nrows = result0.shape[0]
        #assert nrows == self.nnodes, 'nrows=%s nnodes=%s' % (nrows, self.nnodes)
        header = header0
        islot = 0
        with self.assertRaises(RuntimeError):
            create_res_obj(islot,
                           headers,
                           header,
                           A,
                           fmt_dict,
                           result_type,
                           dim_max=1.0,
                           xyz_cid0=None,
                           is_deflection=False,
                           is_force=False)

        create_res_obj(islot,
                       headers,
                       header,
                       A,
                       fmt_dict,
                       result_type,
                       dim_max=1.0,
                       xyz_cid0=None,
                       is_deflection=True,
                       is_force=False)
示例#4
0
    def _load_deflection_force(self, out_filename, is_deflection=False, is_force=False):
        out_filename_short = os.path.basename(out_filename)
        A, fmt_dict, headers = load_deflection_csv(out_filename)
        #nrows, ncols, fmts
        header0 = headers[0]
        result0 = A[header0]
        nrows = result0.shape[0]

        assert nrows == self.gui.nnodes, 'nrows=%s nnodes=%s' % (nrows, self.gui.nnodes)
        result_type = 'node'
        self._add_cases_to_form(A, fmt_dict, headers, result_type,
                                out_filename_short, update=True, is_scalar=False,
                                is_deflection=is_deflection, is_force=is_force)
示例#5
0
    def test_gui_deflection_csv_01b(self):
        """tests solid_bending_multi_deflection_node.txt with deflection loader"""
        csv_filename = os.path.join(MODEL_PATH, 'solid_bending',
                                    'solid_bending_multi_deflection_node.txt')
        A, fmt_dict, headers = load_deflection_csv(csv_filename)
        result_type = 'node'

        header0 = headers[0]
        result0 = A[header0]
        nrows = result0.shape[0]
        #assert nrows == self.nnodes, 'nrows=%s nnodes=%s' % (nrows, self.nnodes)
        header = header0
        islot = 0
        create_res_obj(islot,
                       headers,
                       header,
                       A,
                       fmt_dict,
                       result_type,
                       dim_max=1.0,
                       xyz_cid0=None)