FOX/ObjCryst++  2022
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 #ifndef REAL
84 #define REAL float
85 #endif
86 
87 // Implemented in IO.cpp
90 float string2floatC(const string &s);
91 
92 //######################################################################
93 
96 enum RadiationType { RAD_NEUTRON, RAD_XRAY, RAD_ELECTRON};
98 enum SampleType { SAMPLE_SINGLE_CRYSTAL, SAMPLE_POWDER};
102 enum WavelengthType { WAVELENGTH_MONOCHROMATIC, WAVELENGTH_ALPHA12, WAVELENGTH_TOF,
103  WAVELENGTH_MAD, WAVELENGTH_DAFS, WAVELENGTH_LAUE};
105 enum ReflectionProfileType { PROFILE_GAUSSIAN, PROFILE_LORENTZIAN, PROFILE_PSEUDO_VOIGT,
106  PROFILE_PSEUDO_VOIGT_FINGER_COX_JEPHCOAT,
107  PROFILE_PEARSON_VII };
108 
109 enum PowderBackgroundInterpType{ POWDER_BACKGROUND_LINEAR,
110  POWDER_BACKGROUND_CUBIC_SPLINE};
111 
112 #define XRAY_WAVELENGTH_TO_ENERGY 12398.4
113 
114 //######################################################################
115 // Exception.
119 //######################################################################
120 //:TODO: This should go into VFNDebug.h
122 {
123  public:
125  ObjCrystException(const string & message);
127 
128  static bool verbose;
129  string message;
130 
131  protected:
132  private:
133 };
134 
135 //######################################################################
138 void ObjCrystInformUserStdOut(const string &);
139 
140 //######################################################################
149 extern void (*fpObjCrystInformUser)(const string &);
150 
154 template <class T> class SymmetricPairCompare
155 {
156  public:
157  bool operator()(const pair<T,T> &p1, const pair<T,T> &p2) const
158  {
159  const T* p1f= &(p1.first);
160  const T* p1s= &(p1.second);
161  const T* p2f= &(p2.first);
162  const T* p2s= &(p2.second);
163  if(*p1f < *p1s) { p1s= &(p1.first); p1f= &(p1.second);}
164  if(*p2f < *p2s) { p2s= &(p2.first); p2f= &(p2.second);}
165  if(*p1f != *p2f) return *p1f < *p2f;
166  else return *p1s < *p2s;
167  }
168 };
169 
170 #ifdef OBJCRYST_GL
173 void crystGLPrint(const string &);
174 #endif
175 
178 {
180  REAL mXmin, mXmax, mYmin, mYmax, mZmin, mZmax;
185 };
186 
192 {// Implemented in SpaceGroup.cpp
193  public:
196  private:
197  std::string mLocale;
198 };
199 
200 }//Namespace
201 
202 #endif //_VFN_OBJCRYST_H_
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: doc-main.h:25
ReflectionProfileType
Profile type for powder (could it be used fopr single crystals on 2D detectors ?)
Definition: General.h:105
SampleType
Sample type (not used yet)
Definition: General.h:98
RadiationType
Type of radiation used.
Definition: General.h:96
WavelengthType
Incident beam characteristics : monochromatic, X-Ray tube with Alpha1 and alpha2, MAD (a few waveleng...
Definition: General.h:102
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
void ObjCrystInformUserStdOut(const string &str)
Print some information for the user during long processes.
Definition: Exception.cpp:78
Exception class for ObjCryst++ library.
Definition: General.h:122
Class to compare pairs of objects, with the two objects playing a symmetric role.
Definition: General.h:155
Class to store POV-Ray output options.
Definition: General.h:178
bool mShowHydrogens
Show hydrogens ?
Definition: General.h:184
REAL mXmin
Display limits in reduced coordinates.
Definition: General.h:180
bool mShowLabel
Show labels ?
Definition: General.h:182
This class only serves to temporarilly set the LC_NUMERIC C locale to "C", in order to use '.
Definition: General.h:192