OOMMF mmDisp: Adding New File Formats


mmDisp is designed to be extensible, and in particular to accept new file formats. You can add your own format in two ways: by having a filter run automatically, or by completely integrating your file type into mmDisp by subclassing off the VectorFieldFileInput class in the C++ code.

Adding an automatic file filter

First you must write (in any programming language you wish) a stand-alone executable that reads your file format from standard input, and writes an OOMMF Vector Field format file to stdout. For the sake of this discussion, let's call your program myfilter (if myfilter is not in your executable path, then you will need to specify the full pathname), and let's say you identify all files of your new file type by the extension *.myf

The second step is to set up an environment variable named 'OOMMF_MMDISPFILTER' that is set to a Tcl-formatted list containing a

  1. glob-type filename selection string (example: *.myf)
  2. the name of your filter program (example: myfilter)
The means of setting OOMMF_MMDISPFILTER depends on your command shell---
csh:
setenv OOMMF_MMDISPFILTER '{*.myf myfilter}'
sh and bash:
OOMMF_MMDISPFILTER='{*.myf myfilter}' ; export OOMMF_MMDISPFILTER
Windows:
set OOMMF_MMDISPFILTER='{*.myf myfilter}'

That should do it! Try firing up mmDisp and opening a file through the open file dialog box. (Sorry, command line support for the above filter function is not available in release 0.0a0.) If you get an error message about not being able to create a temporary file, you may need to set the environment variable "TMPDIR" (or "TEMP") to a directory with both write access and sufficient space to (temporarily) store the OOMMF Vector Field output file.

There is a sample filter function, viotoomf, included in the distribution. This converts from the *.vio format (an old format used by some NIST internal micromagnetic code) to the OOMMF Vector Field format. You can try setting up the OOMMF_MMDISPFILTER environment variable with this filter, and try reading the sample stdprobb.vio file included in the demos directory of the mmDisp distribution. However, *.vio files are currently handled internally by mmDisp via the next method of incorporating external file formats:

Subclassing off of VectorFieldFileInput

This is considerably more complicated than setting up a file filter, and requires C++ programming skills. But it is faster, supports automatic file type detection, and does not require temporary disk space. Refer to the source code file oommf/ext/vf/vecfile.cc, or e-mail for details.


The National Institute of Standards and Technology (NIST) is an agency of the U.S. Commerce Department.

Privacy policy / security notice / accessibility statement / Disclaimer / Freedom of Information Act (FOIA) /
No Fear Act Policy / ExpectMore.gov (performance of federal programs) / NIST Information Quality Standards /
Environmental Policy Statement

Date created: October 29, 1999 | Last updated: April 27, 2011    Contact: Webmaster