[cee0b57] | 1 | /*
|
---|
| 2 | * molecule_pointcloud.cpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Oct 5, 2009
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[112b09] | 8 | #include "Helpers/MemDebug.hpp"
|
---|
| 9 |
|
---|
[f66195] | 10 | #include "atom.hpp"
|
---|
[cee0b57] | 11 | #include "config.hpp"
|
---|
[9879f6] | 12 | #include "info.hpp"
|
---|
[cee0b57] | 13 | #include "memoryallocator.hpp"
|
---|
| 14 | #include "molecule.hpp"
|
---|
| 15 |
|
---|
| 16 | /************************************* Functions for class molecule *********************************/
|
---|
| 17 |
|
---|
[6a7f78c] | 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 | };
|
---|
[cee0b57] | 25 |
|
---|
| 26 | /** Determine center of all atoms.
|
---|
| 27 | * \param *out output stream for debugging
|
---|
| 28 | * \return pointer to allocated with central coordinates
|
---|
| 29 | */
|
---|
[e138de] | 30 | Vector *molecule::GetCenter() const
|
---|
[cee0b57] | 31 | {
|
---|
[e138de] | 32 | Vector *center = DetermineCenterOfAll();
|
---|
[cee0b57] | 33 | return center;
|
---|
| 34 | };
|
---|
| 35 |
|
---|
| 36 |
|
---|
[9879f6] | 37 | /** PointCloud implementation of GoPoint
|
---|
| 38 | * Uses atoms and STL stuff.
|
---|
[71b20e] | 39 | */
|
---|
[9879f6] | 40 | TesselPoint* molecule::GetPoint() const
|
---|
[71b20e] | 41 | {
|
---|
[9879f6] | 42 | return (*InternalPointer);
|
---|
[71b20e] | 43 | };
|
---|
| 44 |
|
---|
[9879f6] | 45 | /** PointCloud implementation of GoToNext.
|
---|
| 46 | * Uses atoms and STL stuff.
|
---|
[cee0b57] | 47 | */
|
---|
[776b64] | 48 | void molecule::GoToNext() const
|
---|
[cee0b57] | 49 | {
|
---|
[d3347e] | 50 | if (InternalPointer != atoms.end())
|
---|
[9879f6] | 51 | InternalPointer++;
|
---|
[cee0b57] | 52 | };
|
---|
| 53 |
|
---|
[9879f6] | 54 | /** PointCloud implementation of GoToFirst.
|
---|
| 55 | * Uses atoms and STL stuff.
|
---|
[cee0b57] | 56 | */
|
---|
[776b64] | 57 | void molecule::GoToFirst() const
|
---|
[cee0b57] | 58 | {
|
---|
[274d45] | 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));
|
---|
[cee0b57] | 65 | };
|
---|
| 66 |
|
---|
[9879f6] | 67 | /** PointCloud implementation of IsEmpty.
|
---|
| 68 | * Uses atoms and STL stuff.
|
---|
[cee0b57] | 69 | */
|
---|
[776b64] | 70 | bool molecule::IsEmpty() const
|
---|
[cee0b57] | 71 | {
|
---|
[9879f6] | 72 | return (empty());
|
---|
[cee0b57] | 73 | };
|
---|
| 74 |
|
---|
[9879f6] | 75 | /** PointCloud implementation of IsLast.
|
---|
| 76 | * Uses atoms and STL stuff.
|
---|
[cee0b57] | 77 | */
|
---|
[776b64] | 78 | bool molecule::IsEnd() const
|
---|
[cee0b57] | 79 | {
|
---|
[d3347e] | 80 | return (InternalPointer == atoms.end());
|
---|
[cee0b57] | 81 | };
|
---|
[c72112] | 82 |
|
---|
| 83 | int molecule::GetMaxId() const {
|
---|
| 84 | return getAtomCount();
|
---|
| 85 | }
|
---|