- Examples
- VisTags.cpp.
Definition at line 42 of file VisTags.cpp.
44 #ifdef MOAB_HAVE_NETCDF
47 MPI_Init( &argc, &argv );
51 string file_input, file_output;
52 string read_opts, tags;
55 file_input = string(
MESH_DIR ) + string(
"/io/gcrm_r3.nc" );
56 file_output =
"VisTagsOut.vtk";
61 file_output = argv[2];
68 if( NULL ==
mb )
return 1;
78 if( !strcmp( argv[index],
"-O" ) )
79 read_opts = argv[++index];
80 if( !strcmp( argv[index],
"-t" ) ) tags = argv[++index];
81 if( !strcmp( argv[index],
"-l" ) ) levels = argv[++index];
82 if( !strcmp( argv[index],
"-d" ) ) dimension = atoi( argv[++index] );
88 opts <<
";;TAGS=" << tags <<
";LEVELS=" << levels <<
"\0";
91 vector< string > tagsNames;
92 vector< int > levelsArray;
93 fo.get_strs_option(
"TAGS", tagsNames );
94 fo.get_ints_option(
"LEVELS", levelsArray );
103 for(
size_t i = 0; i < tagsNames.size(); i++ )
105 string tagName = tagsNames[i];
110 cout <<
"not getting tag " << tagName.c_str() <<
"\n";
118 cout <<
"not getting tag len " << tagName.c_str() <<
"\n";
126 cout <<
"not getting tag type " << tagName.c_str() <<
"\n";
135 cout <<
"not getting tag iterate right " << tagName.c_str() <<
"\n";
140 for(
size_t j = 0; j < levelsArray.size(); j++ )
142 int level = levelsArray[j];
145 cout <<
"level too big at " << level <<
"\n";
149 ostringstream newTagName;
150 newTagName << tagName <<
"_" << level;
155 cout <<
"not getting new tag " << newTagName.str() <<
"\n";
163 cout <<
"not getting new tag iterate " << newTagName.str() <<
"\n";
169 double* ptrD = (
double*)newDataPtr;
170 double* oldData = (
double*)dataptr;
171 for(
int k = 0; k < count; k++, ptrD++ )
172 *ptrD = oldData[level + count * k];
180 cout <<
"Successfully wrote file " << file_output <<
"\n";
188 std::cout <<
" configure with netcdf for this example to work\n";
References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::Core::get_entities_by_dimension(), moab::FileOptions::get_ints_option(), moab::FileOptions::get_strs_option(), moab::Core::load_file(), mb, MB_CHK_SET_ERR, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_DOUBLE, MESH_DIR, moab::Range::size(), moab::Core::tag_delete(), moab::Core::tag_get_data_type(), moab::Core::tag_get_handle(), moab::Core::tag_get_length(), moab::Core::tag_iterate(), and moab::Core::write_file().