LeMonADE-project / LeMonADE

Library for Monte Carlo Simulation applying the Bond Fluctuation Model
Other
3 stars 11 forks source link

AddMonomer in Molecules isn't general enough #65

Open Bondoki opened 7 years ago

Bondoki commented 7 years ago

The AddMonomer function in Molecules:

template < class CoordinateType >
  uint32_t addMonomer(const CoordinateType& x, const CoordinateType& y, const CoordinateType& z)
  {
      vertex_type monomer;
      monomer.setX(x);
      monomer.setY(y);
      monomer.setZ(z);
      vertices.push_back(monomer);

      return (vertices.size()-1);
}

has two problems:

  1. the reference const CoordinateType& isn't necessary -> simple copy is sufficient
  2. implicit this functions assumes that vertex_type has implicit the functionality of Vector3D

There is already a more general implementation

uint32_t addMonomer(vertex_type monomer)
  {
      vertices.push_back(monomer);
      return (vertices.size()-1);
}

What shall we do? Delete the first implementation? Or at least rewrite it?