Loading...
Searching...
No Matches
HMOFile.h
Go to the documentation of this file.
// -*- 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
{
class BALL_EXPORT HMOFile
: public LineBasedFile
{
public:
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
};
HMOFile();
HMOFile(const String& filename, File::OpenMode open_mode = std::ios::in);
virtual ~HMOFile();
virtual void clear();
bool operator == (const HMOFile& file);
bool hasCharges() const
{
return (charges_.size() > 0);
}
std::vector<HMOCharge>& getCharges()
{
return charges_;
}
std::vector<HMOCharge> const& getCharges() const
{
return charges_;
}
bool hasComments() const
{
return (comments_.size() > 0);
}
std::vector<String>& getComments()
{
return comments_;
}
std::vector<String> const& getComments() const
{
return comments_;
}
virtual bool open(const String& name, File::OpenMode open_mode = std::ios::in);
virtual bool read(Surface& surface);
virtual bool write(Surface const& surface);
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
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
atomContainer.h
BALL::AtomContainer
Definition atomContainer.h:32
BALL::File::OpenMode
std::ios::openmode OpenMode
Definition file.h:165
BALL::HMOFile::HMOCharge
Definition HMOFile.h:40
BALL::HMOFile::HMOCharge::position
Vector3 position
Definition HMOFile.h:42
BALL::HMOFile::HMOCharge::value
float value
Definition HMOFile.h:43
BALL::HMOFile::readChargeData_
void readChargeData_()
BALL::HMOFile::HMOFile
HMOFile()
Default constructor.
BALL::HMOFile::getCharges
std::vector< HMOCharge > const & getCharges() const
Accessor for the vector of charges, const version.
Definition HMOFile.h:120
BALL::HMOFile::charges_
std::vector< HMOCharge > charges_
Definition HMOFile.h:181
BALL::HMOFile::getComments
std::vector< String > const & getComments() const
Accessor for the vector of comments, const version.
Definition HMOFile.h:138
BALL::HMOFile::write
virtual bool write(Surface const &surface, AtomContainer const &ac)
BALL::HMOFile::HMOFile
HMOFile(const String &filename, File::OpenMode open_mode=std::ios::in)
BALL::HMOFile::read
virtual bool read(Surface &surface)
BALL::HMOFile::getComments
std::vector< String > & getComments()
Accessor for the vector of comments.
Definition HMOFile.h:132
BALL::HMOFile::~HMOFile
virtual ~HMOFile()
Destructor.
BALL::HMOFile::comments_
std::vector< String > comments_
Definition HMOFile.h:184
BALL::HMOFile::clear
virtual void clear()
Clear method.
BALL::HMOFile::readUntil_
bool readUntil_(String const &pattern)
BALL::HMOFile::getCharges
std::vector< HMOCharge > & getCharges()
Accessor for the vector of charges.
Definition HMOFile.h:114
BALL::HMOFile::write
virtual bool write(Surface const &surface)
BALL::HMOFile::ElementType
ElementType
Definition HMOFile.h:52
BALL::HMOFile::Q4
@ Q4
Definition HMOFile.h:57
BALL::HMOFile::T3
@ T3
Definition HMOFile.h:55
BALL::HMOFile::L2
@ L2
Definition HMOFile.h:53
BALL::HMOFile::Q8
@ Q8
Definition HMOFile.h:58
BALL::HMOFile::T6
@ T6
Definition HMOFile.h:56
BALL::HMOFile::H20
@ H20
Definition HMOFile.h:64
BALL::HMOFile::H8
@ H8
Definition HMOFile.h:63
BALL::HMOFile::L3
@ L3
Definition HMOFile.h:54
BALL::HMOFile::P15
@ P15
Definition HMOFile.h:62
BALL::HMOFile::TH10
@ TH10
Definition HMOFile.h:60
BALL::HMOFile::TH4
@ TH4
Definition HMOFile.h:59
BALL::HMOFile::P6
@ P6
Definition HMOFile.h:61
BALL::HMOFile::readNodeData_
void readNodeData_(Surface &surface)
BALL::HMOFile::hasComments
bool hasComments() const
Test for the presence of comments.
Definition HMOFile.h:126
BALL::HMOFile::writeCharges_
void writeCharges_(AtomContainer const &ac)
BALL::HMOFile::writeElements_
void writeElements_(Surface const &surface)
BALL::HMOFile::open
virtual bool open(const String &name, File::OpenMode open_mode=std::ios::in)
BALL::HMOFile::writeNodes_
void writeNodes_(Surface const &surface)
BALL::HMOFile::hasCharges
bool hasCharges() const
Test for the presence of charges.
Definition HMOFile.h:108
BALL::HMOFile::readElementData_
void readElementData_(Surface &surface)
BALL::LineBasedFile::LineBasedFile
LineBasedFile()
Default constructor.
BALL::String
Definition string.h:57
BALL::Surface
TSurface< float > Surface
Definition surface.h:488
lineBasedFile.h
BALL
Definition constants.h:13
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
surface.h