1//=====================================================
2// File   :  static_size_generator.hh
3// Author :  L. Plagne <laurent.plagne@edf.fr)>
4// Copyright (C) EDF R&D,  mar d�c 3 18:59:36 CET 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 _STATIC_SIZE_GENERATOR_HH
21#define _STATIC_SIZE_GENERATOR_HH
22#include <vector>
23
24using namespace std;
25
26//recursive generation of statically defined matrix and vector sizes
27
28template <int SIZE,template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface>
29struct static_size_generator{
30  static void go(vector<double> & tab_sizes, vector<double> & tab_mflops)
31  {
32    tab_sizes.push_back(SIZE);
33    std::cout << tab_sizes.back() << " \t" << std::flush;
34    Perf_Analyzer<Action<Interface<REAL_TYPE,SIZE> > > perf_action;
35    tab_mflops.push_back(perf_action.eval_mflops(SIZE));
36    std::cout << tab_mflops.back() << " MFlops" << std::endl;
37    static_size_generator<SIZE-1,Perf_Analyzer,Action,Interface>::go(tab_sizes,tab_mflops);
38  };
39};
40
41//recursion end
42
43template <template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface>
44struct static_size_generator<1,Perf_Analyzer,Action,Interface>{
45  static  void go(vector<double> & tab_sizes, vector<double> & tab_mflops)
46  {
47    tab_sizes.push_back(1);
48    Perf_Analyzer<Action<Interface<REAL_TYPE,1> > > perf_action;
49    tab_mflops.push_back(perf_action.eval_mflops(1));
50  };
51};
52
53#endif
54
55
56
57
58