BALL 1.5.0
HMOFile.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_FORMAT_HMOFILE_H
6#define BALL_FORMAT_HMOFILE_H
7
9
10#ifndef BALL_KERNEL_ATOMCONTAINER_H
12#endif
13
14#ifndef BALL_MATHS_SURFACE_H
15# include <BALL/MATHS/surface.h>
16#endif
17
18namespace BALL
19{
33 : public LineBasedFile
34 {
35 public:
40 {
41 public:
43 float value;
44
45 bool operator == (const HMOCharge& c) const
46 {
47 return ((position == c.position) && (value == c.value));
48 }
49 };
50
52 {
53 L2 = 60, // line element with two nodes
54 L3 = 63, // line element with three nodes
55 T3 = 103, // triangular element with three nodes
56 T6 = 106, // triangular element with six nodes
57 Q4 = 104, // quadrilateral element with four nodes
58 Q8 = 108, // quadrilateral element with eight nodes
59 TH4 = 204, // tetrahedral element with four nodes
60 TH10 = 210, // tetrahedral element with ten nodes
61 P6 = 206, // pentahedral element with six nodes
62 P15 = 215, // pentahedral element with fifteen nodes
63 H8 = 208, // hexaedral element with eight nodes
64 H20 = 220 // hexaedral element with twenty nodes
65 };
67
71
74
78 HMOFile(const String& filename, File::OpenMode open_mode = std::ios::in);
79
81 virtual ~HMOFile();
82
84
88
90 virtual void clear();
91
93
97
99 bool operator == (const HMOFile& file);
100
102
106
108 bool hasCharges() const
109 {
110 return (charges_.size() > 0);
111 }
112
114 std::vector<HMOCharge>& getCharges()
115 {
116 return charges_;
117 }
118
120 std::vector<HMOCharge> const& getCharges() const
121 {
122 return charges_;
123 }
124
126 bool hasComments() const
127 {
128 return (comments_.size() > 0);
129 }
130
132 std::vector<String>& getComments()
133 {
134 return comments_;
135 }
136
138 std::vector<String> const& getComments() const
139 {
140 return comments_;
141 }
143
147
151 virtual bool open(const String& name, File::OpenMode open_mode = std::ios::in);
152
157 virtual bool read(Surface& surface);
158
166 virtual bool write(Surface const& surface);
167
175 virtual bool write(Surface const& surface, AtomContainer const& ac);
176
178
179 protected:
180 // The vector of charge positions and magnitudes
181 std::vector<HMOCharge> charges_;
182
183 // The comments contained in the original file
184 std::vector<String> comments_;
185
186 // read the node data
187 void readNodeData_(Surface& surface);
188
189 // read the element data
190 void readElementData_(Surface& surface);
191
192 // read the charge data
194
195 // read until a given text is found, and store all comments along the way
196 bool readUntil_(String const& pattern);
197
198 // write the node section of the HMO file
199 void writeNodes_(Surface const& surface);
200
201 // write the elements section of the HMO file
202 void writeElements_(Surface const& surface);
203
204 // write the charges section of the HMO file
206
207 private:
208 const HMOFile& operator = (const HMOFile& file);
209 };
210}
211
212#endif // BALL_FORMAT_HMOFILE_H
Definition: constants.h:13
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL_EXTERN_VARIABLE const double c
Definition: constants.h:149
void readChargeData_()
HMOFile()
Default constructor.
std::vector< HMOCharge > const & getCharges() const
Accessor for the vector of charges, const version.
Definition: HMOFile.h:120
std::vector< HMOCharge > charges_
Definition: HMOFile.h:181
std::vector< String > const & getComments() const
Accessor for the vector of comments, const version.
Definition: HMOFile.h:138
virtual bool write(Surface const &surface, AtomContainer const &ac)
HMOFile(const String &filename, File::OpenMode open_mode=std::ios::in)
virtual bool read(Surface &surface)
std::vector< String > & getComments()
Accessor for the vector of comments.
Definition: HMOFile.h:132
virtual ~HMOFile()
Destructor.
std::vector< String > comments_
Definition: HMOFile.h:184
virtual void clear()
Clear method.
bool readUntil_(String const &pattern)
std::vector< HMOCharge > & getCharges()
Accessor for the vector of charges.
Definition: HMOFile.h:114
virtual bool write(Surface const &surface)
void readNodeData_(Surface &surface)
bool hasComments() const
Test for the presence of comments.
Definition: HMOFile.h:126
void writeCharges_(AtomContainer const &ac)
void writeElements_(Surface const &surface)
virtual bool open(const String &name, File::OpenMode open_mode=std::ios::in)
void writeNodes_(Surface const &surface)
bool hasCharges() const
Test for the presence of charges.
Definition: HMOFile.h:108
void readElementData_(Surface &surface)
std::ios::openmode OpenMode
Definition: file.h:165
#define BALL_EXPORT
Definition: COMMON/global.h:50