matrixbase::GetInternalDataType

Description

Get the internal or underlying base data type of a matrixbase derived object.

Syntax

int GetInternalDataType( )

Parameters

Return

Returns FSI_DOUBLE, FSI_REAL, FSI_SHORT, FSI_LONG, FSI_CHAR, FSI_BYTE, FSI_USHORT,FSI_ULONG, or FSI_COMPLEX which are enumerated in OC_const.h.

Examples

EX1

void matrixbase_GetInternalDataType_ex1()
{
    int nType, ii,jj;
    
    matrix<complex> mat1 = {
        {1,  1i,  1+1i},
        {2,  2i,  2+2i}
    };
    printf("Given matrix:\n");
    for(ii=0; ii<2; ii++) {
        for(jj=0; jj<3; jj++) printf("  %g+%gi", mat1[ii][jj]);
        printf("\n");
    }

    MatrixPage MatPg1;
    MatPg1.Create("Origin");
    MatrixLayer MatLy1 = MatPg1.Layers(0);
    Matrix Mat1(MatLy1);
    Mat1=mat1;
    printf("Observe that %s shows only the Real part\n",Mat1.GetName());
    
    nType = mat1.GetInternalDataType(); // Return FSI_COMPLEX
    
    if(nType==FSI_DOUBLE)  printf( "The matrix is FSI_DOUBLE.\n" );  
    else if(nType==FSI_REAL)    printf( "The matrix is FSI_REAL.\n" );   
    else if(nType==FSI_SHORT)   printf( "The matrix is FSI_SHORT.\n" );  
    else if(nType==FSI_LONG)    printf( "The matrix is FSI_LONG.\n" );   
    else if(nType==FSI_CHAR)    printf( "The matrix is FSI_CHAR.\n" );   
    else if(nType==FSI_BYTE)    printf( "The matrix is FSI_BYTE.\n" );     
    else if(nType==FSI_USHORT)  printf( "The matrix is FSI_USHORT.\n" ); 
    else if(nType==FSI_ULONG)   printf( "The matrix is FSI_ULONG.\n" );   
    else if(nType==FSI_COMPLEX) printf( "The matrix is FSI_COMPLEX.\n" ); 
    else printf("Error: Unexpected result of GetInternalDataType\n");
}

Remark

Get the internal or underlying base data type of a matrixbase derived object.

See Also

matrixbase::CastToDouble, matrixbase::CastToInteger

header to Include

origin.h