29char mg3d_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Mg3d/mg3d.C,v 1.18 2014/10/13 08:53:07 j_novak Exp $" ;
144#include "type_parite.h"
145#include "utilitaires.h"
158Mg3d::Mg3d(
int nz,
int nbr[],
int typr[],
int nbt[],
int typt,
int nbp[],
159 int typp,
int* base_r)
160 : nzone(nz), type_t(typt), type_p(typp)
166 bool cheb = (base_r == 0x0) ;
167 for (
int i=0 ; i<nz ; i++) {
169 colloc_r[i] = cheb ? BASE_CHEB : base_r[i] ;
176 for (
int i=0 ; i<nz ; i++) {
186 for (
int i=0; i<nz; i++) {
204Mg3d::Mg3d(
int nz,
int nbr,
int nbt,
int nbp,
int typt,
int typp,
205 bool compact,
bool leg)
214 colloc_r[0] = leg ? BASE_LEG : BASE_CHEB ;
215 for (
int l=1; l<nz-1; l++) {
217 colloc_r[l] = leg ? BASE_LEG : BASE_CHEB ;
226 colloc_r[nz-1] = leg ? BASE_LEG : BASE_CHEB ;
234 for (
int l=0 ; l<nz ; l++) {
244 for (
int i=0; i<nz; i++) {
262Mg3d::Mg3d(
int nz,
int nbr,
int nbt,
int nbp,
int typt,
int typp)
270 for (
int l=0; l<nz; l++) {
279 for (
int l=0 ; l<nz ; l++) {
289 for (
int i=0; i<nz; i++) {
335 for (
int i=0; i<
nzone; i++) {
336 if (!read_base)
colloc_r[i] = BASE_CHEB ;
360 for (
int i=0 ; i<
nzone ; i++) {
383 for (
int l=0; l<
nzone; l++)
385 cout <<
"Mg3d::sauve(FILE*, bool) : " << endl ;
386 cout <<
"The multi-grid is not with Chebyshev basis!!" << endl ;
387 cout <<
"Consider setting the 'save_base' flaf to 'true'!!"
399ostream& operator<<(ostream& o,
const Mg3d& g) {
401 tr[FIN] =
"FIN" ; tr[RARE] =
"RARE" ; tr[UNSURR] =
"UNSURR" ;
402 const char* tang[2] ;
403 tang[NONSYM] =
"NONSYM" ; tang[SYM] =
"SYM" ;
404 const char* tbase[3] ;
405 tbase[BASE_CHEB] =
"Chebyshev" ; tbase[BASE_LEG] =
"Legendre" ;
406 tbase[BASE_JAC02] =
"Jacobi(0,2)" ;
407 o <<
"Number of domains: " << g.
nzone << endl ;
408 for (
int i=0 ; i< g.
nzone ; i++) {
409 o <<
" Domain #" << i <<
": "
410 <<
"nr = " << g.
nr[i] <<
", " << tr[g.
type_r[i]] <<
"; "
411 <<
"nt = " << g.
nt[i] <<
", " << tang[g.
type_t] <<
"; "
412 <<
"np = " << g.
np[i] <<
", " << tang[g.
type_p] <<
"; "
413 <<
"Collocation points type : " << tbase[g.
colloc_r[i]] << endl ;
424 for (
int i=0 ; i<
nzone ; i++) {
425 if (
nr[i] != titi.
nr[i])
return true ;
426 if (
nt[i] != titi.
nt[i])
return true ;
427 if (
np[i] != titi.
np[i])
return true ;
477 int* nbr_angu =
new int[
nzone] ;
478 for (
int i=0 ; i<
nzone ; i++) {
497 int* nbr_angu =
new int(1) ;
498 int* nbt_angu =
new int(
nt[0]) ;
499 int* nbp_angu =
new int(
np[0]) ;
500 int* type_r_angu =
new int(FIN) ;
522 int* nbr_radial =
new int[
nzone] ;
523 for (
int i=0 ; i<
nzone ; i++) {
528 delete [] nbr_radial ;
543 int* nbr =
new int[
nzone] ;
544 int* nbt =
new int[
nzone] ;
545 int* nbp =
new int[
nzone] ;
547 for (
int l=0; l<
nzone; l++) {
552 nbr[l] = 2*
nr[l] - 1 ;
559 nbt[l] = 2*
nt[l] - 1 ;
591 int* nbr =
new int[
nzone] ;
593 for (
int l=0; l<
nzone; l++) {
597 nbr[l] = (3*
nr[l])/2 ;
619 int* nbt =
new int[
nzone] ;
620 int* nbp =
new int[
nzone] ;
622 for (
int l=0; l<
nzone; l++) {
654 for (
int i=0; i<
nzone; i++) {
655 if (mgi.
get_nr(i) !=
nr[i]) resu = false ;
656 if (mgi.
get_np(i) !=
np[i]) resu = false ;
657 if (mgi.
get_nt(i) !=
nt[i]) resu = false ;
3D grid class in one domain.
const Mg3d * get_twice() const
Returns the pointer on the grid which has twice the number of points in each dimension (for desaliasi...
const Mg3d * plus_half() const
Returns the pointer on the grid which has 50% more points in r dimension (for desaliasing).
int get_colloc_r(int l) const
Returns the type of collocation points used in domain no.
int * type_r
Array (size: nzone) of type of sampling in r ( ) (RARE,FIN, c UNSURR)
Mg3d * g_radial
Pointer on the associated radial grid.
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Mg3d * g_twice
Pointer on the grid which has twice the number of points in each dimension (for desaliasing).
int get_type_t() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the equatorial pl...
int type_t
Type of sampling in (SYM, NONSYM)
const Mg3d * get_angu_1dom() const
Returns the pointer on the associated mono-domain angular grid.
Mg3d * g_non_axi
Pointer on the grid which has at least 4 points in the direction and at least 5 in the direction (f...
void set_deriv_0x0() const
Sets to 0x0 all the pointers on derived quantities (g_radial , g_angu, g_twice, .....
bool operator!=(const Mg3d &) const
Operator !=.
int type_p
Type of sampling in (SYM, NONSYM)
int * nt
Array (size: nzone) of nb. of points in .
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
int get_type_p() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the transformatio...
int * nr
Array (size: nzone) of nb. of points in r ( )
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
void del_deriv() const
Deletes all the derived quantities (g_radial , g_angu, g_twice, ...)
const Mg3d * get_radial() const
Returns the pointer on the associated radial grid.
int get_nzone() const
Returns the number of domains.
Mg3d * g_angu_1dom
Pointer on the associated angular grid with only one domain.
Mg3d * g_angu
Pointer on the associated angular grid.
Mg3d(int nz, int nbr[], int typr[], int nbt[], int typt, int nbp[], int typp, int *base_r=0x0)
General constructor.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
int nzone
Number of domains (zones)
Grille3d ** g
Array (size: nzone) of pointers on the Grille3d's.
bool operator==(const Mg3d &) const
Comparison operator (egality)
Mg3d * g_plus_half
Pointer on the grid which has 50% more points in r dimension (for desaliasing).
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
int * colloc_r
Array (size: nzone) of type of collocation points in r ( ) and related decompoisition bases (BASE_CHE...
const Mg3d * get_non_axi() const
Returns the pointer on the grid which has at least 4 points in the direction and at least 5 in the ...
int * np
Array (size: nzone) of nb. of points in .
void arrete(int a=0)
Setting a stop point in a code.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.