00001 //===================================================== 00002 // File : size_log.hh 00003 // Author : L. Plagne <laurent.plagne@edf.fr)> 00004 // Copyright (C) EDF R&D, lun sep 30 14:23:17 CEST 2002 00005 //===================================================== 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 00010 // of the License, or (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 // 00020 #ifndef SIZE_LOG 00021 #define SIZE_LOG 00022 00023 #include "math.h" 00024 // The Vector class must satisfy the following part of STL vector concept : 00025 // resize() method 00026 // [] operator for seting element 00027 // the vector element are int compatible. 00028 template<class Vector> 00029 void size_log(const int nb_point, const int size_min, const int size_max, Vector & X) 00030 { 00031 X.resize(nb_point); 00032 00033 float ls_min=log(float(size_min)); 00034 float ls_max=log(float(size_max)); 00035 00036 float ls=0.0; 00037 00038 float delta_ls=(ls_max-ls_min)/(float(nb_point-1)); 00039 00040 int size=0; 00041 00042 for (int i=0;i<nb_point;i++){ 00043 00044 ls = ls_min + float(i)*delta_ls ; 00045 00046 size=int(exp(ls)); 00047 00048 X[i]=size; 00049 } 00050 00051 } 00052 00053 00054 #endif