Code generation with an octave interface

Helfer Thomas thomas-helfer at orange.fr
Tue Nov 18 11:24:23 CST 2008


Hello,

I am writing a code generation tool for material properties (Young Modulus, 
etc..), material behaviours (creep,...). This tool support interface to 
c,c++,fortran, some finite element code, etc...

For material properties I have written an interface for octave. This interface 
is pretty convenient for testing and plotting material properties. Code 
generated works but I am wondering if performances are ok. 

You will find an example of original file octave_test.mfront and the generated 
code Test.cpp attached to this mail. 

I mostly used Stefan Van Der Walt's DaCodaAlFine for writting the octave 
interface (http://wiki.octave.org/wiki.pl?DaCodaAlFine). 

Test.cpp can be compiled with mkoctfile using GNU Octave, version 3.0.0
under ubuntu.

This test simply compute the product of the two arguments. The arguments might 
be either two reals, either two matrices, either a scalar and a matrix. All 
these cases are treated individually.

Could you give me your opinion on the code. In particular, to treat the latter 
case, I used to function get_scalar_value and get_matrix_value. Is their any 
real performance penalty du to these functions ? In particular, does 
 octave_value::matrix.value() return a copy of the matrix ?

Feel free to do any remark.

Thanks,

Helfer Thomas,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.cpp
Type: text/x-c++src
Size: 2757 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20081118/bd4f4622/attachment-0001.bin 
-------------- next part --------------
@Parser MaterialLaw;
@Law    Test;
@Author Helfer Thomas;
@Date   18/11/08;

@Description{
  Example for octave users
}

// changing the name of output
@Output f;

@Input T,p;

@Function{
  f = T*p;
} // end of @Function


More information about the Help-octave mailing list