예제 #1
0
 def test_is_binary(self):
     bdf_filename = os.path.join(pkg_path, '..', 'models', 'solid_bending',
                                 'solid_bending.bdf')
     op2_filename = os.path.join(pkg_path, '..', 'models', 'solid_bending',
                                 'solid_bending.op2')
     self.assertTrue(is_binary(op2_filename))
     self.assertFalse(is_binary(bdf_filename))
예제 #2
0
    def read_cart3d(self, infilename, result_names=None):
        """extracts the points, elements, and Cp"""
        self.infilename = infilename
        self.log.info("---starting reading cart3d file...%r---" % self.infilename)

        self.infilename = infilename
        if is_binary(infilename):
            #print "***is_binary"
            self.infile = open(infilename, 'rb')
            (self.nPoints, self.nElements) = self.read_header_binary()
            points = self.read_points_binary(self.nPoints)
            elements = self.read_elements_binary(self.nElements)
            regions = self.read_regions_binary(self.nElements)
            loads = {}
        else:
            self.infile = open(infilename, 'r')
            self.read_header_ascii()
            points = self.read_points_ascii()
            elements = self.read_elements_ascii(bypass=False)
            regions = self.read_regions_ascii(bypass=False)
            loads = self.read_results_ascii(0, self.infile, result_names=result_names)

        self.infile.close()
        self.log.info("nPoints=%s  nElements=%s" % (self.nPoints, self.nElements))
        self.log.info("---finished reading cart3d file...%r---" % self.infilename)
        assert self.nPoints > 0, 'nPoints=%s' % self.nPoints
        assert self.nElements > 0, 'nElements=%s' % self.nElements
        return (points, elements, regions, loads)
예제 #3
0
    def read_stl(self, stl_filename):
        self.infilename = stl_filename
        self.log.info("---starting reading STL file...%r---" % self.infilename)

        if is_binary(stl_filename):
            self.log.debug("***is_binary")
            aaa
            self.infile = open(stl_filename, 'rb')
            (self.nPoints, self.nElements) = self.read_header_binary()
            points = self.read_points_binary(self.nPoints)
            elements = self.read_elements_binary(self.nElements)
            regions = self.read_regions_binary(self.nElements)
            loads = {}
        else:
            self.infile = open(stl_filename, 'r')
            self.read_ascii()

        self.infile.close()
        #self.log.info("nPoints=%s  nElements=%s" % (self.nPoints, self.nElements))
        self.log.info("---finished reading STL file...%r---" % self.infilename)
예제 #4
0
 def test_is_binary(self):
     self.assertTrue(is_binary(abspath("test_utils.pyc")))
     self.assertFalse(is_binary(abspath("test_utils.py")))