TDMS
Time Domain Maxwell Solver
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
InputMatrices Class Reference

Allows us to handle the MATLAB arrays from the input file in a human-readable format. More...

#include <input_matrices.h>

Collaboration diagram for InputMatrices:
[legend]

Public Member Functions

int index_from_matrix_name (const std::string &matrix_name)
 Fetches the index of matrix_name in the tdms_matrix_names::matrixnames array.
 
const mxArray * operator[] (int index)
 Fetch a (pointer to a) MATLAB input matrix by index reference.
 
const mxArray * operator[] (const std::string &matrix_name)
 Fetch a (pointer to a) MATLAB input matrix by name.
 
void set_matrix_pointer (int index, mxArray *new_ptr)
 Set the matrix pointer with the given index.
 
void set_matrix_pointer (const std::string &matrix_name, mxArray *new_ptr)
 Set the pointer to the named matrix.
 
void set_from_input_file (const char *mat_filename)
 Open the input mat file, load the matrices, and setup pointers to the matrices.
 
void set_from_input_file (const char *mat_filename, const char *gridfile)
 Open the input mat file, load the matrices, and setup pointers to the matrices.
 

Public Attributes

std::string input_filename
 

Private Member Functions

void assign_matrix_pointers (MatrixCollection &expected, MatFileMatrixCollection &actual)
 Assigns pointers to the matrices in an input file, based on those we are expecting to recieve.
 
void validate_assigned_pointers ()
 Validates that the MATLAB arrays that we are pointing to are of the type that we expect.
 

Private Attributes

const mxArray * matrix_pointers [NMATRICES]
 

Detailed Description

Allows us to handle the MATLAB arrays from the input file in a human-readable format.

Member Function Documentation

◆ assign_matrix_pointers()

void InputMatrices::assign_matrix_pointers ( MatrixCollection expected,
MatFileMatrixCollection actual 
)
private

Assigns pointers to the matrices in an input file, based on those we are expecting to recieve.

MatrixCollection is a list of names of matrices we expect to be in the MatFileMatrixCollection, based on whether we are reading from a gridfile, input_file without a gridfile, or an input file that came with a gridfile.

Parameters
expectedThe matrices we expect to be able to pull from actual
actualThe matrices saved in an input file, to be loaded

◆ index_from_matrix_name()

int InputMatrices::index_from_matrix_name ( const std::string &  matrix_name)

Fetches the index of matrix_name in the tdms_matrix_names::matrixnames array.

Parameters
matrix_nameThe matrix name to locate
Returns
int The corresponding index

◆ operator[]() [1/2]

const mxArray * InputMatrices::operator[] ( const std::string &  matrix_name)
inline

Fetch a (pointer to a) MATLAB input matrix by name.

Parameters
matrix_nameName of the matrix to fetch the pointer to
Returns
const mxArray* Pointer to the corresponding MATLAB array

◆ operator[]() [2/2]

const mxArray * InputMatrices::operator[] ( int  index)
inline

Fetch a (pointer to a) MATLAB input matrix by index reference.

Index-references can be computed through index_from_matrix_name. They are ordered in the same way as the names in tdms_matrix_names::matrixnames.

Parameters
indexThe index to fetch
Returns
const mxArray* Pointer to the corresponding MATLAB array

◆ set_from_input_file() [1/2]

void InputMatrices::set_from_input_file ( const char *  mat_filename)

Open the input mat file, load the matrices, and setup pointers to the matrices.

Parameters
mat_filenameThe MATLAB filename

◆ set_from_input_file() [2/2]

void InputMatrices::set_from_input_file ( const char *  mat_filename,
const char *  gridfile 
)

Open the input mat file, load the matrices, and setup pointers to the matrices.

Parameters
mat_filenameThe MATLAB filename
gridfileThe additional gridfile

◆ set_matrix_pointer() [1/2]

void InputMatrices::set_matrix_pointer ( const std::string &  matrix_name,
mxArray *  new_ptr 
)
inline

Set the pointer to the named matrix.

Parameters
matrix_nameThe name of the matrix that we want to set the pointer to
new_ptrThe address we want to assign

◆ set_matrix_pointer() [2/2]

void InputMatrices::set_matrix_pointer ( int  index,
mxArray *  new_ptr 
)
inline

Set the matrix pointer with the given index.

Not recommended unless you're certain you are setting the correct array pointer! Use the overload which takes the array name as an input if you are uncertain you are setting the correct pointer.

This function mainly sees use during destruction (and output writing) when we just want to iterate over all the matrices that we are dealing with.

Parameters
indexThe index in matrix_pointers to set
new_ptrThe address we want to assign

Member Data Documentation

◆ input_filename

std::string InputMatrices::input_filename

Name of the input file from which MATLAB objects were extracted. Akward middle-child between full removal of MATLAB and the slow removal of class dependencies


The documentation for this class was generated from the following files: