Feb 20, 2014 at 6:45am UTC
[ double temp=0;
int index1;
//double temp_p_f=0;
count_f=0;
ofstream myfile20;
ofstream grid;
//
for (index=0;index<nt;index++){
Final_T[index]=Final_T[index]*Final_T[index]/4;
}
myfile20.open ("fine-time.txt");
grid.open ("grid.txt");
////myfile << "Writing this to a file.\n";
//
//---------------------
vector<double> my;
for(i=0; i<npixels; i++){
my.push_back(Final_T[i]);
}
//----------------
myfile20 << setw(16) ;
for (int k=1; k<nz+1;k++){
for (int j=1; j<ny+1;j++){
for (int i=1; i<nx+1;i++){
index= (k-1) * nx * ny +(j-1) * (nx) + (i-1) ;
/*if(abs(dp_loc[index])>pi){
dp_loc[index]=pi;
}*/
myfile20 <<Final_T[index]<<setw(16) ;
//myfile20 <<velocityx[index]<< setw(16) ;
// save fine scale time
if(Final_T[index]<threshold){
count_f=count_f+porosity[index]*dx[index]*dy[index]*dz[index];
}
}
myfile20 << endl ;
}
}
double val,result, tmp;
int count=0;
//vector<double> t_;
//vector<double> Vp;
//vector<double> Area;
//int jj=0;
sort(my.begin(), my.end());
val = my.at(0);
//write in to gird.txt
for(i=0;i<npixels;i++)
{
if(val < my.at(i))
{
grid<<my.at(i-1)<<endl;
}
}
startClock1 = clock();
//=====================================================================================
}]
Feb 20, 2014 at 7:15am UTC
a) it would be great if you could post all of your code
b) it would be great if you could format it correctly
doing a) is a neccessity because we arent aware if you didnt bring it out of the namespace (is that the proper phrase?) or if you even included the proper header
Feb 22, 2014 at 2:36am UTC
The code is very long, it will distract you. I found the answer
Just need to add <algorithm> to the library
Thanks
Last edited on Feb 22, 2014 at 2:36am UTC
Feb 23, 2014 at 6:57am UTC
it doesnt matter how long it is. it wont distract us because we know what to look for. we cant look for it though if you dont help us help you
Feb 23, 2014 at 9:10am UTC
Does it work if you write std::sort?