Memosa-FVM  0.2
testOneDConduction_double.cpp
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #include <string>
6 #include <iostream>
7 #include <fstream>
8 
9 using namespace std;
10 
11 #include "PC.h"
12 #include "OneDConduction.h"
13 
14 typedef PC<3,1> PCType;
15 
16 #define NCELLS 10
17 int main(int argc, char *argv[])
18 {
19 
20  double dkConst = 1.;
21  PCType pCkConst(dkConst);
22  pCkConst._data[1] = 0.1;
23 
24  //OneDConduction<double> dp(NCELLS,dkConst);
25  OneDConduction<PCType> pCp(NCELLS,pCkConst);
26 
27  //dp.solve();
28  pCp.solve();
29 
30  //Array<double>& dt = dp.getSolution();
31  Array<PCType>& pCt = pCp.getSolution();
32 
33  //cout << "double solution" << endl;
34  //for(int i=0; i<NCELLS; i++)
35  // cout << i << " " << dt[i] << endl;
36  ofstream mean_file, variance_file;
37  mean_file.open("/tmp/mean-mc.dat");
38  variance_file.open("/tmp/variance-mc.dat");
39 
40  double dx=1.0/NCELLS;
41  double x = dx/2.0;
42  for(int c=0; c<NCELLS; c++)
43  {
44  double Tmean = pCt[i]._data[0] << " "
45  double T = gsl_stats_variance_m(Tc[c],1,NTRIES,Tmean);
46  mean_file << x << " " << Tmean << endl;
47  variance_file << xc[c] << " " << stdDev(pCt[i]) << endl;
48  }
49 
50  return 0;
51 }
Definition: PC.h:61
boost::shared_ptr< Array< T > > getSolution()
PC< 3, 1 > PCType
int main(int argc, char *argv[])
double stdDev(const PC< ORDER, DIM > &a)
Definition: PC.h:363
Definition: Array.h:14
T * _data
Definition: Array.h:500
#define NCELLS
double _data[N]
Definition: PC.h:293
#define NTRIES