Debian Codegraph @

C++/Include/diff.h

raw symbols SCIP
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
53 namespace Lorene {
54 /**
55 * Base (abstract) class for 1D spectral differential operators in one domain.
56 * \ingroup (ellip)
57 *
58 * This class is intended as a base class for several classes of elementary
59 * differential operators in term of \f$\xi\f$, in a given domain.
60 * Their main purpose is to compute the matrix of the elementary operator,
61 * for the given spectral base and number of coefficients. Some of the
62 * operators are not defined in the shells (division by \f$\xi\f$).
63 *
64 */
65 class Diff {
66
67 // Data :
68 // -----
69 public:
70 /// Maximal number of matrices stored per base
71 static const int max_points = 50 ;
72
73 protected:
74 int base ; ///< Base in radial direction
75 int npoints ; ///< Number of coefficients
76
77 // Constructors - Destructor
78 // -------------------------
79 protected:
80 Diff(int base_r, int nr) ; ///< Standard constructor
81 Diff(const Diff& ) ; ///< Copy constructor
82
83 virtual ~Diff() ; ///< Destructor
84
85
86 // Mutators / assignment
87 // ---------------------
88 protected:
89 /// Assignment to another Diff
90 void operator=(const Diff&) ;
91
92 // Accessors
93 // ---------
94 public:
95 /// Returns the base on which the operator is defined
96 int get_base() const {return base ;} ;
97
98 /// Returns the number of coefficients (size of the matrix)
99 int get_npoints() const { return npoints ;} ;
100
101 /// Conversion to a matrix
102 operator Matrice() const { return get_matrice() ; }
103
104 // Computational routines
105 //-----------------------
106 public:
107 /// Returns the matrix associated with the operator
108 virtual const Matrice& get_matrice() const = 0 ;
109
110 // Outputs
111 // -------
112 public:
113 /// Display
114 friend ostream& operator<<(ostream& , const Diff& ) ;
115
116 protected:
117 ///Operator >> (virtual function called by the operator <<).
118 virtual ostream& operator>>(ostream&) const = 0 ;
119
120 };
121
122
123 /**
124 * Class for the elementary differential operator
125 * \f$ \frac{\partial}{\partial \xi} \f$ (see the base class \c Diff ).
126 * \ingroup (ellip)
127 *
128 */
129 class Diff_dsdx : public Diff {
130
131 // Constructors - Destructor
132 // -------------------------
133 public:
134 /** Standard constructor, the base is that of the functions
135 * the operator is acting on (starting base).
136 */
137 Diff_dsdx(int base_r, int nr) ;
138
139 Diff_dsdx(const Diff_dsdx& ) ; ///< Copy constructor
140
141 virtual ~Diff_dsdx() ; ///< Destructor
142
143 private:
144 void initialize() ; ///< Initializes arrays
145
146 // Mutators / assignment
147 // ---------------------
148 public:
149 /// Assignment to another Diff_dsdx
150 void operator=(const Diff_dsdx&) ;
151
152 // Computational routines
153 //-----------------------
154 public:
155 /// Returns the matrix associated with the operator
156 virtual const Matrice& get_matrice() const ;
157
158 // Outputs
159 // -------
160 protected:
161 ///Operator >> (virtual function called by the operator <<).
162 virtual ostream& operator>>(ostream&) const ;
163 };
164
165
166 /**
167 * Class for the elementary differential operator
168 * \f$ \frac{\partial^2}{\partial \xi^2} \f$ (see the base class \c Diff ).
169 * \ingroup (ellip)
170 *
171 */
172 class Diff_dsdx2 : public Diff {
173
174 // Constructors - Destructor
175 // -------------------------
176 public:
177 Diff_dsdx2(int base_r, int nr) ; ///< Standard constructor
178 Diff_dsdx2(const Diff_dsdx2& ) ; ///< Copy constructor
179
180 virtual ~Diff_dsdx2() ; ///< Destructor
181
182 private:
183 void initialize() ; ///< Initializes arrays
184
185 // Mutators / assignment
186 // ---------------------
187 public:
188 /// Assignment to another Diff_dsdx2
189 void operator=(const Diff_dsdx2&) ;
190
191 // Computational routines
192 //-----------------------
193 public:
194 /// Returns the matrix associated with the operator
195 virtual const Matrice& get_matrice() const ;
196
197 // Outputs
198 // -------
199 protected:
200 ///Operator >> (virtual function called by the operator <<).
201 virtual ostream& operator>>(ostream&) const ;
202 };
203
204 /**
205 * Class for the elementary differential operator
206 * \c Identity (see the base class \c Diff ).
207 * \ingroup (ellip)
208 *
209 */
210 class Diff_id : public Diff {
211
212 // Constructors - Destructor
213 // -------------------------
214 public:
215 Diff_id(int base_r, int nr) ; ///< Standard constructor
216 Diff_id(const Diff_id& ) ; ///< Copy constructor
217
218 virtual ~Diff_id() ; ///< Destructor
219
220 private:
221 void initialize() ; ///< Initializes arrays
222
223 // Mutators / assignment
224 // ---------------------
225 public:
226 /// Assignment to another Diff_id
227 void operator=(const Diff_id&) ;
228
229 // Computational routines
230 //-----------------------
231 public:
232 /// Returns the matrix associated with the operator
233 virtual const Matrice& get_matrice() const ;
234
235 // Outputs
236 // -------
237 protected:
238 ///Operator >> (virtual function called by the operator <<).
239 virtual ostream& operator>>(ostream&) const ;
240 };
241
242 /**
243 * Class for the elementary differential operator multiplication by
244 * \f$ \xi \f$ (see the base class \c Diff ). In the compactified
245 * external domain, it corresponds to a multiplication by \f$\xi -1\f$.
246 * It is not defined in the nucleus.
247 * \ingroup (ellip)
248 *
249 */
250 class Diff_mx : public Diff {
251
252 // Constructors - Destructor
253 // -------------------------
254 public:
255 Diff_mx(int base_r, int nr) ; ///< Standard constructor
256 Diff_mx(const Diff_mx& ) ; ///< Copy constructor
257
258 virtual ~Diff_mx() ; ///< Destructor
259
260 private:
261 void initialize() ; ///< Initializes arrays
262
263 // Mutators / assignment
264 // ---------------------
265 public:
266 /// Assignment to another Diff_mx
267 void operator=(const Diff_mx&) ;
268
269 // Computational routines
270 //-----------------------
271 public:
272 /// Returns the matrix associated with the operator
273 virtual const Matrice& get_matrice() const ;
274
275 // Outputs
276 // -------
277 protected:
278 ///Operator >> (virtual function called by the operator <<).
279 virtual ostream& operator>>(ostream&) const ;
280 };
281
282 /**
283 * Class for the elementary differential operator multiplication by
284 * \f$ \xi^2 \f$ (see the base class \c Diff ). In the compactified
285 * external domain, it corresponds to a multiplication by \f$(\xi -1)^2\f$.
286 * \ingroup (ellip)
287 *
288 */
289 class Diff_mx2 : public Diff {
290
291 // Constructors - Destructor
292 // -------------------------
293 public:
294 Diff_mx2(int base_r, int nr) ; ///< Standard constructor
295 Diff_mx2(const Diff_mx2& ) ; ///< Copy constructor
296
297 virtual ~Diff_mx2() ; ///< Destructor
298
299 private:
300 void initialize() ; ///< Initializes arrays
301
302 // Mutators / assignment
303 // ---------------------
304 public:
305 /// Assignment to another Diff_mx2
306 void operator=(const Diff_mx2&) ;
307
308 // Computational routines
309 //-----------------------
310 public:
311 /// Returns the matrix associated with the operator
312 virtual const Matrice& get_matrice() const ;
313
314 // Outputs
315 // -------
316 protected:
317 ///Operator >> (virtual function called by the operator <<).
318 virtual ostream& operator>>(ostream&) const ;
319 };
320
321 /**
322 * Class for the elementary differential operator division by
323 * \f$ \xi - 1\f$ (see the base class \c Diff ). It is only defined
324 * in the compactified external domain.
325 * It is not defined in the shells.
326 * \ingroup (ellip)
327 *
328 */
329 class Diff_sx : public Diff {
330
331 // Constructors - Destructor
332 // -------------------------
333 public:
334 Diff_sx(int base_r, int nr) ; ///< Standard constructor
335 Diff_sx(const Diff_sx& ) ; ///< Copy constructor
336
337 virtual ~Diff_sx() ; ///< Destructor
338
339 private:
340 void initialize() ; ///< Initializes arrays
341
342 // Mutators / assignment
343 // ---------------------
344 public:
345 /// Assignment to another Diff_sx
346 void operator=(const Diff_sx&) ;
347
348 // Computational routines
349 //-----------------------
350 public:
351 /// Returns the matrix associated with the operator
352 virtual const Matrice& get_matrice() const ;
353
354 // Outputs
355 // -------
356 protected:
357 ///Operator >> (virtual function called by the operator <<).
358 virtual ostream& operator>>(ostream&) const ;
359 };
360
361 /**
362 * Class for the elementary differential operator division by
363 * \f$ \xi^2 \f$ (see the base class \c Diff ). In the compactified
364 * external domain, it corresponds to a division by \f$(\xi -1)^2\f$. Not
365 * defined in the shells.
366 * \ingroup (ellip)
367 *
368 */
369 class Diff_sx2 : public Diff {
370
371 // Constructors - Destructor
372 // -------------------------
373 public:
374 Diff_sx2(int base_r, int nr) ; ///< Standard constructor
375 Diff_sx2(const Diff_sx2& ) ; ///< Copy constructor
376
377 virtual ~Diff_sx2() ; ///< Destructor
378
379 private:
380 void initialize() ; ///< Initializes arrays
381
382 // Mutators / assignment
383 // ---------------------
384 public:
385 /// Assignment to another Diff_sx2
386 void operator=(const Diff_sx2&) ;
387
388 // Computational routines
389 //-----------------------
390 public:
391 /// Returns the matrix associated with the operator
392 virtual const Matrice& get_matrice() const ;
393
394 // Outputs
395 // -------
396 protected:
397 ///Operator >> (virtual function called by the operator <<).
398 virtual ostream& operator>>(ostream&) const ;
399 };
400
401 /**
402 * Class for the elementary differential operator
403 * \f$ \xi \frac{\partial}{\partial \xi} \f$ (see the base class \c Diff ).
404 * In the compactified external domain the operator reads
405 * \f$ (\xi -1) \frac{\partial}{\partial \xi} \f$.
406 * \ingroup (ellip)
407 *
408 */
409 class Diff_xdsdx : public Diff {
410
411 // Constructors - Destructor
412 // -------------------------
413 public:
414 Diff_xdsdx(int base_r, int nr) ; ///< Standard constructor
415 Diff_xdsdx(const Diff_xdsdx& ) ; ///< Copy constructor
416
417 virtual ~Diff_xdsdx() ; ///< Destructor
418
419 private:
420 void initialize() ; ///< Initializes arrays
421
422 // Mutators / assignment
423 // ---------------------
424 public:
425 /// Assignment to another Diff_xdsdx
426 void operator=(const Diff_xdsdx&) ;
427
428 // Computational routines
429 //-----------------------
430 public:
431 /// Returns the matrix associated with the operator
432 virtual const Matrice& get_matrice() const ;
433
434 // Outputs
435 // -------
436 protected:
437 ///Operator >> (virtual function called by the operator <<).
438 virtual ostream& operator>>(ostream&) const ;
439 };
440
441 /**
442 * Class for the elementary differential operator
443 * \f$ \frac{1}{\xi} \frac{\partial}{\partial \xi} \f$ (see the base
444 * class \c Diff ). In the compactified external domain, it reads
445 * \f$ \frac{1}{\xi-1} \frac{\partial}{\partial \xi} \f$.
446 * Not defined in the shells.
447 * \ingroup (ellip)
448 *
449 */
450 class Diff_sxdsdx : public Diff {
451
452 // Constructors - Destructor
453 // -------------------------
454 public:
455 Diff_sxdsdx(int base_r, int nr) ; ///< Standard constructor
456 Diff_sxdsdx(const Diff_sxdsdx& ) ; ///< Copy constructor
457
458 virtual ~Diff_sxdsdx() ; ///< Destructor
459
460 private:
461 void initialize() ; ///< Initializes arrays
462
463 // Mutators / assignment
464 // ---------------------
465 public:
466 /// Assignment to another Diff_sxdsdx
467 void operator=(const Diff_sxdsdx&) ;
468
469 // Computational routines
470 //-----------------------
471 public:
472 /// Returns the matrix associated with the operator
473 virtual const Matrice& get_matrice() const ;
474
475 // Outputs
476 // -------
477 protected:
478 ///Operator >> (virtual function called by the operator <<).
479 virtual ostream& operator>>(ostream&) const ;
480 };
481
482 /**
483 * Class for the elementary differential operator
484 * \f$ \xi^2 \frac{\partial^2}{\partial \xi^2} \f$ (see the base
485 * class \c Diff ). In the external compactified domain, it reads
486 * \f$ (\xi - 1)^2 \frac{\partial^2}{\partial \xi^2} \f$.
487 * \ingroup (ellip)
488 *
489 */
490 class Diff_x2dsdx2 : public Diff {
491
492 // Constructors - Destructor
493 // -------------------------
494 public:
495 Diff_x2dsdx2(int base_r, int nr) ; ///< Standard constructor
496 Diff_x2dsdx2(const Diff_x2dsdx2& ) ; ///< Copy constructor
497
498 virtual ~Diff_x2dsdx2() ; ///< Destructor
499
500 private:
501 void initialize() ; ///< Initializes arrays
502
503 // Mutators / assignment
504 // ---------------------
505 public:
506 /// Assignment to another Diff_x2dsdx2
507 void operator=(const Diff_x2dsdx2&) ;
508
509 // Computational routines
510 //-----------------------
511 public:
512 /// Returns the matrix associated with the operator
513 virtual const Matrice& get_matrice() const ;
514
515 // Outputs
516 // -------
517 protected:
518 ///Operator >> (virtual function called by the operator <<).
519 virtual ostream& operator>>(ostream&) const ;
520 };
521
522 /**
523 * Class for the elementary differential operator
524 * \f$ \xi \frac{\partial^2}{\partial \xi^2} \f$ (see the base
525 * class \c Diff ). In the external compactified domain, it reads
526 * \f$ (\xi - 1) \frac{\partial^2}{\partial \xi^2} \f$.
527 * Not defined in the nucleus.
528 * \ingroup (ellip)
529 *
530 */
531 class Diff_xdsdx2 : public Diff {
532
533 // Constructors - Destructor
534 // -------------------------
535 public:
536 Diff_xdsdx2(int base_r, int nr) ; ///< Standard constructor
537 Diff_xdsdx2(const Diff_xdsdx2& ) ; ///< Copy constructor
538
539 virtual ~Diff_xdsdx2() ; ///< Destructor
540
541 private:
542 void initialize() ; ///< Initializes arrays
543
544 // Mutators / assignment
545 // ---------------------
546 public:
547 /// Assignment to another Diff_xdsdx2
548 void operator=(const Diff_xdsdx2&) ;
549
550 // Computational routines
551 //-----------------------
552 public:
553 /// Returns the matrix associated with the operator
554 virtual const Matrice& get_matrice() const ;
555
556 // Outputs
557 // -------
558 protected:
559 ///Operator >> (virtual function called by the operator <<).
560 virtual ostream& operator>>(ostream&) const ;
561 };
562
563 /**
564 * Class for the elementary differential operator
565 * \f$ \xi^2 \frac{\partial}{\partial \xi} \f$ (see the base class \c Diff ).
566 * This operator is not defined in the nucleus. In the compactified external
567 * domain it reads \f$ (\xi-1)^2 \frac{\partial}{\partial \xi} \f$.
568 * \ingroup (ellip)
569 *
570 */
571 class Diff_x2dsdx : public Diff {
572
573 // Constructors - Destructor
574 // -------------------------
575 public:
576 Diff_x2dsdx(int base_r, int nr) ; ///< Standard constructor
577 Diff_x2dsdx(const Diff_x2dsdx& ) ; ///< Copy constructor
578
579 virtual ~Diff_x2dsdx() ; ///< Destructor
580
581 private:
582 void initialize() ; ///< Initializes arrays
583
584 // Mutators / assignment
585 // ---------------------
586 public:
587 /// Assignment to another Diff_x2dsdx
588 void operator=(const Diff_x2dsdx&) ;
589
590 // Computational routines
591 //-----------------------
592 public:
593 /// Returns the matrix associated with the operator
594 virtual const Matrice& get_matrice() const ;
595
596 // Outputs
597 // -------
598 protected:
599 ///Operator >> (virtual function called by the operator <<).
600 virtual ostream& operator>>(ostream&) const ;
601 };
602
603 /**
604 * Class for the elementary differential operator
605 * \f$ \xi^3 \frac{\partial}{\partial \xi} \f$ (see the base class \c Diff ).
606 * In the compactified external domain the operator reads
607 * \f$ (\xi -1)^3 \frac{\partial}{\partial \xi} \f$.
608 * \ingroup (ellip)
609 *
610 */
611 class Diff_x3dsdx : public Diff {
612
613 // Constructors - Destructor
614 // -------------------------
615 public:
616 Diff_x3dsdx(int base_r, int nr) ; ///< Standard constructor
617 Diff_x3dsdx(const Diff_x3dsdx& ) ; ///< Copy constructor
618
619 virtual ~Diff_x3dsdx() ; ///< Destructor
620
621 private:
622 void initialize() ; ///< Initializes arrays
623
624 // Mutators / assignment
625 // ---------------------
626 public:
627 /// Assignment to another Diff_x3dsdx
628 void operator=(const Diff_x3dsdx&) ;
629
630 // Computational routines
631 //-----------------------
632 public:
633 /// Returns the matrix associated with the operator
634 virtual const Matrice& get_matrice() const ;
635
636 // Outputs
637 // -------
638 protected:
639 ///Operator >> (virtual function called by the operator <<).
640 virtual ostream& operator>>(ostream&) const ;
641 };
642
643 /**
644 * Class for the elementary differential operator
645 * \f$ \xi^3 \frac{\partial^2}{\partial \xi^2} \f$ (see the base
646 * class \c Diff ). In the external compactified domain, it reads
647 * \f$ (\xi - 1)^3 \frac{\partial^2}{\partial \xi^2} \f$.
648 * Not defined in the nucleus.
649 * \ingroup (ellip)
650 *
651 */
652 class Diff_x3dsdx2 : public Diff {
653
654 // Constructors - Destructor
655 // -------------------------
656 public:
657 Diff_x3dsdx2(int base_r, int nr) ; ///< Standard constructor
658 Diff_x3dsdx2(const Diff_x3dsdx2& ) ; ///< Copy constructor
659
660 virtual ~Diff_x3dsdx2() ; ///< Destructor
661
662 private:
663 void initialize() ; ///< Initializes arrays
664
665 // Mutators / assignment
666 // ---------------------
667 public:
668 /// Assignment to another Diff_x3dsdx2
669 void operator=(const Diff_x3dsdx2&) ;
670
671 // Computational routines
672 //-----------------------
673 public:
674 /// Returns the matrix associated with the operator
675 virtual const Matrice& get_matrice() const ;
676
677 // Outputs
678 // -------
679 protected:
680 ///Operator >> (virtual function called by the operator <<).
681 virtual ostream& operator>>(ostream&) const ;
682 };
683
684 /**
685 * Class for the elementary differential operator
686 * \f$ \xi^4 \frac{\partial^2}{\partial \xi^2} \f$ (see the base
687 * class \c Diff ). In the external compactified domain, it reads
688 * \f$ (\xi - 1)^4 \frac{\partial^2}{\partial \xi^2} \f$.
689 * \ingroup (ellip)
690 *
691 */
692 class Diff_x4dsdx2 : public Diff {
693
694 // Constructors - Destructor
695 // -------------------------
696 public:
697 Diff_x4dsdx2(int base_r, int nr) ; ///< Standard constructor
698 Diff_x4dsdx2(const Diff_x4dsdx2& ) ; ///< Copy constructor
699
700 virtual ~Diff_x4dsdx2() ; ///< Destructor
701
702 private:
703 void initialize() ; ///< Initializes arrays
704
705 // Mutators / assignment
706 // ---------------------
707 public:
708 /// Assignment to another Diff_x4dsdx2
709 void operator=(const Diff_x4dsdx2&) ;
710
711 // Computational routines
712 //-----------------------
713 public:
714 /// Returns the matrix associated with the operator
715 virtual const Matrice& get_matrice() const ;
716
717 // Outputs
718 // -------
719 protected:
720 ///Operator >> (virtual function called by the operator <<).
721 virtual ostream& operator>>(ostream&) const ;
722 };
723
724
725 }
726 #endif