Back to index

wims  3.65+svn20090927
Classes | Defines | Typedefs | Enumerations | Functions | Variables
chemeq.h File Reference
#include <cstring>
#include <sstream>
#include <iostream>
#include <vector>
#include <string>
#include <map>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  atome
class  Compteur
class  fraction
class  AtomeListe
class  Molec
class  Membre
class  Chemeq
struct  table_entry

Defines

#define VERSION   "2.8"
#define Avogadro   6.022141e+23
#define Electron   1.602176e-19
#define Kb   1.3806e-23
#define Faraday   (Avogadro * Electron)
#define R   (Kb * Avogadro)
#define T0   (273.15+25)
#define MINVAL   -999

Typedefs

typedef std::pair< std::string,
int > 
AtomeCompte

Enumerations

enum  moltype { aqueous, gas, sol }
enum  info_types {
  NAME, SYMBOL, NUMBER, WEIGHT,
  MELTING, BOILING, PAULING, MAX_INFO_NR
}

Functions

std::ostream & operator<< (std::ostream &o, const Compteur &c)
const fractionminFraction (const fraction &, const fraction &)
std::ostream & operator<< (std::ostream &o, fraction f)
fraction operator* (fraction f, int m)
fraction operator* (int m, fraction f)
fraction operator* (fraction f, fraction m)
fraction operator+ (fraction f, fraction g)
fraction operator- (fraction f, fraction g)
bool operator> (fraction f, int i)
bool operator> (fraction f1, fraction f2)
bool operator!= (fraction f, int i)
std::ostream & operator<< (std::ostream &o, const AtomeListe &l)
std::ostream & operator<< (std::ostream &o, const Molec &m)
Membre operator& (Membre &m1, Membre &m2)
Membre operator- (Membre &m1, Membre &m2)
std::ostream & operator<< (std::ostream &o, const Membre &m)
std::ostream & operator<< (std::ostream &o, const Chemeq &c)
double mendelweight (int i)
int findmendel (const char *symb)
double mendelweight (const char *symb)

Variables

atome lesatomes []
const char * moltypeStr []

Class Documentation

struct atome

Definition at line 36 of file chemeq.h.

Class Members
char symb
int Zed
struct table_entry

Definition at line 267 of file chemeq.h.

Class Members
const char * info

Define Documentation

#define Avogadro   6.022141e+23

Definition at line 15 of file chemeq.h.

#define Electron   1.602176e-19

Definition at line 18 of file chemeq.h.

Definition at line 24 of file chemeq.h.

#define Kb   1.3806e-23

Definition at line 21 of file chemeq.h.

#define MINVAL   -999

Definition at line 34 of file chemeq.h.

#define R   (Kb * Avogadro)

Definition at line 27 of file chemeq.h.

#define T0   (273.15+25)

Definition at line 30 of file chemeq.h.

#define VERSION   "2.8"

Definition at line 12 of file chemeq.h.


Typedef Documentation

typedef std::pair<std::string,int> AtomeCompte

Definition at line 43 of file chemeq.h.


Enumeration Type Documentation

enum info_types
Enumerator:
NAME 
SYMBOL 
NUMBER 
WEIGHT 
MELTING 
BOILING 
PAULING 
MAX_INFO_NR 

Definition at line 262 of file chemeq.h.

                {
  NAME, SYMBOL, NUMBER, WEIGHT, MELTING, BOILING, PAULING,
  MAX_INFO_NR      /* Has to be the last element */
};
enum moltype
Enumerator:
aqueous 
gas 
sol 

Definition at line 121 of file chemeq.h.


Function Documentation

int findmendel ( const char *  symb)

Definition at line 962 of file chemeq.cc.

                                 {
  int i=0;
  while (table[i].info[0] && strcmp(table[i].info[SYMBOL], symb) != 0) i++;
  if (table[i].info[0]) return i; else return -1;
}

Here is the caller graph for this function:

double mendelweight ( int  i)

Definition at line 958 of file chemeq.cc.

                          {
  if (i>=0) return strtod (table[i].info[WEIGHT],0); else return 0.0;
}

Here is the caller graph for this function:

double mendelweight ( const char *  symb)

Definition at line 968 of file chemeq.cc.

                                      {
  int i;
  i = findmendel(symb);
  return mendelweight(i);
}

Here is the call graph for this function:

const fraction& minFraction ( const fraction ,
const fraction  
)

Definition at line 929 of file chemeq.cc.

                                                                    {
  if (f1.i*f2.d > f2.i*f1.d) return f1;
  else return f2;
}
bool operator!= ( fraction  f,
int  i 
)

Definition at line 954 of file chemeq.cc.

                                    {
  return f.i != f.d*i;
}
Membre operator& ( Membre m1,
Membre m2 
)

Definition at line 610 of file chemeq.cc.

                                            {
  Membre result;
  //result.printnorm(std::cout);
  fraction min(1);
  for(Membre::iterator i = m1.begin(); i < m1.end(); i++){
    for(Membre::iterator j = m2.begin(); j < m2.end(); j++){
      if ((*i)->eqMol(*j)){
       Molec *m = new Molec(**i);
       if ((*i)->nb > (*j)->nb){
         min=(*j)->nb;
       }else{
         min=(*i)->nb;
       }
       m->nb=min;
       result.push_back(m);
      }
    }
  }
  return result;
}

Here is the call graph for this function:

fraction operator* ( fraction  f,
int  m 
)

Definition at line 898 of file chemeq.cc.

                                       {
  fraction result = fraction(f.i*m, f.d);
  result.simplifie();
  return result;
}

Here is the call graph for this function:

fraction operator* ( int  m,
fraction  f 
)

Definition at line 904 of file chemeq.cc.

                                       {
  fraction result = fraction(f.i*m, f.d);
  result.simplifie();
  return result;
}

Here is the call graph for this function:

fraction operator* ( fraction  f,
fraction  m 
)

Definition at line 910 of file chemeq.cc.

{
  fraction result = fraction(f.i*m.i, f.d*m.d);
  result.simplifie();
  return result;
}

Here is the call graph for this function:

fraction operator+ ( fraction  f,
fraction  g 
)

Definition at line 917 of file chemeq.cc.

                                            {
  fraction result = fraction(f.i*g.d+g.i*f.d, f.d*g.d);
  result.simplifie();
  return result;
}

Here is the call graph for this function:

fraction operator- ( fraction  f,
fraction  g 
)

Definition at line 923 of file chemeq.cc.

                                            {
  fraction result = fraction(f.i*g.d-g.i*f.d, f.d*g.d);
  result.simplifie();
  return result;
}

Here is the call graph for this function:

Membre operator- ( Membre m1,
Membre m2 
)

Definition at line 631 of file chemeq.cc.

                                            {
  Membre result;
  fraction diff(1);
  for(Membre::iterator i = m1.begin(); i < m1.end(); i++){
    Molec *m = new Molec(**i);
    for(Membre::iterator j = m2.begin(); j < m2.end(); j++){
      if ((*i)->eqMol(*j)){
       diff=(*i)->nb - (*j)->nb;
       m->nb=diff;
      }
    }
    result.push_back(m);
  }
  return result;
}
std::ostream& operator<< ( std::ostream &  o,
const Compteur c 
)

Definition at line 138 of file chemeq.cc.

                                                             {
  return c.operator << (o);
}
std::ostream& operator<< ( std::ostream &  o,
fraction  f 
)

Definition at line 892 of file chemeq.cc.

                                                     {
  o << f.i;
  if (f.d!=1) o << '/' << f.d;
  return o;
}
std::ostream& operator<< ( std::ostream &  o,
const AtomeListe l 
)

Definition at line 228 of file chemeq.cc.

                                                               {
  int n;
  const AtomeListe * al;
  if (l.sq()) o << "[";
  if(l.Z()>0 || l.Z()<-1){
    o << l.symbole();
  }
  else if (l.Z()==-1){ // cas de l'électron
    o << "e";
  }
  else{                // cas des groupes parenthésés
    o << "(";
    if((al=l.groupe())) o << *al;
    o << ")";
  }
  if((n=l.getmolecularite())>1) o << "_{" << n << "}";
  if((al=l.suivant())) o << *al;
  if (l.sq()) o << "]";
  return o;
}

Here is the call graph for this function:

std::ostream& operator<< ( std::ostream &  o,
const Molec m 
)

Definition at line 436 of file chemeq.cc.

                                                          {
  if (m.nombre() != 1) m.printNombre(o);
  o << m.liste();
  if (m.charge()){
    o << "^{";
    if(fabs(1.0*m.charge())!=1) o << fabs(1.0*m.charge());
    if(m.charge()>0) o << "+}"; else o << "-}";
  }
  if (m.typage() != aqueous) o << "_{" << moltypeStr[m.typage()] << "}";
  return o;
}

Here is the call graph for this function:

std::ostream& operator<< ( std::ostream &  o,
const Membre m 
)

Definition at line 602 of file chemeq.cc.

                                                           {
  for(int i=0; i < m.size()-1; i++){
    o << *m[i] << "\\,+\\,";
  }
  o << *m[m.size()-1];
  return o;
}
std::ostream& operator<< ( std::ostream &  o,
const Chemeq c 
)

Definition at line 880 of file chemeq.cc.

                                                           {
  o << *c.membregauche() << "\\,\\rightarrow\\," << *c.membredroit();
  if (c.valeur() > MINVAL) {
    o << "\\,(";
    if (c.constante()!=std::string("")) o << c.constante() << "\\,=\\,";
    o << c.valeur_latex();
    if (c.redox()) o << " V";
    o << ")";
  }
  return o;
}

Here is the call graph for this function:

bool operator> ( fraction  f,
int  i 
)

Definition at line 946 of file chemeq.cc.

                                   {
  return f.i > f.d*i;
}
bool operator> ( fraction  f1,
fraction  f2 
)

Definition at line 950 of file chemeq.cc.

                                          {
  return f1.i*f2.d > f1.d*f2.i;
}

Variable Documentation

Definition at line 6 of file chemeq.cc.

const char* moltypeStr[]

Definition at line 249 of file chemeq.cc.