Commit 92a9eb72 authored by David Rohr's avatar David Rohr

code cleanup, move fft plan creation to function, remove file name strings from param class

parent 093227f8
......@@ -205,20 +205,13 @@ int bioem::configure(int ac, char* av[])
exit(1);
}
// ********************* Reading Parameter Input ***************************
// copying inputfile to param class
param.fileinput = infile.c_str();
param.readParameters();
param.readParameters(infile.c_str());
// ********************* Reading Model Input ******************************
// copying modelfile to model class
Model.filemodel = modelfile.c_str();
Model.readModel();
Model.readModel(modelfile.c_str());
// ********************* Reading Particle Maps Input **********************
// ********* HERE: PROBLEM if maps dont fit on the memory!! ***************
// copying mapfile to ref map class
param.filemap = mapfile.c_str();
RefMap.readRefMaps(param);
RefMap.readRefMaps(param, mapfile.c_str());
}
#ifdef WITH_MPI
......@@ -227,6 +220,7 @@ int bioem::configure(int ac, char* av[])
if (mpi_rank != 0) return(1);
// ****************** Precalculating Necessary Stuff *********************
param.PrepareFFTs();
precalculate();
if (getenv("BIOEM_DEBUG_BREAK"))
......@@ -382,10 +376,11 @@ int bioem::run()
// *** Angular Probability ***
// if(param.writeAngles){
ofstream angProbfile;
angProbfile.open ("ANG_PROB_iRefMap");
// }
if(param.writeAngles)
{
angProbfile.open ("ANG_PROB");
}
ofstream outputProbFile;
outputProbFile.open ("Output_Probabilities");
......@@ -423,7 +418,10 @@ int bioem::run()
}
}
angProbfile.close();
if(param.writeAngles)
{
angProbfile.close();
}
outputProbFile.close();
return(0);
......
......@@ -343,7 +343,7 @@ int bioem_cuda::deviceInit()
{
deviceExit();
selectCudaDevice();
if (FFTAlgo) GPUAlgo = 2;
......
......@@ -30,7 +30,7 @@ public:
sumsquare_RefMap = NULL;
RefMapsFFT = NULL;
}
int readRefMaps(bioem_param& param);
int readRefMaps(bioem_param& param, const char* filemap);
int precalculate(bioem_param& param, bioem& bio);
int PreCalculateMapsFFT(bioem_param& param);
......
......@@ -9,7 +9,7 @@ public:
//bioem_model();
//~bioem_model();
int readModel();
int readModel(const char* filemodel);
bool readPDB;
......@@ -17,8 +17,6 @@ public:
myfloat_t getAminoAcidDensity(char *name);
myfloat_t NormDen;
const char* filemodel;
int nPointsModel;
myfloat3_t PointsModel[BIOEM_MODEL_SIZE];
myfloat_t radiusPointsModel[BIOEM_MODEL_SIZE];
......
......@@ -10,6 +10,7 @@
class bioem_param_device
{
public:
// Grids in center assuming equidistance from 0,0
int maxDisplaceCenter;
int GridSpaceCenter;
int NumberPixels;
......@@ -25,10 +26,10 @@ public:
bioem_param();
~bioem_param();
int readParameters();
int readParameters(const char* fileinput);
int CalculateGridsParam();
int CalculateRefCTF();
int InitializeArrays();
void PrepareFFTs();
bioem_param_device param_device;
......@@ -37,20 +38,14 @@ public:
mycomplex_t* refCTF;
myfloat3_t* CtfParam;
// File names
const char* fileinput;
char logFile;
// If to write Probabilities of Angles from Model
bool writeAngles;
//int NumberPixels; //in device class
myfloat_t pixelSize;
// Grid Points in Euler angles, assuming uniform sampling d_alpha=d_gamma (in 2pi) & cos(beta)=-1,1
int angleGridPointsAlpha;
int angleGridPointsBeta;
// Grids in center assuming equidistance from 0,0
//int maxDisplaceCenter; //in device class
int numberGridPointsDisplaceCenter;
//int GridSpaceCenter; //in device class
// Grid sampling for the convolution kernel
//ENVELOPE
myfloat_t startGridEnvelop;
......@@ -64,16 +59,13 @@ public:
int numberGridPointsCTF_amp;
myfloat_t gridCTF_amp;
// Others
//myfloat_t volu;//in device class
myfloat3_t* angles;
int nTotGridAngles;
int nTotCTFs;
//myfloat_t Ntotpi;//in device class
int fft_plans_created;
myfftw_plan fft_plan_c2c_forward, fft_plan_c2c_backward, fft_plan_r2c_forward, fft_plan_c2r_backward;
const char* filemap;
bool dumpMap, loadMap;
private:
......
......@@ -21,7 +21,7 @@
using namespace std;
int bioem_RefMap::readRefMaps(bioem_param& param)
int bioem_RefMap::readRefMaps(bioem_param& param, const char* filemap)
{
numPixels = param.param_device.NumberPixels;
refMapSize = param.param_device.NumberPixels * param.param_device.NumberPixels;
......@@ -50,11 +50,11 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
if(readMultMRC)
{
ifstream input(param.filemap);
ifstream input(filemap);
if (!input.good())
{
cout << "Failed to open file contaning MRC names: " << param.filemap << "\n";
cout << "Failed to open file contaning MRC names: " << filemap << "\n";
exit(0);
}
......@@ -84,13 +84,13 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
}
cout << "\n+++++++++++++++++++++++++++++++++++++++++++ \n";
cout << "Particle Maps read from MULTIPLE MRC Files in: " << param.filemap << "\n" ;
cout << "Particle Maps read from MULTIPLE MRC Files in: " << filemap << "\n" ;
}
else
{
read_MRC(param.filemap,param);
read_MRC(filemap,param);
cout << "\n++++++++++++++++++++++++++++++++++++++++++ \n";
cout << "Particle Maps read from ONE MRC File: " << param.filemap << "\n" ;
cout << "Particle Maps read from ONE MRC File: " << filemap << "\n" ;
}
}
else
......@@ -98,7 +98,7 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
int nummap = -1;
int lasti = 0;
int lastj = 0;
ifstream input(param.filemap);
ifstream input(filemap);
if (!input.good())
{
cout << "Particle Maps Failed to open file" << endl ;
......
......@@ -18,7 +18,7 @@
using namespace std;
int bioem_model::readModel()
int bioem_model::readModel(const char* filemodel)
{
// **************************************************************************************
// ***************Reading reference Models either PDB or x,y,z,r,d format****************
......
......@@ -45,7 +45,7 @@ bioem_param::bioem_param()
angles = NULL;
}
int bioem_param::readParameters()
int bioem_param::readParameters(const char* fileinput)
{
// **************************************************************************************
// ***************************** Reading Input Parameters ******************************
......@@ -256,8 +256,23 @@ int bioem_param::readParameters()
}
param_device.NumberFFTPixels1D = param_device.NumberPixels / 2 + 1;
FFTMapSize = param_device.NumberPixels * param_device.NumberFFTPixels1D;
//Does currently not work with custom alignment on GPU
/*if (FFTMapSize % Alignment)
{
FFTMapSize += Alignment - FFTMapSize % Alignment;
}
cout << "Using MAP Size " << FFTMapSize << " (Alignment " << Alignment << ", Unaligned Size " << param_device.NumberPixels * param_device.NumberFFTPixels1D << ")\n";*/
cout << " +++++++++++++++++++++++++++++++++++++++++ \n";
return(0);
}
void bioem_param::PrepareFFTs()
{
cout << "Preparing FFTs\n";
releaseFFTPlans();
mycomplex_t *tmp_map, *tmp_map2;
......@@ -278,21 +293,7 @@ int bioem_param::readParameters()
myfftw_free(tmp_map);
myfftw_free(tmp_map2);
fft_plans_created = 1;
param_device.NumberFFTPixels1D = param_device.NumberPixels / 2 + 1;
FFTMapSize = param_device.NumberPixels * param_device.NumberFFTPixels1D;
//Does currently not work with custom alignment on GPU
/*if (FFTMapSize % Alignment)
{
FFTMapSize += Alignment - FFTMapSize % Alignment;
}
cout << "Using MAP Size " << FFTMapSize << " (Alignment " << Alignment << ", Unaligned Size " << param_device.NumberPixels * param_device.NumberFFTPixels1D << ")\n";*/
cout << " +++++++++++++++++++++++++++++++++++++++++ \n";
return(0);
fft_plans_created = 1;
}
void bioem_param::releaseFFTPlans()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment