ProSHADE: ProSHADE_internal_spheres::ProSHADE_sphere Class Reference

| ProSHADE 0.7.5.1 (JAN 2021) Protein Shape Detection

Public Member Functions | Protected Member Functions | List of all members
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)
| 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_double maxRange, proshade_single xSize, proshade_single ySize, proshade_single zSize)
| 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
| ) |  |

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] | xDimMax | The internal map maximum index in the x dimension.
  [in] | yDimMax | The internal map maximum index in the y dimension.
  [in] | zDimMax | The internal map maximum index in the z dimension.
  [in] | xSize | The integral map size in angstroms along the x-axis.
  [in] | ySize | The integral map size in angstroms along the y-axis.
  [in] | zSize | The integral map size in angstroms along the z-axis.
  [in] | shOrder | The order of the shell in the shell vector - 0 is the smallest shell.
  [in] | spherePos | A Pointer to vector of proshade_single's with the shell positions.
  [in] | progressiveMapping | Should the bandwidth and angular resolution be set by the actual number of points, or just same for all shells?
  [in] | band | The bandwidth to be set for conservative mapping.
  [in] | map | A pointer to the internal map which should be mapped to the sphere.
  [in] | maxShellBand | This pointer reference will take the shell band, if it is higher than the already known one.
  [out] | X | Data object with all values set and the appropriate map part mapped.

Definition at line 46 of file ProSHADE_spheres.cpp.

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

## ◆ ~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] | X | N/A.

Definition at line 102 of file ProSHADE_spheres.cpp.

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

## 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] | x | A pointer to variable where the x position is to be saved.
  [in] | y | A pointer to variable where the y position is to be saved.
  [in] | z | A pointer to variable where the z position is to be saved.
  [in] | thetaIt | The longitude cut-off index of the grid point of which the XYZ are to be computed.
  [in] | lonCO | A pointer for vector of proshade_double's where the longitude cutt-off values are saved
  [in] | phiIt | The lattitude cut-off index of the grid point of which the XYZ are to be computed.
  [in] | lonCO | A pointer for vector of proshade_double's where the lattitude cutt-off values are saved

Definition at line 339 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | latCO | A 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 311 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | localAngRes | The value of the local angular resolution for this particular shell.

Definition at line 406 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | localBandwidth | The value of the local bandwidth for this particular shell.

Definition at line 393 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | lonCO | A 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 290 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | mappedData | proshade_double pointer to an array of mapped data.

Definition at line 419 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | map | The density map pointer - the map which should be mapped to the data.
  [in] | xDimMax | The internal map maximum index in the x dimension.
  [in] | yDimMax | The internal map maximum index in the y dimension.
  [in] | zDimMax | The internal map maximum index in the z dimension.
  [in] | xPos | The x axis index position of the point of which interpolation vector is to be obtained.
  [in] | yPos | The y axis index position of the point of which interpolation vector is to be obtained.
  [in] | zPos | The z axis index position of the point of which interpolation vector is to be obtained.
  [in] | interpVec | The variable to which the interpolation values are to be saved (vector of proshade_double's initialised to length 4).

Definition at line 263 of file ProSHADE_spheres.cpp.

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

## ◆ getMaxCircumference()

proshade_unsign ProSHADE_internal_spheres::ProSHADE_sphere::getMaxCircumference | ( | proshade_unsign | xDimMax,
|  | proshade_unsign | yDimMax,
|  | proshade_unsign | zDimMax,
|  | proshade_double | maxRange,
|  | proshade_single | xSize,
|  | proshade_single | ySize,
|  | proshade_single | zSize
| ) |  |
| 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] | xDimMax | The internal map maximum index in the x dimension.
  [in] | yDimMax | The internal map maximum index in the y dimension.
  [in] | zDimMax | The internal map maximum index in the z dimension.
  [in] | maxRange | The maximum range of shell in angstroms.
  [in] | xSize | The size of x axis of whole map in angstroms.
  [in] | ySize | The size of y axis of whole map in angstroms.
  [in] | zSize | The size of z axis of whole map in angstroms.

Definition at line 124 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | pos | The array position from which the value should be retrieved.

Definition at line 630 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | sphereRadius | The distance of the shell to the centre of the coordinates.

Definition at line 590 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | xDimMax | The internal map maximum index in the x dimension.
  [in] | yDimMax | The internal map maximum index in the y dimension.
  [in] | zDimMax | The internal map maximum index in the z dimension.
  [in] | x | The x position of the point for which the surrounding indices are to be found.
  [in] | y | The y position of the point for which the surrounding indices are to be found.
  [in] | z | The z position of the point for which the surrounding indices are to be found.
  [in] | xBottom | A pointer to the variable which should now hold the x position of the lower surrounding point.
  [in] | yBottom | A pointer to the variable which should now hold the y position of the lower surrounding point.
  [in] | zBottom | A pointer to the variable which should now hold the z position of the lower surrounding point.
  [in] | xTop | A pointer to the variable which should now hold the x position of the upper surrounding point.
  [in] | yTop | A pointer to the variable which should now hold the y position of the upper surrounding point.
  [in] | zTop | A pointer to the variable which should now hold the z position of the upper surrounding point.

Definition at line 370 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | c000 | The interpolation vector for map point less less less (than the point of interest).
  [in] | c001 | The interpolation vector for map point less less more (than the point of interest).
  [in] | c010 | The interpolation vector for map point less more less (than the point of interest).
  [in] | c011 | The interpolation vector for map point less more more (than the point of interest).
  [in] | c100 | The interpolation vector for map point more less less (than the point of interest).
  [in] | c101 | The interpolation vector for map point more less more (than the point of interest).
  [in] | c110 | The interpolation vector for map point more more less (than the point of interest).
  [in] | c111 | The interpolation vector for map point more more more (than the point of interest).
  [in] | c00 | Pointer to the variable where the less less second interporetation vector will be saved.
  [in] | c01 | Pointer to the variable where the less more second interporetation vector will be saved.
  [in] | c10 | Pointer to the variable where the more less second interporetation vector will be saved.
  [in] | c11 | Pointer to the variable where the more more second interporetation vector will be saved.
  [in] | xd | The relative distance of the point of interest to the lower map point along the x axis.

Definition at line 445 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | c00 | The interpolation vector for map point less less (than the point of interest) as returned from interpolateAlongFirst().
  [in] | c01 | The interpolation vector for map point less more (than the point of interest) as returned from interpolateAlongFirst().
  [in] | c10 | The interpolation vector for map point more less (than the point of interest) as returned from interpolateAlongFirst().
  [in] | c11 | The interpolation vector for map point more more (than the point of interest) as returned from interpolateAlongFirst().
  [in] | c0 | Pointer to the variable where the less third interporetation vector will be saved.
  [in] | c1 | Pointer to the variable where the more third interporetation vector will be saved.
  [in] | yd | The relative distance of the point of interest to the lower map point along the y axis.

Definition at line 491 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | map | The density map pointer - the map which should be mapped to the data.
  [in] | xDimMax | The internal map maximum index in the x dimension.
  [in] | yDimMax | The internal map maximum index in the y dimension.
  [in] | zDimMax | The internal map maximum index in the z dimension.

Definition at line 181 of file ProSHADE_spheres.cpp.

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

## ◆ 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] | pos | The array position to which the value will be set to.
  [in] | value | The value which should be set to the given position.

Definition at line 616 of file ProSHADE_spheres.cpp.

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

The documentation for this class was generated from the following files:

- src/proshade/ProSHADE_spheres.hpp
- src/proshade/ProSHADE_spheres.cpp

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:339
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:445
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:263
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:370
ProSHADE_internal_spheres::ProSHADE_sphere::getMaxCircumference
proshade_unsign getMaxCircumference(proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_double maxRange, proshade_single xSize, proshade_single ySize, proshade_single zSize)
This function determines the maximum circumference of a shell.
Definition: ProSHADE_spheres.cpp:124
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:65
ProSHADE_internal_spheres::autoDetermineBandwidth
proshade_unsign autoDetermineBandwidth(proshade_unsign circumference)
This function determines the bandwidth for the spherical harmonics computation.
Definition: ProSHADE_spheres.cpp:518
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:290
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:181
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:491
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:311