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 char diff_C[] = "$Header: /cvsroot/Lorene/C++/Source/Diff/diff.C,v 1.5 2014/10/13 08:52:50 j_novak Exp $" ;
29 
30 /*
31  * $Id: diff.C,v 1.5 2014/10/13 08:52:50 j_novak Exp $
32  * $Log: diff.C,v $
33  * Revision 1.5 2014/10/13 08:52:50 j_novak
34  * Lorene classes and functions now belong to the namespace Lorene.
35  *
36  * Revision 1.4 2014/10/06 15:13:04 j_novak
37  * Modified #include directives to use c++ syntax.
38  *
39  * Revision 1.3 2007/12/11 15:28:11 jl_cornou
40  * Jacobi(0,2) polynomials partially implemented
41  *
42  * Revision 1.2 2005/02/09 09:53:24 j_novak
43  * Removed irrelevant asserts on number of points.
44  *
45  * Revision 1.1 2005/01/10 16:34:52 j_novak
46  * New class for 1D mono-domain differential operators.
47  *
48  *
49  * $Header: /cvsroot/Lorene/C++/Source/Diff/diff.C,v 1.5 2014/10/13 08:52:50 j_novak Exp $
50  *
51  */
52 
53 // C headers
54 #include <cassert>
55 
56 // Lorene headers
57 #include "diff.h"
58 
59 
60 namespace Lorene {
61 Diff::Diff(int base_r, int nr) : base(base_r >> TRA_R), npoints(nr) {
62 
63  assert (base < MAX_BASE) ;
64 
65 }
66 
67 Diff::Diff(const Diff& diff_in) : base(diff_in.base),
68  npoints(diff_in.npoints) {
69  assert (base < MAX_BASE) ;
70 
71 }
72 
74 
75 void Diff::operator=(const Diff& diff_in) {
76 
77  base = diff_in.base ;
78  npoints = diff_in.npoints ;
79  assert (base < MAX_BASE) ;
80 
81 }
82 
83 ostream& operator<<(ostream& ost, const Diff& ope) {
84 
85  ost << "Differential operator : " ;
86 
87  ope >> ost ;
88 
89  ost << "Radial base: " ;
90 
91  switch (ope.base) {
92 
93  case R_CHEB >> TRA_R :
94  ost << "Chebyshev polynomials (R_CHEB)" ;
95  break ;
96 
97  case R_JACO02 >> TRA_R :
98  ost << "Jacobi(0,2) polynomials (R_JACO02)" ;
99  break ;
100 
101  case R_CHEBP >> TRA_R :
102  ost << "Even Chebyshev polynomials (R_CHEBP)" ;
103  break ;
104 
105  case R_CHEBI >> TRA_R :
106  ost << "Odd Chebyshev polynomials (R_CHEBI)" ;
107  break ;
108 
109  case R_CHEBU >> TRA_R :
110  ost << "Chebyshev polynomials / compactified domain (R_CHEBU)" ;
111  break ;
112 
113  default:
114  ost << "unknown!" << endl ;
115  }
116 
117  ost << " with " << ope.npoints << " coefficients." << endl ;
118  ost << endl ;
119 
120  return ost ;
121 }
122 }
R_CHEB
#define R_CHEB
base de Chebychev ordinaire (fin)
Definition: type_parite.h:166
Lorene::Diff::Diff
Diff(int base_r, int nr)
Standard constructor.
Definition: diff.C:61
Lorene::Diff::npoints
int npoints
Number of coefficients.
Definition: diff.h:75
Lorene
Lorene prototypes.
Definition: app_hor.h:64
Lorene::Diff::operator=
void operator=(const Diff &)
Assignment to another Diff.
Definition: diff.C:75
R_JACO02
#define R_JACO02
base de Jacobi(0,2) ordinaire (finjac)
Definition: type_parite.h:188
R_CHEBP
#define R_CHEBP
base de Cheb. paire (rare) seulement
Definition: type_parite.h:168
R_CHEBI
#define R_CHEBI
base de Cheb. impaire (rare) seulement
Definition: type_parite.h:170
TRA_R
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
Definition: type_parite.h:158
Lorene::Diff
Base (abstract) class for 1D spectral differential operators in one domain.
Definition: diff.h:65
Lorene::Diff::base
int base
Base in radial direction.
Definition: diff.h:74
Lorene::Diff::~Diff
virtual ~Diff()
Destructor.
Definition: diff.C:73
MAX_BASE
#define MAX_BASE
Nombre max. de bases differentes.
Definition: type_parite.h:144
R_CHEBU
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
Definition: type_parite.h:180