File: DSN6File.h

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 239,888 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; makefile: 95
file content (129 lines) | stat: -rw-r--r-- 2,604 bytes parent folder | download | duplicates (8)
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
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//

#ifndef BALL_FORMAT_DSN6FILE_H
#define BALL_FORMAT_DSN6FILE_H

#ifndef BALL_SYSTEM_FILE_H
#	include <BALL/SYSTEM/file.h>
#endif

#ifndef BALL_DATATYPE_REGULARDATA3D_H
# include <BALL/DATATYPE/regularData3D.h>
#endif

namespace BALL
{
	/** DSN6 density map file format. This class enables BALL to read and
	 		write DSN6 - type binary electron density maps as used by FRODO and
			O.
    	\ingroup  Format
	*/
	class BALL_EXPORT DSN6File
		:	public File
	{

		public:

		/** @name Constructors and Destructor
		*/
		//@{

		/// Default constructor
		DSN6File();

		/// Detailed constructor
		DSN6File(const String& name, File::OpenMode open_mode = std::ios::in);

		/// Destructor
		virtual ~DSN6File();

		//@}
		/** @name Assignment
		*/
		//@{

		/// Clear method
		virtual void clear();

		//@}
		/** @name Predicates
		*/
		//@{

		/// Equality operator
		bool operator == (const DSN6File& file) const;

		///
		bool isSwappingBytes() const;

		//@}
		/// @name Public methods for file handling
		//@{

		/** open a DSN6File
		 *  @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 header of an existing file.
				Return true if the header could be read successfully, false ow.
		*/
		virtual bool readHeader();

		/** Read the file into a RegularData3D field. **/
		virtual bool read(RegularData3D& map);

		/** Write a header
				Return true if the header could be written successfully, false ow.
		*/
		virtual bool writeHeader();

		//@}
		/** @name Accessors 
		*/
		//@{

		//@}

		private:
			const DSN6File& operator = (const DSN6File& file);

		protected:

			short int readHeaderValue_(char* header, Position pos);

			void convertBrick_(char* brick);

			/// a flag indicating that we have to swap bytes when reading header values
			bool swap_bytes_;

			/// the start coordinates in grid coordinates, i.e. indices
			Vector3 start_;

			/// the extent of the map
			Vector3 extent_;

			/// the sampling rates used for the map
			Vector3 sampling_rate_;
			
			/// dimension of the crystal unit cell in Angstrom/sample
			Vector3 crystal_dimension_;

			/// angles of the crystal unit cell
			Angle alpha_, beta_, gamma_;

			/// scaling factor for the cell geometry
			float cell_scaling_;

			/// conversion factors for the density map
			float prod_;
			float plus_;

			/// geometry in cartesian coordinates
			Vector3 origin_, xaxis_, yaxis_, zaxis_;
	};
} // namespace BALL

#endif // BALL_FORMAT_DCDFILE_H