[MOAB-dev] Detecting file types

Tim Tautges tautges at mcs.anl.gov
Tue Dec 1 08:57:46 CST 2009


It would help if we documented the following:

- given an extension name or file name, get the name or actual reader/writer which can handle it

- get the extensions a given reader/writer handles and possibly all the readers/writers registered

After looking again at MBReaderWriterSet and MBCore::query_interface, I think all this is already possible, it's just 
not always clear how they're used.  I'll put in a documentation ticket on this.

- tim

Jason Kraftcheck wrote:
> Steve Jackson wrote:
>> On Nov 30, 2009, at 15:36 , Jason Kraftcheck wrote:
>>> So you don't need to know the file type.  You need to know whether or 
>>> not
>>> the file contained geometry that was read into CGM.  Why not just 
>>> query CGM
>>> to see if it has any geometry?
>>
>> Fair enough.  That seemed to me like a roundabout way of coming at the 
>> problem, but it sounds like the simplest fix.
>>
> 
> Well, the direct solution would be to determine whether or not MOAB used 
> the ReadCGM class to read the file.  But asking about the file type is 
> equally indirect, as CGM can read a variety of file formats as well.  If 
> we do want to proved the string name of the reader, then I think the way 
> to do this is to use a file set.  The MOAB load_file function allows an 
> optional EntitySet handle to be passed.  If that handle is provided, the 
> contents of the file will be added to the set.  MOAB should hang 
> pertinent data in tags on that set (file name, file reader name/file 
> type, etc.)
> 
> - jason
> 

-- 
================================================================
"You will keep in perfect peace him whose mind is
   steadfast, because he trusts in you."               Isaiah 26:3

              Tim Tautges            Argonne National Laboratory
          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
          phone: (608) 263-8485      1500 Engineering Dr.
            fax: (608) 263-4499      Madison, WI 53706



More information about the moab-dev mailing list