Back to index

wims  3.65+svn20090927
Functions | Variables
chemeq.cc File Reference
#include "chemeq.h"
#include <cmath>
#include <cstdlib>

Go to the source code of this file.

Functions

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

Variables

atome lesatomes []
const char * moltypeStr [] = { "aq", "g", "s" }

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 f1,
const fraction f2 
)

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:

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;
}
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:

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,
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:

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;
}
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[] = { "aq", "g", "s" }

Definition at line 249 of file chemeq.cc.