moab
|
00001 00015 #include <iostream> 00016 #include <vector> 00017 00018 // Include header for MOAB instance and tag conventions for 00019 #include "moab/Core.hpp" 00020 #include "MBTagConventions.hpp" 00021 00022 int main(int argc, char **argv) { 00023 00024 // instantiate & load a file 00025 moab::Interface *mb = new moab::Core(); 00026 00027 moab::ErrorCode rval; 00028 if (argc <= 1) // 00029 { 00030 // the default file to load 00031 int set_tag_values[] = {1, 2, 5}; 00032 int num_set_tag_values = 3; 00033 // this file is in the mesh files directory 00034 rval = mb->load_file("../MeshFiles/unittest/64bricks_1khex.h5m", 00035 0, 0, PARALLEL_PARTITION_TAG_NAME, set_tag_values, num_set_tag_values); 00036 } 00037 else 00038 { 00039 // first arg is input file, second is tag name, then are the tag values 00040 if (argc < 4) 00041 { 00042 std::cout<< " usage is " << argv[0] << " <file> <tag_name> <value1> <value2> .. \n"; 00043 return 0; 00044 } 00045 00046 else 00047 { 00048 std::vector<int> vals(argc-3); // the first 3 args are exe, file, tagname; the rest are values 00049 for (int i=3; i<argc; i++) 00050 vals[i-3] = atoi(argv[i]); 00051 rval = mb->load_file(argv[1], 0, 0, argv[2], &vals[0], (int) vals.size() ); 00052 } 00053 } 00054 if (moab::MB_SUCCESS!=rval) 00055 std::cout << " failed to read\n"; 00056 rval = mb->write_file("part.h5m"); 00057 if (moab::MB_SUCCESS!=rval) 00058 std::cout << " failed to write partial file.\n"; 00059 else 00060 std::cout << " wrote successfully part.h5m.\n"; 00061 delete mb; 00062 return 0; 00063 }