Commit 27380daf authored by Christoph Junghans's avatar Christoph Junghans

formatting with clang-format-7.0.1

parent 1be95683
......@@ -40,7 +40,7 @@ namespace csg {
*
**/
class BaseBead {
public:
public:
/**
* destructor
*/
......@@ -118,9 +118,11 @@ public:
/** set has position to true */
void HasPos(bool true_or_false) { bead_position_set_ = true_or_false; }
protected:
protected:
BaseBead()
: topology_item_(nullptr), molecule_item_(nullptr), mass_(0.0),
: topology_item_(nullptr),
molecule_item_(nullptr),
mass_(0.0),
bead_position_set_(false){};
TopologyItem topology_item_;
......@@ -146,7 +148,7 @@ inline const TOOLS::vec &BaseBead::getPos() const {
"Cannot get bead position as it has not been set.");
return bead_position_;
}
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif // _VOTCA_CSG_BASEBEAD_H
#endif // _VOTCA_CSG_BASEBEAD_H
......@@ -47,7 +47,7 @@ using namespace votca::tools;
* \todo make sure bead belongs to topology
**/
class Bead : public BaseBead {
public:
public:
/**
* destructor
*/
......@@ -292,7 +292,7 @@ public:
parent_beads_.push_back(parent_bead_id);
}
protected:
protected:
std::vector<int> parent_beads_;
// TODO: this is so far a pointer. this should change! each bead should have
......@@ -395,7 +395,7 @@ inline void Bead::HasU(bool b) { bU_ = b; }
inline void Bead::HasV(bool b) { bV_ = b; }
inline void Bead::HasW(bool b) { bW_ = b; }
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif // _VOTCA_CSG_BEAD_H
#endif // _VOTCA_CSG_BEAD_H
......@@ -35,7 +35,7 @@ using namespace votca::tools;
*/
class BeadList : public std::list<Bead *> {
public:
public:
BeadList(){};
~BeadList() {}
......@@ -48,11 +48,11 @@ public:
Topology *getTopology() { return _topology; }
private:
private:
Topology *_topology;
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_BEADLIST_H */
......@@ -107,7 +107,7 @@ namespace csg {
**/
class BeadMotif : public BeadStructure<BaseBead> {
public:
public:
enum MotifType {
empty,
single_bead,
......@@ -156,7 +156,7 @@ public:
**/
void ConnectBeads(int bead1_id, int bead2_id);
private:
private:
MotifType type_ = MotifType::undefined;
bool junctionsUpToDate_ = false;
bool type_up_to_date_ = false;
......@@ -172,7 +172,7 @@ private:
bool isLoop_();
bool isFusedRing_();
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif // VOTCA_CSG_BEADMOTIF_H
#endif // VOTCA_CSG_BEADMOTIF_H
......@@ -35,7 +35,8 @@ namespace csg {
* @param[in] - reference to beadstructure
* @return - a container of beadmotifs
**/
template <class T> T breakIntoMotifs(BeadStructure<BaseBead> &beadstructure) {
template <class T>
T breakIntoMotifs(BeadStructure<BaseBead> &beadstructure) {
T bead_motifs;
std::vector<BeadStructure<BaseBead>> structures =
breakIntoStructures(beadstructure);
......@@ -77,9 +78,9 @@ template <class T> T breakIntoMotifs(BeadStructure<BaseBead> &beadstructure) {
**/
std::pair<std::unordered_map<int, BeadMotif>, BeadMotifConnector>
breakIntoSimpleMotifs(BeadMotif beadmotif);
breakIntoSimpleMotifs(BeadMotif beadmotif);
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif // VOTCA_CSG_BEADMOTIFALGORITHMS_H
#endif // VOTCA_CSG_BEADMOTIFALGORITHMS_H
......@@ -30,7 +30,7 @@ namespace csg {
*/
class BeadPair : public std::pair<Bead *, Bead *> {
public:
public:
BeadPair() {}
BeadPair(Bead *bead1, Bead *bead2, tools::vec r)
: std::pair<Bead *, Bead *>(bead1, bead2), _r(r), _dist(abs(r)) {}
......@@ -42,12 +42,12 @@ public:
/// \brief the distance of the beads
double &dist() { return _dist; }
protected:
protected:
tools::vec _r;
double _dist;
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_BEADPAIR_H */
......@@ -50,8 +50,9 @@ namespace csg {
* Here BeadStructure 1 and 2 will compare equal
*
**/
template <class T> class BeadStructure {
public:
template <class T>
class BeadStructure {
public:
~BeadStructure() {}
/**
......@@ -110,7 +111,7 @@ public:
bool BeadExist(int bead_id) const { return beads_.count(bead_id); }
protected:
protected:
void InitializeGraph_();
void CalculateStructure_();
TOOLS::GraphNode BaseBeadToGraphNode_(T *basebead);
......@@ -130,7 +131,8 @@ protected:
* Internal Functions *
**********************/
template <class T> void BeadStructure<T>::InitializeGraph_() {
template <class T>
void BeadStructure<T>::InitializeGraph_() {
if (!graphUpToDate) {
std::vector<TOOLS::Edge> connections_vector;
for (const TOOLS::Edge &edge : connections_) {
......@@ -146,7 +148,8 @@ template <class T> void BeadStructure<T>::InitializeGraph_() {
}
}
template <class T> void BeadStructure<T>::CalculateStructure_() {
template <class T>
void BeadStructure<T>::CalculateStructure_() {
InitializeGraph_();
if (!structureIdUpToDate) {
......@@ -175,7 +178,8 @@ TOOLS::GraphNode BeadStructure<T>::BaseBeadToGraphNode_(T *basebead) {
* Public Facing Functions *
***************************/
template <class T> void BeadStructure<T>::AddBead(T *bead) {
template <class T>
void BeadStructure<T>::AddBead(T *bead) {
if (beads_.count(bead->getId())) {
std::string err = "Cannot add bead with Id ";
err += std::to_string(bead->getId());
......@@ -213,12 +217,14 @@ void BeadStructure<T>::ConnectBeads(int bead1_id, int bead2_id) {
}
}
template <class T> TOOLS::Graph BeadStructure<T>::getGraph() {
template <class T>
TOOLS::Graph BeadStructure<T>::getGraph() {
InitializeGraph_();
return graph_;
}
template <class T> bool BeadStructure<T>::isSingleStructure() {
template <class T>
bool BeadStructure<T>::isSingleStructure() {
InitializeGraph_();
if (single_structureUpToDate_ == false) {
......@@ -259,7 +265,8 @@ bool BeadStructure<T>::isStructureEquivalent(BeadStructure<T> &beadstructure) {
return structure_id_.compare(beadstructure.structure_id_) == 0;
}
template <class T> std::vector<T *> BeadStructure<T>::getNeighBeads(int index) {
template <class T>
std::vector<T *> BeadStructure<T>::getNeighBeads(int index) {
if (!graphUpToDate) {
InitializeGraph_();
}
......@@ -271,12 +278,13 @@ template <class T> std::vector<T *> BeadStructure<T>::getNeighBeads(int index) {
return neighbeads;
}
template <class T> T *BeadStructure<T>::getBead(int index) {
template <class T>
T *BeadStructure<T>::getBead(int index) {
assert(beads_.count(index));
return beads_[index];
}
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif
......@@ -32,11 +32,15 @@ namespace csg {
*/
class BeadTriple : public std::tuple<Bead *, Bead *, Bead *> {
public:
public:
BeadTriple() {}
BeadTriple(Bead *bead1, Bead *bead2, Bead *bead3, vec r12, vec r13, vec r23)
: std::tuple<Bead *, Bead *, Bead *>(bead1, bead2, bead3), _r12(r12),
_r13(r13), _r23(r23), _dist12(abs(r12)), _dist13(abs(r13)),
: std::tuple<Bead *, Bead *, Bead *>(bead1, bead2, bead3),
_r12(r12),
_r13(r13),
_r23(r23),
_dist12(abs(r12)),
_dist13(abs(r13)),
_dist23(abs(r23)) {}
virtual ~BeadTriple() {}
......@@ -55,7 +59,7 @@ public:
double &dist13() { return _dist13; }
double &dist23() { return _dist23; }
protected:
protected:
vec _r12;
vec _r13;
vec _r23;
......@@ -64,7 +68,7 @@ protected:
double _dist23;
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_BEADTRIPLE_H */
......@@ -32,12 +32,12 @@ using namespace votca::tools;
several beads can share the same type.
*/
class BeadType : public TopologyItem {
public:
public:
const int &getId() const { return _id; }
const std::string &getName() const { return _name; }
void setName(const std::string &name) { _name = name; }
private:
private:
int _id;
std::string _name;
......@@ -46,7 +46,7 @@ private:
friend class Topology;
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_BEADTYPE_H */
......@@ -26,7 +26,7 @@ using namespace votca::tools;
class BoundaryCondition {
public:
public:
virtual ~BoundaryCondition(){};
/**
......@@ -56,11 +56,11 @@ public:
enum eBoxtype { typeAuto = 0, typeTriclinic, typeOrthorhombic, typeOpen };
virtual eBoxtype getBoxType() = 0;
protected:
protected:
matrix _box;
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_BOUNDARYCONDITION_H */
......@@ -52,7 +52,7 @@ namespace TOOLS = votca::tools;
*/
class CGEngine {
public:
public:
CGEngine();
~CGEngine();
......@@ -81,7 +81,7 @@ public:
*/
bool IsIgnored(std::string ident);
private:
private:
std::map<std::string, CGMoleculeDef *> _molecule_defs;
std::list<std::string> _ignores;
......@@ -96,21 +96,19 @@ inline CGMoleculeDef *CGEngine::getMoleculeDef(std::string name) {
}
iter = _molecule_defs.find(name);
if (iter == _molecule_defs.end())
return NULL;
if (iter == _molecule_defs.end()) return NULL;
return (*iter).second;
}
inline bool CGEngine::IsIgnored(std::string ident) {
for (std::list<std::string>::iterator iter = _ignores.begin();
iter != _ignores.end(); ++iter) {
if (wildcmp(iter->c_str(), ident.c_str()))
return true;
if (wildcmp(iter->c_str(), ident.c_str())) return true;
}
return false;
}
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_CGENGINE_H */
......@@ -43,7 +43,7 @@ using namespace votca::tools;
\todo check for consistency of xml file, seperate xml parser and class!!
*/
class CGMoleculeDef {
public:
public:
CGMoleculeDef() {}
~CGMoleculeDef();
......@@ -55,7 +55,7 @@ public:
const std::string &getName() { return _name; }
const std::string &getIdent() { return _ident; }
private:
private:
Property _options;
struct beaddef_t {
......@@ -90,7 +90,7 @@ private:
Property *getMapByName(const std::string &name);
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_CGMOLECULEDEF_H */
......@@ -35,7 +35,7 @@ using namespace votca::tools;
*/
class CGObserver {
public:
public:
/// \brief called before the first frame
virtual void BeginCG(Topology *top, Topology *top_atom = 0) = 0;
/// \brief called after the last frame
......@@ -44,7 +44,7 @@ public:
virtual void EvalConfiguration(Topology *top, Topology *top_atom = 0) = 0;
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_CGOBSERVER_H */
......@@ -31,7 +31,7 @@ namespace csg {
using namespace votca::tools;
class CsgApplication : public Application {
public:
public:
CsgApplication();
~CsgApplication();
......@@ -99,7 +99,7 @@ public:
*
*/
class Worker : public Thread {
public:
public:
Worker();
~Worker();
......@@ -109,7 +109,7 @@ public:
/// \brief returns worker id
int getId() { return _id; }
protected:
protected:
CsgApplication *_app;
Topology _top, _top_cg;
TopologyMap *_map;
......@@ -146,7 +146,7 @@ public:
*/
virtual void MergeWorker(Worker *worker);
protected:
protected:
std::list<CGObserver *> _observers;
bool _do_mapping;
std::vector<Worker *> _myWorkers;
......@@ -169,7 +169,7 @@ inline void CsgApplication::AddObserver(CGObserver *observer) {
inline CsgApplication::Worker::Worker() : _app(NULL), _map(NULL), _id(-1) {}
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_APPLICATION_H */
......@@ -34,15 +34,17 @@ class Topology;
class Bead;
class ExclusionList {
public:
public:
ExclusionList() {}
~ExclusionList() { Clear(); }
void Clear(void);
template <typename iteratable> void Remove(iteratable &l);
template <typename iteratable>
void Remove(iteratable &l);
template <typename iteratable> void ExcludeList(iteratable &l);
template <typename iteratable>
void ExcludeList(iteratable &l);
struct exclusion_t {
Bead *_atom;
......@@ -66,7 +68,7 @@ public:
void RemoveExclusion(Bead *bead1, Bead *bead2);
private:
private:
std::list<exclusion_t *> _exclusions;
std::map<Bead *, exclusion_t *> _excl_by_bead;
......@@ -75,8 +77,7 @@ private:
inline ExclusionList::exclusion_t *ExclusionList::GetExclusions(Bead *bead) {
std::map<Bead *, exclusion_t *>::iterator iter = _excl_by_bead.find(bead);
if (iter == _excl_by_bead.end())
return NULL;
if (iter == _excl_by_bead.end()) return NULL;
return (*iter).second;
}
......@@ -108,12 +109,9 @@ inline void ExclusionList::InsertExclusion(Bead *bead1_, iteratable &l) {
Bead *bead1 = bead1_;
;
Bead *bead2 = *i;
if (bead2->getId() < bead1->getId())
std::swap(bead1, bead2);
if (bead1 == bead2)
continue;
if (IsExcluded(bead1, bead2))
continue;
if (bead2->getId() < bead1->getId()) std::swap(bead1, bead2);
if (bead1 == bead2) continue;
if (IsExcluded(bead1, bead2)) continue;
exclusion_t *e;
if ((e = GetExclusions(bead1)) == NULL) {
e = new exclusion_t;
......@@ -127,12 +125,9 @@ inline void ExclusionList::InsertExclusion(Bead *bead1_, iteratable &l) {
// template<>
inline void ExclusionList::InsertExclusion(Bead *bead1, Bead *bead2) {
if (bead2->getId() < bead1->getId())
std::swap(bead1, bead2);
if (bead1 == bead2)
return;
if (IsExcluded(bead1, bead2))
return;
if (bead2->getId() < bead1->getId()) std::swap(bead1, bead2);
if (bead1 == bead2) return;
if (IsExcluded(bead1, bead2)) return;
exclusion_t *e;
if ((e = GetExclusions(bead1)) == NULL) {
......@@ -145,18 +140,13 @@ inline void ExclusionList::InsertExclusion(Bead *bead1, Bead *bead2) {
}
inline void ExclusionList::RemoveExclusion(Bead *bead1, Bead *bead2) {
if (bead2->getId() < bead1->getId())
std::swap(bead1, bead2);
if (bead1 == bead2)
return;
if (!IsExcluded(bead1, bead2))
return;
if (bead2->getId() < bead1->getId()) std::swap(bead1, bead2);
if (bead1 == bead2) return;
if (!IsExcluded(bead1, bead2)) return;
std::list<exclusion_t *>::iterator ex;
for (ex = _exclusions.begin(); ex != _exclusions.end(); ++ex)
if ((*ex)->_atom == bead1)
break;
if (ex == _exclusions.end())
return;
if ((*ex)->_atom == bead1) break;
if (ex == _exclusions.end()) return;
(*ex)->_exclude.remove(bead2);
if ((*ex)->_exclude.empty()) {
(*ex) = NULL;
......@@ -167,7 +157,7 @@ inline void ExclusionList::RemoveExclusion(Bead *bead1, Bead *bead2) {
std::ostream &operator<<(std::ostream &out, ExclusionList &ex);
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_EXCLUSIONLIST_H */
......@@ -29,13 +29,14 @@ namespace TOOLS = votca::tools;
template <typename T>
class FileFormatFactory : public TOOLS::ObjectFactory<std::string, T> {
public:
public:
FileFormatFactory() {}
T *Create(const std::string &file);
};
template <typename T> T *FileFormatFactory<T>::Create(const std::string &file) {
template <typename T>
T *FileFormatFactory<T>::Create(const std::string &file) {
std::string filetype = "";
TOOLS::Tokenizer tok(file, ".");
for (TOOLS::Tokenizer::iterator iter = tok.begin(); iter != tok.end(); iter++)
......@@ -47,7 +48,7 @@ template <typename T> T *FileFormatFactory<T>::Create(const std::string &file) {
return NULL;
}
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_FILEFORMATFACTORY_H */
......@@ -41,7 +41,7 @@ void imcio_read_matrix(const std::string &file, Eigen::MatrixXd &gmc);
void imcio_read_index(const std::string &file, std::vector<std::string> &names,
std::vector<RangeParser> &ranges);
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca
#endif /* _VOTCA_CSG_IMCIO_H */
This diff is collapsed.
......@@ -32,7 +32,7 @@ class BeadMap;
Mapper class, collection of maps
*******************************************************/
class Map {
public:
public:
Map(Molecule &in, Molecule &out) : _in(in), _out(out) {}
~Map();
......@@ -40,7 +40,7 @@ public:
void Apply();
protected:
protected:
Molecule _in, _out;
std::vector<BeadMap *> _maps;
};
......@@ -49,13 +49,13 @@ protected:
Interface for all maps
*******************************************************/
class BeadMap {
public:
public:
virtual ~BeadMap(){};
virtual void Apply() = 0;
virtual void Initialize(Molecule *in, Bead *out, Property *opts_map,
Property *opts_bead);
protected:
protected:
Molecule *_in;
Bead *_out;
Property *_opts_map;
......@@ -74,14 +74,14 @@ inline void BeadMap::Initialize(Molecule *in, Bead *out, Property *opts_bead,
Linear map for spherical beads
*******************************************************/
class Map_Sphere : public BeadMap {
public:
public:
Map_Sphere() {}
void Apply();
void Initialize(Molecule *in, Bead *out, Property *opts_bead,
Property *opts_map);
protected:
protected:
void AddElem(Bead *in, double weight, double force_weight);
struct element_t {
......@@ -104,14 +104,14 @@ inline void Map_Sphere::AddElem(Bead *in, double weight, double force_weight) {
Linear map for ellipsoidal bead
*******************************************************/
class Map_Ellipsoid : public Map_Sphere {
public:
public:
Map_Ellipsoid() {}
void Apply();
protected:
protected:
};
} // namespace csg
} // namespace votca
} // namespace csg
} // namespace votca