LORENE
diff.h
1/*
2 * Definition of Lorene class Diff.
3 *
4 */
5
6/*
7 * Copyright (c) 2005 Jerome Novak
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#ifndef __DIFF_H_
27#define __DIFF_H_
28
29/*
30 * $Id: diff.h,v 1.4 2014/10/13 08:52:33 j_novak Exp $
31 * $Log: diff.h,v $
32 * Revision 1.4 2014/10/13 08:52:33 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.3 2006/04/10 15:20:51 j_novak
36 * Operators dsdx and sx can now be used in the nucleus.
37 *
38 * Revision 1.2 2005/01/11 15:16:58 j_novak
39 * More Diff operators.
40 *
41 * Revision 1.1 2005/01/10 16:39:21 j_novak
42 * New class for 1D mono-domain differential operators.
43 *
44 *
45 *
46 * $Header: /cvsroot/Lorene/C++/Include/diff.h,v 1.4 2014/10/13 08:52:33 j_novak Exp $
47 *
48 */
49
50#include "type_parite.h"
51#include "matrice.h"
52
53namespace Lorene {
65class Diff {
66
67 // Data :
68 // -----
69 public:
71 static const int max_points = 50 ;
72
73 protected:
74 int base ;
75 int npoints ;
76
77 // Constructors - Destructor
78 // -------------------------
79 protected:
80 Diff(int base_r, int nr) ;
81 Diff(const Diff& ) ;
82
83 virtual ~Diff() ;
84
85
86 // Mutators / assignment
87 // ---------------------
88 protected:
90 void operator=(const Diff&) ;
91
92 // Accessors
93 // ---------
94 public:
96 int get_base() const {return base ;} ;
97
99 int get_npoints() const { return npoints ;} ;
100
102 operator Matrice() const { return get_matrice() ; }
103
104 // Computational routines
105 //-----------------------
106 public:
108 virtual const Matrice& get_matrice() const = 0 ;
109
110 // Outputs
111 // -------
112 public:
114 friend ostream& operator<<(ostream& , const Diff& ) ;
115
116 protected:
118 virtual ostream& operator>>(ostream&) const = 0 ;
119
120};
121
122
129class Diff_dsdx : public Diff {
130
131 // Constructors - Destructor
132 // -------------------------
133 public:
137 Diff_dsdx(int base_r, int nr) ;
138
139 Diff_dsdx(const Diff_dsdx& ) ;
140
141 virtual ~Diff_dsdx() ;
142
143 private:
144 void initialize() ;
145
146 // Mutators / assignment
147 // ---------------------
148 public:
150 void operator=(const Diff_dsdx&) ;
151
152 // Computational routines
153 //-----------------------
154 public:
156 virtual const Matrice& get_matrice() const ;
157
158 // Outputs
159 // -------
160 protected:
162 virtual ostream& operator>>(ostream&) const ;
163};
164
165
172class Diff_dsdx2 : public Diff {
173
174 // Constructors - Destructor
175 // -------------------------
176 public:
177 Diff_dsdx2(int base_r, int nr) ;
178 Diff_dsdx2(const Diff_dsdx2& ) ;
179
180 virtual ~Diff_dsdx2() ;
181
182 private:
183 void initialize() ;
184
185 // Mutators / assignment
186 // ---------------------
187 public:
189 void operator=(const Diff_dsdx2&) ;
190
191 // Computational routines
192 //-----------------------
193 public:
195 virtual const Matrice& get_matrice() const ;
196
197 // Outputs
198 // -------
199 protected:
201 virtual ostream& operator>>(ostream&) const ;
202};
203
210class Diff_id : public Diff {
211
212 // Constructors - Destructor
213 // -------------------------
214 public:
215 Diff_id(int base_r, int nr) ;
216 Diff_id(const Diff_id& ) ;
217
218 virtual ~Diff_id() ;
219
220 private:
221 void initialize() ;
222
223 // Mutators / assignment
224 // ---------------------
225 public:
227 void operator=(const Diff_id&) ;
228
229 // Computational routines
230 //-----------------------
231 public:
233 virtual const Matrice& get_matrice() const ;
234
235 // Outputs
236 // -------
237 protected:
239 virtual ostream& operator>>(ostream&) const ;
240};
241
250class Diff_mx : public Diff {
251
252 // Constructors - Destructor
253 // -------------------------
254 public:
255 Diff_mx(int base_r, int nr) ;
256 Diff_mx(const Diff_mx& ) ;
257
258 virtual ~Diff_mx() ;
259
260 private:
261 void initialize() ;
262
263 // Mutators / assignment
264 // ---------------------
265 public:
267 void operator=(const Diff_mx&) ;
268
269 // Computational routines
270 //-----------------------
271 public:
273 virtual const Matrice& get_matrice() const ;
274
275 // Outputs
276 // -------
277 protected:
279 virtual ostream& operator>>(ostream&) const ;
280};
281
289class Diff_mx2 : public Diff {
290
291 // Constructors - Destructor
292 // -------------------------
293 public:
294 Diff_mx2(int base_r, int nr) ;
295 Diff_mx2(const Diff_mx2& ) ;
296
297 virtual ~Diff_mx2() ;
298
299 private:
300 void initialize() ;
301
302 // Mutators / assignment
303 // ---------------------
304 public:
306 void operator=(const Diff_mx2&) ;
307
308 // Computational routines
309 //-----------------------
310 public:
312 virtual const Matrice& get_matrice() const ;
313
314 // Outputs
315 // -------
316 protected:
318 virtual ostream& operator>>(ostream&) const ;
319};
320
329class Diff_sx : public Diff {
330
331 // Constructors - Destructor
332 // -------------------------
333 public:
334 Diff_sx(int base_r, int nr) ;
335 Diff_sx(const Diff_sx& ) ;
336
337 virtual ~Diff_sx() ;
338
339 private:
340 void initialize() ;
341
342 // Mutators / assignment
343 // ---------------------
344 public:
346 void operator=(const Diff_sx&) ;
347
348 // Computational routines
349 //-----------------------
350 public:
352 virtual const Matrice& get_matrice() const ;
353
354 // Outputs
355 // -------
356 protected:
358 virtual ostream& operator>>(ostream&) const ;
359};
360
369class Diff_sx2 : public Diff {
370
371 // Constructors - Destructor
372 // -------------------------
373 public:
374 Diff_sx2(int base_r, int nr) ;
375 Diff_sx2(const Diff_sx2& ) ;
376
377 virtual ~Diff_sx2() ;
378
379 private:
380 void initialize() ;
381
382 // Mutators / assignment
383 // ---------------------
384 public:
386 void operator=(const Diff_sx2&) ;
387
388 // Computational routines
389 //-----------------------
390 public:
392 virtual const Matrice& get_matrice() const ;
393
394 // Outputs
395 // -------
396 protected:
398 virtual ostream& operator>>(ostream&) const ;
399};
400
409class Diff_xdsdx : public Diff {
410
411 // Constructors - Destructor
412 // -------------------------
413 public:
414 Diff_xdsdx(int base_r, int nr) ;
415 Diff_xdsdx(const Diff_xdsdx& ) ;
416
417 virtual ~Diff_xdsdx() ;
418
419 private:
420 void initialize() ;
421
422 // Mutators / assignment
423 // ---------------------
424 public:
426 void operator=(const Diff_xdsdx&) ;
427
428 // Computational routines
429 //-----------------------
430 public:
432 virtual const Matrice& get_matrice() const ;
433
434 // Outputs
435 // -------
436 protected:
438 virtual ostream& operator>>(ostream&) const ;
439};
440
450class Diff_sxdsdx : public Diff {
451
452 // Constructors - Destructor
453 // -------------------------
454 public:
455 Diff_sxdsdx(int base_r, int nr) ;
456 Diff_sxdsdx(const Diff_sxdsdx& ) ;
457
458 virtual ~Diff_sxdsdx() ;
459
460 private:
461 void initialize() ;
462
463 // Mutators / assignment
464 // ---------------------
465 public:
467 void operator=(const Diff_sxdsdx&) ;
468
469 // Computational routines
470 //-----------------------
471 public:
473 virtual const Matrice& get_matrice() const ;
474
475 // Outputs
476 // -------
477 protected:
479 virtual ostream& operator>>(ostream&) const ;
480};
481
490class Diff_x2dsdx2 : public Diff {
491
492 // Constructors - Destructor
493 // -------------------------
494 public:
495 Diff_x2dsdx2(int base_r, int nr) ;
496 Diff_x2dsdx2(const Diff_x2dsdx2& ) ;
497
498 virtual ~Diff_x2dsdx2() ;
499
500 private:
501 void initialize() ;
502
503 // Mutators / assignment
504 // ---------------------
505 public:
507 void operator=(const Diff_x2dsdx2&) ;
508
509 // Computational routines
510 //-----------------------
511 public:
513 virtual const Matrice& get_matrice() const ;
514
515 // Outputs
516 // -------
517 protected:
519 virtual ostream& operator>>(ostream&) const ;
520};
521
531class Diff_xdsdx2 : public Diff {
532
533 // Constructors - Destructor
534 // -------------------------
535 public:
536 Diff_xdsdx2(int base_r, int nr) ;
537 Diff_xdsdx2(const Diff_xdsdx2& ) ;
538
539 virtual ~Diff_xdsdx2() ;
540
541 private:
542 void initialize() ;
543
544 // Mutators / assignment
545 // ---------------------
546 public:
548 void operator=(const Diff_xdsdx2&) ;
549
550 // Computational routines
551 //-----------------------
552 public:
554 virtual const Matrice& get_matrice() const ;
555
556 // Outputs
557 // -------
558 protected:
560 virtual ostream& operator>>(ostream&) const ;
561};
562
571class Diff_x2dsdx : public Diff {
572
573 // Constructors - Destructor
574 // -------------------------
575 public:
576 Diff_x2dsdx(int base_r, int nr) ;
577 Diff_x2dsdx(const Diff_x2dsdx& ) ;
578
579 virtual ~Diff_x2dsdx() ;
580
581 private:
582 void initialize() ;
583
584 // Mutators / assignment
585 // ---------------------
586 public:
588 void operator=(const Diff_x2dsdx&) ;
589
590 // Computational routines
591 //-----------------------
592 public:
594 virtual const Matrice& get_matrice() const ;
595
596 // Outputs
597 // -------
598 protected:
600 virtual ostream& operator>>(ostream&) const ;
601};
602
611class Diff_x3dsdx : public Diff {
612
613 // Constructors - Destructor
614 // -------------------------
615 public:
616 Diff_x3dsdx(int base_r, int nr) ;
617 Diff_x3dsdx(const Diff_x3dsdx& ) ;
618
619 virtual ~Diff_x3dsdx() ;
620
621 private:
622 void initialize() ;
623
624 // Mutators / assignment
625 // ---------------------
626 public:
628 void operator=(const Diff_x3dsdx&) ;
629
630 // Computational routines
631 //-----------------------
632 public:
634 virtual const Matrice& get_matrice() const ;
635
636 // Outputs
637 // -------
638 protected:
640 virtual ostream& operator>>(ostream&) const ;
641};
642
652class Diff_x3dsdx2 : public Diff {
653
654 // Constructors - Destructor
655 // -------------------------
656 public:
657 Diff_x3dsdx2(int base_r, int nr) ;
658 Diff_x3dsdx2(const Diff_x3dsdx2& ) ;
659
660 virtual ~Diff_x3dsdx2() ;
661
662 private:
663 void initialize() ;
664
665 // Mutators / assignment
666 // ---------------------
667 public:
669 void operator=(const Diff_x3dsdx2&) ;
670
671 // Computational routines
672 //-----------------------
673 public:
675 virtual const Matrice& get_matrice() const ;
676
677 // Outputs
678 // -------
679 protected:
681 virtual ostream& operator>>(ostream&) const ;
682};
683
692class Diff_x4dsdx2 : public Diff {
693
694 // Constructors - Destructor
695 // -------------------------
696 public:
697 Diff_x4dsdx2(int base_r, int nr) ;
698 Diff_x4dsdx2(const Diff_x4dsdx2& ) ;
699
700 virtual ~Diff_x4dsdx2() ;
701
702 private:
703 void initialize() ;
704
705 // Mutators / assignment
706 // ---------------------
707 public:
709 void operator=(const Diff_x4dsdx2&) ;
710
711 // Computational routines
712 //-----------------------
713 public:
715 virtual const Matrice& get_matrice() const ;
716
717 // Outputs
718 // -------
719 protected:
721 virtual ostream& operator>>(ostream&) const ;
722};
723
724
725}
726#endif
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:172
void operator=(const Diff_dsdx2 &)
Assignment to another Diff_dsdx2.
Definition diff_dsdx2.C:85
void initialize()
Initializes arrays.
Definition diff_dsdx2.C:73
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_dsdx2.C:129
virtual ~Diff_dsdx2()
Destructor.
Definition diff_dsdx2.C:71
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_dsdx2.C:91
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:129
virtual ~Diff_dsdx()
Destructor.
Definition diff_dsdx.C:74
void initialize()
Initializes arrays.
Definition diff_dsdx.C:76
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_dsdx.C:94
void operator=(const Diff_dsdx &)
Assignment to another Diff_dsdx.
Definition diff_dsdx.C:88
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_dsdx.C:131
Class for the elementary differential operator Identity (see the base class Diff ).
Definition diff.h:210
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_id.C:91
virtual ~Diff_id()
Destructor.
Definition diff_id.C:71
void initialize()
Initializes arrays.
Definition diff_id.C:73
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_id.C:123
void operator=(const Diff_id &)
Assignment to another Diff_id.
Definition diff_id.C:85
Class for the elementary differential operator multiplication by (see the base class Diff ).
Definition diff.h:289
virtual ~Diff_mx2()
Destructor.
Definition diff_mx2.C:75
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_mx2.C:95
void initialize()
Initializes arrays.
Definition diff_mx2.C:77
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_mx2.C:147
void operator=(const Diff_mx2 &)
Assignment to another Diff_mx2.
Definition diff_mx2.C:89
Class for the elementary differential operator multiplication by (see the base class Diff ).
Definition diff.h:250
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_mx.C:96
virtual ~Diff_mx()
Destructor.
Definition diff_mx.C:76
void initialize()
Initializes arrays.
Definition diff_mx.C:78
void operator=(const Diff_mx &)
Assignment to another Diff_mx.
Definition diff_mx.C:90
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_mx.C:147
Class for the elementary differential operator division by (see the base class Diff ).
Definition diff.h:369
void initialize()
Initializes arrays.
Definition diff_sx2.C:80
void operator=(const Diff_sx2 &)
Assignment to another Diff_sx2.
Definition diff_sx2.C:92
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_sx2.C:98
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_sx2.C:143
virtual ~Diff_sx2()
Destructor.
Definition diff_sx2.C:78
Class for the elementary differential operator division by (see the base class Diff ).
Definition diff.h:329
virtual ~Diff_sx()
Destructor.
Definition diff_sx.C:80
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_sx.C:144
void initialize()
Initializes arrays.
Definition diff_sx.C:82
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_sx.C:100
void operator=(const Diff_sx &)
Assignment to another Diff_sx.
Definition diff_sx.C:94
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:450
virtual ~Diff_sxdsdx()
Destructor.
Definition diff_sxdsdx.C:77
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
void operator=(const Diff_sxdsdx &)
Assignment to another Diff_sxdsdx.
Definition diff_sxdsdx.C:91
void initialize()
Initializes arrays.
Definition diff_sxdsdx.C:79
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_sxdsdx.C:97
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:490
virtual ~Diff_x2dsdx2()
Destructor.
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
void initialize()
Initializes arrays.
void operator=(const Diff_x2dsdx2 &)
Assignment to another Diff_x2dsdx2.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:571
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
void operator=(const Diff_x2dsdx &)
Assignment to another Diff_x2dsdx.
Definition diff_x2dsdx.C:94
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
void initialize()
Initializes arrays.
Definition diff_x2dsdx.C:82
virtual ~Diff_x2dsdx()
Destructor.
Definition diff_x2dsdx.C:80
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:652
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
void operator=(const Diff_x3dsdx2 &)
Assignment to another Diff_x3dsdx2.
virtual ~Diff_x3dsdx2()
Destructor.
void initialize()
Initializes arrays.
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:611
void initialize()
Initializes arrays.
Definition diff_x3dsdx.C:84
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
void operator=(const Diff_x3dsdx &)
Assignment to another Diff_x3dsdx.
Definition diff_x3dsdx.C:96
virtual ~Diff_x3dsdx()
Destructor.
Definition diff_x3dsdx.C:82
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:692
void initialize()
Initializes arrays.
virtual ~Diff_x4dsdx2()
Destructor.
void operator=(const Diff_x4dsdx2 &)
Assignment to another Diff_x4dsdx2.
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:531
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
void initialize()
Initializes arrays.
Definition diff_xdsdx2.C:79
void operator=(const Diff_xdsdx2 &)
Assignment to another Diff_xdsdx2.
Definition diff_xdsdx2.C:91
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_xdsdx2.C:97
virtual ~Diff_xdsdx2()
Destructor.
Definition diff_xdsdx2.C:77
Class for the elementary differential operator (see the base class Diff ).
Definition diff.h:409
void initialize()
Initializes arrays.
Definition diff_xdsdx.C:80
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Definition diff_xdsdx.C:98
virtual ~Diff_xdsdx()
Destructor.
Definition diff_xdsdx.C:78
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition diff_xdsdx.C:160
void operator=(const Diff_xdsdx &)
Assignment to another Diff_xdsdx.
Definition diff_xdsdx.C:92
Base (abstract) class for 1D spectral differential operators in one domain.
Definition diff.h:65
int npoints
Number of coefficients.
Definition diff.h:75
void operator=(const Diff &)
Assignment to another Diff.
Definition diff.C:75
int get_npoints() const
Returns the number of coefficients (size of the matrix)
Definition diff.h:99
int get_base() const
Returns the base on which the operator is defined.
Definition diff.h:96
virtual ostream & operator>>(ostream &) const =0
Operator >> (virtual function called by the operator <<).
friend ostream & operator<<(ostream &, const Diff &)
Display.
Definition diff.C:83
virtual const Matrice & get_matrice() const =0
Returns the matrix associated with the operator.
static const int max_points
Maximal number of matrices stored per base.
Definition diff.h:71
virtual ~Diff()
Destructor.
Definition diff.C:73
int base
Base in radial direction.
Definition diff.h:74
Matrix handling.
Definition matrice.h:152
Lorene prototypes.
Definition app_hor.h:64