45 #ifdef MOAB_HAVE_NETCDF
54 #if defined( MOAB_HAVE_PNETCDF ) && !defined( MOAB_HAVE_NETCDF )
64 #ifdef MOAB_HAVE_CCMIO
69 #ifdef MOAB_HAVE_DAMSEL
76 #ifdef MOAB_HAVE_HDF5_PARALLEL
91 const char* hdf5_sufxs[] = {
"h5m",
"mhdf", NULL };
92 #ifdef MOAB_HAVE_HDF5_PARALLEL
99 #ifdef MOAB_HAVE_NETCDF
100 const char* exo_sufxs[] = {
"exo",
"exoII",
"exo2",
"g",
"gen", NULL };
103 #elif defined( MOAB_HAVE_PNETCDF )
109 #ifdef MOAB_HAVE_CGNS
110 const char* cgns_sufxs[] = {
"cgns", NULL };
118 const char* nastran_sufxs[] = {
"nas",
"bdf", NULL };
135 #ifdef MOAB_HAVE_NETCDF
139 #ifdef MOAB_HAVE_CCMIO
140 const char* ccmio_sufxs[] = {
"ccm",
"ccmg", NULL };
144 #ifdef MOAB_HAVE_DAMSEL
145 const char* damsel_sufxs[] = {
"h5", NULL };
153 const char* gmsh_sufxs[] = {
"msh",
"gmsh", NULL };
158 const char* tetgen_sufxs[] = {
"node",
"ele",
"face",
"edge", NULL };
161 const char* template_sufxs[] = { NULL };
169 writer_factory_t writer,
170 const char* description,
171 const char*
const* extensions,
174 if( !reader && !writer )
return MB_FAILURE;
180 MB_SET_ERR( MB_FAILURE,
"Conflicting string name for file formats: \"" << name <<
"\"" );
184 const char*
const* iter;
185 for( iter = extensions; *iter; ++iter )
190 if( NULL != reader && h->have_reader() )
191 MB_SET_ERR( MB_FAILURE,
"Conflicting readers for file extension \""
192 << *iter <<
"\": \"" << h->description() <<
"\" and \"" << description
194 else if( NULL != writer && h->have_writer() )
195 MB_SET_ERR( MB_FAILURE,
"Conflicting writers for file extension \""
196 << *iter <<
"\": \"" << h->description() <<
"\" and \"" << description
200 handlerList.push_back(
Handler( reader, writer, name, description, extensions, iter - extensions ) );
205 writer_factory_t writer,
206 const char* description,
207 const char* extension,
210 const char* extensions[2] = { extension, NULL };
218 return handler ==
end() ? NULL : handler->make_reader(
mbCore );
225 return handler ==
end() ? NULL : handler->make_writer(
mbCore );
230 std::string::size_type idx = filename.find_last_of(
"." );
231 std::string::size_type idirx = filename.find_last_of(
"\\/" );
233 if( idx == std::string::npos )
return std::string(
"" );
234 if( ( idirx != std::string::npos ) && ( idirx > idx ) )
return std::string(
"" );
235 return filename.substr( idx + 1 );
239 writer_factory_t write_f,
242 const char*
const* ext,
244 : mReader( read_f ), mWriter( write_f ), mName( nm ), mDescription( desc ), mExtensions( num_ext )
246 for(
int i = 0; i < num_ext; ++i )
251 #define strcasecmp( A, B ) _stricmp( A, B )
256 bool with_writer )
const
259 std::vector< std::string >::const_iterator siter;
262 for( iter =
begin(); iter !=
end(); ++iter )
264 if( ( with_reader && !iter->have_reader() ) || ( with_writer && !iter->have_writer() ) )
continue;
266 for( siter = iter->mExtensions.begin(); siter != iter->mExtensions.end(); ++siter )
267 if( *siter == ext )
return iter;
271 for( iter =
begin(); iter !=
end(); ++iter )
273 if( ( with_reader && !iter->have_reader() ) || ( with_writer && !iter->have_writer() ) )
continue;
275 for( siter = iter->mExtensions.begin(); siter != iter->mExtensions.end(); ++siter )
276 if( 0 == strcasecmp( siter->c_str(), ext.c_str() ) )
return iter;
284 if( !have_reader() )
return false;
286 std::vector< std::string >::const_iterator siter;
287 for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
288 if( !( *siter ).compare( ext ) )
290 else if( 0 == strcasecmp( siter->c_str(), ext ) )
298 if( !have_writer() )
return false;
300 std::vector< std::string >::const_iterator siter;
301 for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
302 if( !( *siter ).compare( ext ) )
304 else if( 0 == strcasecmp( siter->c_str(), ext ) )
312 return std::find(
begin(),
end(), nm );
318 std::string::const_iterator siter = mName.begin();
319 for( ; *nm; ++nm, ++siter )
320 if( siter == mName.end() || tolower( *nm ) != tolower( *siter ) )
return false;