Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Mesquite.hpp
Go to the documentation of this file.
1 /* *****************************************************************
2  MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4  Copyright 2004 Sandia Corporation and Argonne National
5  Laboratory. Under the terms of Contract DE-AC04-94AL85000
6  with Sandia Corporation, the U.S. Government retains certain
7  rights in this software.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  (lgpl.txt) along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 
23  diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
24  pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov
25 
26  ***************************************************************** */
27 #ifndef MESQUITE_HPP
28 #define MESQUITE_HPP
29 #include <cstring>
30 #ifdef _MSC_VER
31 # pragma warning ( 4 : 4786)
32 //# include "mesquite_config.win.h"
33 //#else
34 //# include "mesquite_config.h"
35 #endif
36 
37 #ifdef MSQ_USE_OLD_C_HEADERS
38 # define msq_stdc
39 #else
40 # define msq_stdc std
41 #endif
42 
43 #ifdef MSQ_USE_OLD_IO_HEADERS
44 # define msq_stdio
45 #else
46 # define msq_stdio std
47 #endif
48 
49 #ifdef MSQ_USE_OLD_STD_HEADERS
50 # define msq_std
51 #else
52 # define msq_std std
53 #endif
54 
55 
56 #ifdef MSQ_USE_OLD_C_INCLUDES
57 # include <math.h>
58 # include <float.h>
59 # include <limits.h>
60 #else
61 # include <cmath>
62 # include <cfloat>
63 # include <climits>
64 # ifdef HAVE_CBRT
65 # include <math.h>
66 # endif
67 #endif
68 
80 namespace Mesquite
81 {
82  typedef int StatusCode;
83 
84  typedef double real;
85 
87  {
90  };
91 
93  {
94  POLYGON =7,
100  PRISM =13,
101  PYRAMID =14,
104  };
105 
106  // Version information
107  const char* version_string(bool include_build_number = false);
108  unsigned int major_version_number();
109  unsigned int minor_version_number();
110  unsigned int build_number();
112  {
116  };
118 
119  //GLOBAL variables
121  const int MSQ_HIST_SIZE=7;//number of division in histogram
122  static const double MSQ_SQRT_TWO = msq_stdc::sqrt(2.0);
123  static const double MSQ_SQRT_THREE = msq_stdc::sqrt(3.0);
124  static const double MSQ_SQRT_THREE_DIV_TWO=MSQ_SQRT_THREE/2.0;
125  static const double MSQ_SQRT_THREE_INV=1.0/MSQ_SQRT_THREE;
126  static const double MSQ_SQRT_TWO_INV=1.0/MSQ_SQRT_TWO;
128  static const double MSQ_ONE_THIRD = 1.0 / 3.0;
129  static const double MSQ_TWO_THIRDS = 2.0 / 3.0;
131 
132 #ifdef UINT_MAX
133  const unsigned MSQ_UINT_MAX = UINT_MAX;
134 #else
135  const unsigned MSQ_UINT_MAX = ~(unsigned)0;
136 #endif
137 
138 #ifdef INT_MAX
139  const int MSQ_INT_MAX = INT_MAX;
140 #else
141  const int MSQ_INT_MAX = MSQ_UINT_MAX >> 1;
142 #endif
143 
144 #ifdef INT_MIN
145  const int MSQ_INT_MIN = INT_MIN;
146 #else
147  const int MSQ_INT_MIN = ~MSQ_INT_MAX;
148 #endif
149 
150 #ifdef DBL_MIN
151  const double MSQ_DBL_MIN = DBL_MIN;
152 #else
153  /* This value is rather large - DBL_MIN is normally about 2e-308
154  Put an error here to see if any platform really doesn't
155  have DBL_MIN or DBL_MAX defined, and evaluate what to do then.
156  */
157  #error DBL_MIN not defined
158  const double MSQ_DBL_MIN = 1.0E-30;
159 #endif
160  const double MSQ_MIN = MSQ_DBL_MIN;
161 
162 #ifdef DBL_MAX
163  const double MSQ_DBL_MAX = DBL_MAX;
164 #else
165  /* This value is rather small - DBL_MAX is normally about 2e308
166  Put an error here to see if any platform really doesn't
167  have DBL_MIN or DBL_MAX defined, and evaluate what to do then.
168  */
169  #error DBL_MAX not defined
170  const double MSQ_DBL_MAX = 1.0E30;
171 #endif
172  const double MSQ_MAX = MSQ_DBL_MAX;
173  const double MSQ_MAX_CAP = 1.e6;
174 
175  //macro to return the min/max of a set of arguements. The integer
176  // (e.g., '2') tells how many arguements should be passed for comparison.
177 template <class T> inline T MSQ_MIN_2(T a, T b) { return a < b ? a : b; }
178 template <class T> inline T MSQ_MAX_2(T a, T b) { return a > b ? a : b; }
179 
180 
181  // Utility functions
182 inline double cbrt( double d )
183 {
184 #ifdef HAVE_CBRT
185  return ::cbrt( d );
186 #else
187  return msq_stdc::pow( d, MSQ_ONE_THIRD );
188 #endif
189 }
190 
191 inline double cbrt_sqr( double d )
192 {
193 #ifdef HAVE_CBRT
194  return ::cbrt(d*d);
195 #else
196  return msq_stdc::pow( d, MSQ_TWO_THIRDS );
197 #endif
198 }
199 
200 }
201 
202 
203 #endif
const int MSQ_HIST_SIZE
Definition: Mesquite.hpp:121
static const double MSQ_TWO_THIRDS
Definition: Mesquite.hpp:129
static const double MSQ_ONE_THIRD
Definition: Mesquite.hpp:128
const double MSQ_DBL_MIN
Definition: Mesquite.hpp:158
const double MSQ_MAX_CAP
Definition: Mesquite.hpp:173
const int MSQ_INT_MAX
Definition: Mesquite.hpp:141
const NT & d
EntityTopology
Definition: Mesquite.hpp:92
const char * version_string(bool include_build_number=false)
const double MSQ_DBL_MAX
Definition: Mesquite.hpp:170
unsigned int minor_version_number()
static const double MSQ_SQRT_TWO_DIV_SQRT_THREE
Definition: Mesquite.hpp:127
T MSQ_MAX_2(T a, T b)
Definition: Mesquite.hpp:178
const int MSQ_MAX_NUM_VERT_PER_ENT
Definition: Mesquite.hpp:120
int StatusCode
Definition: Mesquite.hpp:82
double sqrt(double d)
Definition: double.h:73
static const double MSQ_SQRT_THREE_DIV_TWO
Definition: Mesquite.hpp:124
const unsigned MSQ_UINT_MAX
Definition: Mesquite.hpp:135
double cbrt_sqr(double d)
Definition: Mesquite.hpp:191
static const double MSQ_SQRT_TWO
Definition: Mesquite.hpp:122
const int MSQ_INT_MIN
Definition: Mesquite.hpp:147
double real
Definition: Mesquite.hpp:84
const double MSQ_MAX
Definition: Mesquite.hpp:172
static const double MSQ_SQRT_TWO_INV
Definition: Mesquite.hpp:126
unsigned int build_number()
Mesquite::ReleaseType release_type()
static const double MSQ_SQRT_THREE_INV
Definition: Mesquite.hpp:125
double cbrt(double d)
Definition: Mesquite.hpp:182
unsigned int major_version_number()
double pow(double value, const Exponent &exp)
T MSQ_MIN_2(T a, T b)
Definition: Mesquite.hpp:177
static const double MSQ_3RT_2_OVER_6RT_3
Definition: Mesquite.hpp:130
const double MSQ_MIN
Definition: Mesquite.hpp:160
StatusCodeValues
Definition: Mesquite.hpp:86
static const double MSQ_SQRT_THREE
Definition: Mesquite.hpp:123