SUS CODE README: This code is an improved implementation (see TechNote.pdf for details) of our simultaneous smoothing and untangling method that is described in the following paper: J.M. Escobar, E. Rodriguez, R. Montenegro, G. Montero, J.M. Gonzalez-Yuste, Simultaneous untangling and smoothing of tetrahedral meshes, Computer Methods in Applied Mechanics and Engineering, 192 (25) 2775--2787 (2003). SUS code obtains an optimized tetrahedral mesh from a tangled or valid one, by using local node relocation maintaining the initial mesh topology. If you use this code in a research work, we would be grateful if you cite the above paper. COMPILATION: In order to compile this code you will need an optimization library. We have used Uncmin++, available from http://www.smallwaters.com/software/cpp/uncmin.html. Uncmin++ in turn requires classes implementing vectors and matrices. We have used Simple C++ Numeric Toolkit (SCPPNT), from http://www.smallwaters.com/software/cpp/scppnt.html Our code has been developed in a Debian Linux environment, using gcc 4.1.2. It should compile and run in any similar Linux environment. Although code has been developed with portability in mind, we haven't ported it to other platforms. Please, send us an e-mail if you are able of use it in other platforms (erodriguez at dis dot ulpgc dot es). Please check the following Makefile variables; modify them according to your system paths: scppnt_include : path to include files of optimization library uncmindir : path to include files of UNCMIN++ optimization library EXECUTION: To run the program, user must provide the initial mesh information with two mandatory arguments in the command line: -n fnodes : file of nodes -e felems : file of elements (tetrahedra) The program have the following optional arguments: -o fsmooth : output file with optimized mesh nodes (only node file is written, as element file remains the same) -s fstats : output statistics file, containing best, worst and mean quality of the mesh and number of tangled elements in every iteration -d : input mesh is normalized by default. Use -d to avoid normalization -q qprefix : output a quality file at each iteration. File name is qprefix+iteration_number -i max_iter : Maximum number of mesh optimization iterations, including both untangling and smoothing (100 by default) -m smooth_iter: Number of smoothing iteration after mesh untangling (20 by default) MESH FILES FORMAT: In order to define a mesh, two ASCII files are needed: 1) file of nodes: location of mesh nodes First non-comment line of the file is the number of nodes After that, every node of the mesh is listed, one per line in the following format: x y z ref where x, y, z are the node coordinates and ref is an integer reference number. The procedure will only relocate nodes with reference number equal to 0. 2) file of elements: contains information about tetrahedra First non-comment line contains the number of mesh elements Following that, every element of the mesh must be specified, one per line, using the following format: 0 n0 n1 n2 n3 where, 0 is a reference number (irrelevant for our purposes) and n0, n1, n2 and n3 are the node numbers of the element. Node numbering is directly related with the node ordering in the node file, starting with 1. For example, given the following files: nodes: # This is an optional comment line (begins with #) 5 0.0 0.0 0.0 1 1.0 0.0 0.0 1 0.0 1.0 0.0 1 0.0 0.0 1.0 0 0.0 0.0 -1.0 0 elements: # This is an (optional) comment line (begins with #) 2 0 0 1 2 3 0 0 2 1 4 Please note that elements must have positive orientation (see the paper for details). Both node and element files can have comment lines. Those lines starting with character # are ignored. EXAMPLE MESHES: Two examples are provided in order to test the program. Both can be found in 'examples' directory: examples/TangledCube: is a tangled mesh of an unitary cube examples/Screwdriver: is a tangled mesh of a screwdriver. This tetrahedral mesh was constructed with our meccano method using a surface triangulation obtained from Cyberware (http://www.cyberware.com) as input data In both cases, all inner nodes of valid meshes have been randomly moved to get tangled meshes EXAMPLES OF USE: The following command will optimize the tangled cube mesh: ./sus -n ../examples/TangledCube/tangled.dat -e ../examples/TangledCube/elem.dat If you want to save the optimized nodes positions, you must use the '-o' option: ./sus -n ../examples/TangledCube/tangled.dat -e ../examples/TangledCube/elem.dat -o ./nodes.dat We have successfully used this code in many experiments, but we can't guarantee that it works in all cases. Contributions to improve this code are welcome.