Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

merge.C

Go to the documentation of this file.
00001 /**********************************************************************
00002  * merge.C:
00003  *
00004  *      Takes multiple .sm files as input, merges them into
00005  *      a single mesh, then writes the result to file.
00006  *
00007  *      Input parameters on the command line should be the
00008  *      list of input meshes, followed by the name of the
00009  *      output mesh.
00010  *
00011  **********************************************************************/
00012 #include "std/fstream.H"
00013 #include "mesh/lmesh.H"
00014 #include "std/config.H"
00015 
00016 inline BMESHptr
00017 read_mesh(char* infile)
00018 {
00019    BMESHptr ret = new BMESH;
00020    if (!ret->read_file(infile))
00021       return 0;
00022    return ret;
00023 }
00024 
00025 int 
00026 main(int argc, char *argv[])
00027 {
00028    if (argc < 4)
00029    {
00030       err_msg("Usage: %s input1.sm input2.sm [ etc. ] output.sm", argv[0]);
00031       return 1;
00032    }
00033 
00034    BMESHptr ret;
00035    for (int i=1; i < argc - 1; i++) {
00036       BMESHptr mesh = BMESH::read_jot_file(argv[i]);
00037       if (mesh) {
00038          // Remove duplicate vertices while we're at it
00039          mesh->remove_duplicate_vertices(false); // don't keep the bastards
00040          ret = (ret ? BMESH::merge(ret, mesh) : mesh);
00041       }
00042    }
00043 
00044    if (Config::get_var_bool("JOT_RECENTER"))
00045       ret->recenter();
00046 
00047    ret->write_file(argv[argc-1]);
00048 
00049    return 0;
00050 }
00051 
00052 /* end of file merge.C */

Generated on Mon Sep 18 11:39:32 2006 for jot by  doxygen 1.4.4