guide me to make this code better or efficient
given this prototype code how could I improve this?
Code:
#include "geocoding.h"
int main()
{
vector<vector<vector<SURFACEMODEL> > > radar = invgeocoding();
dirgeocoding(radar);
return 0;
}
#include "geocoding.h"
vector<vector<vector<SURFACEMODEL> > > invgeocoding()
{
// read input parameters
// memory allocations
vector<vector<SURFACEMODEL> > dtmpixel(ny_dtm, vector<SURFACEMODEL>(nx_dtm));
vector<vector<vector<SURFACEMODEL> > > radarpixel(ny_radar, vector<vector<SURFACEMODEL> >(nx_radar));
// read SURFACEMODEL data binary file
// copy relevant surface data to radar dimension matrix (smaller than surface)
return radarpixel;
}
#include "geocoding.h"
void dirgeocoding(vector<vector<vector<SURFACEMODEL> > > radarpixel)
{
// interpolation of height data for each radarpixel
}
I am learning C++ by doing, I am used to prototyping / calculating with matlab but don't really have the grip on references and pointers in C. Considering my surface model could be hundreds of MB's should I free memory somewhere? Typically surface 2D vector (dtmpixel) should be much larger than radar 3D vector (radarpixel). In function dirgeocoding I need to calculate some values of class SURFACEMODEL. I would like to advance a little bit and don't waste too much unnecessary memory.
Best regards