@@ -90,6 +90,7 @@ def run_lots_of_files(filenames: list[str], folder: str='',
9090 run_export_caero : bool = True ,
9191 run_skin_solids : bool = True ,
9292 allow_similar_eid : bool = True ,
93+ sort_cards : bool = True ,
9394 dev : bool = True ,
9495 crash_cards : Optional [list [str ]]= None ,
9596 run_pickle : bool = True , quiet : bool = False ) -> list [str ]:
@@ -214,6 +215,7 @@ def run_lots_of_files(filenames: list[str], folder: str='',
214215 run_export_caero = run_export_caero ,
215216 run_skin_solids = run_skin_solids ,
216217 allow_similar_eid = allow_similar_eid ,
218+ sort_cards = sort_cards ,
217219
218220 dev = dev ,
219221 crash_cards = crash_cards ,
@@ -291,6 +293,7 @@ def run_bdf(folder: str, bdf_filename: PathLike,
291293 is_lax_parser : bool = False ,
292294 allow_duplicates : bool = False ,
293295 allow_similar_eid : bool = True ,
296+ sort_cards : bool = True ,
294297 stop : bool = False , nastran : str = '' , post : int = - 1 ,
295298 dynamic_vars = None ,
296299 quiet : bool = False , dumplines : bool = False , dictsort : bool = False ,
@@ -400,6 +403,7 @@ def run_bdf(folder: str, bdf_filename: PathLike,
400403 sum_load = sum_load , size = size , is_double = is_double ,
401404 is_lax_parser = is_lax_parser ,
402405 allow_similar_eid = allow_similar_eid ,
406+ sort_cards = sort_cards ,
403407 allow_tabs = allow_tabs ,
404408 allow_duplicates = allow_duplicates ,
405409 stop = stop , nastran = nastran , post = post , hdf5 = hdf5 ,
@@ -444,6 +448,7 @@ def run_and_compare_fems(
444448 allow_tabs : bool = True ,
445449 allow_duplicates : bool = False ,
446450 allow_similar_eid : bool = True ,
451+ sort_cards : bool = True ,
447452 stop : bool = False ,
448453 nastran : str = '' ,
449454 post : int = - 1 ,
@@ -520,6 +525,7 @@ def run_and_compare_fems(
520525 save_file_structure = save_file_structure ,
521526 hdf5 = hdf5 ,
522527 encoding = encoding , crash_cards = crash_cards , safe_xref = safe_xref ,
528+ sort_cards = sort_cards ,
523529 limit_mesh_opt = limit_mesh_opt ,
524530 run_pickle = run_pickle , stop = stop , name = name )
525531
@@ -700,6 +706,7 @@ def run_fem1(fem1: BDF, bdf_filename: str, out_model: str, mesh_form: str,
700706 encoding : Optional [str ]= None ,
701707 crash_cards : Optional [list [str ]]= None ,
702708 limit_mesh_opt : bool = False ,
709+ sort_cards : bool = True ,
703710 safe_xref : bool = True , run_pickle : bool = False , stop : bool = False ,
704711 name : str = '' ) -> BDF :
705712 """
@@ -832,12 +839,17 @@ def run_fem1(fem1: BDF, bdf_filename: str, out_model: str, mesh_form: str,
832839 hdf5_filename = f'{ out_model } { name } .h5'
833840 _test_hdf5 (fem1 , hdf5_filename )
834841
842+ args = {
843+ 'size' : size ,
844+ 'is_double' : is_double ,
845+ 'sort_cards' : sort_cards ,
846+ }
835847 if mesh_form is None :
836848 pass
837849 elif mesh_form == 'combined' :
838- fem1 .write_bdf (out_model , interspersed = True , size = size , is_double = is_double )
850+ fem1 .write_bdf (out_model , interspersed = True , ** args )
839851 elif mesh_form == 'separate' :
840- fem1 .write_bdf (out_model , interspersed = False , size = size , is_double = is_double )
852+ fem1 .write_bdf (out_model , interspersed = False , ** args )
841853 else :
842854 msg = "mesh_form=%r; allowed_mesh_forms=['combined','separate']" % mesh_form
843855 raise NotImplementedError (msg )
@@ -2270,6 +2282,10 @@ def test_bdf_argparse(argv=None):
22702282
22712283 parent_parser .add_argument ('--lax' , action = 'store_true' ,
22722284 help = 'use the lax card parser (default=False)' )
2285+ parent_parser .add_argument (
2286+ '--nosort' , action = 'store_false' ,
2287+ help = 'Dont sort the nodes, elements, ... (default=False -> sort)' )
2288+
22732289 parent_parser .add_argument ('--duplicate' , action = 'store_true' ,
22742290 help = 'overwrite duplicates; takes the later card (default=False)' )
22752291 parent_parser .add_argument ('-q' , '--quiet' , action = 'store_true' ,
@@ -2375,7 +2391,7 @@ def get_test_bdf_usage_args_examples(encoding):
23752391 options = (
23762392 '\n [options] = [-e E] [--encoding ENCODE] [-q] [--dumplines] [--dictsort]\n '
23772393 f' [--ignore I] [--crash C] [--pickle] [--profile] [--hdf5] [{ formats } ] [--filter]\n '
2378- ' [--skip_loads] [--skip_mass] [--lax] [--duplicate]\n '
2394+ ' [--skip_loads] [--skip_mass] [--lax] [--nosort] [-- duplicate]\n '
23792395 )
23802396 usage = (
23812397 "Usage:\n "
@@ -2406,6 +2422,7 @@ def get_test_bdf_usage_args_examples(encoding):
24062422 ' every element/property to test them. May fails if a \n '
24072423 ' card is fully not supported (default=False)\n '
24082424 ' --lax dont be strict on float parsing\n '
2425+ ' --nosort Dont sort the nodes, elements, ... (default=False -> nosort)\n '
24092426 ' --duplicate overwrite duplicate GRIDs\n '
24102427 ' -l, --large writes the BDF in large field, single precision format (default=False)\n '
24112428 ' -d, --double writes the BDF in large field, double precision format (default=False)\n '
0 commit comments