LORENE
diff.C
1 /*
2  * Methods for the Diff class.
3  *
4  * (see file diff.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2005 Jerome Novak
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation.
16  *
17  * LORENE is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with LORENE; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  */
27 
28 
29 
30 /*
31  * $Id: diff.C,v 1.6 2016/12/05 16:17:50 j_novak Exp $
32  * $Log: diff.C,v $
33  * Revision 1.6 2016/12/05 16:17:50 j_novak
34  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
35  *
36  * Revision 1.5 2014/10/13 08:52:50 j_novak
37  * Lorene classes and functions now belong to the namespace Lorene.
38  *
39  * Revision 1.4 2014/10/06 15:13:04 j_novak
40  * Modified #include directives to use c++ syntax.
41  *
42  * Revision 1.3 2007/12/11 15:28:11 jl_cornou
43  * Jacobi(0,2) polynomials partially implemented
44  *
45  * Revision 1.2 2005/02/09 09:53:24 j_novak
46  * Removed irrelevant asserts on number of points.
47  *
48  * Revision 1.1 2005/01/10 16:34:52 j_novak
49  * New class for 1D mono-domain differential operators.
50  *
51  *
52  * $Header: /cvsroot/Lorene/C++/Source/Diff/diff.C,v 1.6 2016/12/05 16:17:50 j_novak Exp $
53  *
54  */
55 
56 // C headers
57 #include <cassert>
58 
59 // Lorene headers
60 #include "diff.h"
61 
62 
63 namespace Lorene {
64 Diff::Diff(int base_r, int nr) : base(base_r >> TRA_R), npoints(nr) {
65 
66  assert (base < MAX_BASE) ;
67 
68 }
69 
70 Diff::Diff(const Diff& diff_in) : base(diff_in.base),
71  npoints(diff_in.npoints) {
72  assert (base < MAX_BASE) ;
73 
74 }
75 
77 
78 void Diff::operator=(const Diff& diff_in) {
79 
80  base = diff_in.base ;
81  npoints = diff_in.npoints ;
82  assert (base < MAX_BASE) ;
83 
84 }
85 
86 ostream& operator<<(ostream& ost, const Diff& ope) {
87 
88  ost << "Differential operator : " ;
89 
90  ope >> ost ;
91 
92  ost << "Radial base: " ;
93 
94  switch (ope.base) {
95 
96  case R_CHEB >> TRA_R :
97  ost << "Chebyshev polynomials (R_CHEB)" ;
98  break ;
99 
100  case R_JACO02 >> TRA_R :
101  ost << "Jacobi(0,2) polynomials (R_JACO02)" ;
102  break ;
103 
104  case R_CHEBP >> TRA_R :
105  ost << "Even Chebyshev polynomials (R_CHEBP)" ;
106  break ;
107 
108  case R_CHEBI >> TRA_R :
109  ost << "Odd Chebyshev polynomials (R_CHEBI)" ;
110  break ;
111 
112  case R_CHEBU >> TRA_R :
113  ost << "Chebyshev polynomials / compactified domain (R_CHEBU)" ;
114  break ;
115 
116  default:
117  ost << "unknown!" << endl ;
118  }
119 
120  ost << " with " << ope.npoints << " coefficients." << endl ;
121  ost << endl ;
122 
123  return ost ;
124 }
125 }
Diff(int base_r, int nr)
Standard constructor.
Definition: diff.C:64
Base (abstract) class for 1D spectral differential operators in one domain.
Definition: diff.h:65
Lorene prototypes.
Definition: app_hor.h:67
#define R_JACO02
base de Jacobi(0,2) ordinaire (finjac)
Definition: type_parite.h:188
int npoints
Number of coefficients.
Definition: diff.h:75
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
Definition: type_parite.h:158
#define R_CHEBI
base de Cheb. impaire (rare) seulement
Definition: type_parite.h:170
#define R_CHEBP
base de Cheb. paire (rare) seulement
Definition: type_parite.h:168
int base
Base in radial direction.
Definition: diff.h:74
void operator=(const Diff &)
Assignment to another Diff.
Definition: diff.C:78
virtual ~Diff()
Destructor.
Definition: diff.C:76
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
Definition: type_parite.h:180
#define MAX_BASE
Nombre max. de bases differentes.
Definition: type_parite.h:144
#define R_CHEB
base de Chebychev ordinaire (fin)
Definition: type_parite.h:166