Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
12 
13 namespace Cantera
14 {
16 {
17  size_t k1 = 0;
18 
19  /* - Loop over all of the species */
20  for (size_t i = 0; i < m_numSpeciesTot; ++i) {
21  /*
22  * Find the index of I in the index vector m_speciesIndexVector[].
23  * Call it k1 and continue.
24  */
25  for (size_t j = 0; j < m_numSpeciesTot; ++j) {
26  size_t l = m_speciesMapIndex[j];
27  k1 = j;
28  if (l == i) {
29  break;
30  }
31  }
32  /*
33  * - Switch the species data back from k1 into i
34  * -> because we loop over all species, reaction data
35  * are now permanently hosed.
36  */
37  vcs_switch_pos(false, i, k1);
38  }
39  return 0;
40 }
41 
42 }
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...
std::vector< size_t > m_speciesMapIndex
Index vector that keeps track of the species vector rearrangement.
Definition: vcs_solve.h:1781
size_t m_numSpeciesTot
Total number of species in the problems.
Definition: vcs_solve.h:1493
int vcs_rearrange()
Switch all species data back to the original order.
void vcs_switch_pos(const bool ifunc, const size_t k1, const size_t k2)
Swaps the indices for all of the global data for two species, k1 and k2.