The *.mat and *.lud files are binary files, written in the native platform coding (e.g. little endian coding on the INTEL/AMD CPUs), and have a Fortran block.
Sections
How to read the *.mat, *.lud, *.rhs files and *.str files The *.mat, *.lud and *.rhs files are generally not generated by FEKO, but they can be requested by the user. The *.mat file contains the elements of the MoM matrix A. The *.lud file is the LU decomposition of the MoM matrix A, which is used for the solution of the system of linear equations A x = y. The *.rhs file contains the right hand side vector y representing the MoM excitation. The *.str file contains the solution vector x of the system of linear equations A x = y. This is useful for adding further output without rerunning FEKO from scratch. A method is given here to read these files externally.
Reading the *.mat and *.lud files using Fortran The *.mat and *.lud files are binary files, written in the native platform coding (e.g. little endian coding on the INTEL/AMD CPUs), and have a Fortran block structure using the COMPLEX data type (in either single or double precsion). Reading can be done again from Fortran using the following code fragment: CHARACTER MD5_CHECK*32 INTEGER VERSION LOGICAL FILE_SINGLE_PRECISION INTEGER ROWS, COLUMNS INTEGER I, J OPEN (19, FILE="filename", FORM='UNFORMATTED') READ (19) VERSION READ (19) MD5_CHECK IF (VERSION.GE.2) THEN READ (19) FILE_SINGLE_PRECISION ELSE FILE_SINGLE_PRECISION = .FALSE. END IF READ (19) ROWS READ (19) COLUMNS DO J=1, COLUMNS IF (FILE_SINGLE_PRECISION) THEN READ (19) (MATRIX_S(I,J), I=1, ROWS) ELSE READ (19) (MATRIX(I,J), I=1, ROWS) END IF END DO CLOSE (19)
with these additional variables
MATRIX
a two dimensional array at least ROWS*COLUMNS in size to store the data in double precision (declared as DOUBLE COMPLEX)
MATRIX_S a two dimensional array at least ROWS*COLUMNS in size to store the data in single precision (declared as COMPLEX) The command above READ (19) (MATRIX_S(I,J), I=1, ROWS)
reads a complete column of the matrix at once.
File structure The structure of the *.mat and *.lud file are as follows: | length=4 | VERSION (4 bytes) | length=4 | | length=32 | MD5_CHECK (32 bytes) | length=32 | (| length=4 | FILE_SINGLE_PRECISION (4 bytes) | length=4 |) ‐‐ Only present if VERSION >= 2 | length=4 | ROWS (4 bytes) | length=4 | | length=4 | COLUMNS (4 bytes) | length=4 | | length=ROWS*es | MATRIX(:,1) (ROW*es bytes) | length=ROWS*es | ‐‐ es is 8 or 16 bytes depending on precision. | length=ROWS*es | MATRIX(:,2) (ROW*es bytes) | length=ROWS*es | ... | length=ROWS*es | MATRIX(:,COLUMNS) (ROW*es bytes) | length=ROWS*es |
Here each record of interest is preceeded by a length field that indicates the size (in bytes) of the record. For files written with FEKO versions prior to Suite 6.2, the size of the length field is dependant on the platform (32bit vs 64bit). In the case of a 64bit platform, the length field is 8 bytes in size, whereas files saved on 32bit platforms have 4 byte length fields. For versions of FEKO from Suite 6.2 onward, the size of the length field is 4 bytes regardless of the platform where the file was generated and saved. When reading these files using an external utility, such as one written in C or MATLAB, these length fields must also be considerd. They can either be ignored or can be used to detect errors in the reading process. Note that when using GNU Fortran, the compiler option "frecordmarker=8" must be used when reading *.mat files created by 64bit FEKO versions of Suite 6.1 or earlier as the default for this compiler is a length field of 4 bytes.
Reading the *.rhs files The following code fragement must be used to read the *.rhs file: OPEN (23, FILE=FNAMEEXT, FORM='UNFORMATTED') READ (23,ERR=200) (Y(I), I=1, NSZEILE)
with: NSZEILE Number of basis functions for MoM (as obtained from the from the *.out file or the *.mat file above) Note here that the vector array Y is always DOUBLE COMPLEX (also for a single precision run of FEKO). Note also the comments regarding the record length for
32bit versus 64bit FEKO versions up to and after Suite 6.1 from above.
Reading the *.str files The *.str file can be created on request by selecting "Save to *.str file" for "Save/read currents" under the General tab of Solution Settings in CADFEKO. It can also be requested in the PS card in EDITFEKO. The *.str file is saved as a binary file, but can be converted into ASCII format by using the attached str2ascii application. When using the "r" option, a special *.str file format is created which is reparsable (i.e. FEKO can read back in again). This gives users the power to visualise for instance characteristic modes. The syntax to use therefore is as follows: str2ascii r > ascii.str This gives a file "ascii.str" with an ASCII format of the *.str file which FEKO can read again. More information on visualisation of characteristic modes is also available as a howto.
Using the mat2ascii utility to obtain the *.mat file in ASCII format For users who are not familiar with FORTRAN or compilers, we attach to this page utilities for 32 bit and 64 bit Windows and Linux. These utilities are run from the command line giving directly the ASCII output for the *.mat file. Please note that the coding in this utility is platform dependent i.e. a *.mat file obtained with a 64bit version of FEKO cannot be read by a 32bit compilation of FEKO. Attached files mat2ascii.20121019.zip str2ascii utility
Copyright © 20002013 EM Software & Systems, All rights reserved.