Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-01-24 17:34:51


"Daniel Frey" <d.frey_at_[hidden]> wrote

> I uploaded the new version of the constant library to the files section.
> Additionally, I added an example which shows how it can be used with a
> unit library, e.g. YANL 2.2. The constant library itself is independent
> of the unit library, and I hope that it can be transfered to the other
> unit libraries as well. A short appetizer:

[example of constant use]

I've had a look but am a bit baffled as to how I go about constructing this
beast for my pqs library.
pqs is not like YANL !

Nevertheless If you wish to try it out :

http://groups.yahoo.com/group/boost/files/pqs/pqs-1-00-02.zip
http://groups.yahoo.com/group/boost/files/pqs/pqs-1-00-02.tar.gz

My current method to do something like this in pqs is attached. Heres the
main source: (both constants could use default params of course)

regards
Andy Little

#include "../pqs.hpp"
#include "math_constants.hpp"
#include "ideal_gas_constant.hpp"
using namespace physical_quantities;

int main()
{
  // a bubble of gas in a resin cure
  q_length::m const r(0.5e-6);
  q_volume::m3 const V
    = 4.0/3.0 * math::constants<>::pi * power<3>(r);

  //setting at room temperature and pressure
  q_temperature::K T(310);
  q_pressure::Pa P(1.01325e5);

  // The resin sets.
  // The bubble contains a constant
  // molar quantity of gas.
  q_substance::mol const subst
    = P * V /(physics::ideal_gas_constant<>::R * T);

  //the temperature is subsequently reduced
  // near to absolute zero
  T = q_temperature::K(0.001);

  //what is the pressure in the bubble now?
  P = subst * physics::ideal_gas_constant<>::R * T / V;
  std::cout << P <<'\n';
}

begin 666 gas_constants.txt
M+R]I9&5A;%]G87-?8V]N<W1A;G0N:'!P#0H-"B-I9FYD968_at_4$A94TE#04Q?
M455!3E1)5$E%4U]'05-?0T].4U1!3E1?2%!07TE.0TQ51$5$#0HC9&5F:6YE
M(%!(65-)0T%,7U%504Y4251)15-?1T%37T-/3E-404Y47TA04%])3D-,541%
M1 T*#0HC:6YC;'5D92 B+BXO<'%S+FAP<"(-"@T*;F%M97-P86-E('!H>7-I
M8W-[#0H@(" @=&5M<&QA=&4\='EP96YA;64_at_5F%L=65?='EP92 ](&9L;V%T
M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G5S:6YG('!H>7-I8W,Z.FED96%L7V=A<U]C;VYS=&%N=#L-"@T*
M=&5M<&QA=&4\/B -"FED96%L7V=A<U]C;VYS=&%N=#QD;W5B;&4^.CIT>7!E
M(&-O;G-T("8-"FED96%L7V=A<U]C;VYS=&%N=#QD;W5B;&4^.CI2(#T-"FED
M96%L7V=A<U]C;VYS=&%N=#QD;W5B;&4^.CIT>7!E*#@N,S$T*3L@( T*#0IT
M96UP;&%T93P^( T*:61E86Q?9V%S7V-O;G-T86YT/&9L;V%T/CHZ='EP92!C
M;VYS=" F#0II9&5A;%]G87-?8V]N<W1A;G0\9FQO870^.CI2(#T-"FED96%L
M7V=A<U]C;VYS=&%N=#QF;&]A=#XZ.G1Y<&4H."XS,31&*3L@#0H-"G1E;7!L
M871E/#X@#0II9&5A;%]G87-?8V]N<W1A;G0\;&]N9R!D;W5B;&4^.CIT>7!E
M(&-O;G-T("8-"FED96%L7V=A<U]C;VYS=&%N=#QL;VYG(&1O=6)L93XZ.E(@
M/0T*:61E86Q?9V%S7V-O;G-T86YT/&QO;F<@9&]U8FQE/CHZ='EP92_at_X+C,Q
%-$8I.R `
`
end


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk