libbio
Loading...
Searching...
No Matches
chemical/affinity/Affinity.h
Go to the documentation of this file.
1/*
2 * This file is a part of the Biology project by eons LLC.
3 * Biology (aka Develop Biology) is a framework for approaching software
4 * development from a natural sciences perspective.
5 *
6 * Copyright (C) 2023 Séon O'Shannon & eons LLC
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
26
27namespace bio {
28namespace chemical {
29
30class Substance;
31
36class Affinity :
37 public chemical::Class< Affinity >,
38 public ::bio::Affinity,
39 public Covalent< UnorderedMotif< physical::Attraction< Filter > > >,
40 public Covalent< UnorderedMotif< physical::Attraction< Property > > >,
41 public Covalent< UnorderedMotif< physical::Attraction< State > > >,
42 virtual public Structure
43{
44public:
45
47 chemical,
50 )
51
52
56
61
69
77 typename physical::Attraction< T >::Force GetAttractionFor(T t) const
78 {
82 if (container->IsAllocated(index)) {
83 return 0.0f;
84 }
85 return container->Access(index).template As< physical::Attraction< T > >().GetForce();
86 }
87
88 template < typename T >
90 {
91 Strength ret = 0.0f;
92 for (
93 SmartIterator itt = substance->template GetAll< T >()->End();
94 !itt.IsBeforeBeginning();
95 --itt
96 ) {
97 ret += this->GetAttractionFor< T >(itt.template As< T >());
98 }
99 return ret;
100 }
101
102};
103
104} //chemical namespace
105} //bio namespace
#define BIO_DISAMBIGUATE_ALL_CLASS_METHODS(ns, caller)
Definition ClassMethodMacros.h:112
#define BIO_SANITIZE_AT_SAFETY_LEVEL_1(test, success, failure)
Definition SanitizeMacros.h:55
Definition physical/affinity/Affinity.h:39
Definition Covalent.h:42
Definition Pointer.h:115
Definition SmartIterator.h:40
Definition chemical/affinity/Affinity.h:43
Strength MeasureAttractionAlong(Pointer< const Substance > substance) const
Definition chemical/affinity/Affinity.h:89
physical::Attraction< T >::Force GetAttractionFor(T t) const
Definition chemical/affinity/Affinity.h:77
virtual Strength GetStrengthOfAttractionTo(Pointer< const physical::Wave > wave) const
Definition chemical/affinity/Affinity.cpp:32
BIO_DEFAULT_IDENTIFIABLE_CONSTRUCTORS(chemical, Affinity, filter::Chemical()) virtual ~Affinity()
Definition chemical/common/Class.h:52
Definition Structure.h:41
Definition Substance.h:47
Definition Attraction.h:43
Wave(Pointer< Symmetry > symmetry=NULL)
Definition Wave.cpp:102
Filter Chemical()
Definition FinalCell.h:29