CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Reading input matrix in a solver (http://www.cfd-online.com/Forums/openfoam-programming-development/107564-reading-input-matrix-solver.html)

tsimon October 1, 2012 06:34

Reading input matrix in a solver
 
Hi! I would like to get input from a case file (we could call this file someProperties located in constant dir). The information to be read should be scalars in a 10x19 matrix. How could this be performed in OF (1.6-ext and simpleFoam, if it matters).

Should the matrix be declared as:
int myMatrix[10][19];

and if so, how do I read the someProperties file to get the values into "myMatrix"?

Best regards, tsimon.

treima October 1, 2012 08:33

Hi,

you can define matrices this way:

Matrix<scalar,scalar> matrix(19,10);

With matrix[i][j] you can grab the elements. Now you have to find a nice way to read your elements from files. This depends on your data.


regards
treima


All times are GMT -4. The time now is 21:17.