Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions
gmx::AnalysisNeighborhoodPairSearch Class Reference

#include <gromacs/selection/nbsearch.h>

Description

Initialized neighborhood pair search with a fixed set of positions.

This class is used to loop through pairs of neighbors within the cutoff provided to AnalysisNeighborhood. The following code demonstrates its use:

nb.setCutoff(cutoff);
gmx::AnalysisNeighborhoodSearch search = nb.initSearch(pbc, refPos);
gmx::AnalysisNeighborhoodPairSearch pairSearch = search.startPairSearch(selection);
while (pairSearch.findNextPair(&pair))
{
// <do something for each found pair the information in pair>
}
*

It is not possible to use a single search object from multiple threads concurrently.

This class works like a pointer: copies of it point to the same search. In general, avoid creating copies, and only use the copy/assignment support for moving the variable around. With C++11, this class would best be movable.

Methods in this class do not throw.

Public Types

typedef std::shared_ptr
< internal::AnalysisNeighborhoodPairSearchImpl > 
ImplPointer
 Internal short-hand type for a pointer to the implementation class. More...
 

Public Member Functions

 AnalysisNeighborhoodPairSearch (const ImplPointer &impl)
 Internally initialize the search. More...
 
bool findNextPair (AnalysisNeighborhoodPair *pair)
 Finds the next pair within the cutoff. More...
 
void skipRemainingPairsForTestPosition ()
 Skip remaining pairs for a test position in the search. More...
 

Member Typedef Documentation

typedef std::shared_ptr<internal::AnalysisNeighborhoodPairSearchImpl> gmx::AnalysisNeighborhoodPairSearch::ImplPointer

Internal short-hand type for a pointer to the implementation class.

See AnalysisNeighborhoodSearch::ImplPointer for rationale of using shared_ptr and ownership semantics.

Constructor & Destructor Documentation

gmx::AnalysisNeighborhoodPairSearch::AnalysisNeighborhoodPairSearch ( const ImplPointer impl)
explicit

Internally initialize the search.

Used to implement AnalysisNeighborhoodSearch::startPairSearch(). Cannot be called from user code.

Member Function Documentation

bool gmx::AnalysisNeighborhoodPairSearch::findNextPair ( AnalysisNeighborhoodPair pair)

Finds the next pair within the cutoff.

Parameters
[out]pairInformation about the found pair.
Returns
false if there were no more pairs.

If the method returns false, pair will be invalid.

See Also
AnalysisNeighborhoodPair
AnalysisNeighborhoodSearch::startPairSearch()
void gmx::AnalysisNeighborhoodPairSearch::skipRemainingPairsForTestPosition ( )

Skip remaining pairs for a test position in the search.

When called after findNextPair(), makes subsequent calls to findNextPair() skip any pairs that have the same test position as that previously returned. This is useful if the caller wants to search whether any reference position within the cutoff satisfies some condition. This method can be used to skip remaining pairs after the first such position has been found if the remaining pairs would not have an effect on the outcome.


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