ProSHADE: ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup Class Reference

| ProSHADE 0.7.5.4 (MAR 2021) Protein Shape Detection

Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup Class Reference

This class contains peak groups detected in the rotation function mapped spheres. More...

`#include <ProSHADE_spheres.hpp>`

## Public Member Functions
| ProSHADE_rotFun_spherePeakGroup (proshade_double lat, proshade_double lon, proshade_unsign sphPos, proshade_unsign angDim)
| Constructor for getting empty ProSHADE_rotFun_spherePeakGroup class. More...
| ~ProSHADE_rotFun_spherePeakGroup (void)
| Destructor for the ProSHADE_rotFun_spherePeakGroup class. More...
bool | checkIfPeakBelongs (proshade_double lat, proshade_double lon, proshade_unsign sphPos, proshade_double cosTol, proshade_signed verbose)
| This function takes a new prospective peak and tests if it belongs to this peak group or not. More...
void | findCyclicPointGroupsGivenFold (std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > sphereVals, proshade_double axisTolerance, std::vector< proshade_double * > *detectedCs, bool bicubicInterp, proshade_unsign fold, proshade_unsign verbose)
| Function detecting cyclic point groups with a particular fold in a peak group. More...
proshade_double | getLatFromIndices (void)
| Accessor function for the private variable latFromInds. More...
proshade_double | getLatToIndices (void)
| Accessor function for the private variable latToInds. More...
proshade_double | getLonFromIndices (void)
| Accessor function for the private variable lonFromInds. More...
proshade_double | getLonToIndices (void)
| Accessor function for the private variable lonToInds. More...
std::vector< proshade_unsign > | getSpherePositions (void)
| Accessor function for the private variable spherePositions. More...

## Public Attributes
proshade_double | latSampling
proshade_double | lonSampling
proshade_unsign | dimension
proshade_double | latFrom
proshade_double | latTo
proshade_double | lonFrom
proshade_double | lonTo
proshade_double | latFromInds
proshade_double | latToInds
proshade_double | lonFromInds
proshade_double | lonToInds
std::vector< proshade_unsign > | spherePositions
proshade_double * | latMinLonMinXYZ
proshade_double * | latMaxLonMinXYZ
proshade_double * | latMinLonMaxXYZ
proshade_double * | latMaxLonMaxXYZ

## Protected Member Functions
void | computeCornerPositions (void)
| This function computes the group corner vectors, saving results into internal variables.
proshade_signed | angularDistanceWithBorders (proshade_signed origLat, proshade_signed testedLat)
| This function takes two lattitude or longitude positions and finds the smallest distance between them considering the border periodicity. More...
void | getAllAngleDifferences (std::vector< proshade_double > *angDiffs, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > sphereVals)
| This function takes all angles present in this peak group and finds the set of unique angle differeces. More...
void | getAllPossibleFolds (std::vector< proshade_double > *angDiffs, std::vector< proshade_unsign > *foldsToTry, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > sphereVals)
| This function angle differences and creates a list of folds that may be present in the group. More...
void | getSpheresFormingFold (proshade_unsign foldToTry, std::vector< proshade_unsign > *spheresFormingFold, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > sphereVals, proshade_double sphereAngleTolerance)
| This function simply finds the indices of the spheres which form the requested form. More...
void | getBestIndexForFold (proshade_double *bestPosVal, proshade_double *bestLatInd, proshade_double *bestLonInd, std::vector< proshade_unsign > *spheresFormingFold, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > sphereVals)
| Function which does simple search through all peak groups indices and saves the index with the highest peak height sum over all spheres. More...

## Detailed Description

This class contains peak groups detected in the rotation function mapped spheres.

This class codes the object that contains all the information about a single group of peaks found in the set of ProSHADE_rotFun_sphere objects with mapped rotation function values.

Definition at line 129 of file ProSHADE_spheres.hpp.

## Constructor & Destructor Documentation

## ◆ ProSHADE_rotFun_spherePeakGroup()

ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::ProSHADE_rotFun_spherePeakGroup | ( | proshade_double | lat,
|  | proshade_double | lon,
|  | proshade_unsign | sphPos,
|  | proshade_unsign | angDim
| ) |  |

Constructor for getting empty ProSHADE_rotFun_spherePeakGroup class.

This function simply creates an object of the ProSHADE_rotFun_spherePeakGroup class and fills in the initial data.

Parameters

  [in] | lat | The lattitude value of the first peak of the group.
  [in] | lon | The longitude value of the first peak of the group.
  [in] | sphPos | The sphere number of the peak.
  [in] | angDim | The dimensionality of the sphere grid that we are processing.
  [out] | X | Data object with all values set and ready to add new data or search for point groups in the supplied peaks.

Definition at line 1029 of file ProSHADE_spheres.cpp.

1030 {
1031 //================================================ Compute the run-specific values
1032 this->dimension = angDim;
1033 this->lonSampling = ( M_PI ) / static_cast<proshade_double> ( this->dimension );
1034 this->latSampling = ( M_PI * 2.0 ) / static_cast<proshade_double> ( this->dimension );
1035
1036 //================================================ The constructor is called when firstt peak of the group is found. Save the values of this initial peak.
1037 this->latFrom = static_cast<proshade_double> ( lat ) * this->latSampling;
1038 this->latTo = static_cast<proshade_double> ( lat ) * this->latSampling;
1039 this->lonFrom = static_cast<proshade_double> ( lon ) * this->lonSampling;
1040 this->lonTo = static_cast<proshade_double> ( lon ) * this->lonSampling;
1041 this->latFromInds = lat;
1042 this->latToInds = lat;
1043 this->lonFromInds = lon;
1044 this->lonToInds = lon;
1045 ProSHADE_internal_misc::addToUnsignVector ( &this->spherePositions, sphPos );
1046
1047 //================================================ Allocate memory for similarity positions
1048 this->latMinLonMinXYZ = new proshade_double[3];
1049 this->latMaxLonMinXYZ = new proshade_double[3];
1050 this->latMinLonMaxXYZ = new proshade_double[3];
1051 this->latMaxLonMaxXYZ = new proshade_double[3];
1052 ProSHADE_internal_misc::checkMemoryAllocation ( this->latMinLonMinXYZ, __FILE__, __LINE__, __func__ );
1053 ProSHADE_internal_misc::checkMemoryAllocation ( this->latMaxLonMinXYZ, __FILE__, __LINE__, __func__ );
1054 ProSHADE_internal_misc::checkMemoryAllocation ( this->latMinLonMaxXYZ, __FILE__, __LINE__, __func__ );
1055 ProSHADE_internal_misc::checkMemoryAllocation ( this->latMaxLonMaxXYZ, __FILE__, __LINE__, __func__ );
1056
1057 //================================================ Compute corner vectors
1058 this->computeCornerPositions ( );
1059
1060 //================================================ Done
1061
1062 }

## ◆ ~ProSHADE_rotFun_spherePeakGroup()

ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::~ProSHADE_rotFun_spherePeakGroup | ( | void |  | ) |

Destructor for the ProSHADE_rotFun_spherePeakGroup class.

This function releases all memory allocated by the ProSHADE_rotFun_spherePeakGroup object.

Definition at line 1068 of file ProSHADE_spheres.cpp.

1069 {
1070 //================================================ Release the XYZ arrays
1071 delete[] this->latMinLonMinXYZ;
1072 delete[] this->latMaxLonMinXYZ;
1073 delete[] this->latMinLonMaxXYZ;
1074 delete[] this->latMaxLonMaxXYZ;
1075 }

## Member Function Documentation

## ◆ angularDistanceWithBorders()

proshade_signed ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::angularDistanceWithBorders | ( | proshade_signed | newAngul,
|  | proshade_signed | currentAngul
| ) |  |
| protected

This function takes two lattitude or longitude positions and finds the smallest distance between them considering the border periodicity.

Parameters

  [in] | newAngul | The first lattitude or longitude value.
  [in] | currentAngul | The second lattitude or longitude value.
  [out] | ret | The smallest distance between the first and the second lattitude or longitude values.

Definition at line 1109 of file ProSHADE_spheres.cpp.

1110 {
1111 //================================================ Initialise variables
1112 proshade_signed smallerAngul = newAngul - this->dimension;
1113 proshade_signed largerAngul = newAngul + this->dimension;
1114
1115 //================================================ Find the smallest distance
1116 proshade_signed ret = std::min ( std::abs ( currentAngul - newAngul ), std::min ( std::abs ( currentAngul - smallerAngul ), std::abs ( currentAngul - largerAngul ) ) );
1117
1118 //================================================ Done
1119 return ( ret );
1120
1121 }

## ◆ checkIfPeakBelongs()

bool ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::checkIfPeakBelongs | ( | proshade_double | lat,
|  | proshade_double | lon,
|  | proshade_unsign | sphPos,
|  | proshade_double | cosTol,
|  | proshade_signed | verbose
| ) |  |

This function takes a new prospective peak and tests if it belongs to this peak group or not.

This function takes a new peak position in terms of lattitude and longitude and proceeds to convert these to XYZ position. It then checks this XYZ position against this group's "corners" (i.e. the group's lattitude and longitude minimum and maximum borders). If the tested position belongs to the group (i.e. it has small cosine distance to one of the corners), then it is added and the group corners are updated. Otherwise, false is returned and nothing changes in the group.

Parameters

  [in] | lat | The lattitude value of the first peak of the group.
  [in] | lon | The longitude value of the first peak of the group.
  [in] | sphPos | The sphere number of the peak.
  [in] | cosTol | The tolerance for cosine distance similarity to consider the two vectors similar.
  [in] | verbose | How verbose should the run be? Use -1 if you do not want any standard output output.
  [out] | res | Boolean value signifying if the peak was added.

Definition at line 1137 of file ProSHADE_spheres.cpp.

1138 {
1139 //================================================ Initialise local variables
1140 bool peakAdded = false;
1141 std::stringstream hlpSS;
1142 std::stringstream hlpSS2;
1143
1144 //================================================ Compute peaks XYZ and its cosine distance to group corners
1145 proshade_double xPos = 1.0 * std::sin ( lon * this->lonSampling ) * std::cos ( lat * this->latSampling );
1146 proshade_double yPos = 1.0 * std::sin ( lon * this->lonSampling ) * std::sin ( lat * this->latSampling );
1147 proshade_double zPos = 1.0 * std::cos ( lon * this->lonSampling );
1148 hlpSS2 << "Peak " << xPos << " ; " << yPos << " ; " << zPos << " is close enough to group with corner ";
1149
1150 if ( ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection ( xPos, yPos, zPos, this->latMinLonMinXYZ[0], this->latMinLonMinXYZ[1], this->latMinLonMinXYZ[2], cosTol ) ) { peakAdded = true; hlpSS2 << this->latMinLonMinXYZ[0] << " ; " << this->latMinLonMinXYZ[1] << " ; " << this->latMinLonMinXYZ[2]; }
1151 if ( ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection ( xPos, yPos, zPos, this->latMaxLonMinXYZ[0], this->latMaxLonMinXYZ[1], this->latMaxLonMinXYZ[2], cosTol ) && !peakAdded ) { peakAdded = true; hlpSS2 << this->latMaxLonMinXYZ[0] << " ; " << this->latMaxLonMinXYZ[1] << " ; " << this->latMaxLonMinXYZ[2]; }
1152 if ( ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection ( xPos, yPos, zPos, this->latMinLonMaxXYZ[0], this->latMinLonMaxXYZ[1], this->latMinLonMaxXYZ[2], cosTol ) && !peakAdded ) { peakAdded = true; hlpSS2 << this->latMinLonMaxXYZ[0] << " ; " << this->latMinLonMaxXYZ[1] << " ; " << this->latMinLonMaxXYZ[2]; }
1153 if ( ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection ( xPos, yPos, zPos, this->latMaxLonMaxXYZ[0], this->latMaxLonMaxXYZ[1], this->latMaxLonMaxXYZ[2], cosTol ) && !peakAdded ) { peakAdded = true; hlpSS2 << this->latMaxLonMaxXYZ[0] << " ; " << this->latMaxLonMaxXYZ[1] << " ; " << this->latMaxLonMaxXYZ[2]; }
1154
1155 //================================================ If peak within corners, add it
1156 if ( peakAdded )
1157 {
1158 //============================================ Report progress
1159 hlpSS << "Peak group dimensions changed from LAT " << this->latFromInds << " - " << this->latToInds << " and LON " << this->lonFromInds << " - " << this->lonToInds << " to ";
1160 ProSHADE_internal_messages::printProgressMessage ( verbose, 6, hlpSS2.str() );
1161
1162 //============================================ Initialise local variables
1163 proshade_unsign largerCorner, smallerCorner;
1164 bool latCornersDone = false;
1165 bool lonCornersDone = false;
1166
1167 //============================================ Check if lattitude boundaries need to be modified
1168 if ( ( this->latFromInds <= this->latToInds ) && !( ( lat >= this->latFromInds ) && ( lat <= this->latToInds ) ) )
1169 {
1170 //======================================== Lattitude is outside of group boundaries
1171 smallerCorner = angularDistanceWithBorders ( lat, this->latFromInds );
1172 largerCorner = angularDistanceWithBorders ( lat, this->latToInds );
1173
1174 if ( smallerCorner < largerCorner )
1175 {
1176 this->latFromInds = lat;
1177 latCornersDone = true;
1178 }
1179 if ( smallerCorner > largerCorner )
1180 {
1181 this->latToInds = lat;
1182 latCornersDone = true;
1183 }
1184 if ( smallerCorner == largerCorner )
1185 {
1186 if ( lat < this->latFromInds ) { this->latFromInds = lat; latCornersDone = true; }
1187 else if ( lat > this->latToInds ) { this->latToInds = lat; latCornersDone = true; }
1188 }
1189 }
1190
1191 if ( ( this->latFromInds > this->latToInds ) && !( ( lat >= this->latFromInds ) || ( lat <= this->latToInds ) ) )
1192 {
1193 //======================================== Lattitude is outside of group boundaries
1194 smallerCorner = angularDistanceWithBorders ( lat, this->latFromInds );
1195 largerCorner = angularDistanceWithBorders ( lat, this->latToInds );
1196
1197 if ( smallerCorner < largerCorner )
1198 {
1199 this->latFromInds = lat;
1200 latCornersDone = true;
1201 }
1202 if ( smallerCorner > largerCorner )
1203 {
1204 this->latToInds = lat;
1205 latCornersDone = true;
1206 }
1207 if ( smallerCorner == largerCorner )
1208 {
1209 if ( lat < this->latFromInds ) { this->latFromInds = lat; latCornersDone = true; }
1210 else if ( lat > this->latToInds ) { this->latToInds = lat; latCornersDone = true; }
1211 }
1212 }
1213
1214
1215 //============================================ Check if longitude boundaries need to be modified
1216 if ( ( this->lonFromInds <= this->lonToInds ) && !( ( lon >= this->lonFromInds ) && ( lon <= this->lonToInds ) ) )
1217 {
1218 //======================================== Lattitude is outside of group boundaries
1219 smallerCorner = angularDistanceWithBorders ( lon, this->lonFromInds );
1220 largerCorner = angularDistanceWithBorders ( lon, this->lonToInds );
1221
1222 if ( smallerCorner < largerCorner )
1223 {
1224 this->lonFromInds = lon;
1225 lonCornersDone = true;
1226 }
1227 if ( smallerCorner > largerCorner )
1228 {
1229 this->lonToInds = lon;
1230 lonCornersDone = true;
1231 }
1232 if ( smallerCorner == largerCorner )
1233 {
1234 if ( lon < this->lonFromInds ) { this->lonFromInds = lon; lonCornersDone = true; }
1235 else if ( lon > this->lonToInds ) { this->lonToInds = lon; lonCornersDone = true; }
1236 }
1237 }
1238
1239 if ( ( this->lonFromInds > this->lonToInds ) && !( ( lon >= this->lonFromInds ) || ( lon <= this->lonToInds ) ) )
1240 {
1241 //======================================== Lattitude is outside of group boundaries
1242 smallerCorner = angularDistanceWithBorders ( lon, this->lonFromInds );
1243 largerCorner = angularDistanceWithBorders ( lon, this->lonToInds );
1244
1245 if ( smallerCorner < largerCorner )
1246 {
1247 this->lonFromInds = lon;
1248 lonCornersDone = true;
1249 }
1250 if ( smallerCorner > largerCorner )
1251 {
1252 this->lonToInds = lon;
1253 lonCornersDone = true;
1254 }
1255 if ( smallerCorner == largerCorner )
1256 {
1257 if ( lon < this->lonFromInds ) { this->lonFromInds = lon; lonCornersDone = true; }
1258 else if ( lon > this->lonToInds ) { this->lonToInds = lon; lonCornersDone = true; }
1259 }
1260 }
1261
1262 //============================================ Modify corner positions
1263 if ( latCornersDone )
1264 {
1265 this->latFrom = static_cast<proshade_double> ( this->latFromInds ) * this->latSampling;
1266 this->latTo = static_cast<proshade_double> ( this->latToInds ) * this->latSampling;
1267 }
1268
1269 if ( lonCornersDone )
1270 {
1271 this->lonFrom = static_cast<proshade_double> ( this->lonFromInds ) * this->lonSampling;
1272 this->lonTo = static_cast<proshade_double> ( this->lonToInds ) * this->lonSampling;
1273 }
1274
1275 //============================================ Compute corner vectors
1276 this->computeCornerPositions ( );
1277 hlpSS << "LAT " << this->latFromInds << " - " << this->latToInds << " and LON " << this->lonFromInds << " - " << this->lonToInds << " ( peak position LAT " << lat << " LON " << lon << " )";
1278 ProSHADE_internal_messages::printProgressMessage ( verbose, 7, hlpSS.str() );
1279
1280 //============================================ If new sphere, add it to the list
1281 bool isSphereNew = true;
1282 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->spherePositions.size() ); iter++ ) { if ( this->spherePositions.at(iter) == sphPos ) { isSphereNew = false; } }
1283 if ( isSphereNew ) { ProSHADE_internal_misc::addToUnsignVector ( &this->spherePositions, sphPos ); }
1284 }
1285
1286 //================================================ Done
1287 return ( peakAdded );
1288
1289 }

## ◆ findCyclicPointGroupsGivenFold()

void ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::findCyclicPointGroupsGivenFold | ( | std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > | sphereVals,
|  | proshade_double | axisTolerance,
|  | std::vector< proshade_double * > * | detectedCs,
|  | bool | bicubicInterp,
|  | proshade_unsign | fold,
|  | proshade_unsign | verbose
| ) |  |

Function detecting cyclic point groups with a particular fold in a peak group.

This function is a simplification of the findCyclicPointGroups function for the cases where the required fold is known. It simply assumes that all the supplied mapped spheres are to be used to find the fold, i.e. that fold-1 is equal to the length of sphereVals. With this assumption, the function can go directly for finding the peak index with highest peak height sum.

At this point, this function can also optionally do bi-cubic interpolation around this index with highest peak sum to try to improve the symmetry axis by searching between the lattitude and longitude indices. Finally, this function will create the ProSHADE formatted array of symmetry group information and save it into the supplied vector, terminating thereafter.

Warning
  This function assumes that the supplied sphereVals argument contains only the spheres relating to the required fold and no other spheres - this assumption does not hold if the convertRotationFunction() function was called - consider yourself warned.

Parameters

  [in] | sphereVals | A vector of spheres with mapped rotation function values.
  [in] | axisTolerance | The tolerance for cosine distance to consider two angles identical.
  [in] | detectedCs | A vector of double pointers pointer to which any detected axis will be added in the ProSHADE format - [0] = fold, [1] = x-axis, [2] = y-axis, [3] = z-axis, [4] = angle, [5] = average peak height.
  [in] | bicubicInterp | Should the bicubic interpolation between the peak indices be done?
  [in] | fold | The fold for which we are searching for cyclic point groups.
  [in] | verbose | The verbosity of the run.

Definition at line 1366 of file ProSHADE_spheres.cpp.

1367 {
1368 //================================================ Check that this peak group has all the angles
1369 if ( ( fold - 1 ) != spherePositions.size() ) { return ; }
1370
1371 //================================================ Initialise variables
1372 proshade_double bestPosVal, bestLatInd, bestLonInd;
1373 std::vector< proshade_unsign > spheresFormingFold;
1374
1375 //================================================ Set all supplied spheres to be required to form the fold
1376 for ( proshade_unsign shIt = 0; shIt < static_cast<proshade_unsign> ( sphereVals.size() ); shIt++ )
1377 {
1378 ProSHADE_internal_misc::addToUnsignVector ( &spheresFormingFold, shIt );
1379 }
1380
1381 //================================================ Find the index with the highest peak height sum
1382 this->getBestIndexForFold ( &bestPosVal, &bestLatInd, &bestLonInd, &spheresFormingFold, sphereVals );
1383
1384 //================================================ Optimise by bicubic interpolation if required
1385 if ( bicubicInterp )
1386 {
1387 ProSHADE_internal_maths::optimiseAxisBiCubicInterpolation ( &bestLatInd, &bestLonInd, &bestPosVal, &spheresFormingFold, &sphereVals );
1388 }
1389
1390 //================================================ Create ProSHADE symmetry axis array and save it
1391 proshade_double* detectedSymmetry = new proshade_double[6];
1392 ProSHADE_internal_misc::checkMemoryAllocation ( detectedSymmetry, __FILE__, __LINE__, __func__ );
1393
1394 detectedSymmetry[0] = static_cast<proshade_double> ( fold );
1395 detectedSymmetry[1] = 1.0 * std::sin ( bestLonInd * this->lonSampling ) * std::cos ( bestLatInd * this->latSampling );
1396 detectedSymmetry[2] = 1.0 * std::sin ( bestLonInd * this->lonSampling ) * std::sin ( bestLatInd * this->latSampling );
1397 detectedSymmetry[3] = 1.0 * std::cos ( bestLonInd * this->lonSampling );
1398 detectedSymmetry[4] = ( 2.0 * M_PI ) / detectedSymmetry[0];
1399 detectedSymmetry[5] = ( bestPosVal - 1.0 ) / ( detectedSymmetry[0] - 1 );
1400
1401 //================================================ Make sure max is positive
1402 if ( ( ( std::max ( std::abs ( detectedSymmetry[1] ), std::max ( std::abs ( detectedSymmetry[2] ), std::abs ( detectedSymmetry[3] ) ) ) == std::abs ( detectedSymmetry[1] ) ) && ( detectedSymmetry[1] < 0.0 ) ) ||
1403 ( ( std::max ( std::abs ( detectedSymmetry[1] ), std::max ( std::abs ( detectedSymmetry[2] ), std::abs ( detectedSymmetry[3] ) ) ) == std::abs ( detectedSymmetry[2] ) ) && ( detectedSymmetry[2] < 0.0 ) ) ||
1404 ( ( std::max ( std::abs ( detectedSymmetry[1] ), std::max ( std::abs ( detectedSymmetry[2] ), std::abs ( detectedSymmetry[3] ) ) ) == std::abs ( detectedSymmetry[3] ) ) && ( detectedSymmetry[3] < 0.0 ) ) )
1405 {
1406 detectedSymmetry[1] *= -1.0;
1407 detectedSymmetry[2] *= -1.0;
1408 detectedSymmetry[3] *= -1.0;
1409 detectedSymmetry[4] *= -1.0;
1410 }
1411
1412 //================================================ Save detected point group
1413 ProSHADE_internal_misc::addToDblPtrVector ( detectedCs, detectedSymmetry );
1414
1415 //================================================ Report progress
1416 std::stringstream hlpSS;
1417 hlpSS << "Detected group with fold " << detectedSymmetry[0] << " along axis " << detectedSymmetry[1] << " ; " << detectedSymmetry[2] << " ; " << detectedSymmetry[3] << " and with peak height " << detectedSymmetry[5];
1418 ProSHADE_internal_messages::printProgressMessage ( verbose, 4, hlpSS.str() );
1419
1420 //================================================ Done
1421 return ;
1422
1423 }

## ◆ getAllAngleDifferences()

void ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getAllAngleDifferences | ( | std::vector< proshade_double > * | angDiffs,
|  | std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > | sphereVals
| ) |  |
| protected

This function takes all angles present in this peak group and finds the set of unique angle differeces.

Parameters

  [in] | angDiffs | A pointer to a vector to which all angle differences will be saved into.
  [in] | sphereVals | A vector of spheres with mapped rotation function values.

Definition at line 1430 of file ProSHADE_spheres.cpp.

1431 {
1432 //================================================ Initialise local variables
1433 std::vector< proshade_double > angs;
1434
1435 //================================================ Find all present angles
1436 for ( proshade_unsign shPos = 0; shPos < static_cast<proshade_unsign> ( this->spherePositions.size() ); shPos++ )
1437 {
1438 ProSHADE_internal_misc::addToDoubleVector ( &angs, sphereVals.at(this->spherePositions.at(shPos))->getRadius() );
1439 }
1440
1441 //================================================ Find all angle differences
1442 for ( proshade_unsign ang1It = 0; ang1It < static_cast<proshade_unsign> ( angs.size() ); ang1It++ )
1443 {
1444 for ( proshade_unsign ang2It = 1; ang2It < static_cast<proshade_unsign> ( angs.size() ); ang2It++ )
1445 {
1446 //======================================== Use unique combinations only
1447 if ( ang1It >= ang2It ) { continue; }
1448
1449 //======================================== Add angle difference rounded to 5 decimal places
1450 ProSHADE_internal_misc::addToDoubleVector ( angDiffs, std::floor ( std::abs ( angs.at(ang1It) - angs.at(ang2It) ) * 100000.0 ) / 100000.0 );
1451 }
1452 }
1453
1454 //================================================ Sort and remove duplicates
1455 std::sort ( (*angDiffs).begin(), (*angDiffs).end() );
1456 (*angDiffs).erase ( std::unique ( (*angDiffs).begin(), (*angDiffs).end() ), (*angDiffs).end() );
1457
1458 //================================================ Done
1459 return ;
1460
1461 }

## ◆ getAllPossibleFolds()

void ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getAllPossibleFolds | ( | std::vector< proshade_double > * | angDiffs,
|  | std::vector< proshade_unsign > * | foldsToTry,
|  | std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > | sphereVals
| ) |  |
| protected

This function angle differences and creates a list of folds that may be present in the group.

The function starts by taking each detected angle difference and checking how well it divides a circle (2 Pi). The remainder of this division is then check against a tolerance threshold, which takes into account how many peaks in the rotation function space is the distance off from the theoretical exact value.

Parameters

  [in] | angDiffs | A pointer to a vector containing all the unique angle differences for this peak group.
  [in] | foldsToTry | A pointer to a vector to which the predicted fold to try to find are to be saved into.
  [in] | sphereVals | A vector of spheres with mapped rotation function values.

Definition at line 1473 of file ProSHADE_spheres.cpp.

1474 {
1475 //================================================ Initialise local variables
1476 proshade_double divRem, divBasis, symmErr, angTolerance, angToleranceNext;
1477 proshade_double peakErr = ( M_PI * 2.0 ) / ( static_cast<proshade_double> ( this->dimension ) );
1478
1479 //================================================ For each angle difference in the group
1480 for ( proshade_unsign diffIt = 0; diffIt < static_cast<proshade_unsign> ( angDiffs->size() ); diffIt++ )
1481 {
1482 //============================================ Find the basis and remainder of the 2pi/dist equation
1483 divRem = std::modf ( static_cast<proshade_double> ( ( 2.0 * M_PI ) / std::abs ( angDiffs->at(diffIt) ) ), &divBasis );
1484
1485 //============================================ If the remainder would be smaller for larger basis, so change the basis
1486 if ( divRem > 0.5 )
1487 {
1488 divRem -= 1.0;
1489 divBasis += 1.0;
1490 }
1491
1492 //============================================ Remove fold 1, that is not really what we are after here ...
1493 if ( divBasis == 1 ) { continue; }
1494
1495 //============================================ Is there enough angles in the group for such a fold?
1496 if ( static_cast<proshade_unsign> ( this->spherePositions.size() ) < ( divBasis - 1 ) ) { continue; }
1497
1498 //============================================ Determine errors on peaks and on folds
1499 symmErr = divRem * ( ( 2.0 * M_PI ) / static_cast<proshade_double> ( divBasis ) );
1500 angTolerance = std::abs( symmErr / peakErr );
1501 angToleranceNext = ( ( ( 2.0 * M_PI ) / static_cast<proshade_double> ( divBasis ) ) - ( ( 2.0 * M_PI ) / static_cast<proshade_double> ( divBasis + 1 ) ) ) / peakErr;
1502
1503 //============================================ Is remainder small enough?
1504 if ( angTolerance < std::max ( 3.0, ( 0.1 / peakErr ) ) )
1505 {
1506 //======================================== Is the next symmetry close enough? If so, test previous and next folds as well.
1507 if ( angToleranceNext < std::max ( 1.5, ( 0.1 / peakErr ) ) )
1508 {
1509 //==================================== The next fold would pass as well. Use one previous and one following fold as well to cover for errors
1510 ProSHADE_internal_misc::addToUnsignVector ( foldsToTry, divBasis - 1 );
1511 ProSHADE_internal_misc::addToUnsignVector ( foldsToTry, divBasis + 1 );
1512 }
1513
1514 //======================================== This fold seems reasonable, save it
1515 ProSHADE_internal_misc::addToUnsignVector ( foldsToTry, divBasis );
1516 }
1517 }
1518
1519 //================================================ Sort and remove duplicates
1520 std::sort ( (*foldsToTry).begin(), (*foldsToTry).end(), std::greater <proshade_unsign>() );
1521 foldsToTry->erase ( std::unique ( (*foldsToTry).begin(), (*foldsToTry).end() ), (*foldsToTry).end() );
1522
1523 //================================================ Done
1524 return ;
1525
1526 }

## ◆ getBestIndexForFold()

void ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getBestIndexForFold | ( | proshade_double * | bestPosVal,
|  | proshade_double * | bestLatInd,
|  | proshade_double * | bestLonInd,
|  | std::vector< proshade_unsign > * | spheresFormingFold,
|  | std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > | sphereVals
| ) |  |
| protected

Function which does simple search through all peak groups indices and saves the index with the highest peak height sum over all spheres.

Parameters

  [in] | bestPosVal | Pointer to double where the highest sum of heights will be stored.
  [in] | bestLatInd | Pointer to double where the highest values lattitude index will be held.
  [in] | bestLonInd | Pointer to double where the highest values longitude index will be held.
  [in] | spheresFormingFold | A vector pointer to a vector containing the indices of the spheres forming this fold.
  [in] | sphereVals | A vector of spheres with mapped rotation function values.

Definition at line 1582 of file ProSHADE_spheres.cpp.

1583 {
1584 //================================================ Initialise variables
1585 proshade_double curPosVal;
1586 *bestPosVal = -1.0;
1587 if ( this->latFromInds > this->latToInds ) { this->latToInds += this->dimension; }
1588 if ( this->lonFromInds > this->lonToInds ) { this->lonToInds += this->dimension; }
1589
1590 //================================================ Compute the best average peak height axis for peak indices
1591 for ( proshade_unsign latIt = this->latFromInds; latIt <= this->latToInds; latIt++ )
1592 {
1593 //============================================ Deal with boundaries
1594 if ( latIt >= this->dimension ) { latIt -= this->dimension; this->latToInds -= this->dimension; }
1595
1596 for ( proshade_unsign lonIt = this->lonFromInds; lonIt <= this->lonToInds; lonIt++ )
1597 {
1598 //======================================== Deal with boundaries
1599 if ( lonIt >= this->dimension ) { lonIt -= this->dimension; this->lonToInds -= this->dimension; }
1600
1601 //======================================== Initialise variables
1602 curPosVal = 1.0;
1603
1604 //======================================== Find this indices value
1605 for ( proshade_unsign sphIt = 0; sphIt < static_cast<proshade_unsign> ( spheresFormingFold->size() ); sphIt++ )
1606 {
1607 curPosVal += sphereVals.at(spheresFormingFold->at(sphIt))->getSphereLatLonPosition ( latIt, lonIt );
1608 }
1609
1610 //======================================== If best, save it
1611 if ( curPosVal > *bestPosVal )
1612 {
1613 *bestPosVal = curPosVal;
1614 *bestLatInd = latIt;
1615 *bestLonInd = lonIt;
1616 }
1617 }
1618 }
1619
1620 //================================================ Done
1621 return ;
1622
1623 }

## ◆ getLatFromIndices()

proshade_double ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getLatFromIndices | ( | void |  | ) |

Accessor function for the private variable latFromInds.

Parameters

  [out] | latFromInds | The lattitude index start for the group.

Definition at line 1295 of file ProSHADE_spheres.cpp.

1296 {
1297 //================================================ Done
1298 return ( this->latFromInds );
1299
1300 }

## ◆ getLatToIndices()

proshade_double ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getLatToIndices | ( | void |  | ) |

Accessor function for the private variable latToInds.

Parameters

  [out] | latToInds | The lattitude index end for the group.

Definition at line 1306 of file ProSHADE_spheres.cpp.

1307 {
1308 //================================================ Done
1309 return ( this->latToInds );
1310
1311 }

## ◆ getLonFromIndices()

proshade_double ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getLonFromIndices | ( | void |  | ) |

Accessor function for the private variable lonFromInds.

Parameters

  [out] | lonFromInds | The longitude index start for the group.

Definition at line 1317 of file ProSHADE_spheres.cpp.

1318 {
1319 //================================================ Done
1320 return ( this->lonFromInds );
1321
1322 }

## ◆ getLonToIndices()

proshade_double ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getLonToIndices | ( | void |  | ) |

Accessor function for the private variable lonToInds.

Parameters

  [out] | lonToInds | The longitude index end for the group.

Definition at line 1328 of file ProSHADE_spheres.cpp.

1329 {
1330 //================================================ Done
1331 return ( this->lonToInds );
1332
1333 }

## ◆ getSpherePositions()

std::vector< proshade_unsign > ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getSpherePositions | ( | void |  | ) |

Accessor function for the private variable spherePositions.

Parameters

  [out] | spherePositions | A vector of all angles (spheres) indices present in this group.

Definition at line 1339 of file ProSHADE_spheres.cpp.

1340 {
1341 //================================================ Done
1342 return ( this->spherePositions );
1343
1344 }

## ◆ getSpheresFormingFold()

void ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::getSpheresFormingFold | ( | proshade_unsign | foldToTry,
|  | std::vector< proshade_unsign > * | spheresFormingFold,
|  | std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > | sphereVals,
|  | proshade_double | sphereAngleTolerance
| ) |  |
| protected

This function simply finds the indices of the spheres which form the requested form.

Parameters

  [in] | foldToTry | The value of the fold for which all the required spheres are to be sought.
  [in] | spheresFormingFold | A pointer to vector to which the sphere indices of spheres forming this fold will be saved into.
  [in] | sphereVals | A vector of spheres with mapped rotation function values.
  [in] | sphereAngleTolerance | The tolerance for how different the sphere angle can be for the sphere to be still considered.

Definition at line 1535 of file ProSHADE_spheres.cpp.

1536 {
1537 //================================================ Initialise local variables
1538 proshade_double soughtAngle, minSphereVal;
1539 proshade_unsign minSpherePos;
1540
1541 //================================================ Generate expected angles and check if close-by sphere exists
1542 for ( proshade_double fIt = 1.0; fIt < static_cast<proshade_double> ( foldToTry ); fIt += 1.0 )
1543 {
1544 //============================================ Set variables for the iteration
1545 minSphereVal = 999.9;
1546 soughtAngle = fIt * ( 2.0 * M_PI / static_cast<proshade_double> ( foldToTry ) );
1547
1548 //============================================ Find the closest sphere passing conditions
1549 for ( proshade_unsign angsIt = 0; angsIt < static_cast<proshade_unsign> ( this->spherePositions.size() ); angsIt++ )
1550 {
1551 if ( std::abs ( sphereVals.at(this->spherePositions.at(angsIt))->getRepresentedAngle() - soughtAngle ) < sphereAngleTolerance )
1552 {
1553 if ( minSphereVal > 1.0 - std::cos ( std::abs ( sphereVals.at(this->spherePositions.at(angsIt))->getRepresentedAngle() - soughtAngle ) ) )
1554 {
1555 minSphereVal = 1.0 - std::cos ( std::abs ( sphereVals.at(this->spherePositions.at(angsIt))->getRepresentedAngle() - soughtAngle ) );
1556 minSpherePos = angsIt;
1557 }
1558 }
1559 }
1560
1561 //============================================ If no passing sphere, test next fold
1562 if ( minSphereVal == 999.9 ) { break; }
1563
1564 //============================================ Save best position
1565 ProSHADE_internal_misc::addToUnsignVector ( spheresFormingFold, this->spherePositions.at(minSpherePos) );
1566 }
1567
1568 //================================================ Done
1569 return ;
1570
1571 }

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

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

ProSHADE_internal_misc::addToDblPtrVector
void addToDblPtrVector(std::vector< proshade_double * > *vecToAddTo, proshade_double *elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:143
ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::angularDistanceWithBorders
proshade_signed angularDistanceWithBorders(proshade_signed origLat, proshade_signed testedLat)
This function takes two lattitude or longitude positions and finds the smallest distance between them...
Definition: ProSHADE_spheres.cpp:1109
ProSHADE_internal_spheres::ProSHADE_rotFun_spherePeakGroup::computeCornerPositions
void computeCornerPositions(void)
This function computes the group corner vectors, saving results into internal variables.
Definition: ProSHADE_spheres.cpp:1079
ProSHADE_internal_maths::optimiseAxisBiCubicInterpolation
void optimiseAxisBiCubicInterpolation(proshade_double *bestLattitude, proshade_double *bestLongitude, proshade_double *bestSum, std::vector< proshade_unsign > *sphereList, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > *sphereMappedRotFun, proshade_double step=0.05)
This function provides axis optimisation given starting lattitude and longitude indices.
Definition: ProSHADE_maths.cpp:2296
ProSHADE_internal_misc::addToDoubleVector
void addToDoubleVector(std::vector< proshade_double > *vecToAddTo, proshade_double elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:77
ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection
bool vectorOrientationSimilaritySameDirection(proshade_double a1, proshade_double a2, proshade_double a3, proshade_double b1, proshade_double b2, proshade_double b3, proshade_double tolerance=0.1)
This function compares two vectors using cosine distance and decides if they are similar using tolera...
Definition: ProSHADE_maths.cpp:2266
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::ProSHADE_rotFun_spherePeakGroup::getBestIndexForFold
void getBestIndexForFold(proshade_double *bestPosVal, proshade_double *bestLatInd, proshade_double *bestLonInd, std::vector< proshade_unsign > *spheresFormingFold, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > sphereVals)
Function which does simple search through all peak groups indices and saves the index with the highes...
Definition: ProSHADE_spheres.cpp:1582
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_messages::printProgressMessage
void printProgressMessage(proshade_signed verbose, proshade_signed messageLevel, std::string message)
General stdout message printing.
Definition: ProSHADE_messages.cpp:70