48 #ifdef MOAB_HAVE_NETCDF
57 #if defined( MOAB_HAVE_PNETCDF ) && !defined( MOAB_HAVE_NETCDF )
66 #ifdef MOAB_HAVE_CCMIO
71 #ifdef MOAB_HAVE_DAMSEL
78 #ifdef MOAB_HAVE_HDF5_PARALLEL
93 const char* hdf5_sufxs[] = {
"h5m",
"mhdf", NULL };
94 #ifdef MOAB_HAVE_HDF5_PARALLEL
101 #ifdef MOAB_HAVE_NETCDF
102 const char* exo_sufxs[] = {
"exo",
"exoII",
"exo2",
"g",
"gen", NULL };
107 #ifdef MOAB_HAVE_CGNS
108 const char* cgns_sufxs[] = {
"cgns", NULL };
116 const char* nastran_sufxs[] = {
"nas",
"bdf", NULL };
132 #ifdef MOAB_HAVE_CGM_FACET
133 const char* facet_sufxs[] = {
"facet", NULL };
136 #ifdef MOAB_HAVE_CGM_OCC
137 const char* occ_sufxs[] = {
"brep",
"occ", NULL };
138 const char* step_sufxs[] = {
"step",
"stp", NULL };
139 const char* iges_sufxs[] = {
"iges",
"igs", NULL };
145 #ifdef MOAB_HAVE_NETCDF
149 #ifdef MOAB_HAVE_CCMIO
150 const char* ccmio_sufxs[] = {
"ccm",
"ccmg", NULL };
154 #ifdef MOAB_HAVE_DAMSEL
155 const char* damsel_sufxs[] = {
"h5", NULL };
163 const char* gmsh_sufxs[] = {
"msh",
"gmsh", NULL };
168 const char* tetgen_sufxs[] = {
"node",
"ele",
"face",
"edge", NULL };
171 const char* template_sufxs[] = { NULL };
179 writer_factory_t writer,
180 const char* description,
181 const char*
const* extensions,
184 if( !reader && !writer )
return MB_FAILURE;
190 MB_SET_ERR( MB_FAILURE,
"Conflicting string name for file formats: \"" << name <<
"\"" );
194 const char*
const* iter;
195 for( iter = extensions; *iter; ++iter )
200 if( NULL != reader && h->have_reader() )
201 MB_SET_ERR( MB_FAILURE,
"Conflicting readers for file extension \""
202 << *iter <<
"\": \"" << h->description() <<
"\" and \"" << description
204 else if( NULL != writer && h->have_writer() )
205 MB_SET_ERR( MB_FAILURE,
"Conflicting writers for file extension \""
206 << *iter <<
"\": \"" << h->description() <<
"\" and \"" << description
210 handlerList.push_back(
Handler( reader, writer, name, description, extensions, iter - extensions ) );
215 writer_factory_t writer,
216 const char* description,
217 const char* extension,
220 const char* extensions[2] = { extension, NULL };
228 return handler ==
end() ? NULL : handler->make_reader(
mbCore );
235 return handler ==
end() ? NULL : handler->make_writer(
mbCore );
240 std::string::size_type idx = filename.find_last_of(
"." );
241 std::string::size_type idirx = filename.find_last_of(
"\\/" );
243 if( idx == std::string::npos )
return std::string(
"" );
244 if( ( idirx != std::string::npos ) && ( idirx > idx ) )
return std::string(
"" );
245 return filename.substr( idx + 1 );
249 writer_factory_t write_f,
252 const char*
const* ext,
254 : mReader( read_f ), mWriter( write_f ), mName( nm ), mDescription( desc ), mExtensions( num_ext )
256 for(
int i = 0; i < num_ext; ++i )
261 #define strcasecmp( A, B ) _stricmp( A, B )
266 bool with_writer )
const
269 std::vector< std::string >::const_iterator siter;
272 for( iter =
begin(); iter !=
end(); ++iter )
274 if( ( with_reader && !iter->have_reader() ) || ( with_writer && !iter->have_writer() ) )
continue;
276 for( siter = iter->mExtensions.begin(); siter != iter->mExtensions.end(); ++siter )
277 if( *siter == ext )
return iter;
281 for( iter =
begin(); iter !=
end(); ++iter )
283 if( ( with_reader && !iter->have_reader() ) || ( with_writer && !iter->have_writer() ) )
continue;
285 for( siter = iter->mExtensions.begin(); siter != iter->mExtensions.end(); ++siter )
286 if( 0 == strcasecmp( siter->c_str(), ext.c_str() ) )
return iter;
294 if( !have_reader() )
return false;
296 std::vector< std::string >::const_iterator siter;
297 for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
298 if( !( *siter ).compare( ext ) )
300 else if( 0 == strcasecmp( siter->c_str(), ext ) )
308 if( !have_writer() )
return false;
310 std::vector< std::string >::const_iterator siter;
311 for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
312 if( !( *siter ).compare( ext ) )
314 else if( 0 == strcasecmp( siter->c_str(), ext ) )
322 return std::find(
begin(),
end(), nm );
328 std::string::const_iterator siter = mName.begin();
329 for( ; *nm; ++nm, ++siter )
330 if( siter == mName.end() || tolower( *nm ) != tolower( *siter ) )
return false;