| 1 | //
|
|---|
| 2 | // File: MPQC_Physics_Units_Impl.cc
|
|---|
| 3 | // Symbol: MPQC.Physics_Units-v0.2
|
|---|
| 4 | // Symbol Type: class
|
|---|
| 5 | // Babel Version: 0.10.2
|
|---|
| 6 | // Description: Server-side implementation for MPQC.Physics_Units
|
|---|
| 7 | //
|
|---|
| 8 | // WARNING: Automatically generated; only changes within splicers preserved
|
|---|
| 9 | //
|
|---|
| 10 | // babel-version = 0.10.2
|
|---|
| 11 | //
|
|---|
| 12 | #include "MPQC_Physics_Units_Impl.hh"
|
|---|
| 13 |
|
|---|
| 14 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units._includes)
|
|---|
| 15 | // Put additional includes or other arbitrary code here...
|
|---|
| 16 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units._includes)
|
|---|
| 17 |
|
|---|
| 18 | // user-defined constructor.
|
|---|
| 19 | void MPQC::Physics_Units_impl::_ctor() {
|
|---|
| 20 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units._ctor)
|
|---|
| 21 | // add construction details here
|
|---|
| 22 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units._ctor)
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | // user-defined destructor.
|
|---|
| 26 | void MPQC::Physics_Units_impl::_dtor() {
|
|---|
| 27 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units._dtor)
|
|---|
| 28 | // add destruction details here
|
|---|
| 29 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units._dtor)
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | // static class initializer.
|
|---|
| 33 | void MPQC::Physics_Units_impl::_load() {
|
|---|
| 34 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units._load)
|
|---|
| 35 | // guaranteed to be called at most once before any other method in this class
|
|---|
| 36 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units._load)
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | // user-defined static methods: (none)
|
|---|
| 40 |
|
|---|
| 41 | // user-defined non-static methods:
|
|---|
| 42 | /**
|
|---|
| 43 | * Initializes the units as a human readable string
|
|---|
| 44 | * options are "angstroms" or "bohr"
|
|---|
| 45 | */
|
|---|
| 46 | void
|
|---|
| 47 | MPQC::Physics_Units_impl::initialize (
|
|---|
| 48 | /* in */ const ::std::string& unitname )
|
|---|
| 49 | throw ()
|
|---|
| 50 | {
|
|---|
| 51 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units.initialize)
|
|---|
| 52 | // insert implementation here
|
|---|
| 53 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units.initialize)
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | /**
|
|---|
| 57 | * Returns the units as a human readable string.
|
|---|
| 58 | */
|
|---|
| 59 | ::std::string
|
|---|
| 60 | MPQC::Physics_Units_impl::get_unit_name ()
|
|---|
| 61 | throw ()
|
|---|
| 62 |
|
|---|
| 63 | {
|
|---|
| 64 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units.get_unit_name)
|
|---|
| 65 | return units->string_rep();
|
|---|
| 66 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units.get_unit_name)
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | /**
|
|---|
| 70 | * Converts from self's units to the given unit name.
|
|---|
| 71 | */
|
|---|
| 72 | double
|
|---|
| 73 | MPQC::Physics_Units_impl::convert_to (
|
|---|
| 74 | /* in */ const ::std::string& unitname )
|
|---|
| 75 | throw ()
|
|---|
| 76 | {
|
|---|
| 77 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units.convert_to)
|
|---|
| 78 | if (units.null()) return 0;
|
|---|
| 79 | sc::Ref<sc::Units> u = new sc::Units(unitname.c_str());
|
|---|
| 80 | return units->to(u);
|
|---|
| 81 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units.convert_to)
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | /**
|
|---|
| 85 | * Converts to self's units from the given unit name.
|
|---|
| 86 | */
|
|---|
| 87 | double
|
|---|
| 88 | MPQC::Physics_Units_impl::convert_from (
|
|---|
| 89 | /* in */ const ::std::string& unitname )
|
|---|
| 90 | throw ()
|
|---|
| 91 | {
|
|---|
| 92 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units.convert_from)
|
|---|
| 93 | if (units.null()) return 0;
|
|---|
| 94 | sc::Ref<sc::Units> u = new sc::Units(unitname.c_str());
|
|---|
| 95 | return units->from(u);
|
|---|
| 96 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units.convert_from)
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 | // DO-NOT-DELETE splicer.begin(MPQC.Physics_Units._misc)
|
|---|
| 101 | void
|
|---|
| 102 | MPQC::Physics_Units_impl::set_units(const sc::Ref<sc::Units> &u)
|
|---|
| 103 | {
|
|---|
| 104 | units = u;
|
|---|
| 105 | }
|
|---|
| 106 | // DO-NOT-DELETE splicer.end(MPQC.Physics_Units._misc)
|
|---|
| 107 |
|
|---|