45 #ifdef MOAB_HAVE_NETCDF
54 #if defined( MOAB_HAVE_PNETCDF ) && !defined( MOAB_HAVE_NETCDF )
63 #ifdef MOAB_HAVE_CCMIO
68 #ifdef MOAB_HAVE_DAMSEL
75 #ifdef MOAB_HAVE_HDF5_PARALLEL
90 const char* hdf5_sufxs[] = {
"h5m",
"mhdf", NULL };
91 #ifdef MOAB_HAVE_HDF5_PARALLEL
98 #ifdef MOAB_HAVE_NETCDF
99 const char* exo_sufxs[] = {
"exo",
"exoII",
"exo2",
"g",
"gen", NULL };
104 #ifdef MOAB_HAVE_CGNS
105 const char* cgns_sufxs[] = {
"cgns", NULL };
113 const char* nastran_sufxs[] = {
"nas",
"bdf", NULL };
130 #ifdef MOAB_HAVE_NETCDF
134 #ifdef MOAB_HAVE_CCMIO
135 const char* ccmio_sufxs[] = {
"ccm",
"ccmg", NULL };
139 #ifdef MOAB_HAVE_DAMSEL
140 const char* damsel_sufxs[] = {
"h5", NULL };
148 const char* gmsh_sufxs[] = {
"msh",
"gmsh", NULL };
153 const char* tetgen_sufxs[] = {
"node",
"ele",
"face",
"edge", NULL };
156 const char* template_sufxs[] = { NULL };
164 writer_factory_t writer,
165 const char* description,
166 const char*
const* extensions,
169 if( !reader && !writer )
return MB_FAILURE;
175 MB_SET_ERR( MB_FAILURE,
"Conflicting string name for file formats: \"" << name <<
"\"" );
179 const char*
const* iter;
180 for( iter = extensions; *iter; ++iter )
185 if( NULL != reader && h->have_reader() )
186 MB_SET_ERR( MB_FAILURE,
"Conflicting readers for file extension \""
187 << *iter <<
"\": \"" << h->description() <<
"\" and \"" << description
189 else if( NULL != writer && h->have_writer() )
190 MB_SET_ERR( MB_FAILURE,
"Conflicting writers for file extension \""
191 << *iter <<
"\": \"" << h->description() <<
"\" and \"" << description
195 handlerList.push_back(
Handler( reader, writer, name, description, extensions, iter - extensions ) );
200 writer_factory_t writer,
201 const char* description,
202 const char* extension,
205 const char* extensions[2] = { extension, NULL };
213 return handler ==
end() ? NULL : handler->make_reader(
mbCore );
220 return handler ==
end() ? NULL : handler->make_writer(
mbCore );
225 std::string::size_type idx = filename.find_last_of(
"." );
226 std::string::size_type idirx = filename.find_last_of(
"\\/" );
228 if( idx == std::string::npos )
return std::string(
"" );
229 if( ( idirx != std::string::npos ) && ( idirx > idx ) )
return std::string(
"" );
230 return filename.substr( idx + 1 );
234 writer_factory_t write_f,
237 const char*
const* ext,
239 : mReader( read_f ), mWriter( write_f ), mName( nm ), mDescription( desc ), mExtensions( num_ext )
241 for(
int i = 0; i < num_ext; ++i )
246 #define strcasecmp( A, B ) _stricmp( A, B )
251 bool with_writer )
const
254 std::vector< std::string >::const_iterator siter;
257 for( iter =
begin(); iter !=
end(); ++iter )
259 if( ( with_reader && !iter->have_reader() ) || ( with_writer && !iter->have_writer() ) )
continue;
261 for( siter = iter->mExtensions.begin(); siter != iter->mExtensions.end(); ++siter )
262 if( *siter == ext )
return iter;
266 for( iter =
begin(); iter !=
end(); ++iter )
268 if( ( with_reader && !iter->have_reader() ) || ( with_writer && !iter->have_writer() ) )
continue;
270 for( siter = iter->mExtensions.begin(); siter != iter->mExtensions.end(); ++siter )
271 if( 0 == strcasecmp( siter->c_str(), ext.c_str() ) )
return iter;
279 if( !have_reader() )
return false;
281 std::vector< std::string >::const_iterator siter;
282 for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
283 if( !( *siter ).compare( ext ) )
285 else if( 0 == strcasecmp( siter->c_str(), ext ) )
293 if( !have_writer() )
return false;
295 std::vector< std::string >::const_iterator siter;
296 for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
297 if( !( *siter ).compare( ext ) )
299 else if( 0 == strcasecmp( siter->c_str(), ext ) )
307 return std::find(
begin(),
end(), nm );
313 std::string::const_iterator siter = mName.begin();
314 for( ; *nm; ++nm, ++siter )
315 if( siter == mName.end() || tolower( *nm ) != tolower( *siter ) )
return false;