Cantera  2.1.2
BasisOptimize.cpp File Reference

Functions which calculation optimized basis of the stoichiometric coefficient matrix (see /ref equil functions) More...

#include "cantera/thermo/ThermoPhase.h"
#include "cantera/equil/MultiPhase.h"
Include dependency graph for BasisOptimize.cpp:

Go to the source code of this file.

## Namespaces

Cantera
Namespace for the Cantera kernel.

## Functions

static void print_stringTrunc (const char *str, int space, int alignment)
Print a string within a given space limit. More...

static size_t amax (double *x, size_t j, size_t n)
Finds the location of the maximum component in a vector x More...

static int mlequ (double *c, size_t idem, size_t n, double *b, size_t m)
Invert an nxn matrix and solve m rhs's. More...

## Variables

int BasisOptimize_print_lvl = 0
External int that is used to turn on debug printing for the BasisOptimze program. More...

## Detailed Description

Functions which calculation optimized basis of the stoichiometric coefficient matrix (see /ref equil functions)

Definition in file BasisOptimize.cpp.

## Function Documentation

 static void print_stringTrunc ( const char * str, int space, int alignment )
static

Print a string within a given space limit.

This routine limits the amount of the string that will be printed to a maximum of "space" characters.

Parameters
 str String -> must be null terminated. space space limit for the printing. alignment 0 centered 1 right aligned 2 left aligned

Definition at line 425 of file BasisOptimize.cpp.

References Cantera::writelog(), and Cantera::writelogf().

Referenced by Cantera::BasisOptimize().

 static size_t amax ( double * x, size_t j, size_t n )
static

Finds the location of the maximum component in a vector x

Parameters
 x Vector to search j j <= i < n : i is the range of indices to search in x n Length of the vector
Returns
index of the greatest value on x searched

Definition at line 480 of file BasisOptimize.cpp.

Referenced by Cantera::absmax(), and Cantera::BasisOptimize().

 static int mlequ ( double * c, size_t idem, size_t n, double * b, size_t m )
static

Invert an nxn matrix and solve m rhs's.

Solve C X + B = 0

This routine uses Gauss elimination and is optimized for the solution of lots of rhs's. A crude form of row pivoting is used here.

Parameters
 c C is the matrix to be inverted idem first dimension in the calling routine. idem >= n must be true n number of rows and columns in the matrix b rhs of the matrix problem m number of rhs to be solved for
• c[i+j*idem] = c_i_j = Matrix to be inverted
• b[i+j*idem] = b_i_j = vectors of rhs's. Each column is a new rhs.

Where j = column number and i = row number.

Returns
Retuns 1 if the matrix is singular, or 0 if the solution is OK

The solution is returned in the matrix b.

Definition at line 493 of file BasisOptimize.cpp.

References Cantera::writelogf().

Referenced by Cantera::BasisOptimize().