21.01.2015 Views

COMSOL Multiphysics™

COMSOL Multiphysics™

COMSOL Multiphysics™

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Terminology<br />

The following data types are used in the serialization:<br />

• Boolean refers to an 8-bit signed character which must be 0 or 1.<br />

• Character refers to an 8-bit signed character.<br />

• Integer refers to a 32-bit signed integer.<br />

• Double refers to a 64-bit double.<br />

Matrices are stored in row-major order. In this documentation we use brackets to<br />

indicate a matrix. Hence, integer[3][4] means that 12 integers representing a<br />

matrix are store in the file. The first three entries corresponds to the integers in the first<br />

row of the matrix, and so on.<br />

Text File Format<br />

<strong>COMSOL</strong> Multiphysics text file, using the file extension .mphtxt, are text files where<br />

values are stored as text separated by whitespace characters.<br />

Lexical conventions:<br />

• Strings are serialized as the length of the string followed by a space and then the<br />

characters of the string, for example, “6 <strong>COMSOL</strong>”. This is the only place where<br />

whitespace matters.<br />

• The software ignores everything following a # on a line except when reading a<br />

string. This makes it possible to store comments in the file.<br />

Binary File Format<br />

<strong>COMSOL</strong> Multiphysics binary file, using the extension .mphbin, are binary files with<br />

the following data representation:<br />

• Integers and doubles are stored in little-endian byte order.<br />

• Strings are stored as the length of the string (integer) followed by the characters of<br />

the string (integers).<br />

SAVING AND LOADING<br />

You can import <strong>COMSOL</strong> Multiphysics files into the <strong>COMSOL</strong> Multiphysics GUI or<br />

load them as variables into <strong>COMSOL</strong> Script (or MATLAB).<br />

428 | CHAPTER 3: THE <strong>COMSOL</strong> MULTIPHYSICS FILES

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!