Turn off warning

Place here all posts related to implementation and source codes. This forum is rather technical and reserved for programmers.
valerio
Posts: 10
Joined: Mon Jan 14, 2008 1:56 pm

Turn off warning

Postby valerio » Sun Aug 16, 2009 8:46 pm

Hi all,

I'm trying to use the qtvwave library to build a simple mex C function to calculate Rayleigh wave ellipticity. As Marc suggested in another post, I started playing with the gpell code and after some copy, paste and modify, now the code is somehow running.
However I get a segmentation fault in all those particular cases where gpell produces some warning (e.g. ** Warning ** : _x2 == min). In all other cases it works well.
I'm still not 100% sure this can cause the problem but, just in case, is there any automatic way to suppress these warnings and any console output?

Thanks,
Valerio
Attachments
gpell_core.cpp
(1.63 KiB) Downloaded 324 times

admin
Site Admin
Posts: 412
Joined: Mon Aug 13, 2007 11:48 am
Location: ISTerre
Contact:

Postby admin » Sat Oct 17, 2009 2:58 am

Hi Valerio,

In latest release the warning is either fixed or it does not produce any crash. For your information, in the next release qtbwave library has been renamed to GpCoreWave. Among other reasons I wanted to get rid of prefix 'Qtb' which means nothing and prefer using namespace. Porting from one version to the other is really not a big deal (just a few replacements).

I can't remember if there was a C and a Fortran interface to that library at the time you implement your mex function. Now, there is a C interface to the computation of dispersion and ellipticity curves.

Thanks for the code.

admin
Site Admin
Posts: 412
Joined: Mon Aug 13, 2007 11:48 am
Location: ISTerre
Contact:

Postby admin » Sat Oct 17, 2009 3:07 am

Reading your code, I do not understand exactly what your are doing. Are you calculating the curve for two samples only? Why not setting the number of samples in the argument of the function?
On the output, what do you expect? One single value? Or a complete vector containing the ellipticity curve? Do you know to return a vector to Matlab? And how to accept a vector, for instance the sampling vector?

valerio
Posts: 10
Joined: Mon Jan 14, 2008 1:56 pm

Postby valerio » Sat Oct 17, 2009 4:14 pm

Thanks for the reply.
Yes, I know this code could appear a little awful... :-)
but this was the last of a long series of tests were I changed a lot of stuff, and the interface has been generally defined for testing purposes only (so, it is not optimized at all). Of course the Mex final interface would have been better written ;-p
The idea was just of getting one unique output value out of one unique frequency. Unfortunately, I can't make it working even in this simple case.

Anyway, now that I know about the new C interface, I will use it.
Thanks once again!

Valerio

admin
Site Admin
Posts: 412
Joined: Mon Aug 13, 2007 11:48 am
Location: ISTerre
Contact:

Postby admin » Sat Oct 17, 2009 5:30 pm

Just a remark to get one single frequency point in the ellipticity curve.
If the sampling is rather poor it is likely to produce very bad results. To compute an ellipticity curve it is necessary to first compute the dispersion curve which requires a large band to allow automatic validity tests. So the best solution if you want just one point, let's say at 1 Hz, is to add samples before and after: e.g. 25 samples from 0.1Hz to 1Hz and other 25 from 1Hz to 10 Hz. Do the computation and return only the 26th value located at 1Hz.


Return to “Developer's corner”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest