1919/* -------------------------------------------------------------------------
2020 * constructor initializing seqR3 to 0
2121 *-------------------------------------------------------------------------*/
22- seqR3::seqR3 (long M){
23- long n;
22+ seqR3::seqR3 (long M)
23+ {
24+ // long n;
2425 N=M;
25- x = (double *)malloc (N*sizeof (double ));
26- y = (double *)malloc (N*sizeof (double ));
27- z = (double *)malloc (N*sizeof (double ));
28- for (n=0 ; n<N; n++){
29- x[n]=0.0 ;
30- y[n]=0.0 ;
31- z[n]=0.0 ;
32- }
33- }
26+ // x = (double *)malloc(N*sizeof(double));
27+ // y = (double *)malloc(N*sizeof(double));
28+ // z = (double *)malloc(N*sizeof(double));
29+ seqr3 = new vectR3[N];
30+ clear ();
31+ // for(n=0; n<N; n++){
32+ // x[n]=0.0;
33+ // y[n]=0.0;
34+ // z[n]=0.0;
35+ // }
36+ }
3437
3538/* -------------------------------------------------------------------------
3639 * constructor initializing seqR3 to <u>
3740 *-------------------------------------------------------------------------*/
38- seqR3::seqR3 (long M, double u){
39- long n;
41+ seqR3::seqR3 (long M, double u)
42+ {
43+ // long n;
4044 N=M;
41- x = (double *)malloc (N*sizeof (double ));
42- y = (double *)malloc (N*sizeof (double ));
43- z = (double *)malloc (N*sizeof (double ));
44- for (n=0 ; n<N; n++){
45- x[n]=u;
46- y[n]=u;
47- z[n]=u;
48- }
49- }
45+ // x = (double *)malloc(N*sizeof(double));
46+ // y = (double *)malloc(N*sizeof(double));
47+ // z = (double *)malloc(N*sizeof(double));
48+ seqr3 = new vectR3[N];
49+ fill ( u );
50+ // for(n=0; n<N; n++){
51+ // x[n]=u;
52+ // y[n]=u;
53+ // z[n]=u;
54+ // }
55+ }
5056
5157/* -------------------------------------------------------------------------
5258 * fill the seqR3 with a value 0
5359 *-------------------------------------------------------------------------*/
54- void seqR3::clear (void ){
55- long n;
56- for (n=0 ; n<N; n++){
57- x[n]=0 ;
58- y[n]=0 ;
59- z[n]=0 ;
60+ void seqR3::clear (void )
61+ {
62+ for ( long n=0 ; n<N; n++){
63+ put ( n, 0 );
64+ // x[n]=0;
65+ // y[n]=0;
66+ // z[n]=0;
6067 }
61- }
68+ }
6269
63- /* -------------------------------------------------------------------------
64- * fill the seqR3 with a value <u>
65- *-------------------------------------------------------------------------*/
66- void seqR3::fill (double u){
70+ // -----------------------------------------------------------------------------
71+ // ! \brief Fill the seqR3 with a value <u>
72+ // -----------------------------------------------------------------------------
73+ void seqR3::fill (double u)
74+ {
6775 long n;
68- for (n=0 ; n<N; n++){
69- x[n]=u;
70- y[n]=u;
71- z[n]=u;
72- }
76+ for (n=0 ; n<N; n++)
77+ {
78+ put ( n, u );
79+ // x[n]=u;
80+ // y[n]=u;
81+ // z[n]=u;
7382 }
83+ }
7484
75- /* -------------------------------------------------------------------------
76- * put a single value <u> into the seqR3 x at location n
77- *-------------------------------------------------------------------------*/
78- int seqR3::put (long n, double u, double v, double w){
85+ // -----------------------------------------------------------------------------
86+ // ! \brief Put a single value <u> into the seqR3 x at location n
87+ // -----------------------------------------------------------------------------
88+ int seqR3::put (long n, double u, double v, double w)
89+ {
7990 if (n<N){
80- x[n]=u;
81- y[n]=v;
82- z[n]=w;
91+ seqr3[n].put ( u, v, w );
92+ // x[n]=u;
93+ // y[n]=v;
94+ // z[n]=w;
8395 return 0 ;
8496 }
8597 else {
8698 fprintf (stderr," n=%ld larger than seqR3 size N=%ld\n " ,n,N);
8799 return -1 ;
88100 }
89- }
101+ }
90102
91- int seqR3::put (long n, vectR3 xyz){
92- if (n<N){
93- x[n]=xyz.getx ();
94- y[n]=xyz.gety ();
95- z[n]=xyz.getz ();
103+ // -----------------------------------------------------------------------------
104+ // \brief Put a single value <u> into the seqR3 x at location n
105+ // -----------------------------------------------------------------------------
106+ int seqR3::put (long n, vectR3 abc)
107+ {
108+ if (n<N)
109+ {
110+ // x[n]=xyz.getx();
111+ // y[n]=xyz.gety();
112+ // z[n]=xyz.getz();
113+ (seqr3[n]).put ( abc.getx (), abc.gety (), abc.gety () );
96114 return 0 ;
97- }
98- else {
115+ }
116+ else
117+ {
99118 fprintf (stderr," n=%ld larger than seqR3 size N=%ld\n " ,n,N);
100119 return -1 ;
101- }
102120 }
121+ }
103122
104- /* -------------------------------------------------------------------------
105- * get a single value from the sequence x at location n
106- * -------------------------------------------------------------------------*/
123+ // ---- -------------------------------------------------------------------------
124+ // ! \brief Get a single value from the sequence x at location n
125+ // -----------------------------------------------------------------------------
107126vectR3 seqR3::get (long n){
108- vectR3 xyz (0 ,0 ,0 );
109- if (n<N)xyz.put (x[n],y[n],z[n]);
110- else fprintf (stderr," n=%ld larger than seqR3 size N=%ld\n " ,n,N);
111- return xyz;
127+ // vectR3 xyz(0,0,0);
128+ // if(n<N)xyz.put(x[n],y[n],z[n]);
129+ // else fprintf(stderr,"n=%ld larger than seqR3 size N=%ld\n",n,N);
130+ return seqr3[n];
131+ // return xyz;
112132 }
113133
114- /* -------------------------------------------------------------------------
115- * get a single value from the sequence x,y, or z at location n
116- * -------------------------------------------------------------------------*/
134+ // ---- -------------------------------------------------------------------------
135+ // ! \brief Get the x element from the sequence at location n
136+ // -----------------------------------------------------------------------------
117137double seqR3::getx (long n){
118138 double u=0 ;
119- if (n<N)u=x[n];
139+ // if(n<N)u=x[n];
140+ if (n<N)u = seqr3[n].getx ();
120141 else fprintf (stderr," n=%ld larger than x seqR3 size N=%ld\n " ,n,N);
121142 return u;
122143 }
144+
145+ // -----------------------------------------------------------------------------
146+ // ! \brief Get the y element from the sequence at location n
147+ // -----------------------------------------------------------------------------
123148double seqR3::gety (long n){
124149 double u=0 ;
125- if (n<N)u=y[n];
150+ if (n<N)u = seqr3[n].gety ();
151+ // if(n<N)u=y[n];
126152 else fprintf (stderr," n=%ld larger than y seqR3 size N=%ld\n " ,n,N);
127153 return u;
128154 }
155+
156+ // -----------------------------------------------------------------------------
157+ // ! \brief Get the z element from the sequence at location n
158+ // -----------------------------------------------------------------------------
129159double seqR3::getz (long n){
130160 double u=0 ;
131- if (n<N)u=z[n];
161+ // if(n<N)u=z[n];
162+ if (n<N)u = seqr3[n].getz ();
132163 else fprintf (stderr," n=%ld larger than z seqR3 size N=%ld\n " ,n,N);
133164 return u;
134165 }
@@ -141,7 +172,8 @@ void seqR3::list(const long start, const long end, const char *str1, const char
141172 if (ptr!=NULL ){
142173 if (strlen (str1)>0 ) fprintf (ptr," %s" ,str1);
143174 for (n=start,m=1 ; n<=end; n++,m++){
144- fprintf (ptr," (%6.3lf,%6.3lf,%6.3lf) " ,x[n],y[n],z[n]);
175+ // fprintf(ptr,"(%6.3lf,%6.3lf,%6.3lf) ",x[n],y[n],z[n]);
176+ fprintf (ptr," (%6.3lf,%6.3lf,%6.3lf) " , seqr3[n].getx (), seqr3[n].gety (), seqr3[n].getz () );
145177 if (m%3 ==0 )fprintf (ptr," \n " );
146178 }
147179 if (strlen (str2)>0 )fprintf (ptr," %s" ,str2);
@@ -154,14 +186,16 @@ void seqR3::list(const long start, const long end, const char *str1, const char
154186void seqR3::list1 (void ){
155187 long n,m;
156188 for (n=0 ,m=1 ; n<N; n++,m++){
157- printf (" (%2.0lf,%2.0lf,%2.0lf) " ,x[n],y[n],z[n]);
189+ // printf("(%2.0lf,%2.0lf,%2.0lf) ",x[n],y[n],z[n]);
190+ printf (" (%2.0lf,%2.0lf,%2.0lf) " , seqr3[n].getx (), seqr3[n].gety (), seqr3[n].getz () );
158191 if (m%5 ==0 )printf (" \n " );
159192 }
160193 }
161194void seqR3::list1 (long start, long end){
162195 long n,m;
163196 for (n=start,m=1 ; n<=end; n++,m++){
164- printf (" (%2.0lf,%2.0lf,%2.0lf) " ,x[n],y[n],z[n]);
197+ // printf("(%2.0lf,%2.0lf,%2.0lf) ",x[n],y[n],z[n]);
198+ printf (" (%2.0lf,%2.0lf,%2.0lf) " , seqr3[n].getx (), seqr3[n].gety (), seqr3[n].getz () );
165199 if (m%50 ==0 )printf (" \n " );
166200 else if (m%10 ==0 )printf (" " );
167201 }
@@ -210,12 +244,12 @@ vectR3 operator-(vectR3 p){
210244 return q;
211245 }
212246
213- /* -------------------------------------------------------------------------
214- * return the angle theta in radians between the two vectors induced by
215- * the points <p> and <q> in the space R^3.
216- * on SUCCESS return theta in the closed interval [0:PI]
217- * on ERROR return negative value or exit with value EXIT_FAILURE
218- * -------------------------------------------------------------------------*/
247+ // -------------------------------------------------------------------------
248+ // ! \brief return the angle theta in radians between the two vectors induced by
249+ // ! the points <p> and <q> in the space R^3.
250+ // ! \returns On SUCCESS return theta in the closed interval [0:PI];
251+ // ! On ERROR return negative value or exit with value EXIT_FAILURE
252+ // -------------------------------------------------------------------------*/
219253double pqtheta (const vectR3 p, const vectR3 q){
220254 const double rp=p.mag (), rq=q.mag ();
221255 double y,theta;
@@ -228,9 +262,9 @@ double pqtheta(const vectR3 p, const vectR3 q){
228262 return theta;
229263 }
230264
231- /* -------------------------------------------------------------------------
232- * return the minimum element of the 6 tupple
233- * -------------------------------------------------------------------------*/
265+ // ---- -------------------------------------------------------------------------
266+ // ! \brief Return the minimum element of the 6 tupple
267+ // -----------------------------------------------------------------------------
234268double otriple::min (void ) const
235269{
236270 int i;
@@ -245,9 +279,9 @@ double otriple::min(void) const
245279 return min;
246280}
247281
248- /* -------------------------------------------------------------------------
249- * return the maximum element of the 6 tupple
250- * -------------------------------------------------------------------------*/
282+ // ---- -------------------------------------------------------------------------
283+ // ! \brief Return the maximum element of the 6 tupple
284+ // -----------------------------------------------------------------------------
251285double otriple::max (void ) const
252286{
253287 int i;
0 commit comments