当前位置: 首页>>代码示例>>Python>>正文


Python BDF.get_bdf_stats方法代码示例

本文整理汇总了Python中pyNastran.bdf.bdf.BDF.get_bdf_stats方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.get_bdf_stats方法的具体用法?Python BDF.get_bdf_stats怎么用?Python BDF.get_bdf_stats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyNastran.bdf.bdf.BDF的用法示例。


在下文中一共展示了BDF.get_bdf_stats方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_write_1

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import get_bdf_stats [as 别名]
    def test_write_1(self):
        """
        Tests 1 read method and various write methods
        """
        model = BDF(log=log, debug=False)

        bdf_name = os.path.join(test_path, 'test_mass.dat')
        model.read_bdf(bdf_name)
        model.write_bdf(os.path.join(test_path, 'test_mass1a.out'), size=8)
        model.write_bdf(os.path.join(test_path, 'test_mass2a.out'), size=8)
        msg = model.get_bdf_stats(return_type='list')
        # print('\n'.join(msg))

        model.write_bdf(os.path.join(test_path, 'test_mass1b.out'), size=8, interspersed=False)
        model.write_bdf(os.path.join(test_path, 'test_mass2b.out'), size=8, interspersed=True)
        os.remove(os.path.join(test_path, 'test_mass1a.out'))
        os.remove(os.path.join(test_path, 'test_mass2a.out'))
        os.remove(os.path.join(test_path, 'test_mass1b.out'))
        os.remove(os.path.join(test_path, 'test_mass2b.out'))
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:21,代码来源:test_read_write.py

示例2: run_fem1

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import get_bdf_stats [as 别名]
def run_fem1(fem1, bdf_model, mesh_form, xref, punch, sum_load, size, is_double, cid,
             encoding=None):
    """
    Reads/writes the BDF

    Parameters
    ----------
    fem1 : BDF()
        The BDF object
    bdf_model : str
        The root path of the bdf filename
    mesh_form : str {combined, separate}
        'combined' : interspersed=True
        'separate' : interspersed=False
    xref : bool
        The xref mode
    punch : bool
        punch flag
    sum_load : bool
        static load sum flag
    size : int, {8, 16}
        size flag
    is_double : bool
        double flag
    cid : int / None
        cid flag
    """
    assert os.path.exists(bdf_model), print_bad_path(bdf_model)
    try:
        if '.pch' in bdf_model:
            fem1.read_bdf(bdf_model, xref=False, punch=True, encoding=encoding)
        else:
            fem1.read_bdf(bdf_model, xref=False, punch=punch, encoding=encoding)
            #fem1.geom_check(geom_check=True, xref=False)
            fem1.write_skin_solid_faces('skin_file.bdf', size=16, is_double=False)
            if xref:
                #fem1.uncross_reference()
                fem1.cross_reference()
                fem1._xref = True
                spike_fem = read_bdf(fem1.bdf_filename, encoding=encoding)

                remake = False
                if remake:
                    log = fem1.log
                    fem1.save('model.obj')
                    fem1.save('model.obj', unxref=False)
                    fem1.write_bdf('spike_out.bdf')
                    fem1.get_bdf_stats()

                    fem1 = BDF()
                    fem1.load('model.obj')
                    fem1.write_bdf('spike_in.bdf')
                    fem1.log = log
                    fem1.get_bdf_stats()

                    fem1.cross_reference()
                    #fem1.get_bdf_stats()
                    fem1._xref = True

                #fem1.geom_check(geom_check=True, xref=True)
                #fem1.uncross_reference()
                #fem1.cross_reference()
    except:
        print("failed reading %r" % bdf_model)
        raise
    #fem1.sumForces()

    if fem1._auto_reject:
        out_model = bdf_model + '.rej'
    else:
        out_model = bdf_model + '_out'
        if cid is not None and xref:
            fem1.resolve_grids(cid=cid)

        if mesh_form == 'combined':
            fem1.write_bdf(out_model, interspersed=False, size=size, is_double=is_double)
        elif mesh_form == 'separate':
            fem1.write_bdf(out_model, interspersed=False, size=size, is_double=is_double)
        else:
            msg = "mesh_form=%r; allowedForms=['combined','separate']" % mesh_form
            raise NotImplementedError(msg)
        #fem1.writeAsCTRIA3(out_model)

    fem1._get_maps()
    return out_model, fem1
开发者ID:marcinch18,项目名称:pyNastran,代码行数:87,代码来源:test_bdf.py

示例3: example1

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import get_bdf_stats [as 别名]
def example1():
    """
    Example 1: Read/Write - Level 2
    """
    # this example will demonstate:
    #  - reading the BDF
    #  - getting some basic information
    #  - writing the BDF

    # our model
    import pyNastran
    pkg_path = pyNastran.__path__[0]
    test_path = os.path.join(pkg_path, '..', 'models', 'solid_bending')
    bdf_filename = os.path.join(test_path, 'solid_bending.bdf')

    # instantiate the model
    from pyNastran.bdf.bdf import BDF
    model = BDF()
    model.read_bdf(bdf_filename)

    # print information about the model
    print(model.get_bdf_stats())

    ## ---BDF Statistics---
    ## SOL 101
    ##
    ## bdf.loads[1]
    ##   FORCE:   23
    ##
    ## bdf.loads[2]
    ##   LOAD:    1
    ##
    ## bdf.params
    ##   PARAM    : 2
    ##
    ## bdf.nodes
    ##   GRID     : 72
    ##
    ## bdf.elements
    ##   CTETRA   : 186
    ##
    ## bdf.properties
    ##   PSOLID   : 1
    ##
    ## bdf.materials
    ##   MAT1     : 1
    ##
    ## bdf.coords
    ##   CORD2R   : ???

    # write the file
    bdf_filename_out = os.path.join(test_path, 'solid_bending_out.bdf')
    model.write_bdf(bdf_filename_out)

    # looking at the output
    print(file_slice(bdf_filename_out, 94, 100))
    ## GRID          71         .500008 1.61116      3.
    ## GRID          72         .500015 1.00001      3.
    ## $ELEMENTS_WITH_PROPERTIES
    ## PSOLID         1       1
    ## CTETRA         1       1       8      13      67      33
    ## CTETRA         2       1       8       7      62      59

    # write the file with large field format; double precision
    bdf_filename_out2 = os.path.join(test_path, 'solid_bending_out2.bdf')
    model.write_bdf(bdf_filename_out2, size=16, is_double=False)
    print(file_slice(bdf_filename_out2, 166, 175))
    ## GRID*                 71                         .500008         1.61116
    ## *                     3.
    ## GRID*                 72                         .500015         1.00001
    ## *                     3.
    ## $ELEMENTS_WITH_PROPERTIES
    ## PSOLID         1       1
    ## CTETRA         1       1       8      13      67      33
    ## CTETRA         2       1       8       7      62      59
    ## CTETRA         3       1       8      45      58      66

    # write the file with large field format; double precision
    bdf_filename_out3 = os.path.join(test_path, 'solid_bending_out3.bdf')
    model.write_bdf(bdf_filename_out3, size=16, is_double=True)
    print(file_slice(bdf_filename_out3, 166, 175))
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:83,代码来源:bdf_doc.py

示例4: load_nastran_geometry

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import get_bdf_stats [as 别名]
    def load_nastran_geometry(self, bdf_filename, dirname):
        self.eidMap = {}
        self.nidMap = {}
        #print('bdf_filename=%r' % bdf_filename)
        #key = self.caseKeys[self.iCase]
        #case = self.resultCases[key]

        #skipReading = self.removeOldGeometry(bdfFileName)
        #if skipReading:
            #return
        if bdf_filename is None or bdf_filename is '':
            #self.grid = vtk.vtkUnstructuredGrid()
            #self.gridResult = vtk.vtkFloatArray()
            #self.emptyResult = vtk.vtkFloatArray()
            #self.vectorResult = vtk.vtkFloatArray()
            #self.grid2 = vtk.vtkUnstructuredGrid()
            #self.scalarBar.VisibilityOff()
            return
        else:
            self.TurnTextOff()
            self.grid.Reset()
            self.grid2.Reset()
            #self.gridResult = vtk.vtkFloatArray()
            #self.gridResult.Reset()
            #self.gridResult.Modified()
            #self.eidMap = {}
            #self.nidMap = {}

            self.resultCases = {}
            self.nCases = 0
        for i in ('caseKeys', 'iCase', 'iSubcaseNameMap'):
            if hasattr(self, i):
                del i

            #print dir(self)
        self.scalarBar.VisibilityOff()
        self.scalarBar.Modified()

        fname_base, ext = os.path.splitext(bdf_filename)
        punch = False
        if ext.lower() in '.pch':
            punch = True

        #if bdf_filename.lower().endswith('.op2'):  # read the OP2; requires make_geom
            #op2_filename = bdf_filename
            #model = OP2(# make_geom=True,
                       #debug=True, log=self.log)
            #model.read_op2(op2_filename)
            #model.cross_reference(xref=True, xref_loads=False, xref_constraints=False)
        if 0:
            pass
        else:  # read the bdf/punch
            model = BDF(log=self.log, debug=True)
            self.modelType = model.modelType
            model.read_bdf(bdf_filename, include_dir=dirname, punch=punch)

        nNodes = model.nNodes()
        assert nNodes > 0
        nElements = model.nElements()
        assert nElements > 0
        nCAeros = model.nCAeros()
        self.nNodes = nNodes
        self.nElements = nElements

        print "nNodes = ",self.nNodes
        self.log_info("nElements = %i" % self.nElements)
        msg = model.get_bdf_stats(return_type='list')
        #self.log_info(msg)
        for msgi in msg:
            model.log.debug(msgi)

        #self.aQuadGrid.Allocate(nElements+nNodes, 1000)

        if 'CONM2' in model.card_count:
            nCONM2 = model.card_count['CONM2']
        else:
            nCONM2 = 0
        self.grid.Allocate(self.nElements, 1000)
        #self.gridResult.SetNumberOfComponents(self.nElements)
        self.grid2.Allocate(nCAeros + nCONM2, 1000)

        points = vtk.vtkPoints()
        points.SetNumberOfPoints(self.nNodes)
        #self.gridResult.Allocate(self.nNodes, 1000)
        #vectorReselt.SetNumberOfComponents(3)
        #elem.SetNumberOfPoints(nNodes)
        if 0:
            i = 0
            fraction = 1. / nNodes  # so you can color the nodes by ID
            for (nid, node) in sorted(model.nodes.iteritems()):
                point = node.Position()
                points.InsertPoint(i, *point)
                #self.gridResult.InsertNextValue(i * fraction)

                #elem = vtk.vtkVertex()
                #elem.GetPointIds().SetId(0, i)
                #self.aQuadGrid.InsertNextCell(elem.GetCellType(),
                #                              elem.GetPointIds())
                #vectorResult.InsertTuple3(0, 0.0, 0.0, 1.0)

#.........这里部分代码省略.........
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:103,代码来源:nastranIO.py


注:本文中的pyNastran.bdf.bdf.BDF.get_bdf_stats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。