101 lines
2.8 KiB
Plaintext
Executable File
101 lines
2.8 KiB
Plaintext
Executable File
# Test sort
|
|
#
|
|
# Input files:
|
|
# input_test01.inp Original line graph with various kinds of components
|
|
# input_test02.inp Shuffled version of original file
|
|
# input_test03.inp Hybrid mesh containing line segments and a triangle
|
|
# input_test04.inp Trivial mesh with 2 points and no elements
|
|
#
|
|
# Output files:
|
|
#
|
|
# output*nosort.inp pre-sorted output files
|
|
# output*sort.inp sorted output files
|
|
#
|
|
# See reference for visual reference
|
|
#
|
|
##########################################
|
|
|
|
# SORT POINTS using INDEX
|
|
cmo / create / moquad / / / quad
|
|
createpts / xyz / 3 3 1 / 0. 0. 0. / 1. 1. 0. / 1 1 1
|
|
|
|
# SHOW INPUT node x and y
|
|
cmo / printatt / moquad / xic
|
|
cmo / printatt / moquad / yic
|
|
dump avs output_points_nosort.inp moquad
|
|
|
|
sort / moquad / index / ascending / ikey / xic yic
|
|
reorder / moquad / ikey
|
|
|
|
# SHOW SORTED node x and y
|
|
cmo / printatt / moquad / xic
|
|
cmo / printatt / moquad / yic
|
|
dump avs output_points_sort.inp moquad
|
|
|
|
cmo delete moquad
|
|
cmo / create / moquad / / / quad
|
|
createpts / xyz / 4 4 1 / 0. 0. 0. / 1. 1. 0. / 1 1 1
|
|
rzbrick/xyz/4,4,1/1,0,0/connect
|
|
cmo/set_id/ moquad/element cell_id
|
|
|
|
# SHOW INPUT cell numbers
|
|
cmo / printatt / moquad / cell_id
|
|
dump avs output_quad_nosort.inp moquad
|
|
|
|
# SORT CELLS using INDEX
|
|
sort/moquad/index/ descending / ikey / cell_id
|
|
reorder / moquad / ikey
|
|
|
|
# SHOW SORTED cell numbers reversed
|
|
cmo / printatt / moquad / cell_id
|
|
dump avs output_quad_sort.inp moquad
|
|
cmo / delete / moquad
|
|
|
|
###### POLY SORT with LINE_GRAPH #############
|
|
# simply poly line sort for simple case with elem and nodes
|
|
read avs input_poly_no_sort.inp mol_poly
|
|
cmo status mol_poly
|
|
cmo copy mol_poly2 mol_poly
|
|
|
|
# SORT ELEMENT with LINE_GRAPH ##############
|
|
cmo select mol_poly
|
|
sort/mol_poly/line_graph/ascending/ekey/element
|
|
cmo printatt mol_poly ekey
|
|
reorder mol_poly ekey
|
|
dump avs output_poly_e_sort.inp mol_poly
|
|
|
|
# SORT NODE with LINE_GRAPH ################
|
|
cmo select mol_poly2
|
|
sort/mol_poly2/line_graph/ascending/nkey/node
|
|
cmo printatt mol_poly2 nkey
|
|
reorder mol_poly2 nkey
|
|
dump avs output_poly_n_sort.inp mol_poly
|
|
|
|
cmo delete mol_poly
|
|
cmo delete mol_poly2
|
|
|
|
# The following checks for graceful failures. #
|
|
|
|
########### ERROR CAPTURE FOR NO MESH OBJECT ########
|
|
# This should stop gracefully with an error (no mesh object).
|
|
sort / / line_graph / ascending / key
|
|
|
|
###########
|
|
|
|
read / input_test01.inp / mo01
|
|
|
|
########### ERROR CAPTURE ARG 4 #################
|
|
# Error (must be "ascending" or "descending")
|
|
sort / mo01 / line_graph / wrong / key
|
|
|
|
########### ERROR CAPTURE ARG 6 ###############
|
|
# Error (invalid argument)
|
|
sort / mo01 / line_graph / ascending / key / extra_arg
|
|
|
|
########### DEFAULT CREATE INTERNAL KEY #######
|
|
# Should generate a key since one is not provided.
|
|
# but not recommended since reorder will need att name
|
|
sort / mo01 / line_graph / ascending
|
|
|
|
finish
|