Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::ITopologyProvider Class Referenceabstract

#include <gromacs/selection/selectionoptionbehavior.h>

Inherited by gmx::anonymous_namespace{insert_molecules.cpp}::InsertMolecules, and gmx::TrajectoryAnalysisRunnerCommon::Impl.

Description

Provides topology information to SelectionOptionBehavior.

Modules that use SelectionOptionBehavior need to implement this interface to provide functionality to load topology information for use with the selections.

If future need arises to use similar information elsewhere, this can be moved to, e.g., the topology module, but for now it is here for simplicity. Also, if/when there will be more modules that use this, we can identify common code from those users and possibly provide a shared implementation (e.g., in the form of another IOptionsBehavior), but currently there are too few users to identify any useful reusable functionality from the callers.

See Also
SelectionCollection::setTopology().

Public Member Functions

virtual gmx_mtop_t * getTopology (bool required)=0
 Returns the topology to use. More...
 
virtual int getAtomCount ()=0
 Returns the number of atoms. More...
 

Member Function Documentation

virtual int gmx::ITopologyProvider::getAtomCount ( )
pure virtual

Returns the number of atoms.

This method is only called if getTopology() returns NULL. It should return the number of atoms that at most need to be selected by the selections.

virtual gmx_mtop_t* gmx::ITopologyProvider::getTopology ( bool  required)
pure virtual

Returns the topology to use.

Parameters
[in]requiredWhether the topology is required by the caller.

Can return NULL if required is false and the topology is not provided by the user. If required is true, should throw an error if the topology cannot be loaded.

This method may get called multiple times, potentially with different values of required. Subsequent calls should just return the same topology that was loaded in the first call.


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