The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 GSL Library Fourier Integral
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DimkaFF

Lithuania
8 Posts

Posted - 01/03/2018 :  06:28:03 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2015, beta b9.2.196 (32 bit)
Operating System: WIN7 Ultimate N (64bit)
-----------------------------------------

Hi, dear Sirs,
I'm trying to calculate Fourier Integral using QAWF routine from GSL library. For this routine I need to define specific functions and structures in the header file (ocgsl.h in my case) as follows
(reference:ftp://ftp.eso.org/scisoft/scisoft4/sources/gsl/include/gsl/gsl_integration.h):


============================================================================================================================================================================

1 #pragma dll(libgsl, header) 
2 // this is OC special pragma, 
3 // header keyword is to indicate libgsl.dll is in same location as this file
4 #include <Origin.h>
5 #define GSL_EXPORT	// for OC, this is not needed, so make it empty
6 
7 // you can directly search and copy gsl function prototypes here
8 
9 /*---------------------------------------------------------------------Structures--------------------------------------------------------------------------------------*/
10
11typedef double (* FUNC)(double x, void * params);
12
13struct gsl_function_struct 
14{
15	FUNC function;
16	void * params;
17};
18
19typedef struct gsl_function_struct gsl_function ;
20
21typedef struct
22{
23    size_t limit;
24    size_t size;
25    size_t nrmax;
26    size_t i;
27    size_t maximum_level;
28    double *alist;
29    double *blist;
30    double *rlist;
31    double *elist;
32    size_t *order;
33    size_t *level;
34}gsl_integration_workspace;
35
36typedef struct
37{
38  double alpha;
39  double beta;
40  int mu;
41  int nu;
42  double ri[25];
43  double rj[25];
44  double rg[25];
45  double rh[25];
46} gsl_integration_qaws_table;
47
48enum gsl_integration_qawo_enum { GSL_INTEG_COSINE, GSL_INTEG_SINE };
49
50typedef struct {
51	size_t n;
52    double omega;
53    double L;
54    double par;
55    enum gsl_integration_qawo_enum sine;
56    double *chebmo;
57} gsl_integration_qawo_table;
58
59/*---------------------------------------------------------------------Memmory Allocation--------------------------------------------------------------------------------------*/
60
61GSL_EXPORT gsl_integration_workspace  *gsl_integration_workspace_alloc (const size_t n);
62GSL_EXPORT void gsl_integration_workspace_free (gsl_integration_workspace * w);
63
64
65GSL_EXPORT gsl_ integration_qawo_table *gsl_integration_qawo_table_alloc(double omega, double L, enum gsl_integration_qawo_enum sine, site_t n);
66GSL_EXPORT int  gsl_integration_qawo_table_set (gsl_integration_qawo_table *t, double omega, double L, enum gsl_integration_qawo_enum sine);
67GSL_EXPORT int  gsl_integration_qawo_table_set_length(gsl_integration_qawo_table *t, double L);
68GSL_EXPORT void gsl_integration_qawo_table_free(gsl_integration_qawo_table * t);
69
70
71/*---------------------------------------------------------------------Integration--------------------------------------------------------------------------------------*/
72GSL_EXPORT int gsl_integration_qag (const gsl_function * f,
73                                    double a, double b,
74                                    double epsabs, double epsrel, size_t limit,
75                                    int key,
76                                    gsl_integration_workspace * workspace,
77                                    double *result, double *abserr);
78                                    
79GSL_EXPORT int gsl_integration_qags (const gsl_function * f,
80									double a, double b, 
81									double epsabs, double epsrel, size_t limit, 
82									gsl_integration_workspace * workspace, 
83									double *result, double *abserr);
84									
85GSL_EXPORT int gsl_integration_qawf(const gsl_function * f,
86									double a, double epsabs,
87									size_t limit, 
88									gsl_integration_workspace *workspace, 
89									gsl_integration_workspace *cycle_workspace,
90									gsl_integration_qawo_table *wf,
91									double *result, double *abserr);
92									
93/*---------------------------------------------------------------------Otehr funct--------------------------------------------------------------------------------------*/
94
============================================================================================================================================================================



When I am trying to compile C-code, OriginC compiler produces the following error:

GSL_DAP_Fourier.c
C:\...\OriginLab User file\originc\ocgsl.h(55) :Error, unknown keyword in type declaration
C:\...\OriginLab User file\originc\ocgsl.h(50) :Error, data type declaration error
C:\...\OriginLab User file\OriginC\GSL_DAP_Fourier.c(2) :Error, include file compilation error
Compiling errors found, linking cannot start!


It is seems, that Origin C compiler does not recognize line no.55, i.e. enumeration list enum gsl_integration_qawo_enum sine; in the structure gsl_integration_qawo_table;. I'm not a big expert in Origin C programming, but I suppose, that it is OriginC compiler-specific problem. Maybe can you share your suggestion how can I use QAWF routine in OriginC ?

In the link below have I attached GSL dll's, header ocgsl.h and test_QAWF.c files.
https://drive.google.com/file/d/1dPTSbacgZ3Bgyv7zGhqKMYj4We0QfALA/view?usp=sharing


Best regards,
Dmitriy.

eparent

118 Posts

Posted - 01/03/2018 :  4:23:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The simplest solution is to change that line from:
enum gsl_integration_qawo_enum sine;

to:
int sine;

Go to Top of Page

DimkaFF

Lithuania
8 Posts

Posted - 01/04/2018 :  12:31:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by eparent

The simplest solution is to change that line from:
enum gsl_integration_qawo_enum sine;

to:
int sine;





eparent,
thank you for your answer. I tried to do this. Also, I have changed
gsl_integration_qawo_enum sine
to the type
int sine
in the function argument list, but another error was still appear. The actual problem was redundant space symbol in the function name in the line 65. Now the code works ok. Thank you again.

Edited by - DimkaFF on 01/04/2018 03:01:35 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000