• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //=====================================================
2 // File   :  init_vector.hh
3 // Author :  L. Plagne <laurent.plagne@edf.fr)>
4 // Copyright (C) EDF R&D,  lun sep 30 14:23:18 CEST 2002
5 //=====================================================
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 //
20 #ifndef INIT_VECTOR_HH
21 #define INIT_VECTOR_HH
22 
23 // The Vector class must satisfy the following part of STL vector concept :
24 //            resize() method
25 //            [] operator for setting element
26 //            value_type defined
27 template<double init_function(int), class Vector>
init_vector(Vector & X,int size)28 void init_vector(Vector & X, int size){
29 
30   X.resize(size);
31 
32   for (unsigned int i=0;i<X.size();i++){
33     X[i]=typename Vector::value_type(init_function(i));
34   }
35 }
36 
37 #endif
38