FOX/ObjCryst++  1.10.X (development)
General.h
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2002 Vincent Favre-Nicolin vincefn@users.sourceforge.net
3  2000-2001 University of Geneva (Switzerland)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 /* General.h
20 * header file for various global declaration. Most of these declarations
21 * should be moved to other headers, and this file could eventually disappear.
22 *
23 */
24 
25 #ifndef _VFN_OBJCRYST_H_
26 #define _VFN_OBJCRYST_H_
27 
28 
29 #include <string>
30 #include <cmath>
31 #include <utility>
32 
33 // Restricted pointers (useful for auto-vectorization)
34 #ifdef __GNUG__
35  #define RESTRICT __restrict__
36 #elif defined(_MSC_VER) || defined(__ICL) // MS and VC++ compiler
37  #define RESTRICT __restrict
38 #else
39  #define RESTRICT
40 #endif
41 
42 //profiling
43 #ifdef __MWERKS__
44 #include <Profiler.h>
45 #endif
46 
47 #ifdef PROFILING_ON
48 #include "Profile/Profiler.h"
49 #else
50 
51 #define TAU_PROFILE(name, type, group)
52 #define TAU_PROFILE_START(var)
53 #define TAU_PROFILE_TIMER(var, name, type, group)
54 #define TAU_PROFILE_STOP(var)
55 #define TAU_PROFILE_INIT(argc, argv)
56 #define TAU_PROFILE_SET_NODE(node)
57 #define TAU_PROFILE_SET_CONTEXT(context)
58 #define TAU_EVENT(event, data)
59 #define TAU_REPORT_STATISTICS()
60 #define TAU_REPORT_THREAD_STATISTICS()
61 
62 #endif
63 
64 #include "ObjCryst/Quirks/VFNDebug.h"
65 
66 using namespace std;
73 namespace ObjCryst
74 {
75 
76 #ifndef M_PI
77 #define M_PI 3.14159265358979323846264338327950288
78 #endif
79 
80 #define DEG2RAD (M_PI/180.)
81 #define RAD2DEG (180./M_PI)
82 
83 #define REAL float
84 
85 // Implemented in IO.cpp
88 float string2floatC(const string &s);
89 
90 //######################################################################
91 
94 enum RadiationType { RAD_NEUTRON, RAD_XRAY, RAD_ELECTRON};
96 enum SampleType { SAMPLE_SINGLE_CRYSTAL, SAMPLE_POWDER};
100 enum WavelengthType { WAVELENGTH_MONOCHROMATIC, WAVELENGTH_ALPHA12, WAVELENGTH_TOF,
101  WAVELENGTH_MAD, WAVELENGTH_DAFS, WAVELENGTH_LAUE};
103 enum ReflectionProfileType { PROFILE_GAUSSIAN, PROFILE_LORENTZIAN, PROFILE_PSEUDO_VOIGT,
104  PROFILE_PSEUDO_VOIGT_FINGER_COX_JEPHCOAT,
105  PROFILE_PEARSON_VII };
106 
107 enum PowderBackgroundInterpType{ POWDER_BACKGROUND_LINEAR,
108  POWDER_BACKGROUND_CUBIC_SPLINE};
109 
110 #define XRAY_WAVELENGTH_TO_ENERGY 12398.4
111 
112 //######################################################################
113 // Exception.
117 //######################################################################
118 //:TODO: This should go into VFNDebug.h
120 {
121  public:
123  ObjCrystException(const string & message);
125 
126  static bool verbose;
127  string message;
128 
129  protected:
130  private:
131 };
132 
133 //######################################################################
136 void ObjCrystInformUserStdOut(const string &);
137 
138 //######################################################################
147 extern void (*fpObjCrystInformUser)(const string &);
148 
152 template <class T> class SymmetricPairCompare
153 {
154  public:
155  bool operator()(const pair<T,T> &p1, const pair<T,T> &p2) const
156  {
157  const T* p1f= &(p1.first);
158  const T* p1s= &(p1.second);
159  const T* p2f= &(p2.first);
160  const T* p2s= &(p2.second);
161  if(*p1f < *p1s) { p1s= &(p1.first); p1f= &(p1.second);}
162  if(*p2f < *p2s) { p2s= &(p2.first); p2f= &(p2.second);}
163  if(*p1f != *p2f) return *p1f < *p2f;
164  else return *p1s < *p2s;
165  }
166 };
167 
168 #ifdef OBJCRYST_GL
169 void crystGLPrint(const string &);
172 #endif
173 
176 {
178  REAL mXmin, mXmax, mYmin, mYmax, mZmin, mZmax;
183 };
184 
190 {// Implemented in SpaceGroup.cpp
191  public:
194  private:
195  std::string mLocale;
196 };
197 
198 }//Namespace
199 
200 #endif //_VFN_OBJCRYST_H_
This class only serves to temporarilly set the LC_NUMERIC C locale to "C", in order to use '...
Definition: General.h:189
REAL mXmin
Display limits in reduced coordinates.
Definition: General.h:178
bool mShowLabel
Show labels ?
Definition: General.h:180
float string2floatC(const string &s)
Function to convert a substring to a floating point value, imposing a C locale (using '...
Definition: ObjCryst/IO.cpp:59
ReflectionProfileType
Profile type for powder (could it be used fopr single crystals on 2D detectors ?) ...
Definition: General.h:103
void ObjCrystInformUserStdOut(const string &str)
Print some information for the user during long processes.
Definition: Exception.cpp:78
SampleType
Sample type (not used yet)
Definition: General.h:96
Class to store POV-Ray output options.
Definition: General.h:175
bool mShowHydrogens
Show hydrogens ?
Definition: General.h:182
WavelengthType
Incident beam characteristics : monochromatic, X-Ray tube with Alpha1 and alpha2, MAD (a few waveleng...
Definition: General.h:100
Class to compare pairs of objects, with the two objects playing a symmetric role. ...
Definition: General.h:152
Exception class for ObjCryst++ library.
Definition: General.h:119
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: Atom.cpp:47
RadiationType
Type of radiation used.
Definition: General.h:94