ProSHADE  0.7.6.6 (JUL 2022)
Protein Shape Detection
ProSHADE_internal_spheres::ProSHADE_sphere Class Reference

This class contains all inputed and derived data for a single sphere. More...

#include <ProSHADE_spheres.hpp>

Public Member Functions

 ProSHADE_sphere (proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_single xSize, proshade_single ySize, proshade_single zSize, proshade_unsign shOrder, std::vector< proshade_single > *spherePos, bool progressiveMapping, proshade_unsign band, proshade_double *map, proshade_unsign *maxShellBand, proshade_unsign *maxCompBand)
 Constructor for getting empty ProSHADE_sphere class. More...
 
 ~ProSHADE_sphere (void)
 Destructor for the ProSHADE_sphere class. More...
 
void allocateRotatedMap (void)
 This function allocates the rotated map memory.
 
proshade_unsign getLocalBandwidth (void)
 This function returns the local bandwidth. More...
 
proshade_unsign getLocalAngRes (void)
 This function returns the local angular resolution. More...
 
proshade_double * getMappedData (void)
 This function returns the mapped data array. More...
 
proshade_double getShellRadius (void)
 This function returns the radius of the shell in question. More...
 
void setRotatedMappedData (proshade_unsign pos, proshade_double value)
 This function sets the rotated mapped data value to the given position. More...
 
proshade_double getRotatedMappedData (proshade_unsign pos)
 This function gets the rotated mapped data value for a particular position. More...
 

Protected Member Functions

proshade_unsign getMaxCircumference (proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_single maxRange)
 This function determines the maximum circumference of a shell. More...
 
bool getMapPoint (proshade_double *map, proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_signed xPos, proshade_signed yPos, proshade_signed zPos, std::vector< proshade_double > *interpVec)
 This function fills in the interpolation vector for a single map point. More...
 
void getLongitudeCutoffs (std::vector< proshade_double > *lonCO)
 This function fills in the vector of longitudal bin boarder values. More...
 
void getLattitudeCutoffs (std::vector< proshade_double > *latCO)
 This function fills in the vector of lattitudal bin boarder values. More...
 
void getInterpolationXYZ (proshade_double *x, proshade_double *y, proshade_double *z, proshade_double thetaIt, std::vector< proshade_double > *lonCO, proshade_unsign phiIt, std::vector< proshade_double > *latCO)
 This function finds the x, y and z positions of supplied shell point. More...
 
void getXYZTopBottoms (proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_double x, proshade_double y, proshade_double z, proshade_signed *xBottom, proshade_signed *yBottom, proshade_signed *zBottom, proshade_signed *xTop, proshade_signed *yTop, proshade_signed *zTop)
 This function fills in the interpolation vector for a single map point. More...
 
void interpolateAlongFirst (std::vector< proshade_double > c000, std::vector< proshade_double > c001, std::vector< proshade_double > c010, std::vector< proshade_double > c011, std::vector< proshade_double > c100, std::vector< proshade_double > c101, std::vector< proshade_double > c110, std::vector< proshade_double > c111, std::vector< proshade_double > *c00, std::vector< proshade_double > *c01, std::vector< proshade_double > *c10, std::vector< proshade_double > *c11, proshade_double xd)
 This function interpolates along the first (X) dimension. More...
 
void interpolateAlongSecond (std::vector< proshade_double > c00, std::vector< proshade_double > c01, std::vector< proshade_double > c10, std::vector< proshade_double > c11, std::vector< proshade_double > *c0, std::vector< proshade_double > *c1, proshade_double yd)
 This function interpolates along the second (Y) dimension. More...
 
void mapData (proshade_double *map, proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax)
 This function maps the internal map to the specific sphere. More...
 

Detailed Description

This class contains all inputed and derived data for a single sphere.

This class codes the object that contains all the information about a single concentric sphere as well as all the functionality required to process such data.

Definition at line 48 of file ProSHADE_spheres.hpp.

Constructor & Destructor Documentation

◆ ProSHADE_sphere()

ProSHADE_internal_spheres::ProSHADE_sphere::ProSHADE_sphere ( proshade_unsign  xDimMax,
proshade_unsign  yDimMax,
proshade_unsign  zDimMax,
proshade_single  xSize,
proshade_single  ySize,
proshade_single  zSize,
proshade_unsign  shOrder,
std::vector< proshade_single > *  spherePos,
bool  progressiveMapping,
proshade_unsign  band,
proshade_double *  map,
proshade_unsign *  maxShellBand,
proshade_unsign *  maxCompBand 
)

Constructor for getting empty ProSHADE_sphere class.

This constructor takes all the information required by the shell and proceeds to set the shell object accordingly. It can either set the spherical harmonics variables according to shell size (if the progressive mapping is allowed), or it just uses the whole map defaults (in the opposite case). It also maps the density onto the spherical grid of the shell using tri-linear interpolation.

Parameters
[in]xDimMaxThe internal map maximum index in the x dimension.
[in]yDimMaxThe internal map maximum index in the y dimension.
[in]zDimMaxThe internal map maximum index in the z dimension.
[in]xSizeThe integral map size in angstroms along the x-axis.
[in]ySizeThe integral map size in angstroms along the y-axis.
[in]zSizeThe integral map size in angstroms along the z-axis.
[in]shOrderThe order of the shell in the shell vector - 0 is the smallest shell.
[in]spherePosA Pointer to vector of proshade_single's with the shell positions.
[in]progressiveMappingShould the bandwidth and angular resolution be set by the actual number of points, or just same for all shells?
[in]bandThe bandwidth to be set for conservative mapping.
[in]mapA pointer to the internal map which should be mapped to the sphere.
[in]maxShellBandThis pointer reference will take the shell band, if it is higher than the already known one.
[in]maxCompBandThis pointer reference will take the shell band, if it is higher than the already known one.
[out]XData object with all values set and the appropriate map part mapped.

Definition at line 47 of file ProSHADE_spheres.cpp.

48 {
49  //================================================ Save inputs
50  this->shellOrder = shOrder;
51  this->sphereWidth = static_cast< proshade_single > ( ( spherePos->at(0) + spherePos->at(1) ) / 2.0f );
52  this->sphereRadius = static_cast< proshade_double > ( spherePos->at(shOrder) );
53 
54  //================================================ Determine shell ranges in angstroms
55  proshade_double maxDist = 0.0;
56  if ( shOrder == static_cast<proshade_unsign> ( spherePos->size() - 1 ) ) { maxDist = static_cast<proshade_double> ( spherePos->at(spherePos->size()-1) + ( spherePos->at(1) - spherePos->at(0) ) ); }
57  else { maxDist = static_cast<proshade_double> ( ( spherePos->at(shOrder) + spherePos->at(shOrder+1) ) / 2.0f ); }
58 
59  //================================================ Set the max range
60  this->maxSphereRange = static_cast<proshade_single> ( 2.0 * maxDist );
61 
62  //================================================ Set map sampling rates
63  this->xDimSampling = xSize / static_cast<proshade_single> (xDimMax);
64  this->yDimSampling = ySize / static_cast<proshade_single> (yDimMax);
65  this->zDimSampling = zSize / static_cast<proshade_single> (zDimMax);
66 
67  //================================================ Get maximum circumference
68  proshade_unsign maxCircumference = this->getMaxCircumference ( xDimMax, yDimMax, zDimMax, this->maxSphereRange );
69 
70  //================================================ Get spherical harmonics calculation values
71  if ( progressiveMapping )
72  {
73  this->localBandwidth = std::min ( autoDetermineBandwidth ( maxCircumference ), band );
74  this->localAngRes = this->localBandwidth * 2;
75  }
76  else
77  {
78  this->localBandwidth = band;
79  this->localAngRes = this->localBandwidth * 2;
80  }
81 
82  //================================================ Save the maximum shell band for later
83  if ( *maxShellBand < this->localBandwidth ) { *maxShellBand = this->localBandwidth; *maxCompBand = this->localBandwidth; }
84 
85  //================================================ Allocate memory for sphere mapping
86  this->mappedData = new proshade_double[this->localAngRes * this->localAngRes];
87  ProSHADE_internal_misc::checkMemoryAllocation ( this->mappedData, __FILE__, __LINE__, __func__ );
88 
89  //================================================ Set rotated mapped data
90  this->mappedDataRot = nullptr;
91 
92  //================================================ Map the data to the sphere
93  this->mapData ( map, xDimMax, yDimMax, zDimMax );
94 
95 }

◆ ~ProSHADE_sphere()

ProSHADE_internal_spheres::ProSHADE_sphere::~ProSHADE_sphere ( void  )

Destructor for the ProSHADE_sphere class.

This destructor is responsible for releasing all memory used by the data storing object

Parameters
[out]XN/A.

Definition at line 103 of file ProSHADE_spheres.cpp.

104 {
105  delete[] this->mappedData;
106 
107  if ( this->mappedDataRot != nullptr )
108  {
109  delete[] this->mappedDataRot;
110  }
111 }

Member Function Documentation

◆ getInterpolationXYZ()

void ProSHADE_internal_spheres::ProSHADE_sphere::getInterpolationXYZ ( proshade_double *  x,
proshade_double *  y,
proshade_double *  z,
proshade_double  thetaIt,
std::vector< proshade_double > *  lonCO,
proshade_unsign  phiIt,
std::vector< proshade_double > *  latCO 
)
protected

This function finds the x, y and z positions of supplied shell point.

This function converts the angular grid longitude and lattitude position (defined as in between the cutt-offs of the given index and its neighbour) to the X, Y and Z axis positions, which it saves in the supplied variables.

Parameters
[in]xA pointer to variable where the x position is to be saved.
[in]yA pointer to variable where the y position is to be saved.
[in]zA pointer to variable where the z position is to be saved.
[in]thetaItThe longitude cut-off index of the grid point of which the XYZ are to be computed.
[in]lonCOA pointer for vector of proshade_double's where the longitude cutt-off values are saved
[in]phiItThe lattitude cut-off index of the grid point of which the XYZ are to be computed.
[in]lonCOA pointer for vector of proshade_double's where the lattitude cutt-off values are saved

Definition at line 337 of file ProSHADE_spheres.cpp.

338 {
339  //================================================ Compute and save XYZ interpolation positions
340  *x = this->sphereRadius * std::cos ( ( lonCO->at( static_cast<proshade_unsign> ( thetaIt ) ) + lonCO->at( static_cast<proshade_unsign> ( thetaIt+1 ) ) ) / 2.0 ) *
341  std::cos ( ( latCO->at( static_cast<proshade_unsign> ( phiIt ) ) + latCO->at( static_cast<proshade_unsign> ( phiIt+1 ) ) ) / 2.0 );
342  *y = this->sphereRadius * std::sin ( ( lonCO->at( static_cast<proshade_unsign> ( thetaIt ) ) + lonCO->at( static_cast<proshade_unsign> ( thetaIt+1 ) ) ) / 2.0 ) *
343  std::cos ( ( latCO->at( static_cast<proshade_unsign> ( phiIt ) ) + latCO->at( static_cast<proshade_unsign> ( phiIt+1 ) ) ) / 2.0 );
344  *z = this->sphereRadius * std::sin ( ( latCO->at( static_cast<proshade_unsign> ( phiIt ) ) + latCO->at( static_cast<proshade_unsign> ( phiIt+1 ) ) ) / 2.0 );
345 
346  //================================================ Done
347  return ;
348 
349 }

◆ getLattitudeCutoffs()

void ProSHADE_internal_spheres::ProSHADE_sphere::getLattitudeCutoffs ( std::vector< proshade_double > *  latCO)
protected

This function fills in the vector of lattitudal bin boarder values.

This is a simple abstraction function which finds the boarders of the angular grid binds along the lattitudal angle.

Parameters
[in]latCOA pointer for vector of proshade_double's to which the cutt-off values are to be saved. The vector needs to be initialised for this->localAngRes + 1 size.

Definition at line 309 of file ProSHADE_spheres.cpp.

310 {
311  //================================================ Get the cut-offs
312  for ( proshade_unsign iter = 0; iter <= this->localAngRes; iter++ )
313  {
314  latCO->at(iter) = ( static_cast<proshade_double> ( iter ) *
315  ( static_cast<proshade_double> ( M_PI ) / static_cast<proshade_double> ( this->localAngRes ) ) -
316  ( static_cast<proshade_double> ( M_PI ) / 2.0 ) );
317  }
318 
319  //================================================ Done
320  return ;
321 
322 }

◆ getLocalAngRes()

proshade_unsign ProSHADE_internal_spheres::ProSHADE_sphere::getLocalAngRes ( void  )

This function returns the local angular resolution.

This is a simple accessor function so that the inverse sphere to Cartesian interpolation knows the proper angular cut-offs for each sphere.

Parameters
[out]localAngResThe value of the local angular resolution for this particular shell.

Definition at line 404 of file ProSHADE_spheres.cpp.

405 {
406  //================================================ Return the value
407  return ( this->localAngRes );
408 }

◆ getLocalBandwidth()

proshade_unsign ProSHADE_internal_spheres::ProSHADE_sphere::getLocalBandwidth ( void  )

This function returns the local bandwidth.

This is a simple accessor function so that the spherical harmonics can allocate the proper memory given the local bandwidth of the sphere.

Parameters
[out]localBandwidthThe value of the local bandwidth for this particular shell.

Definition at line 391 of file ProSHADE_spheres.cpp.

392 {
393  //================================================ Return the value
394  return ( this->localBandwidth );
395 }

◆ getLongitudeCutoffs()

void ProSHADE_internal_spheres::ProSHADE_sphere::getLongitudeCutoffs ( std::vector< proshade_double > *  lonCO)
protected

This function fills in the vector of longitudal bin boarder values.

This is a simple abstraction function which finds the boarders of the angular grid binds along the longitudal angle.

Parameters
[in]lonCOA pointer for vector of proshade_double's to which the cutt-off values are to be saved. The vector needs to be initialised for this->localAngRes + 1 size.

Definition at line 288 of file ProSHADE_spheres.cpp.

289 {
290  //================================================ Get the cut-offs
291  for ( proshade_unsign iter = 0; iter <= this->localAngRes; iter++ )
292  {
293  lonCO->at(iter) = static_cast<proshade_double> ( iter ) *
294  ( ( static_cast<proshade_double> ( M_PI ) * 2.0 ) / static_cast<proshade_double> ( this->localAngRes ) ) -
295  ( static_cast<proshade_double> ( M_PI ) );
296  }
297 
298  //================================================ Done
299  return ;
300 
301 }

◆ getMappedData()

proshade_double * ProSHADE_internal_spheres::ProSHADE_sphere::getMappedData ( void  )

This function returns the mapped data array.

This is a simple accessor function so that the spherical harmonics can access the mapped data in an array.

Parameters
[out]mappedDataproshade_double pointer to an array of mapped data.

Definition at line 417 of file ProSHADE_spheres.cpp.

418 {
419  //================================================ Return the value
420  return ( this->mappedData );
421 }

◆ getMapPoint()

bool ProSHADE_internal_spheres::ProSHADE_sphere::getMapPoint ( proshade_double *  map,
proshade_unsign  xDimMax,
proshade_unsign  yDimMax,
proshade_unsign  zDimMax,
proshade_signed  xPos,
proshade_signed  yPos,
proshade_signed  zPos,
std::vector< proshade_double > *  interpVec 
)
protected

This function fills in the interpolation vector for a single map point.

This function takes the index positions of a map point and a pointer to a vector of 4 proshade_double's and fills in the vector so that interpolation can easily be done using its values. It also returns boolean value, true if the point is in bounds and everything had succeeded and false if the point was out of bounds and therefore the interpolation is not required as the mapped value should just be 0.

Parameters
[in]mapThe density map pointer - the map which should be mapped to the data.
[in]xDimMaxThe internal map maximum index in the x dimension.
[in]yDimMaxThe internal map maximum index in the y dimension.
[in]zDimMaxThe internal map maximum index in the z dimension.
[in]xPosThe x axis index position of the point of which interpolation vector is to be obtained.
[in]yPosThe y axis index position of the point of which interpolation vector is to be obtained.
[in]zPosThe z axis index position of the point of which interpolation vector is to be obtained.
[in]interpVecThe variable to which the interpolation values are to be saved (vector of proshade_double's initialised to length 4).

Definition at line 261 of file ProSHADE_spheres.cpp.

262 {
263  //================================================ Initialise local variables
264  proshade_signed posIter = zPos + static_cast<proshade_signed> ( zDimMax ) * ( yPos + static_cast<proshade_signed> ( yDimMax ) * xPos );
265 
266  //================================================ Check of out-of-bounds shells
267  if ( ( xPos < 0 ) || ( xPos >= static_cast<proshade_signed> ( xDimMax ) ) ) { return ( false ); }
268  if ( ( yPos < 0 ) || ( yPos >= static_cast<proshade_signed> ( yDimMax ) ) ) { return ( false ); }
269  if ( ( zPos < 0 ) || ( zPos >= static_cast<proshade_signed> ( zDimMax ) ) ) { return ( false ); }
270 
271  //================================================ Get the interpolation values
272  interpVec->at(0) = static_cast<proshade_double> ( xPos ) * static_cast<proshade_double> ( this->xDimSampling );
273  interpVec->at(1) = static_cast<proshade_double> ( yPos ) * static_cast<proshade_double> ( this->yDimSampling );
274  interpVec->at(2) = static_cast<proshade_double> ( zPos ) * static_cast<proshade_double> ( this->zDimSampling );
275  interpVec->at(3) = map[posIter];
276 
277  //================================================ Done
278  return ( true );
279 
280 }

◆ getMaxCircumference()

proshade_unsign ProSHADE_internal_spheres::ProSHADE_sphere::getMaxCircumference ( proshade_unsign  xDimMax,
proshade_unsign  yDimMax,
proshade_unsign  zDimMax,
proshade_single  maxRange 
)
protected

This function determines the maximum circumference of a shell.

This function takes the input variables and finds the maximum circumference of the sphere data.

Parameters
[in]xDimMaxThe internal map maximum index in the x dimension.
[in]yDimMaxThe internal map maximum index in the y dimension.
[in]zDimMaxThe internal map maximum index in the z dimension.
[in]maxRangeThe maximum range of shell in angstroms.

Definition at line 122 of file ProSHADE_spheres.cpp.

123 {
124  //================================================ Find from and to limits on indices
125  proshade_signed xFromInd = static_cast<proshade_signed> ( xDimMax / 2 ) -
126  static_cast<proshade_signed> ( (maxRange/2) / this->xDimSampling );
127  proshade_signed yFromInd = static_cast<proshade_signed> ( yDimMax / 2 ) -
128  static_cast<proshade_signed> ( (maxRange/2) / this->yDimSampling );
129  proshade_signed zFromInd = static_cast<proshade_signed> ( zDimMax / 2 ) -
130  static_cast<proshade_signed> ( (maxRange/2) / this->zDimSampling );
131 
132  proshade_signed xToInd = static_cast<proshade_signed> ( xDimMax / 2 ) +
133  static_cast<proshade_signed> ( (maxRange/2) / this->xDimSampling );
134  proshade_signed yToInd = static_cast<proshade_signed> ( yDimMax / 2 ) +
135  static_cast<proshade_signed> ( (maxRange/2) / this->yDimSampling );
136  proshade_signed zToInd = static_cast<proshade_signed> ( zDimMax / 2 ) +
137  static_cast<proshade_signed> ( (maxRange/2) / this->zDimSampling );
138 
139  //================================================ Check for bounds
140  if ( xFromInd < 0 ) { xFromInd = 0; }
141  if ( yFromInd < 0 ) { yFromInd = 0; }
142  if ( zFromInd < 0 ) { zFromInd = 0; }
143  if ( xToInd > static_cast<proshade_signed> ( xDimMax ) ) { xToInd = static_cast<proshade_signed> ( xDimMax ); }
144  if ( yToInd > static_cast<proshade_signed> ( yDimMax ) ) { yToInd = static_cast<proshade_signed> ( yDimMax ); }
145  if ( zToInd > static_cast<proshade_signed> ( zDimMax ) ) { zToInd = static_cast<proshade_signed> ( zDimMax ); }
146 
147  //================================================ Get dim sizes
148  proshade_unsign xDimSZ = static_cast< proshade_unsign > ( xToInd - xFromInd );
149  proshade_unsign yDimSZ = static_cast< proshade_unsign > ( yToInd - yFromInd );
150  proshade_unsign zDimSZ = static_cast< proshade_unsign > ( zToInd - zFromInd );
151 
152  //================================================ check for too sparse sampling
153  if ( ( xDimSZ == 0 ) && ( yDimSZ == 0 ) && ( zDimSZ == 0 ) ) { xDimSZ = 1; yDimSZ = 1; zDimSZ = 1; }
154 
155  //================================================ Find max and mid dims
156  std::vector<proshade_unsign> dimSizes;
157  ProSHADE_internal_misc::addToUnsignVector ( &dimSizes, xDimSZ );
158  ProSHADE_internal_misc::addToUnsignVector ( &dimSizes, yDimSZ );
159  ProSHADE_internal_misc::addToUnsignVector ( &dimSizes, zDimSZ );
160  std::sort ( dimSizes.begin(), dimSizes.end() );
161  proshade_unsign maxDim = dimSizes.at(2);
162  proshade_unsign midDim = dimSizes.at(1);
163 
164  //================================================ Return max circumference
165  return ( maxDim + midDim );
166 }

◆ getRotatedMappedData()

proshade_double ProSHADE_internal_spheres::ProSHADE_sphere::getRotatedMappedData ( proshade_unsign  pos)

This function gets the rotated mapped data value for a particular position.

Parameters
[in]posThe array position from which the value should be retrieved.

Definition at line 631 of file ProSHADE_spheres.cpp.

632 {
633  //================================================ Done
634  return ( this->mappedDataRot[pos] );
635 
636 }

◆ getShellRadius()

proshade_double ProSHADE_internal_spheres::ProSHADE_sphere::getShellRadius ( void  )

This function returns the radius of the shell in question.

This is a simple accessor function so that the sphere radius can be accessed when need be.

Parameters
[out]sphereRadiusThe distance of the shell to the centre of the coordinates.

Definition at line 591 of file ProSHADE_spheres.cpp.

592 {
593  //================================================ Done
594  return ( this->sphereRadius );
595 
596 }

◆ getXYZTopBottoms()

void ProSHADE_internal_spheres::ProSHADE_sphere::getXYZTopBottoms ( proshade_unsign  xDimMax,
proshade_unsign  yDimMax,
proshade_unsign  zDimMax,
proshade_double  x,
proshade_double  y,
proshade_double  z,
proshade_signed *  xBottom,
proshade_signed *  yBottom,
proshade_signed *  zBottom,
proshade_signed *  xTop,
proshade_signed *  yTop,
proshade_signed *  zTop 
)
protected

This function fills in the interpolation vector for a single map point.

This function takes the XYZ position of a point and finds the top and bottom map points which surround the XYZ position.

Parameters
[in]xDimMaxThe internal map maximum index in the x dimension.
[in]yDimMaxThe internal map maximum index in the y dimension.
[in]zDimMaxThe internal map maximum index in the z dimension.
[in]xThe x position of the point for which the surrounding indices are to be found.
[in]yThe y position of the point for which the surrounding indices are to be found.
[in]zThe z position of the point for which the surrounding indices are to be found.
[in]xBottomA pointer to the variable which should now hold the x position of the lower surrounding point.
[in]yBottomA pointer to the variable which should now hold the y position of the lower surrounding point.
[in]zBottomA pointer to the variable which should now hold the z position of the lower surrounding point.
[in]xTopA pointer to the variable which should now hold the x position of the upper surrounding point.
[in]yTopA pointer to the variable which should now hold the y position of the upper surrounding point.
[in]zTopA pointer to the variable which should now hold the z position of the upper surrounding point.

Definition at line 368 of file ProSHADE_spheres.cpp.

369 {
370  //================================================ Get the values
371  *xBottom = static_cast< proshade_signed > ( std::floor ( ( x / static_cast< proshade_double > ( this->xDimSampling ) ) ) + ( static_cast< proshade_double > ( xDimMax ) / 2.0 ) );
372  *yBottom = static_cast< proshade_signed > ( std::floor ( ( y / static_cast< proshade_double > ( this->yDimSampling ) ) ) + ( static_cast< proshade_double > ( yDimMax ) / 2.0 ) );
373  *zBottom = static_cast< proshade_signed > ( std::floor ( ( z / static_cast< proshade_double > ( this->zDimSampling ) ) ) + ( static_cast< proshade_double > ( zDimMax ) / 2.0 ) );
374 
375  *xTop = *xBottom + 1;
376  *yTop = *yBottom + 1;
377  *zTop = *zBottom + 1;
378 
379  //================================================ Done
380  return ;
381 
382 }

◆ interpolateAlongFirst()

void ProSHADE_internal_spheres::ProSHADE_sphere::interpolateAlongFirst ( std::vector< proshade_double >  c000,
std::vector< proshade_double >  c001,
std::vector< proshade_double >  c010,
std::vector< proshade_double >  c011,
std::vector< proshade_double >  c100,
std::vector< proshade_double >  c101,
std::vector< proshade_double >  c110,
std::vector< proshade_double >  c111,
std::vector< proshade_double > *  c00,
std::vector< proshade_double > *  c01,
std::vector< proshade_double > *  c10,
std::vector< proshade_double > *  c11,
proshade_double  xd 
)
protected

This function interpolates along the first (X) dimension.

This function takes the 8 interpolation vectors for the neighbouring map points and proceeds to interpolate out the X axis from all of them, thus resulting in 4 new interpolation vectors which contain the Y and Z dimension values. This is the first step of the tri-linear interpolation procedure.

Parameters
[in]c000The interpolation vector for map point less less less (than the point of interest).
[in]c001The interpolation vector for map point less less more (than the point of interest).
[in]c010The interpolation vector for map point less more less (than the point of interest).
[in]c011The interpolation vector for map point less more more (than the point of interest).
[in]c100The interpolation vector for map point more less less (than the point of interest).
[in]c101The interpolation vector for map point more less more (than the point of interest).
[in]c110The interpolation vector for map point more more less (than the point of interest).
[in]c111The interpolation vector for map point more more more (than the point of interest).
[in]c00Pointer to the variable where the less less second interporetation vector will be saved.
[in]c01Pointer to the variable where the less more second interporetation vector will be saved.
[in]c10Pointer to the variable where the more less second interporetation vector will be saved.
[in]c11Pointer to the variable where the more more second interporetation vector will be saved.
[in]xdThe relative distance of the point of interest to the lower map point along the x axis.

Definition at line 443 of file ProSHADE_spheres.cpp.

444 {
445  //================================================ Interpolate for the less less point
446  c00->at(0) = ( static_cast< proshade_double > ( this->xDimSampling ) * xd ) + c000.at(0);
447  c00->at(1) = c000.at(1);
448  c00->at(2) = c000.at(2);
449  c00->at(3) = ( c000.at(3) * ( 1.0 - xd ) ) + ( c100.at(3) * xd );
450 
451  //================================================ Interpolate for the less more point
452  c01->at(0) = ( static_cast< proshade_double > ( this->xDimSampling ) * xd ) + c001.at(0);
453  c01->at(1) = c001.at(1);
454  c01->at(2) = c001.at(2);
455  c01->at(3) = ( c001.at(3) * ( 1.0 - xd ) ) + ( c101.at(3) * xd );
456 
457  //================================================ Interpolate for the more less point
458  c10->at(0) = ( static_cast< proshade_double > ( this->xDimSampling ) * xd ) + c010.at(0);
459  c10->at(1) = c010.at(1);
460  c10->at(2) = c010.at(2);
461  c10->at(3) = ( c010.at(3) * ( 1.0 - xd ) ) + ( c110.at(3) * xd );
462 
463  //================================================ Interpolate for the more more point
464  c11->at(0) = ( static_cast< proshade_double > ( this->xDimSampling ) * xd ) + c011.at(0);
465  c11->at(1) = c011.at(1);
466  c11->at(2) = c011.at(2);
467  c11->at(3) = ( c011.at(3) * ( 1.0 - xd ) ) + ( c111.at(3) * xd );
468 
469  //================================================ Done
470  return ;
471 
472 }

◆ interpolateAlongSecond()

void ProSHADE_internal_spheres::ProSHADE_sphere::interpolateAlongSecond ( std::vector< proshade_double >  c00,
std::vector< proshade_double >  c01,
std::vector< proshade_double >  c10,
std::vector< proshade_double >  c11,
std::vector< proshade_double > *  c0,
std::vector< proshade_double > *  c1,
proshade_double  yd 
)
protected

This function interpolates along the second (Y) dimension.

This function takes the 4 interpolation vectors for the neighbouring map points with the X axis already interpolate (that is, as outputted from the interpolateAlongFirst() function) and proceeds to interpolate out the Y axis from all of them, thus resulting in 2 new interpolation vectors which contain the Z dimension values only. This is the second step of the tri-linear interpolation procedure.

Parameters
[in]c00The interpolation vector for map point less less (than the point of interest) as returned from interpolateAlongFirst().
[in]c01The interpolation vector for map point less more (than the point of interest) as returned from interpolateAlongFirst().
[in]c10The interpolation vector for map point more less (than the point of interest) as returned from interpolateAlongFirst().
[in]c11The interpolation vector for map point more more (than the point of interest) as returned from interpolateAlongFirst().
[in]c0Pointer to the variable where the less third interporetation vector will be saved.
[in]c1Pointer to the variable where the more third interporetation vector will be saved.
[in]ydThe relative distance of the point of interest to the lower map point along the y axis.

Definition at line 489 of file ProSHADE_spheres.cpp.

490 {
491  //================================================ Interpolate for the less point
492  c0->at(0) = c00.at(0);
493  c0->at(1) = ( static_cast< proshade_double > ( this->yDimSampling ) * yd ) + c00.at(1);
494  c0->at(2) = c00.at(2);
495  c0->at(3) = ( c00.at(3) * ( 1.0 - yd ) ) + ( c10.at(3) * yd );
496 
497  //================================================ Interpolate for the more point
498  c1->at(0) = c01.at(0);
499  c1->at(1) = ( static_cast< proshade_double > ( this->yDimSampling ) * yd ) + c01.at(1);
500  c1->at(2) = c01.at(2);
501  c1->at(3) = ( c01.at(3) * ( 1.0 - yd ) ) + ( c11.at(3) * yd );
502 
503  //================================================ Done
504  return ;
505 
506 }

◆ mapData()

void ProSHADE_internal_spheres::ProSHADE_sphere::mapData ( proshade_double *  map,
proshade_unsign  xDimMax,
proshade_unsign  yDimMax,
proshade_unsign  zDimMax 
)
protected

This function maps the internal map to the specific sphere.

This function deals with the map values mapping onto a sphere in abstract terms, or in programatical terms it simply interpolates the appropriate map data onto a spherical grid a given by the sphere object calling it. It uses the tri-linear interpolation in the order XYZ and saves all results internally.

Parameters
[in]mapThe density map pointer - the map which should be mapped to the data.
[in]xDimMaxThe internal map maximum index in the x dimension.
[in]yDimMaxThe internal map maximum index in the y dimension.
[in]zDimMaxThe internal map maximum index in the z dimension.

Definition at line 179 of file ProSHADE_spheres.cpp.

180 {
181  //================================================ Initialise local variavles
182  proshade_double x, y, z, xRelative, yRelative, zRelative;
183  proshade_signed xBottom, yBottom, zBottom, xTop, yTop, zTop;
184  std::vector<proshade_double> lonCO ( this->localAngRes + 1 );
185  std::vector<proshade_double> latCO ( this->localAngRes + 1 );
186  std::vector<proshade_double> c000 = std::vector<proshade_double> ( 4 );
187  std::vector<proshade_double> c001 = std::vector<proshade_double> ( 4 );
188  std::vector<proshade_double> c010 = std::vector<proshade_double> ( 4 );
189  std::vector<proshade_double> c011 = std::vector<proshade_double> ( 4 );
190  std::vector<proshade_double> c100 = std::vector<proshade_double> ( 4 );
191  std::vector<proshade_double> c101 = std::vector<proshade_double> ( 4 );
192  std::vector<proshade_double> c110 = std::vector<proshade_double> ( 4 );
193  std::vector<proshade_double> c111 = std::vector<proshade_double> ( 4 );
194  std::vector<proshade_double> c00 = std::vector<proshade_double> ( 4 );
195  std::vector<proshade_double> c01 = std::vector<proshade_double> ( 4 );
196  std::vector<proshade_double> c10 = std::vector<proshade_double> ( 4 );
197  std::vector<proshade_double> c11 = std::vector<proshade_double> ( 4 );
198  std::vector<proshade_double> c0 = std::vector<proshade_double> ( 4 );
199  std::vector<proshade_double> c1 = std::vector<proshade_double> ( 4 );
200 
201  //================================================ Find pixelisation cutOffs
202  this->getLongitudeCutoffs ( &lonCO );
203  this->getLattitudeCutoffs ( &latCO );
204 
205  //================================================ Interpolate the map onto this shell
206  for ( unsigned int thIt = 0; thIt < this->localAngRes; thIt++ )
207  {
208  for ( unsigned int phIt = 0; phIt < this->localAngRes; phIt++ )
209  {
210  //======================================== Get grid point x, y and z
211  this->getInterpolationXYZ ( &x, &y, &z, thIt, &lonCO, phIt, &latCO );
212 
213  //======================================== Find 8 closest point around the grid point in indices
214  this->getXYZTopBottoms ( xDimMax, yDimMax, zDimMax, x, y, z, &xBottom, &yBottom, &zBottom, &xTop, &yTop, &zTop );
215 
216  //======================================== Get the 8 closest points interpolation vectors (or set to 0 if out-of-bounds)
217  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yBottom, zBottom, &c000 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
218  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yBottom, zTop , &c001 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
219  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yTop , zBottom, &c010 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
220  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yTop , zTop , &c011 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
221  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yBottom, zBottom, &c100 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
222  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yBottom, zTop , &c101 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
223  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yTop , zBottom, &c110 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
224  if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yTop , zTop , &c111 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0; continue; }
225 
226  //======================================== Interpolate along X axis
227  xRelative = ( x - ( static_cast< proshade_double > ( xBottom - static_cast<proshade_signed> ( ( ( xDimMax ) / 2 ) ) ) * static_cast< proshade_double > ( this->xDimSampling ) ) ) / static_cast< proshade_double > ( this->xDimSampling );
228  this->interpolateAlongFirst ( c000, c001, c010, c011, c100, c101, c110, c111, &c00, &c01, &c10, &c11, xRelative );
229 
230  //======================================== Interpolate along Y axis
231  yRelative = ( y - ( static_cast< proshade_double > ( yBottom - static_cast<proshade_signed> ( ( ( yDimMax ) / 2 ) ) ) * static_cast< proshade_double > ( this->yDimSampling ) ) ) / static_cast< proshade_double > ( this->yDimSampling );
232  this->interpolateAlongSecond ( c00, c01, c10, c11, &c0, &c1, yRelative );
233 
234  //======================================== Save the resulting value
235  zRelative = ( z - ( static_cast< proshade_double > ( zBottom - static_cast<proshade_signed> ( ( ( zDimMax ) / 2 ) ) ) * static_cast< proshade_double > ( this->zDimSampling ) ) ) / static_cast< proshade_double > ( this->zDimSampling );
236  this->mappedData[phIt * this->localAngRes + thIt] = ( c0.at(3) * ( 1.0 - zRelative ) ) + ( c1.at(3) * zRelative );
237  }
238  }
239 
240  //================================================ Done
241  return ;
242 
243 }

◆ setRotatedMappedData()

void ProSHADE_internal_spheres::ProSHADE_sphere::setRotatedMappedData ( proshade_unsign  pos,
proshade_double  value 
)

This function sets the rotated mapped data value to the given position.

Parameters
[in]posThe array position to which the value will be set to.
[in]valueThe value which should be set to the given position.

Definition at line 617 of file ProSHADE_spheres.cpp.

618 {
619  //================================================ Set the value to the position
620  this->mappedDataRot[pos] = value;
621 
622  //================================================ Done
623  return ;
624 
625 }

The documentation for this class was generated from the following files:
ProSHADE_internal_spheres::ProSHADE_sphere::getInterpolationXYZ
void getInterpolationXYZ(proshade_double *x, proshade_double *y, proshade_double *z, proshade_double thetaIt, std::vector< proshade_double > *lonCO, proshade_unsign phiIt, std::vector< proshade_double > *latCO)
This function finds the x, y and z positions of supplied shell point.
Definition: ProSHADE_spheres.cpp:337
ProSHADE_internal_spheres::ProSHADE_sphere::interpolateAlongFirst
void interpolateAlongFirst(std::vector< proshade_double > c000, std::vector< proshade_double > c001, std::vector< proshade_double > c010, std::vector< proshade_double > c011, std::vector< proshade_double > c100, std::vector< proshade_double > c101, std::vector< proshade_double > c110, std::vector< proshade_double > c111, std::vector< proshade_double > *c00, std::vector< proshade_double > *c01, std::vector< proshade_double > *c10, std::vector< proshade_double > *c11, proshade_double xd)
This function interpolates along the first (X) dimension.
Definition: ProSHADE_spheres.cpp:443
ProSHADE_internal_spheres::ProSHADE_sphere::getMapPoint
bool getMapPoint(proshade_double *map, proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_signed xPos, proshade_signed yPos, proshade_signed zPos, std::vector< proshade_double > *interpVec)
This function fills in the interpolation vector for a single map point.
Definition: ProSHADE_spheres.cpp:261
ProSHADE_internal_spheres::ProSHADE_sphere::getXYZTopBottoms
void getXYZTopBottoms(proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_double x, proshade_double y, proshade_double z, proshade_signed *xBottom, proshade_signed *yBottom, proshade_signed *zBottom, proshade_signed *xTop, proshade_signed *yTop, proshade_signed *zTop)
This function fills in the interpolation vector for a single map point.
Definition: ProSHADE_spheres.cpp:368
ProSHADE_internal_spheres::ProSHADE_sphere::getMaxCircumference
proshade_unsign getMaxCircumference(proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_single maxRange)
This function determines the maximum circumference of a shell.
Definition: ProSHADE_spheres.cpp:122
ProSHADE_internal_misc::checkMemoryAllocation
void checkMemoryAllocation(chVar checkVar, std::string fileP, unsigned int lineP, std::string funcP, std::string infoP="This error may occurs when ProSHADE requests memory to be\n : allocated to it and this operation fails. This could\n : happen when not enough memory is available, either due to\n : other processes using a lot of memory, or when the machine\n : does not have sufficient memory available. Re-run to see\n : if this problem persists.")
Checks if memory was allocated properly.
Definition: ProSHADE_misc.hpp:73
ProSHADE_internal_spheres::autoDetermineBandwidth
proshade_unsign autoDetermineBandwidth(proshade_unsign circumference)
This function determines the bandwidth for the spherical harmonics computation.
Definition: ProSHADE_spheres.cpp:516
ProSHADE_internal_misc::addToUnsignVector
void addToUnsignVector(std::vector< proshade_unsign > *vecToAddTo, proshade_unsign elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:99
ProSHADE_internal_spheres::ProSHADE_sphere::getLongitudeCutoffs
void getLongitudeCutoffs(std::vector< proshade_double > *lonCO)
This function fills in the vector of longitudal bin boarder values.
Definition: ProSHADE_spheres.cpp:288
ProSHADE_internal_spheres::ProSHADE_sphere::mapData
void mapData(proshade_double *map, proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax)
This function maps the internal map to the specific sphere.
Definition: ProSHADE_spheres.cpp:179
ProSHADE_internal_spheres::ProSHADE_sphere::interpolateAlongSecond
void interpolateAlongSecond(std::vector< proshade_double > c00, std::vector< proshade_double > c01, std::vector< proshade_double > c10, std::vector< proshade_double > c11, std::vector< proshade_double > *c0, std::vector< proshade_double > *c1, proshade_double yd)
This function interpolates along the second (Y) dimension.
Definition: ProSHADE_spheres.cpp:489
ProSHADE_internal_spheres::ProSHADE_sphere::getLattitudeCutoffs
void getLattitudeCutoffs(std::vector< proshade_double > *latCO)
This function fills in the vector of lattitudal bin boarder values.
Definition: ProSHADE_spheres.cpp:309