#define __WINDOWS__ 1
#include <iostream>
#include <algorithm>
#include <string>
#include "libidxgui.h"
#include "datasource.h"
#include "libidx.h"
#include "idx.h"
uint dump_count = 0;
using namespace std;
using namespace ebl;
void test_state_copy();
int main(int argc,char** argv)
{
test_state_copy();
return 0;
}
void test_state_copy()
{
state<double> a(4,4);
cout<<"a.printElems()显示的元素:"<<endl;
a.printElems();
cout<<endl;
cout<<"a.x[0]中的元素:"<<endl;
a.x[0].printElems();
cout<<endl;
/*cout<<"a.dx[0]中的元素:"<<endl;
a.dx[0].printElems();
cout<<endl;
cout<<"a.ddx[0]中的元素:"<<endl;
a.ddx[0].printElems();
cout<<endl;*/
a.resize_dx();
a.resize_ddx();
cout<<"a.printElems()显示的元素:"<<endl;
a.printElems();
cout<<endl;
cout<<"a.x[0]中的元素:"<<endl;
a.x[0].printElems();
cout<<endl;
cout<<"a.dx[0]中的元素:"<<endl;
a.dx[0].printElems();
cout<<endl;
cout<<"a.ddx[0]中的元素:"<<endl;
a.ddx[0].printElems();
cout<<endl;
dseed(32);
idx_aloop3(xx,a,double,xd,a.dx[0],double,xdd,a.ddx[0],double)
{
*xx = drand(2);
*xd = drand(2);
*xdd = drand(2);
}
cout<<"a.printElems()显示的元素:"<<endl;
a.printElems();
cout<<endl;
cout<<"a.x[0]中的元素:"<<endl;
a.x[0].printElems();
cout<<endl;
cout<<"a.dx[0]中的元素:"<<endl;
a.dx[0].printElems();
cout<<endl;
cout<<"a.ddx[0]中的元素:"<<endl;
a.ddx[0].printElems();
cout<<endl;
state<double> b = a.deep_copy();
cout<<"b.printElems()显示的元素:"<<endl;
b.printElems();
cout<<endl;
cout<<"b.x[0]中的元素:"<<endl;
b.x[0].printElems();
cout<<endl;
cout<<"b.dx[0]中的元素:"<<endl;
b.dx[0].printElems();
cout<<endl;
cout<<"b.ddx[0]中的元素:"<<endl;
b.ddx[0].printElems();
cout<<endl;
idx_addc(a,1.,a);
cout<<"a.printElems()显示的元素:"<<endl;
a.printElems();
cout<<endl;
cout<<"a.x[0]中的元素:"<<endl;
a.x[0].printElems();
cout<<endl;
cout<<"a.dx[0]中的元素:"<<endl;
a.dx[0].printElems();
cout<<endl;
cout<<"a.ddx[0]中的元素:"<<endl;
a.ddx[0].printElems();
cout<<endl;
idx_addc(a.dx[0],2.,a.dx[0]);
cout<<"a.printElems()显示的元素:"<<endl;
a.printElems();
cout<<endl;
cout<<"a.x[0]中的元素:"<<endl;
a.x[0].printElems();
cout<<endl;
cout<<"a.dx[0]中的元素:"<<endl;
a.dx[0].printElems();
cout<<endl;
cout<<"a.ddx[0]中的元素:"<<endl;
a.ddx[0].printElems();
cout<<endl;
idx_addc(a.ddx[0],3.,a.ddx[0]);
cout<<"a.printElems()显示的元素:"<<endl;
a.printElems();
cout<<endl;
cout<<"a.x[0]中的元素:"<<endl;
a.x[0].printElems();
cout<<endl;
cout<<"a.dx[0]中的元素:"<<endl;
a.dx[0].printElems();
cout<<endl;
cout<<"a.ddx[0]中的元素:"<<endl;
a.ddx[0].printElems();
cout<<endl;
}