ProSHADE  0.7.6.6 (JUL 2022)
Protein Shape Detection
ProSHADE_internal_misc Namespace Reference

This namespace contains all the miscellaneous functions used throughout the code but unrelated to it. More...

Functions

void addToStringVector (std::vector< std::string > *vecToAddTo, std::string elementToAdd)
 Adds the element to the vector. More...
 
void addToSingleVector (std::vector< proshade_single > *vecToAddTo, proshade_single elementToAdd)
 Adds the element to the vector. More...
 
void addToDoubleVector (std::vector< proshade_double > *vecToAddTo, proshade_double elementToAdd)
 Adds the element to the vector. More...
 
void addToUnsignVector (std::vector< proshade_unsign > *vecToAddTo, proshade_unsign elementToAdd)
 Adds the element to the vector. More...
 
void addToSignedVector (std::vector< proshade_signed > *vecToAddTo, proshade_signed elementToAdd)
 Adds the element to the vector. More...
 
void addToDblPtrVector (std::vector< proshade_double * > *vecToAddTo, proshade_double *elementToAdd)
 Adds the element to the vector. More...
 
void addToSigPtrVector (std::vector< proshade_signed * > *vecToAddTo, proshade_signed *elementToAdd)
 Adds the element to the vector. More...
 
void addToUnsPtrVector (std::vector< proshade_unsign * > *vecToAddTo, proshade_unsign *elementToAdd)
 Adds the element to the vector. More...
 
void addToUnsignVectorVector (std::vector< std::vector< proshade_unsign > > *vecToAddTo, std::vector< proshade_unsign > elementToAdd)
 Adds the element to the vector of vectors. More...
 
void addToDoubleVectorVector (std::vector< std::vector< proshade_double > > *vecToAddTo, std::vector< proshade_double > elementToAdd)
 Adds the element to the vector of vectors. More...
 
void addToDblPtrVectorVector (std::vector< std::vector< proshade_double * > > *vecToAddTo, std::vector< proshade_double * > elementToAdd)
 Adds the element to the vector of vectors of double pointers. More...
 
bool sortSymHlp (const proshade_double *a, const proshade_double *b)
 This function compares two arrays of two based on the fifth number, sorting lowest first. More...
 
bool sortSymHlpInv (const proshade_double *a, const proshade_double *b)
 This function compares two arrays of two based on the fifth number, sorting highest first. More...
 
bool sortSymFSCHlp (const proshade_double *a, const proshade_double *b)
 This function compares two arrays of two based on the sixth number, sorting highest first. More...
 
bool sortSymFSCHlpInv (const proshade_double *a, const proshade_double *b)
 This function compares two arrays of two based on the sixth number, sorting highest first. More...
 
bool sortTSymByPeak (const std::vector< proshade_double * > a, const std::vector< proshade_double * > b)
 This function compares two vectors of arrays based on the sum of the fifth column, sorting highest first. More...
 
bool sortOSymByPeak (const std::vector< proshade_double * > a, const std::vector< proshade_double * > b)
 This function compares two vectors of arrays based on the sum of the fifth column, sorting highest first. More...
 
bool sortISymByPeak (const std::vector< proshade_double * > a, const std::vector< proshade_double * > b)
 This function compares two vectors of arrays based on the sum of the fifth column, sorting highest first. More...
 
bool sortDSymHlpInv (const proshade_double *a, const proshade_double *b)
 This function compares two arrays of the ProSHADE dihedral symmetry list based on combination of axes folds and heightst. More...
 
bool sortSymFoldHlp (const proshade_double *a, const proshade_double *b)
 
bool sortSymInvFoldHlp (const proshade_double *a, const proshade_double *b)
 This function compares two arrays of two based on the first number, sorting highest first. More...
 
void deepCopyAxisToDblPtrVector (std::vector< proshade_double * > *dblPtrVec, proshade_double *axis)
 Does a deep copy of a double array to a vector of double arrays. More...
 
void deepCopyBoundsSigPtrVector (std::vector< proshade_signed * > *sigPtrVec, proshade_signed *xFrom, proshade_signed *xTo, proshade_signed *yFrom, proshade_signed *yTo, proshade_signed *zFrom, proshade_signed *zTo)
 Does a deep copy of a signed int array to a vector of signed int arrays. More...
 
template<class chVar >
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. More...
 

Detailed Description

This namespace contains all the miscellaneous functions used throughout the code but unrelated to it.

The ProSHADE_internal_misc namespace contains all the functions which are useful, but not really related to shape description or data processing.

Function Documentation

◆ addToDblPtrVector()

void ProSHADE_internal_misc::addToDblPtrVector ( std::vector< proshade_double * > *  vecToAddTo,
proshade_double *  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of complex<double> and a single complex<double> element and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of complex<double>'s which should be elongated.
[in]elementToAddcomplex<double> to be added to the back of the vector.

Definition at line 143 of file ProSHADE_misc.cpp.

144 {
145  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
146 #if __cplusplus >= 201103L
147  vecToAddTo->emplace_back ( elementToAdd );
148 #else
149  vecToAddTo->push_back ( elementToAdd );
150 #endif
151 
152  //================================================ Done
153  return ;
154 
155 }

◆ addToDblPtrVectorVector()

void ProSHADE_internal_misc::addToDblPtrVectorVector ( std::vector< std::vector< proshade_double * > > *  vecToAddTo,
std::vector< proshade_double * >  elementToAdd 
)

Adds the element to the vector of vectors of double pointers.

This function takes a pointer to a vector of vectors of double pointers and a single vector of double pointers and adds this element to the end of the vector of vectors of pointers. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of vectors of double pointers which should be elongated.
[in]elementToAddvector of double pointers to be added to the back of the vector.

Definition at line 255 of file ProSHADE_misc.cpp.

256 {
257  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
258 #if __cplusplus >= 201103L
259  vecToAddTo->emplace_back ( elementToAdd );
260 #else
261  vecToAddTo->push_back ( elementToAdd );
262 #endif
263 
264  //================================================ Done
265  return ;
266 
267 }

◆ addToDoubleVector()

void ProSHADE_internal_misc::addToDoubleVector ( std::vector< proshade_double > *  vecToAddTo,
proshade_double  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of proshade_double and a single proshade_double element and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of proshade_double's which should be elongated.
[in]elementToAddproshade_double to be added to the back of the vector.

Definition at line 77 of file ProSHADE_misc.cpp.

78 {
79  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
80 #if __cplusplus >= 201103L
81  vecToAddTo->emplace_back ( elementToAdd );
82 #else
83  vecToAddTo->push_back ( elementToAdd );
84 #endif
85 
86  //================================================ Done
87  return ;
88 
89 }

◆ addToDoubleVectorVector()

void ProSHADE_internal_misc::addToDoubleVectorVector ( std::vector< std::vector< proshade_double > > *  vecToAddTo,
std::vector< proshade_double >  elementToAdd 
)

Adds the element to the vector of vectors.

This function takes a pointer to a vector of vectors of doubles and a single vector of doubles and adds this element to the end of the vector of vectors. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of vectors of doubles which should be elongated.
[in]elementToAddvector of doubles to be added to the back of the vector.

Definition at line 233 of file ProSHADE_misc.cpp.

234 {
235  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
236 #if __cplusplus >= 201103L
237  vecToAddTo->emplace_back ( elementToAdd );
238 #else
239  vecToAddTo->push_back ( elementToAdd );
240 #endif
241 
242  //================================================ Done
243  return ;
244 
245 }

◆ addToSignedVector()

void ProSHADE_internal_misc::addToSignedVector ( std::vector< proshade_signed > *  vecToAddTo,
proshade_signed  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of proshade_signed and a single proshade_signed element and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of proshade_signed's which should be elongated.
[in]elementToAddproshade_signed to be added to the back of the vector.

Definition at line 121 of file ProSHADE_misc.cpp.

122 {
123  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
124 #if __cplusplus >= 201103L
125  vecToAddTo->emplace_back ( elementToAdd );
126 #else
127  vecToAddTo->push_back ( elementToAdd );
128 #endif
129 
130  //================================================ Done
131  return ;
132 
133 }

◆ addToSigPtrVector()

void ProSHADE_internal_misc::addToSigPtrVector ( std::vector< proshade_signed * > *  vecToAddTo,
proshade_signed *  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of proshade_signed pointers and a single proshade_signed pointer and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of complex<double>'s which should be elongated.
[in]elementToAddcomplex<double> to be added to the back of the vector.

Definition at line 166 of file ProSHADE_misc.cpp.

167 {
168  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
169 #if __cplusplus >= 201103L
170  vecToAddTo->emplace_back ( elementToAdd );
171 #else
172  vecToAddTo->push_back ( elementToAdd );
173 #endif
174 
175  //================================================ Done
176  return ;
177 
178 }

◆ addToSingleVector()

void ProSHADE_internal_misc::addToSingleVector ( std::vector< proshade_single > *  vecToAddTo,
proshade_single  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of proshade_single and a single proshade_single element and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of proshade_single's which should be elongated.
[in]elementToAddproshade_single to be added to the back of the vector.

Definition at line 55 of file ProSHADE_misc.cpp.

56 {
57  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
58 #if __cplusplus >= 201103L
59  vecToAddTo->emplace_back ( elementToAdd );
60 #else
61  vecToAddTo->push_back ( elementToAdd );
62 #endif
63 
64  //================================================ Done
65  return ;
66 
67 }

◆ addToStringVector()

void ProSHADE_internal_misc::addToStringVector ( std::vector< std::string > *  vecToAddTo,
std::string  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of strings and a single string element and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of strings which should be elongated.
[in]elementToAddString to be added to the back of the vector.

Definition at line 33 of file ProSHADE_misc.cpp.

34 {
35  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
36 #if __cplusplus >= 201103L
37  vecToAddTo->emplace_back ( elementToAdd );
38 #else
39  vecToAddTo->push_back ( elementToAdd );
40 #endif
41 
42  //================================================ Done
43  return ;
44 
45 }

◆ addToUnsignVector()

void ProSHADE_internal_misc::addToUnsignVector ( std::vector< proshade_unsign > *  vecToAddTo,
proshade_unsign  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of proshade_unsign and a single proshade_unsign element and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of proshade_unsign's which should be elongated.
[in]elementToAddproshade_unsign to be added to the back of the vector.

Definition at line 99 of file ProSHADE_misc.cpp.

100 {
101  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
102 #if __cplusplus >= 201103L
103  vecToAddTo->emplace_back ( elementToAdd );
104 #else
105  vecToAddTo->push_back ( elementToAdd );
106 #endif
107 
108  //================================================ Done
109  return ;
110 
111 }

◆ addToUnsignVectorVector()

void ProSHADE_internal_misc::addToUnsignVectorVector ( std::vector< std::vector< proshade_unsign > > *  vecToAddTo,
std::vector< proshade_unsign >  elementToAdd 
)

Adds the element to the vector of vectors.

This function takes a pointer to a vector of vectors of unsigns and a single vector of unsigns adds this element to the end of the vector of vectors. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of vectors of unsigns which should be elongated.
[in]elementToAddvector of unsigns to be added to the back of the vector.

Definition at line 211 of file ProSHADE_misc.cpp.

212 {
213  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
214 #if __cplusplus >= 201103L
215  vecToAddTo->emplace_back ( elementToAdd );
216 #else
217  vecToAddTo->push_back ( elementToAdd );
218 #endif
219 
220  //================================================ Done
221  return ;
222 
223 }

◆ addToUnsPtrVector()

void ProSHADE_internal_misc::addToUnsPtrVector ( std::vector< proshade_unsign * > *  vecToAddTo,
proshade_unsign *  elementToAdd 
)

Adds the element to the vector.

This function takes a pointer to a vector of proshade_unsign pointers and a single proshade_unsign pointer and adds this element to the end of the vector. The reason for this function is to make vector elongation C++ standard independent (push_back vs. emplace_back)

Parameters
[in]vecToAddToPointer to vector of proshade_unsign pointer's which should be elongated.
[in]elementToAddproshade_unsign pointer to be added to the back of the vector.

Definition at line 189 of file ProSHADE_misc.cpp.

190 {
191  //================================================ Based on the compiler C++11 support, use the correct vector addition function.
192 #if __cplusplus >= 201103L
193  vecToAddTo->emplace_back ( elementToAdd );
194 #else
195  vecToAddTo->push_back ( elementToAdd );
196 #endif
197 
198  //================================================ Done
199  return ;
200 
201 }

◆ checkMemoryAllocation()

template<class chVar >
void ProSHADE_internal_misc::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." 
)
inline

Checks if memory was allocated properly.

This function checks if the memory allocation has suceeded for a given pointer, printing error message if not.

Parameters
[in]checkVarPointer to be checked.

Definition at line 73 of file ProSHADE_misc.hpp.

73  : 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." )
74  {
75  //============================================ Check against NULL
76  if ( checkVar == nullptr )
77  {
78  throw ProSHADE_exception ( "Failed to allocate memory.", "E000007", fileP, lineP, funcP, infoP );
79  }
80 
81  //============================================ Done
82  return ;
83 
84  }

◆ deepCopyAxisToDblPtrVector()

void ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( std::vector< proshade_double * > *  dblPtrVec,
proshade_double *  axis 
)

Does a deep copy of a double array to a vector of double arrays.

This function deep copies a single symmetry axis ( proshade_double[7] ) into a vector of such arrays.

Parameters
[in]dblPtrVecPointer to vector of proshade_double arrays to which the second argument is to be deep copied.
[in]axisThe proshade_double array to be copied to the first argument.

Definition at line 433 of file ProSHADE_misc.cpp.

434 {
435  //================================================ Allocate new memory
436  proshade_double* symAx = new proshade_double[7];
437 
438  //================================================ Check memory allocation
439  ProSHADE_internal_misc::checkMemoryAllocation ( symAx, __FILE__, __LINE__, __func__ );
440 
441  //================================================ Copy the 6 values
442  symAx[0] = axis[0];
443  symAx[1] = axis[1];
444  symAx[2] = axis[2];
445  symAx[3] = axis[3];
446  symAx[4] = axis[4];
447  symAx[5] = axis[5];
448  symAx[6] = axis[6];
449 
450  //================================================ Save
451  ProSHADE_internal_misc::addToDblPtrVector ( dblPtrVec, symAx );
452 
453  //================================================ Done
454  return ;
455 
456 }

◆ deepCopyBoundsSigPtrVector()

void ProSHADE_internal_misc::deepCopyBoundsSigPtrVector ( std::vector< proshade_signed * > *  sigPtrVec,
proshade_signed *  xFrom,
proshade_signed *  xTo,
proshade_signed *  yFrom,
proshade_signed *  yTo,
proshade_signed *  zFrom,
proshade_signed *  zTo 
)

Does a deep copy of a signed int array to a vector of signed int arrays.

This function deep copies a single bounds array ( proshade_signed[6] ) into a vector of such arrays.

Parameters
[in]sigPtrVecPointer to vector of proshade_signed arrays to which the second argument is to be deep copied.
[in]xFromPointer to the index value from which the x dimension start.
[in]xToPointer to the index value to which the x dimensions runs.
[in]yFromPointer to the index value from which the y dimension start.
[in]yToPointer to the index value to which the y dimensions runs.
[in]zFromPointer to the index value from which the z dimension start.
[in]zToPointer to the index value to which the z dimensions runs.

Definition at line 470 of file ProSHADE_misc.cpp.

471 {
472  //================================================ Allocate new memory
473  proshade_signed* bounds = nullptr;
474  bounds = new proshade_signed[6];
475 
476  //================================================ Check memory allocation
477  ProSHADE_internal_misc::checkMemoryAllocation ( bounds, __FILE__, __LINE__, __func__ );
478 
479  //================================================ Copy the 6 values
480  bounds[0] = *xFrom;
481  bounds[1] = *xTo;
482  bounds[2] = *yFrom;
483  bounds[3] = *yTo;
484  bounds[4] = *zFrom;
485  bounds[5] = *zTo;
486 
487  //================================================ Save
488  ProSHADE_internal_misc::addToSigPtrVector ( sigPtrVec, bounds );
489 
490  //================================================ Done
491  return ;
492 
493 }

◆ sortDSymHlpInv()

bool ProSHADE_internal_misc::sortDSymHlpInv ( const proshade_double *  a,
const proshade_double *  b 
)

This function compares two arrays of the ProSHADE dihedral symmetry list based on combination of axes folds and heightst.

Parameters
[in]aThe first array to compare.
[in]bThe second array to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 402 of file ProSHADE_misc.cpp.

403 {
404  //================================================ Get weighted averages
405  proshade_double aScore = ( ( a[0] * a[5] ) + ( a[6] * a[11] ) ) / ( a[0] + a[6] );
406  proshade_double bScore = ( ( b[0] * b[5] ) + ( b[6] * b[11] ) ) / ( b[0] + b[6] );
407 
408  //================================================ Compare
409  return ( aScore > bScore );
410 
411 }

◆ sortISymByPeak()

bool ProSHADE_internal_misc::sortISymByPeak ( const std::vector< proshade_double * >  a,
const std::vector< proshade_double * >  b 
)

This function compares two vectors of arrays based on the sum of the fifth column, sorting highest first.

Parameters
[in]aThe first vector to compare.
[in]bThe second vector to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 377 of file ProSHADE_misc.cpp.

378 {
379  //================================================ If one is less or more than 31, it is wrong
380  if ( a.size() != 31 ) { return ( false ); }
381  if ( b.size() != 31 ) { return ( true ); }
382 
383  //================================================ Find the sums
384  proshade_double aSum = 0.0, bSum = 0.0;
385  for ( size_t it = 0; it < 31; it++ )
386  {
387  aSum += a.at(it)[5];
388  bSum += b.at(it)[5];
389  }
390 
391  //================================================ Decide
392  return ( aSum > bSum );
393 
394 }

◆ sortOSymByPeak()

bool ProSHADE_internal_misc::sortOSymByPeak ( const std::vector< proshade_double * >  a,
const std::vector< proshade_double * >  b 
)

This function compares two vectors of arrays based on the sum of the fifth column, sorting highest first.

Parameters
[in]aThe first vector to compare.
[in]bThe second vector to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 352 of file ProSHADE_misc.cpp.

353 {
354  //================================================ If one is less or more than 31, it is wrong
355  if ( a.size() != 13 ) { return ( false ); }
356  if ( b.size() != 13 ) { return ( true ); }
357 
358  //================================================ Find the sums
359  proshade_double aSum = 0.0, bSum = 0.0;
360  for ( size_t it = 0; it < 13; it++ )
361  {
362  aSum += a.at(it)[5];
363  bSum += b.at(it)[5];
364  }
365 
366  //================================================ Decide
367  return ( aSum > bSum );
368 
369 }

◆ sortSymFSCHlp()

bool ProSHADE_internal_misc::sortSymFSCHlp ( const proshade_double *  a,
const proshade_double *  b 
)

This function compares two arrays of two based on the sixth number, sorting highest first.

Parameters
[in]aThe first array to compare.
[in]bThe second array to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 301 of file ProSHADE_misc.cpp.

302 {
303  //================================================ Compare
304  return ( a[6] > b[6] );
305 
306 }

◆ sortSymFSCHlpInv()

bool ProSHADE_internal_misc::sortSymFSCHlpInv ( const proshade_double *  a,
const proshade_double *  b 
)

This function compares two arrays of two based on the sixth number, sorting highest first.

Parameters
[in]aThe first array to compare.
[in]bThe second array to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 314 of file ProSHADE_misc.cpp.

315 {
316  //================================================ Compare
317  return ( a[6] > b[6] );
318 
319 }

◆ sortSymHlp()

bool ProSHADE_internal_misc::sortSymHlp ( const proshade_double *  a,
const proshade_double *  b 
)

This function compares two arrays of two based on the fifth number, sorting lowest first.

Parameters
[in]aThe first array to compare.
[in]bThe second array to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 275 of file ProSHADE_misc.cpp.

276 {
277  //================================================ Compare
278  return ( a[5] < b[5] );
279 
280 }

◆ sortSymHlpInv()

bool ProSHADE_internal_misc::sortSymHlpInv ( const proshade_double *  a,
const proshade_double *  b 
)

This function compares two arrays of two based on the fifth number, sorting highest first.

Parameters
[in]aThe first array to compare.
[in]bThe second array to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 288 of file ProSHADE_misc.cpp.

289 {
290  //================================================ Compare
291  return ( a[5] > b[5] );
292 
293 }

◆ sortSymInvFoldHlp()

bool ProSHADE_internal_misc::sortSymInvFoldHlp ( const proshade_double *  a,
const proshade_double *  b 
)

This function compares two arrays of two based on the first number, sorting highest first.

Parameters
[in]aThe first array to compare.
[in]bThe second array to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 419 of file ProSHADE_misc.cpp.

420 {
421  //================================================ Compare
422  return ( a[0] > b[0] );
423 
424 }

◆ sortTSymByPeak()

bool ProSHADE_internal_misc::sortTSymByPeak ( const std::vector< proshade_double * >  a,
const std::vector< proshade_double * >  b 
)

This function compares two vectors of arrays based on the sum of the fifth column, sorting highest first.

Parameters
[in]aThe first vector to compare.
[in]bThe second vector to compare.
[out]XBoolean whether the first is smaller than the second.

Definition at line 327 of file ProSHADE_misc.cpp.

328 {
329  //================================================ If one is less or more than 31, it is wrong
330  if ( a.size() != 7 ) { return ( false ); }
331  if ( b.size() != 7 ) { return ( true ); }
332 
333  //================================================ Find the sums
334  proshade_double aSum = 0.0, bSum = 0.0;
335  for ( size_t it = 0; it < 7; it++ )
336  {
337  aSum += a.at(it)[5];
338  bSum += b.at(it)[5];
339  }
340 
341  //================================================ Decide
342  return ( aSum > bSum );
343 
344 }
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_misc::addToSigPtrVector
void addToSigPtrVector(std::vector< proshade_signed * > *vecToAddTo, proshade_signed *elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:166
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