MOAB: Mesh Oriented datABase  (version 5.2.1)
sphere_decomp.cpp
Go to the documentation of this file.
00001 /*
00002  * Sphere decomp tool.  Meshes a group of spheres and the interstices between with
00003  * hex elements, by triangulating the vertices corresponding to sphere centers
00004  * and subdividing those tets.  For a description of the subdivision template used,
00005  * see comments in the subdivide_tet function below.
00006  */
00007 
00008 #include "moab/Core.hpp"
00009 #include "SphereDecomp.hpp"
00010 #include <iostream>
00011 
00012 const char* SPHERE_RADII_TAG_NAME = "SPHERE_RADII";
00013 
00014 #define RR \
00015     if( moab::MB_SUCCESS != result ) return result
00016 
00017 int main( int argc, char* argv[] )
00018 {
00019     if( argc < 3 )
00020     {
00021         std::cout << "Usage: " << argv[0] << " <input_mesh> <output_mesh>" << std::endl;
00022         return 0;
00023     }
00024 
00025     // create MOAB
00026     moab::Interface* mbImpl = new moab::Core();
00027 
00028     // read in mesh
00029     moab::ErrorCode result = mbImpl->load_mesh( argv[1] );
00030     if( moab::MB_SUCCESS != result )
00031     {
00032         std::cout << "Problems loading mesh." << std::endl;
00033         return 1;
00034     }
00035 
00036     moab::Tag sphere_radii_tag = 0;
00037     double dum_val             = 0.1;
00038     result = mbImpl->tag_get_handle( SPHERE_RADII_TAG_NAME, 1, moab::MB_TYPE_DOUBLE, sphere_radii_tag,
00039                                      moab::MB_TAG_DENSE | moab::MB_TAG_CREAT, &dum_val );
00040     if( moab::MB_SUCCESS != result )
00041     {
00042         std::cout << "Problem allocating SPHERE_RADII tag." << std::endl;
00043         return 1;
00044     }
00045 
00046     SphereDecomp sd( mbImpl );
00047 
00048     moab::EntityHandle this_set = 0;
00049     result                      = sd.build_sphere_mesh( SPHERE_RADII_TAG_NAME, &this_set );RR;
00050 
00051     // write mesh
00052     result = mbImpl->write_mesh( argv[2], &this_set, 1 );RR;
00053 
00054     return 0;
00055 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines