ARTS  2.2.66
test_opt_properties.cc
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 Sreerekha Ravi <rekha@sat.physik.uni-bremen.de>
2 
3  This program is free software; you can redistribute it and/or
4  modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation; either version 2 of the
6  License, or (at your option) any later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
16  USA. *
17 
24 #include <iostream>
25 #include "scatproperties.h"
26 extern const Numeric DEG2RAD;
27 int main(void)
28 {
29  Vector amp(8);
30  Vector za(18),aa(36);
31  Matrix l_cross(4,4);
32  Numeric freq = 325*1e+9;
33  // elements of amplitude matrix
34  amp[0] = 1;
35  amp[1] = 0;
36  amp[2] = 0;
37  amp[3] = 0;
38  amp[4] = 0;
39  amp[5] = 0;
40  amp[6] = 0;
41  amp[7] = 0;
42 
43  cout << "\n Extinction Matrix test \n";
44  cout << "Amplitude matrix: \n";
45  cout << amp;
46 
47  cout << "\n";
48  za[0]=0;
49  aa[0]=0;
50  amp2ext(l_cross,amp,freq);
51  cout << "Extinction Matrix: \n";
52  for( Index i = 0; i<4; i++)
53  {
54  for (Index j = 0; j<4; j++)
55  //ext_matrix(l_cross,amp,freq);
56  cout << " " << l_cross(i,j);
57  }
58  cout << "\n";
59  /*===========================================================
60  checking integration
61  ==========================================================*/
62  Vector A(361);
63  Vector A1(361);
64  Numeric X;
65  Numeric llim=0.;
66  Numeric ulim=180.;
67  Numeric N=40;
68  Numeric h=(ulim-llim)/N;
69  cout<<"Lower Limit :" << llim <<"\n" ;
70  cout<<"Upper Limit :" << ulim <<"\n" ;
71  cout<<"Number of points :" << N <<"\n" ;
72  cout<<"Step length :" << h <<"\n" ;
73  for (Numeric theta=0;theta<ulim+1;theta=theta+1)
74  {
75  A[theta]=sin(theta*DEG2RAD);
76  //A[theta]=theta;
77  A1[theta]=DEG2RAD*A[theta];
78  //cout<<theta<<" "<<A[theta] <<"\n";
79  }
80  single_trapez(X,A1,llim,ulim,h);
81  cout << "Integral of the Expression "<< " " <<X<<"\n" ;
82  /*=========================================================
83  testing for double integration============================
84  =======================================================*/
85  Matrix B(181,361);
86  Matrix B1(181,361);
87  //Vector B1(5);
88  //Vector X2(3);
89  //Numeric X1;
90  Numeric Y2;
91  //Index N1=4;
92  Numeric llim2=0;
93  Numeric ulim2=180;
94  Numeric llim1=0.;
95  Numeric ulim1=180;
96  Numeric N1=180;
97  Numeric h1=(ulim1-llim1)/N1;
98  Numeric N2=180;
99  Numeric h2=(ulim2-llim2)/N2;
100  cout<<"Number of points inner integral :" << N1 <<"\n" ;
101  cout<<"Step length - inner integral:" << h1 <<"\n" ;
102  cout<<"Number of points outer integral:" << N2 <<"\n" ;
103  cout<<"Step length - outer integral:" << h2 <<"\n" ;
104  for (Numeric i=llim2;i<ulim2+1;i=i+1)
105  {
106  for (Numeric j=llim1;j<ulim1+1;j=j+1)
107  {
108  B(i,j)=sin(j*DEG2RAD);
109  B1(i,j)=DEG2RAD*B(i,j);
110 
111  }
112  }
113  double_trapez(Y2,B1,llim1,llim2,ulim1,ulim2,h1,h2);
114  cout << " Double Integral of the Expression "<< " " <<Y2<<"\n" ;
115 /*=========================================================
116  testing for double integration through successive single integration
117  =======================================================*/
118  Matrix C(181,361); //Defining the matrix dimension
119  Vector CC1(181);
120  Numeric CCC,CC;
121  for (Numeric i=llim2;i<ulim2+1;i=i+1)
122  {
123  for (Numeric j=llim1;j<ulim1+1;j=j+1)
124  {
125  C(i,j)=sin(j*DEG2RAD);//Matrix definition;simple sin(theta)
126  }
127  }
128  for (Numeric i=llim2;i<ulim2+1;i=i+1)
129  {
130  Vector C1=C(i,Range(joker));
131  C1 *= DEG2RAD;
132  //trapezoidal integration for the columns corresponding to each rows
133  single_trapez(CC,C1,llim1,ulim1,h1);
134  CC1[i]=CC;
135  }
136  //trapezoidal integration for the rows
137  single_trapez(CCC,CC1,llim2,ulim2,h2);
138  cout << " Double Integral of the Expression through successive single integrations "<< " " <<CCC<<"\n";
139  return 0;
140 }
#define N
Definition: rng.cc:195
#define C(a, b)
Definition: Faddeeva.cc:254
The Vector class.
Definition: matpackI.h:556
const Numeric DEG2RAD
The range class.
Definition: matpackI.h:148
#define N1
Definition: rng.cc:321
const Joker joker
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
The Matrix class.
Definition: matpackI.h:788