/* * Method of the class Map_et to compute the mapping parameters to let the * domain boundaries coincide with isosurfaces of a given scalar field. * * (see file map.h for documentation). */ /* * Copyright (c) 2000-2001 Eric Gourgoulhon * * This file is part of LORENE. * * LORENE is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LORENE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LORENE; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ char map_et_adapt_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_et_adapt.C,v 1.11 2014/10/13 08:53:03 j_novak Exp $" ; /* * $Id: map_et_adapt.C,v 1.11 2014/10/13 08:53:03 j_novak Exp $ * $Log: map_et_adapt.C,v $ * Revision 1.11 2014/10/13 08:53:03 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.10 2014/10/06 15:13:12 j_novak * Modified #include directives to use c++ syntax. * * Revision 1.9 2010/01/31 16:58:39 e_gourgoulhon * Back to rev. 1.7 (1.8 has been committed by mistake). * * Revision 1.8 2010/01/31 16:51:47 e_gourgoulhon * File local_settings_linux is now called local_settings_linux_old (for * it is quite old and not compatible with the gcc 4.x series). * * Revision 1.7 2006/09/05 13:39:45 p_grandclement * update of the bin_ns_bh project * * Revision 1.6 2006/05/17 13:27:12 j_novak * Removed strange character on line 534. * * Revision 1.5 2006/05/03 11:15:25 p_grandclement * modif filtering * * Revision 1.4 2006/05/03 07:07:52 p_grandclement * Petite correction * * Revision 1.3 2006/04/25 07:21:59 p_grandclement * Various changes for the NS_BH project * * Revision 1.2 2003/10/03 15:58:48 j_novak * Cleaning of some headers * * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon * LORENE * * Revision 2.6 2000/11/10 15:19:300 eric * Appel de Valeur::equipot_outward plutot que Valeur::equipot * dans la determination des isopotentielles. * * Revision 2.5 2000/10/23 14:01:17 eric * Changement des arguments (en autre, ajout de nz_search, qui est * desormais a priori independant de nzadapt). * * Revision 2.4 2000/10/20 13:13:01 eric * nzet --> nzadapt. * nz_search = nzadapt --> nz_search = nzadapt + 1 * * Revision 2.3 2000/02/17 19:00:53 eric * nz_search = nzet et non plus nz_search = nz-1. * * Revision 2.2 2000/02/15 15:09:12 eric * Changement du Param : fact_echelle est desormais passe en double_mod. * * Revision 2.1 2000/01/03 15:46:59 eric * *** empty log message *** * * Revision 2.0 2000/01/03 13:30:59 eric * *** empty log message *** * * * $Header: /cvsroot/Lorene/C++/Source/Map/map_et_adapt.C,v 1.11 2014/10/13 08:53:03 j_novak Exp $ * */ // Headers C #include // Headers Lorene #include "cmp.h" #include "itbl.h" #include "param.h" #include "proto.h" namespace Lorene { void Map_et::adapt(const Cmp& ent, const Param& par, int nbr_filtre) { // Parameters of the computation // ----------------------------- int nitermax = par.get_int(0) ; int& niter = par.get_int_mod(0) ; int nzadapt = par.get_int(1) ; int nz_search = par.get_int(2) ; int adapt_flag = par.get_int(3) ; int j_bord = par.get_int(4) ; // index of theta_* int k_bord = par.get_int(5) ; // index of phi_* double precis = par.get_double(0) ; double fact_lamu = par.get_double(1) ; double fact_echelle = par.get_double(2) ; const Tbl& ent_limit = par.get_tbl(0) ; int nz = mg->get_nzone() ; int nt = mg->get_nt(0) ; int np = mg->get_np(0) ; // Protections // ----------- assert(ent.get_mp() == this) ; assert(nzadapt < nz) ; assert(nzadapt > 0) ; assert(nz_search >= nzadapt) ; for (int l=1; lget_nt(l) == nt ) ; assert( mg->get_np(l) == np ) ; } assert(ent_limit.get_ndim() == 1) ; assert(ent_limit.get_taille() >= nzadapt) ; assert(ent_limit.get_etat() == ETATQCQ) ; // Initializations // --------------- niter = 0 ; const double xi_max = 1 ; //======================================================================= // Special case of a fixed mapping : only a rescaling is performed //======================================================================= if ( (adapt_flag == 0) || (nzadapt == 0) ) { homothetie(fact_echelle) ; return ; } //======================================================================= // General case //======================================================================= // New mapping parameters // ---------------------- double* nalpha = new double[nz] ; double* nbeta = new double[nz] ; Itbl l_ext(np, nt) ; Tbl x_ext(np, nt) ; Tbl xtgg(np, nt, 1) ; // working array constructed from the isosurface // equation Tbl xtff(np, nt, 1) ; // idem //---------------------------------------------------------------- // Adaptation of the nucleus //---------------------------------------------------------------- double ent0 = ent_limit(0) ; // Search for the equipotential surface ent = ent0 // ---> l = l_ext(theta, phi) // xi = x_ext(theta, phi) // ----------------------------------------------- int niter0 ; (ent.va).equipot_outward(ent0, nz_search, precis, nitermax, niter0, l_ext, x_ext) ; niter = ( niter0 > niter ) ? niter0 : niter ; // The new mapping must be such that the found isosurface corresponds // to xi = 1 // Computation of r_ext(theta, phi) - r_eq ---> xtgg // ------------------------------------------------- xtgg.set_etat_qcq() ; assert(l_ext.get_etat() == ETATQCQ) ; double r_eq = val_r_jk(0, xi_max, j_bord, k_bord) ; double* pxtgg = xtgg.t ; int* pl_ext = l_ext.t ; double* px_ext = x_ext.t ; for (int k=0; k xtgg // odd phi harmonics --> xtff // ------------------------------------------------------------------------ int base_p = ( ((ent.va).base).b[0] ) & MSQ_P ; switch( base_p ) { case P_COSSIN_P : { // case of only even harmonics in phi xtff.set_etat_zero() ; break ; } case P_COSSIN : { // general case: a Fourier transform must be // done xtff.set_etat_qcq() ; double* pxtff = xtff.t ; pxtgg = xtgg.t ; assert(np>=4) ; int deg[3] ; int dimc[3] ; deg[0] = np ; deg[1] = nt ; deg[2] = 1; dimc[0] = np + 2 ; dimc[1] = nt ; dimc[2] = 1 ; double* cf = new double[(np+2)*nt] ; double* cf0 = new double[(np+2)*nt] ; double* ff0 = new double[np*nt] ; for (int i=0; i < np*nt; i++) { cf[i] = *pxtgg ; pxtgg++ ; } cfpcossin(deg, dimc, cf) ; // Fourier transform // Even harmonics // -------------- double* pcf0 = cf0 ; double* pcf = cf ; for (int k=0; k