Skip to content

Commit

Permalink
Move typename for mixing to MixingRuleBase and use where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
HomesGH committed Jul 30, 2024
1 parent 050d235 commit 45fc874
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ensemble/EnsembleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Ensemble {
std::map<std::string, int> _componentnamesToIds;
// The mixing rules (xi,eta) can be accessed by _mixingrules[cid1][cid2]
// Note that cid1 < cid2 and that cid is in internal format, i.e. starts with 0
std::map<int, std::map<int, std::shared_ptr<MixingRuleBase>>> _mixingrules;
MixingRuleBase::MixRulesType _mixingrules;
DomainBase* _domain;
Type _type = undefined;

Expand Down
3 changes: 2 additions & 1 deletion src/molecules/Comp2Param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

#include "utils/Logger.h"
#include "Simulation.h"
#include "molecules/mixingrules/MixingRuleBase.h"


void Comp2Param::initialize(
const std::vector<Component>& components, const MixRulesType & mixcoeff,
const std::vector<Component>& components, const MixingRuleBase::MixRulesType & mixcoeff,
double epsRF, double rc, double rcLJ)
{
m_numcomp = components.size();
Expand Down
8 changes: 2 additions & 6 deletions src/molecules/Comp2Param.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define COMP2PARAM_H_

#include <vector>
#include <memory>

#include "molecules/Component.h"
#include "molecules/Array2D.h"
Expand All @@ -15,9 +14,6 @@
* @author Martin Bernreuther <[email protected]> et al. (2010)
*/
class Comp2Param {

using MixRulesType = std::map<int,std::map<int,std::shared_ptr<MixingRuleBase>>>;

public:
/** Create a new empty parameter stream. */
Comp2Param() : m_numcomp(0), m_ssparatbl(0,0) {}
Expand All @@ -26,7 +22,7 @@ class Comp2Param {
* the given components and parameters.
*/
Comp2Param(const std::vector<Component>& components,
const MixRulesType & mixcoeff,
const MixingRuleBase::MixRulesType & mixcoeff,
double epsRF, double rc, double rcLJ) :
m_numcomp(components.size()), m_ssparatbl(m_numcomp,m_numcomp)
{
Expand All @@ -43,7 +39,7 @@ class Comp2Param {
* The order of the entries must correspond to the
* PotForce() function found in potforce.h reading the stream
*/
void initialize(const std::vector<Component>& components, const MixRulesType & mixcoeff, double epsRF, double rc, double rcLJ);
void initialize(const std::vector<Component>& components, const MixingRuleBase::MixRulesType & mixcoeff, double epsRF, double rc, double rcLJ);

private:
unsigned int m_numcomp; /**< number of components */
Expand Down
4 changes: 4 additions & 0 deletions src/molecules/mixingrules/MixingRuleBase.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#ifndef MIXINGRULE_BASE_H_
#define MIXINGRULE_BASE_H_

#include <map>
#include <string>
#include <vector>
#include <memory>

class XMLfileUnits;

class MixingRuleBase {
public:
using MixRulesType = typename std::map<int,std::map<int,std::shared_ptr<MixingRuleBase>>>;

virtual ~MixingRuleBase() = default;

virtual void readXML(const XMLfileUnits& xmlconfig);
Expand Down

0 comments on commit 45fc874

Please sign in to comment.