bioformats  5.1.8
pressure.h
Go to the documentation of this file.
1 /*
2  * #%L
3  * OME-COMMON C++ library for C++ compatibility/portability
4  * %%
5  * Copyright © 2015 - 2016 Open Microscopy Environment:
6  * - Massachusetts Institute of Technology
7  * - National Institutes of Health
8  * - University of Dundee
9  * - Board of Regents of the University of Wisconsin-Madison
10  * - Glencoe Software, Inc.
11  * %%
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright notice,
16  * this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * The views and conclusions contained in the software and documentation are
34  * those of the authors and should not be interpreted as representing official
35  * policies, either expressed or implied, of any organization.
36  * #L%
37  */
38 
47 #ifndef OME_COMMON_UNITS_PRESSURE_H
48 #define OME_COMMON_UNITS_PRESSURE_H
49 
50 #include <ome/common/config.h>
51 #include <ome/common/units/types.h>
52 
53 #include <boost/units/base_units/metric/bar.hpp>
54 #include <boost/units/base_units/metric/atmosphere.hpp>
55 #include <boost/units/base_units/metric/torr.hpp>
56 #include <boost/units/base_units/metric/mmHg.hpp>
57 #include <boost/units/unit.hpp>
58 #include <boost/units/quantity.hpp>
59 #include <boost/units/systems/si.hpp>
60 
61 namespace ome
62 {
63  namespace common
64  {
65  namespace units
66  {
67 
68  // Pressure types, constants and quantities.
69 
71  typedef si::pressure pressure_unit;
73  typedef quantity<si::pressure> pressure_quantity;
74 
76  typedef make_scaled_unit<si::pressure,scale<10,static_rational<-24> > >::type yoctopascal_unit;
78  typedef make_scaled_unit<si::pressure,scale<10,static_rational<-21> > >::type zeptopascal_unit;
80  typedef make_scaled_unit<si::pressure,scale<10,static_rational<-18> > >::type attopascal_unit;
82  typedef make_scaled_unit<si::pressure,scale<10,static_rational<-15> > >::type femtopascal_unit;
84  typedef make_scaled_unit<si::pressure,scale<10,static_rational<-12> > >::type picopascal_unit;
86  typedef make_scaled_unit<si::pressure,scale<10,static_rational< -9> > >::type nanopascal_unit;
88  typedef make_scaled_unit<si::pressure,scale<10,static_rational< -6> > >::type micropascal_unit;
90  typedef make_scaled_unit<si::pressure,scale<10,static_rational< -3> > >::type millipascal_unit;
92  typedef make_scaled_unit<si::pressure,scale<10,static_rational< -2> > >::type centipascal_unit;
94  typedef make_scaled_unit<si::pressure,scale<10,static_rational< -1> > >::type decipascal_unit;
96  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 0> > >::type pascal_unit;
98  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 1> > >::type dekapascal_unit;
100  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 1> > >::type decapascal_unit;
102  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 2> > >::type hectopascal_unit;
104  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 3> > >::type kilopascal_unit;
106  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 6> > >::type megapascal_unit;
108  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 9> > >::type gigapascal_unit;
110  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 12> > >::type terapascal_unit;
112  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 15> > >::type petapascal_unit;
114  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 18> > >::type exapascal_unit;
116  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 21> > >::type zettapascal_unit;
118  typedef make_scaled_unit<si::pressure,scale<10,static_rational< 24> > >::type yottapascal_unit;
119 
121  BOOST_UNITS_STATIC_CONSTANT(yoctopascal, yoctopascal_unit);
123  BOOST_UNITS_STATIC_CONSTANT(zeptopascal, zeptopascal_unit);
125  BOOST_UNITS_STATIC_CONSTANT(attopascal, attopascal_unit);
127  BOOST_UNITS_STATIC_CONSTANT(femtopascal, femtopascal_unit);
129  BOOST_UNITS_STATIC_CONSTANT(picopascal, picopascal_unit);
131  BOOST_UNITS_STATIC_CONSTANT(nanopascal, nanopascal_unit);
133  BOOST_UNITS_STATIC_CONSTANT(micropascal, micropascal_unit);
135  BOOST_UNITS_STATIC_CONSTANT(millipascal, millipascal_unit);
137  BOOST_UNITS_STATIC_CONSTANT(centipascal, centipascal_unit);
139  BOOST_UNITS_STATIC_CONSTANT(decipascal, decipascal_unit);
141  BOOST_UNITS_STATIC_CONSTANT(pascal, pascal_unit);
143  BOOST_UNITS_STATIC_CONSTANT(dekapascal, dekapascal_unit);
145  BOOST_UNITS_STATIC_CONSTANT(decapascal, decapascal_unit);
147  BOOST_UNITS_STATIC_CONSTANT(hectopascal, hectopascal_unit);
149  BOOST_UNITS_STATIC_CONSTANT(kilopascal, kilopascal_unit);
151  BOOST_UNITS_STATIC_CONSTANT(megapascal, megapascal_unit);
153  BOOST_UNITS_STATIC_CONSTANT(gigapascal, gigapascal_unit);
155  BOOST_UNITS_STATIC_CONSTANT(terapascal, terapascal_unit);
157  BOOST_UNITS_STATIC_CONSTANT(petapascal, petapascal_unit);
159  BOOST_UNITS_STATIC_CONSTANT(exapascal, exapascal_unit);
161  BOOST_UNITS_STATIC_CONSTANT(zettapascal, zettapascal_unit);
163  BOOST_UNITS_STATIC_CONSTANT(yottapascal, yottapascal_unit);
164 
166  BOOST_UNITS_STATIC_CONSTANT(yoctopascals, yoctopascal_unit);
168  BOOST_UNITS_STATIC_CONSTANT(zeptopascals, zeptopascal_unit);
170  BOOST_UNITS_STATIC_CONSTANT(attopascals, attopascal_unit);
172  BOOST_UNITS_STATIC_CONSTANT(femtopascals, femtopascal_unit);
174  BOOST_UNITS_STATIC_CONSTANT(picopascals, picopascal_unit);
176  BOOST_UNITS_STATIC_CONSTANT(nanopascals, nanopascal_unit);
178  BOOST_UNITS_STATIC_CONSTANT(micropascals, micropascal_unit);
180  BOOST_UNITS_STATIC_CONSTANT(millipascals, millipascal_unit);
182  BOOST_UNITS_STATIC_CONSTANT(centipascals, centipascal_unit);
184  BOOST_UNITS_STATIC_CONSTANT(decipascals, decipascal_unit);
186  BOOST_UNITS_STATIC_CONSTANT(pascals, pascal_unit);
188  BOOST_UNITS_STATIC_CONSTANT(dekapascals, dekapascal_unit);
190  BOOST_UNITS_STATIC_CONSTANT(decapascals, decapascal_unit);
192  BOOST_UNITS_STATIC_CONSTANT(hectopascals, hectopascal_unit);
194  BOOST_UNITS_STATIC_CONSTANT(kilopascals, kilopascal_unit);
196  BOOST_UNITS_STATIC_CONSTANT(megapascals, megapascal_unit);
198  BOOST_UNITS_STATIC_CONSTANT(gigapascals, gigapascal_unit);
200  BOOST_UNITS_STATIC_CONSTANT(terapascals, terapascal_unit);
202  BOOST_UNITS_STATIC_CONSTANT(petapascals, petapascal_unit);
204  BOOST_UNITS_STATIC_CONSTANT(exapascals, exapascal_unit);
206  BOOST_UNITS_STATIC_CONSTANT(zettapascals, zettapascal_unit);
208  BOOST_UNITS_STATIC_CONSTANT(yottapascals, yottapascal_unit);
209 
211  typedef quantity<yoctopascal_unit> yoctopascal_quantity;
213  typedef quantity<zeptopascal_unit> zeptopascal_quantity;
215  typedef quantity<attopascal_unit> attopascal_quantity;
217  typedef quantity<femtopascal_unit> femtopascal_quantity;
219  typedef quantity<picopascal_unit> picopascal_quantity;
221  typedef quantity<nanopascal_unit> nanopascal_quantity;
223  typedef quantity<micropascal_unit> micropascal_quantity;
225  typedef quantity<millipascal_unit> millipascal_quantity;
227  typedef quantity<centipascal_unit> centipascal_quantity;
229  typedef quantity<decipascal_unit> decipascal_quantity;
231  typedef quantity<pascal_unit> pascal_quantity;
233  typedef quantity<dekapascal_unit> dekapascal_quantity;
235  typedef quantity<decapascal_unit> decapascal_quantity;
237  typedef quantity<hectopascal_unit> hectopascal_quantity;
239  typedef quantity<kilopascal_unit> kilopascal_quantity;
241  typedef quantity<megapascal_unit> megapascal_quantity;
243  typedef quantity<gigapascal_unit> gigapascal_quantity;
245  typedef quantity<terapascal_unit> terapascal_quantity;
247  typedef quantity<petapascal_unit> petapascal_quantity;
249  typedef quantity<exapascal_unit> exapascal_quantity;
251  typedef quantity<zettapascal_unit> zettapascal_quantity;
253  typedef quantity<yottapascal_unit> yottapascal_quantity;
254 
256  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< -3> > >::unit_type millibar_unit;
258  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< -2> > >::unit_type centibar_unit;
260  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< -1> > >::unit_type decibar_unit;
262  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< 0> > >::unit_type bar_unit;
264  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< 1> > >::unit_type dekabar_unit;
266  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< 1> > >::unit_type decabar_unit;
268  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< 2> > >::unit_type hectobar_unit;
270  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< 3> > >::unit_type kilobar_unit;
272  typedef scaled_base_unit<boost::units::metric::bar_base_unit,scale<10,static_rational< 6> > >::unit_type megabar_unit;
273 
275  BOOST_UNITS_STATIC_CONSTANT(millibar, millibar_unit);
277  BOOST_UNITS_STATIC_CONSTANT(centibar, centibar_unit);
279  BOOST_UNITS_STATIC_CONSTANT(decibar, decibar_unit);
281  BOOST_UNITS_STATIC_CONSTANT(bar, bar_unit);
283  BOOST_UNITS_STATIC_CONSTANT(dekabar, dekabar_unit);
285  BOOST_UNITS_STATIC_CONSTANT(decabar, decabar_unit);
287  BOOST_UNITS_STATIC_CONSTANT(hectobar, hectobar_unit);
289  BOOST_UNITS_STATIC_CONSTANT(kilobar, kilobar_unit);
291  BOOST_UNITS_STATIC_CONSTANT(megabar, megabar_unit);
292 
294  BOOST_UNITS_STATIC_CONSTANT(millibars, millibar_unit);
296  BOOST_UNITS_STATIC_CONSTANT(centibars, centibar_unit);
298  BOOST_UNITS_STATIC_CONSTANT(decibars, decibar_unit);
300  BOOST_UNITS_STATIC_CONSTANT(bars, bar_unit);
302  BOOST_UNITS_STATIC_CONSTANT(dekabars, dekabar_unit);
304  BOOST_UNITS_STATIC_CONSTANT(decabars, decabar_unit);
306  BOOST_UNITS_STATIC_CONSTANT(hectobars, hectobar_unit);
308  BOOST_UNITS_STATIC_CONSTANT(kilobars, kilobar_unit);
310  BOOST_UNITS_STATIC_CONSTANT(megabars, megabar_unit);
311 
313  typedef quantity<millibar_unit> millibar_quantity;
315  typedef quantity<centibar_unit> centibar_quantity;
317  typedef quantity<decibar_unit> decibar_quantity;
319  typedef quantity<bar_unit> bar_quantity;
321  typedef quantity<dekabar_unit> dekabar_quantity;
323  typedef quantity<decabar_unit> decabar_quantity;
325  typedef quantity<hectobar_unit> hectobar_quantity;
327  typedef quantity<kilobar_unit> kilobar_quantity;
329  typedef quantity<megabar_unit> megabar_quantity;
330 
332  typedef boost::units::metric::atmosphere_base_unit::unit_type atmosphere_unit;
334  BOOST_UNITS_STATIC_CONSTANT(atmosphere, atmosphere_unit);
336  BOOST_UNITS_STATIC_CONSTANT(atmospheres, atmosphere_unit);
338  typedef quantity<atmosphere_unit> atmosphere_quantity;
339 
341  struct psi_base_unit : boost::units::base_unit<psi_base_unit,
342  boost::units::pressure_dimension, 3> { };
344  typedef psi_base_unit::unit_type psi_unit;
346  BOOST_UNITS_STATIC_CONSTANT(psi, psi_unit);
348  typedef quantity<psi_unit> psi_quantity;
349 
351  typedef boost::units::metric::torr_base_unit::unit_type torr_unit;
353  BOOST_UNITS_STATIC_CONSTANT(torr, torr_unit);
355  typedef quantity<torr_unit> torr_quantity;
356 
358  typedef scaled_base_unit<boost::units::metric::torr_base_unit,scale<10,static_rational< -3> > >::unit_type millitorr_unit;
360  BOOST_UNITS_STATIC_CONSTANT(millitorr, millitorr_unit);
362  typedef quantity<millitorr_unit> millitorr_quantity;
363 
365  typedef boost::units::metric::mmHg_base_unit::unit_type mmHg_unit;
367  BOOST_UNITS_STATIC_CONSTANT(mmHg, mmHg_unit);
369  typedef quantity<mmHg_unit> mmHg_quantity;
370 
371  }
372  }
373 }
374 
376 BOOST_UNITS_DEFINE_CONVERSION_FACTOR(ome::common::units::psi_base_unit, si::pressure, double, 6894.7573); // exact conversion
379 
380 namespace boost
381 {
382  namespace units
383  {
384 
386  template<> struct base_unit_info<ome::common::units::psi_base_unit>
387  {
389  static std::string name() { return "pound-force per square inch"; }
391  static std::string symbol() { return "lbf/in^2"; }
392  };
393 
394  }
395 }
396 
397 #endif // OME_COMMON_UNITS_PRESSURE_H
398 
399 /*
400  * Local Variables:
401  * mode:C++
402  * End:
403  */
Base unit for pound-force per square inch (psi) pressure.
Definition: pressure.h:341
Definition: length.h:576
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(ome::common::units::psi_base_unit, si::pressure, double, 6894.7573)
Conversion factor for pound-force per square inch (psi) to pascal.
BOOST_UNITS_DEFAULT_CONVERSION(ome::common::units::psi_base_unit, si::pressure)
Default conversion for pound-force per square inch (psi) to is to SI pressure units (pascals)...
static std::string symbol()
Unit symbol.
Definition: pressure.h:391
static std::string name()
Unit name.
Definition: pressure.h:389