ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/pair_criteria/PairCriterion.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010-2022 The ESPResSo project
3
*
4
* This file is part of ESPResSo.
5
*
6
* ESPResSo is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* ESPResSo is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
#ifndef ESPRESSO_SRC_CORE_PAIR_CRITERIA_PAIR_CRITERION_HPP
20
#define ESPRESSO_SRC_CORE_PAIR_CRITERIA_PAIR_CRITERION_HPP
21
22
#include "
Particle.hpp
"
23
#include "
particle_node.hpp
"
24
25
namespace
PairCriteria
{
26
/**
27
* @brief Criterion which returns a true/false value for a pair of particles.
28
*/
29
class
PairCriterion
{
30
public
:
31
/** @brief Make a decision based on two particles */
32
virtual
bool
decide
(
Particle
const
&p1,
Particle
const
&p2)
const
= 0;
33
/**
34
* @brief Make a decision based on particle ids.
35
* This can only run on the head node outside of the integration loop.
36
*/
37
bool
decide
(
int
id1,
int
id2)
const
{
38
// Retrieve particle data
39
auto
const
&p1 =
get_particle_data
(id1);
40
auto
const
&p2 =
get_particle_data
(id2);
41
const
bool
res =
decide
(p1, p2);
42
return
res;
43
}
44
virtual
~PairCriterion
() =
default
;
45
};
46
}
// namespace PairCriteria
47
48
#endif
Particle.hpp
PairCriteria::PairCriterion
Criterion which returns a true/false value for a pair of particles.
Definition
core/pair_criteria/PairCriterion.hpp:29
PairCriteria::PairCriterion::decide
bool decide(int id1, int id2) const
Make a decision based on particle ids.
Definition
core/pair_criteria/PairCriterion.hpp:37
PairCriteria::PairCriterion::~PairCriterion
virtual ~PairCriterion()=default
PairCriteria::PairCriterion::decide
virtual bool decide(Particle const &p1, Particle const &p2) const =0
Make a decision based on two particles.
PairCriteria
Definition
core/pair_criteria/BondCriterion.hpp:26
get_particle_data
const Particle & get_particle_data(int p_id)
Get particle data.
Definition
particle_node.cpp:172
particle_node.hpp
Particles creation and deletion.
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:395
src
core
pair_criteria
PairCriterion.hpp
Generated on Fri Nov 8 2024 02:12:53 for ESPResSo by
1.9.8