/usr/include/camitk-3.3/libraries/pml/BasicAtomProperties.h is in libcamitk3-dev 3.3.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | /*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef BASICATOMPROPERTIES_H
#define BASICATOMPROPERTIES_H
#include "PhysicalModelIO.h"
#include "StructureProperties.h"
/**
* @ingroup group_cepmodeling_libraries_pml
*
* @brief
* This class is the basic Atom Properties class.
* You should derive from this class a AtomProperties class and use it to implement your own custom stuff.
* This is a pure virtual class.
*
**/
class BasicAtomProperties : public StructureProperties {
public:
/** Default constructor : set the position to the origin, and generate an unique index
* @param myPM the physical model the atom belongs to
*/
BasicAtomProperties(PhysicalModel *myPM);
/** constructor from xml node: try to read and get the properties from xml
* @param myPM the physical model the atom belongs to
* @param n the xml node to read to get the information
*/
BasicAtomProperties(PhysicalModel *myPM, xmlNodePtr n);
/** set the position to the origin
* @param myPM the physical model the atom belongs to
* @param ind an unique index
*/
BasicAtomProperties(PhysicalModel *myPM, const unsigned int ind);
/** generate an unique index.
* @param myPM the physical model the atom belongs to
* @param pos the initial position
*/
BasicAtomProperties(PhysicalModel *myPM, const double pos[3]);
/** everything is given here
* @param myPM the physical model the atom belongs to
* @param pos the initial position
* @param ind an unique index
*/
BasicAtomProperties(PhysicalModel *myPM, const unsigned int ind, const double pos[3]);
/// the destructor...
virtual ~BasicAtomProperties();
/// print to an output stream in "pseudo" XML format.
virtual void xmlPrint(std::ostream &) =0;
/** Reinitialize the unique index to zero (usually that what you want to do when you
* start to load a new PhysicalModel
*/
static void resetUniqueIndex();
/// get the position of the atom (array of 3 doubles)
void getPosition(double pos[3]) const;
/// set the position of the atom
void setPosition(const double [3]);
/// set the position of the atom
void setPosition(const double, const double, const double);
/** change the position pointer.
* This is useful to allocate a big bunch of memory with all the position
* in order to improve memory cache usage.
* \note this memory is not deleted/cleaned in ~BasicAtomProperties (the destructor)
*
* @param ptr the pointer to the memory (should have enough space for storing double[3]
* @param update update the new memory space using the previously stored position
*/
void setPositionPointer(double *ptr, bool update = true);
protected:
/// write the default xml properties (beginning)
void beginXML(std::ostream &);
/// write the default xml properties (end)
void endXML(std::ostream &);
private:
/// unique number (used to generate unique index for atoms if not given at the instanciation)
static unsigned int maxUniqueIndex;
/** allocate the memory needed for the position (double[3]).
* This place in memory is a default, it can be changed using setPositionPointer(..).
* This method is called in all the constructors, and only there.
*/
void allocate();
/// Pointer to the memory triplet that stores the atom's position
double *X;
/// true only if the memory used for the position was allocated in the constructor and not changed afterwards
bool allocated;
};
// --------------- inlines ---------------
inline void BasicAtomProperties::getPosition(double pos[3]) const {
pos[0]=X[0]; pos[1]=X[1]; pos[2]=X[2];
}
inline void BasicAtomProperties::setPosition(const double pos[3]) {
X[0]=pos[0]; X[1]=pos[1]; X[2]=pos[2];
}
inline void BasicAtomProperties::setPosition(const double x,const double y,const double z) {
X[0]=x; X[1]=y; X[2]=z;
}
#endif //BasicAtomProperties_H
|