Cantera  2.0
vcs_rearrange.cpp
Go to the documentation of this file.
1 /**
2  * @file vcs_rearrange.cpp
3  * implementation file for rearranging species.
4  */
5 /*
6  * Copyright (2007) Sandia Corporation. Under the terms of
7  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
8  * U.S. Government retains certain rights in this software.
9  */
10 
13 
14 #include <cstdio>
15 #include <cstdlib>
16 #include <cmath>
17 
18 
19 namespace VCSnonideal
20 {
21 
22 
23 // Switch all species data back to the original order.
24 /*
25  * This destroys the data based on reaction ordering.
26  */
28 {
29  size_t i, l, j;
30  size_t k1 = 0;
31 
32  /* - Loop over all of the species */
33  for (i = 0; i < m_numSpeciesTot; ++i) {
34  /*
35  * Find the index of I in the index vector m_speciesIndexVector[].
36  * Call it k1 and continue.
37  */
38  for (j = 0; j < m_numSpeciesTot; ++j) {
39  l = m_speciesMapIndex[j];
40  k1 = j;
41  if (l == i) {
42  break;
43  }
44  }
45  /*
46  * - Switch the species data back from k1 into i
47  * -> because we loop over all species, reaction data
48  * are now permanently hosed.
49  */
50  vcs_switch_pos(false, i, k1);
51  }
52  return 0;
53 }
54 
55 }
56