| 1 | /*
|
|---|
| 2 | * molecule_pointcloud.cpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Oct 5, 2009
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "Helpers/MemDebug.hpp"
|
|---|
| 9 |
|
|---|
| 10 | #include "atom.hpp"
|
|---|
| 11 | #include "config.hpp"
|
|---|
| 12 | #include "info.hpp"
|
|---|
| 13 | #include "memoryallocator.hpp"
|
|---|
| 14 | #include "molecule.hpp"
|
|---|
| 15 |
|
|---|
| 16 | /************************************* Functions for class molecule *********************************/
|
|---|
| 17 |
|
|---|
| 18 | /** Returns a name for this point cloud, here the molecule's name.
|
|---|
| 19 | * \return name of point cloud
|
|---|
| 20 | */
|
|---|
| 21 | const char * const molecule::GetName() const
|
|---|
| 22 | {
|
|---|
| 23 | return name;
|
|---|
| 24 | };
|
|---|
| 25 |
|
|---|
| 26 | /** Determine center of all atoms.
|
|---|
| 27 | * \param *out output stream for debugging
|
|---|
| 28 | * \return pointer to allocated with central coordinates
|
|---|
| 29 | */
|
|---|
| 30 | Vector *molecule::GetCenter() const
|
|---|
| 31 | {
|
|---|
| 32 | Vector *center = DetermineCenterOfAll();
|
|---|
| 33 | return center;
|
|---|
| 34 | };
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | /** PointCloud implementation of GoPoint
|
|---|
| 38 | * Uses atoms and STL stuff.
|
|---|
| 39 | */
|
|---|
| 40 | TesselPoint* molecule::GetPoint() const
|
|---|
| 41 | {
|
|---|
| 42 | return (*InternalPointer);
|
|---|
| 43 | };
|
|---|
| 44 |
|
|---|
| 45 | /** PointCloud implementation of GoToNext.
|
|---|
| 46 | * Uses atoms and STL stuff.
|
|---|
| 47 | */
|
|---|
| 48 | void molecule::GoToNext() const
|
|---|
| 49 | {
|
|---|
| 50 | if (InternalPointer != atoms.end())
|
|---|
| 51 | InternalPointer++;
|
|---|
| 52 | };
|
|---|
| 53 |
|
|---|
| 54 | /** PointCloud implementation of GoToFirst.
|
|---|
| 55 | * Uses atoms and STL stuff.
|
|---|
| 56 | */
|
|---|
| 57 | void molecule::GoToFirst() const
|
|---|
| 58 | {
|
|---|
| 59 | // evil hack necessary because
|
|---|
| 60 | // -# although InternalPointer is mutable
|
|---|
| 61 | // -# only const_iterator begin() is called due to const in the function declaration above
|
|---|
| 62 | // -# and there is no cast from const_iterator to const iterator
|
|---|
| 63 | atomSet::const_iterator test = begin();
|
|---|
| 64 | InternalPointer = *(reinterpret_cast<atomSet::iterator *>(&test));
|
|---|
| 65 | };
|
|---|
| 66 |
|
|---|
| 67 | /** PointCloud implementation of IsEmpty.
|
|---|
| 68 | * Uses atoms and STL stuff.
|
|---|
| 69 | */
|
|---|
| 70 | bool molecule::IsEmpty() const
|
|---|
| 71 | {
|
|---|
| 72 | return (empty());
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 | /** PointCloud implementation of IsLast.
|
|---|
| 76 | * Uses atoms and STL stuff.
|
|---|
| 77 | */
|
|---|
| 78 | bool molecule::IsEnd() const
|
|---|
| 79 | {
|
|---|
| 80 | return (InternalPointer == atoms.end());
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | int molecule::GetMaxId() const {
|
|---|
| 84 | return getAtomCount();
|
|---|
| 85 | }
|
|---|