本文整理汇总了Python中pyNastran.bdf.dev_vectorized.bdf.BDF.set_dynamic_syntax方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.set_dynamic_syntax方法的具体用法?Python BDF.set_dynamic_syntax怎么用?Python BDF.set_dynamic_syntax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNastran.bdf.dev_vectorized.bdf.BDF
的用法示例。
在下文中一共展示了BDF.set_dynamic_syntax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_bdf
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import set_dynamic_syntax [as 别名]
def run_bdf(folder, bdf_filename, debug=False, xref=True, check=True, punch=False,
cid=None, meshForm='combined', isFolder=False, print_stats=False,
sum_load=False, size=8, precision='single',
reject=False, dynamic_vars=None):
if dynamic_vars is None:
dynamic_vars = {}
bdfModel = str(bdf_filename)
print("bdfModel = %r" % bdfModel)
if isFolder:
bdfModel = os.path.join(test_path, folder, bdf_filename)
assert os.path.exists(bdfModel), '%r doesnt exist' % bdfModel
print("before read bdf, Memory usage: %s (Mb) " % memory_usage_psutil())
#print('before read bdf, Memory usage: %s (kb)' % resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
fem1 = BDF(debug=debug, log=None)
if dynamic_vars:
fem1.set_dynamic_syntax(dynamic_vars)
fem1.log.info('starting fem1')
sys.stdout.flush()
fem2 = None
diffCards = []
try:
outModel = run_fem1(fem1, bdfModel, meshForm, xref, punch, sum_load, size, precision, cid)
fem2 = run_fem2(bdfModel, outModel, xref, punch, sum_load, size, precision, reject, debug=debug, log=None)
diffCards = compare(fem1, fem2, xref=xref, check=check, print_stats=print_stats)
except KeyboardInterrupt:
sys.exit('KeyboardInterrupt...sys.exit()')
#except IOError:
#pass
#except AttributeError: # only temporarily uncomment this when running lots of tests
#pass
#except SyntaxError: # only temporarily uncomment this when running lots of tests
#pass
#except AssertionError: # only temporarily uncomment this when running lots of tests
#pass
except SystemExit:
sys.exit('sys.exit...')
except:
#exc_type, exc_value, exc_traceback = sys.exc_info()
#print "\n"
traceback.print_exc(file=sys.stdout)
#print msg
print("-" * 80)
raise
print("-" * 80)
return (fem1, fem2, diffCards)
示例2: run_bdf
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import set_dynamic_syntax [as 别名]
def run_bdf(
folder,
bdf_filename,
debug=False,
xref=True,
check=True,
punch=False,
cid=None,
mesh_form="combined",
is_folder=False,
print_stats=False,
encoding=None,
sum_load=False,
size=8,
is_double=False,
quiet=False,
reject=False,
dynamic_vars=None,
):
"""
Runs a single BDF
Parameters
----------
folder : str
the folder where the bdf_filename is
bdf_filename : str
the bdf file to analyze
debug : bool, optional
run with debug logging (default=False)
xref : bool / str, optional
True : cross reference the model
False : don't cross reference the model
'safe' : do safe cross referencing
check : bool, optional
validate cards for things like mass, area, etc.
punch : bool, optional
this is a PUNCH file (no executive/case control decks)
cid : int / None, optional
convert the model grids to an alternate coordinate system (default=None; no conversion)
mesh_form : str, optional, {'combined', 'separate'}
'combined' : interspersed=True
'separate' : interspersed=False
is_folder : bool, optional
attach the test path and the folder to the bdf_filename
print_stats : bool, optional
get a nicely formatted message of all the cards in the model
sum_load : bool, optional
Sum the static loads (doesn't work for frequency-based loads)
size : int, optional, {8, 16}
The field width of the model
is_double : bool, optional
Is this a double precision model?
True : size = 16
False : six = {8, 16}
reject : bool, optional
True : all the cards are rejected
False : the model is read
nastran : str, optional
the path to nastran (default=''; no analysis)
post : int, optional
the PARAM,POST,value to run
dynamic vars : dict[str]=int / float / str / None
support OpenMDAO syntax %myvar; max variable length=7
quiet : bool; default=False
suppresses print messages
dumplines: bool; default=False
writes pyNastran_dump.bdf
dictsort : bool; default=False
writes pyNastran_dict.bdf
dev : bool; default=False
True : crashes if an Exception occurs
False : doesn't crash; useful for running many tests
"""
if not quiet:
print("debug = %s" % debug)
if dynamic_vars is None:
dynamic_vars = {}
# TODO: why do we need this?
bdf_model = str(bdf_filename)
if not quiet:
print("bdf_model = %s" % bdf_model)
if is_folder:
bdf_model = os.path.join(test_path, folder, bdf_filename)
assert os.path.exists(bdf_model), "%r doesnt exist" % bdf_model
# print("before read bdf, Memory usage: %s (Mb) " % memory_usage_psutil())
# print('before read bdf, Memory usage: %s (kb)' % resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
fem1 = BDF(debug=debug, log=None)
if dynamic_vars:
fem1.set_dynamic_syntax(dynamic_vars)
fem1.log.info("starting fem1")
sys.stdout.flush()
fem2 = None
diff_cards = []
# try:
out_model = run_fem1(fem1, bdf_model, mesh_form, xref, punch, sum_load, size, is_double, cid)
#.........这里部分代码省略.........