MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include "MeshTransform.hpp"
#include "MeshImpl.hpp"
#include "CLArgs.hpp"
#include "MsqError.hpp"
#include <iostream>
Go to the source code of this file.
Classes | |
class | RotateArg |
class | ScaleArg |
class | TranslateArg |
Functions | |
int | main (int argc, char *argv[]) |
Variables | |
const char | ROTATE_FLAG = 'r' |
const char | SCALE_FLAG = 's' |
const char | TRANSLATE_FLAG = 't' |
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 62 of file transform.cpp.
References CLArgs::add_required_arg(), args, CLArgs::double_list_flag(), input_file, CLArgs::limit_list_flag(), MBMesquite::MeshTransform::loop_over_mesh(), MBMesquite::MeshImpl::mark_skin_fixed(), mesh, CLArgs::parse_options(), CLArgs::print_usage(), MBMesquite::MeshImpl::read_vtk(), ROTATE_FLAG, SCALE_FLAG, skin(), MBMesquite::MeshTransform::skip_fixed_vertices(), CLArgs::toggle_flag(), TRANSLATE_FLAG, CLArgs::ArgTemplate< T >::value(), and MBMesquite::MeshImpl::write_vtk().
{ MeshTransform xform; RotateArg rotate_arg( &xform ); ScaleArg scale_arg( &xform ); TranslateArg translate_arg( &xform ); CLArgs::ToggleArg freeonly, skin; CLArgs args( "vtkxform", "Transform a mesh", "Apply one or more transformations to vertex coordinates " "in a mesh read from a VTK file." ); const char* ROTATE_VALS[] = { "a", "i", "j", "k" }; args.double_list_flag( ROTATE_FLAG, "Specify a rotation as an angle in degrees counter-clockwise about a vector", &rotate_arg ); args.limit_list_flag( ROTATE_FLAG, 4, ROTATE_VALS ); const char* SCALE_VALS[] = { "s", "sx", "sy", "sz" }; args.double_list_flag( SCALE_FLAG, "Specify factor(s) by which to scale mesh about origin", &scale_arg ); args.limit_list_flag( SCALE_FLAG, 1, SCALE_VALS ); args.limit_list_flag( SCALE_FLAG, 3, SCALE_VALS + 1 ); const char* TRANSLATE_VALS[] = { "dx", "dy", "dz" }; args.double_list_flag( TRANSLATE_FLAG, "Specify translation of vertex coordinates.", &translate_arg ); args.limit_list_flag( TRANSLATE_FLAG, 3, TRANSLATE_VALS ); args.toggle_flag( 'f', "Do not move fixed vertices.", &freeonly ); args.toggle_flag( 'k', "Mark boundary vertices as fixed", &skin ); args.add_required_arg( "input_file" ); args.add_required_arg( "output_file" ); std::vector< std::string > files; if( !args.parse_options( argc, argv, files, std::cerr ) ) { args.print_usage( std::cerr ); exit( 1 ); } std::string input_file = files[0]; std::string output_file = files[1]; MeshImpl mesh; MsqError err; mesh.read_vtk( input_file.c_str(), err ); if( err ) { std::cerr << err << std::endl << "Failed to read file: " << input_file << std::endl; return 1; } if( skin.value() ) { mesh.mark_skin_fixed( err, false ); if( err ) { std::cerr << err << std::endl << "Failed to skin mesh from file: " << input_file << std::endl; return 1; } } xform.skip_fixed_vertices( freeonly.value() ); MeshDomainAssoc mesh_and_domain = MeshDomainAssoc( &mesh, 0 ); xform.loop_over_mesh( &mesh_and_domain, 0, err ); if( err ) { std::cerr << err << std::endl; return 2; } mesh.write_vtk( output_file.c_str(), err ); if( err ) { std::cerr << err << std::endl << "Failed to write file: " << output_file << std::endl; return 1; } return 0; }
const char ROTATE_FLAG = 'r' |
Definition at line 10 of file transform.cpp.
Referenced by main().
const char SCALE_FLAG = 's' |
Definition at line 11 of file transform.cpp.
Referenced by main().
const char TRANSLATE_FLAG = 't' |
Definition at line 12 of file transform.cpp.
Referenced by main().