/usr/include/BALL/FORMAT/HMOFile.h is in libball1.4-dev 1.4.3~beta1-4.
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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_FORMAT_HMOFILE_H
#define BALL_FORMAT_HMOFILE_H
#include <BALL/FORMAT/lineBasedFile.h>
#ifndef BALL_KERNEL_ATOMCONTAINER_H
# include <BALL/KERNEL/atomContainer.h>
#endif
#ifndef BALL_MATHS_SURFACE_H
# include <BALL/MATHS/surface.h>
#endif
namespace BALL
{
/** HMO mesh file format.
*
* This class enables BALL to read and write the HMO format for
* polygonal meshes of surfaces. For the moment, we do not implement
* all variants allowed by HMO, but rather focus on triangular surface
* meshes. In addition, we read and write an extension to HMO (CHARGE_DATA),
* which contains information about positions and magnitudes of partially
* charged atoms in the system.
*
* \ingroup Format
*
*/
class BALL_EXPORT HMOFile
: public LineBasedFile
{
public:
/** @name Nested classes and enums
*/
//@{
class HMOCharge
{
public:
Vector3 position;
float value;
bool operator == (const HMOCharge& c) const
{
return ((position == c.position) && (value == c.value));
}
};
enum ElementType
{
L2 = 60, // line element with two nodes
L3 = 63, // line element with three nodes
T3 = 103, // triangular element with three nodes
T6 = 106, // triangular element with six nodes
Q4 = 104, // quadrilateral element with four nodes
Q8 = 108, // quadrilateral element with eight nodes
TH4 = 204, // tetrahedral element with four nodes
TH10 = 210, // tetrahedral element with ten nodes
P6 = 206, // pentahedral element with six nodes
P15 = 215, // pentahedral element with fifteen nodes
H8 = 208, // hexaedral element with eight nodes
H20 = 220 // hexaedral element with twenty nodes
};
//@}
/** @name Constructors and Destructor
*/
//@{
/// Default constructor
HMOFile();
/** Detailed constructor
* @throw Exception::FileNotFound if the file could not be opened
*/
HMOFile(const String& filename, File::OpenMode open_mode = std::ios::in);
/// Destructor
virtual ~HMOFile();
//@}
/** @name Assignment
*/
//@{
/// Clear method
virtual void clear();
//@}
/** @name Predicates
*/
//@{
/// Equality operator
bool operator == (const HMOFile& file);
//@}
/** @name Accessors
*/
//@{
/// Test for the presence of charges
bool hasCharges() const
{
return (charges_.size() > 0);
}
/// Accessor for the vector of charges
std::vector<HMOCharge>& getCharges()
{
return charges_;
}
/// Accessor for the vector of charges, const version
std::vector<HMOCharge> const& getCharges() const
{
return charges_;
}
/// Test for the presence of comments
bool hasComments() const
{
return (comments_.size() > 0);
}
/// Accessor for the vector of comments
std::vector<String>& getComments()
{
return comments_;
}
/// Accessor for the vector of comments, const version
std::vector<String> const& getComments() const
{
return comments_;
}
//@}
/** @name Public methods for file handling
*/
//@{
/** Open an HMOFile
* @throw Exception::FileNotFound if the file could not be opened
*/
virtual bool open(const String& name, File::OpenMode open_mode = std::ios::in);
/** Read the file into a Surface
*
* @throw Exception::ParseError if the file was invalid
*/
virtual bool read(Surface& surface);
/** Write a given surface to an HMO file
*
* If the vector of comments is not empty, it is prepended to the written file.
* Otherwise, a generic comment is used.
*
* Return true if the file could be written succesfully, false otherwise
*/
virtual bool write(Surface const& surface);
/** Write a given surface and the charges contained in a given AtomContainer to an HMO file
*
* If the vector of comments is not empty, it is prepended to the written file.
* Otherwise, a generic comment is used.
*
* Return true if the file could be written successfully, false otherwise
*/
virtual bool write(Surface const& surface, AtomContainer const& ac);
//@}
protected:
// The vector of charge positions and magnitudes
std::vector<HMOCharge> charges_;
// The comments contained in the original file
std::vector<String> comments_;
// read the node data
void readNodeData_(Surface& surface);
// read the element data
void readElementData_(Surface& surface);
// read the charge data
void readChargeData_();
// read until a given text is found, and store all comments along the way
bool readUntil_(String const& pattern);
// write the node section of the HMO file
void writeNodes_(Surface const& surface);
// write the elements section of the HMO file
void writeElements_(Surface const& surface);
// write the charges section of the HMO file
void writeCharges_(AtomContainer const& ac);
private:
const HMOFile& operator = (const HMOFile& file);
};
}
#endif // BALL_FORMAT_HMOFILE_H
|