mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Use std::set instead of std::map when the value is never used
This commit is contained in:
parent
36a15fc685
commit
a6196d3744
@ -283,7 +283,9 @@ protected:
|
|||||||
std::vector<std::string> m_include;
|
std::vector<std::string> m_include;
|
||||||
std::vector<std::string> m_exclude;
|
std::vector<std::string> m_exclude;
|
||||||
std::vector<size_t> m_speciesNumber;
|
std::vector<size_t> m_speciesNumber;
|
||||||
std::map<size_t, int> m_rxns;
|
|
||||||
|
//! Indices of reactions that are included in the diagram
|
||||||
|
set<size_t> m_rxns;
|
||||||
size_t m_local;
|
size_t m_local;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,9 +97,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::map<size_t, int> m_loc;
|
//! Indices of grid points that need new grid points added after them
|
||||||
|
set<size_t> m_loc;
|
||||||
std::map<size_t, int> m_keep;
|
std::map<size_t, int> m_keep;
|
||||||
std::map<std::string, int> m_c;
|
//! Names of components that require the addition of new grid points
|
||||||
|
set<string> m_c;
|
||||||
std::vector<bool> m_active;
|
std::vector<bool> m_active;
|
||||||
doublereal m_ratio, m_slope, m_curve, m_prune;
|
doublereal m_ratio, m_slope, m_curve, m_prune;
|
||||||
doublereal m_min_range;
|
doublereal m_min_range;
|
||||||
|
@ -128,13 +128,13 @@ vector_int ReactionPathDiagram::reactions()
|
|||||||
for (const auto& rxn : path(i)->reactionMap()) {
|
for (const auto& rxn : path(i)->reactionMap()) {
|
||||||
double flxratio = rxn.second/flmax;
|
double flxratio = rxn.second/flmax;
|
||||||
if (flxratio > threshold) {
|
if (flxratio > threshold) {
|
||||||
m_rxns[rxn.first] = 1;
|
m_rxns.insert(rxn.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vector_int r;
|
vector_int r;
|
||||||
for (const auto& rxn : m_rxns) {
|
for (const auto& rxn : m_rxns) {
|
||||||
r.push_back(int(rxn.first));
|
r.push_back(int(rxn));
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ void ReactionPathDiagram::linkNodes(size_t k1, size_t k2, size_t rxn,
|
|||||||
m_pathlist.push_back(ff);
|
m_pathlist.push_back(ff);
|
||||||
}
|
}
|
||||||
ff->addReaction(rxn, value, legend);
|
ff->addReaction(rxn, value, legend);
|
||||||
m_rxns[rxn] = 1;
|
m_rxns.insert(rxn);
|
||||||
m_flxmax = std::max(ff->flow(), m_flxmax);
|
m_flxmax = std::max(ff->flow(), m_flxmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ int Refiner::analyze(size_t n, const doublereal* z,
|
|||||||
for (size_t j = 0; j < n-1; j++) {
|
for (size_t j = 0; j < n-1; j++) {
|
||||||
doublereal r = fabs(v[j+1] - v[j])/dmax;
|
doublereal r = fabs(v[j+1] - v[j])/dmax;
|
||||||
if (r > 1.0 && dz[j] >= 2 * m_gridmin) {
|
if (r > 1.0 && dz[j] >= 2 * m_gridmin) {
|
||||||
m_loc[j] = 1;
|
m_loc.insert(j);
|
||||||
m_c[name] = 1;
|
m_c.insert(name);
|
||||||
}
|
}
|
||||||
if (r >= m_prune) {
|
if (r >= m_prune) {
|
||||||
m_keep[j] = 1;
|
m_keep[j] = 1;
|
||||||
@ -135,9 +135,9 @@ int Refiner::analyze(size_t n, const doublereal* z,
|
|||||||
doublereal r = fabs(s[j+1] - s[j]) / (dmax + m_thresh/dz[j]);
|
doublereal r = fabs(s[j+1] - s[j]) / (dmax + m_thresh/dz[j]);
|
||||||
if (r > 1.0 && dz[j] >= 2 * m_gridmin &&
|
if (r > 1.0 && dz[j] >= 2 * m_gridmin &&
|
||||||
dz[j+1] >= 2 * m_gridmin) {
|
dz[j+1] >= 2 * m_gridmin) {
|
||||||
m_c[name] = 1;
|
m_c.insert(name);
|
||||||
m_loc[j] = 1;
|
m_loc.insert(j);
|
||||||
m_loc[j+1] = 1;
|
m_loc.insert(j+1);
|
||||||
}
|
}
|
||||||
if (r >= m_prune) {
|
if (r >= m_prune) {
|
||||||
m_keep[j+1] = 1;
|
m_keep[j+1] = 1;
|
||||||
@ -155,8 +155,8 @@ int Refiner::analyze(size_t n, const doublereal* z,
|
|||||||
for (size_t j = 1; j < n-1; j++) {
|
for (size_t j = 1; j < n-1; j++) {
|
||||||
// Add a new point if the ratio with left interval is too large
|
// Add a new point if the ratio with left interval is too large
|
||||||
if (dz[j] > m_ratio*dz[j-1]) {
|
if (dz[j] > m_ratio*dz[j-1]) {
|
||||||
m_loc[j] = 1;
|
m_loc.insert(j);
|
||||||
m_c[fmt::format("point {}", j)] = 1;
|
m_c.insert(fmt::format("point {}", j));
|
||||||
m_keep[j-1] = 1;
|
m_keep[j-1] = 1;
|
||||||
m_keep[j] = 1;
|
m_keep[j] = 1;
|
||||||
m_keep[j+1] = 1;
|
m_keep[j+1] = 1;
|
||||||
@ -165,8 +165,8 @@ int Refiner::analyze(size_t n, const doublereal* z,
|
|||||||
|
|
||||||
// Add a point if the ratio with right interval is too large
|
// Add a point if the ratio with right interval is too large
|
||||||
if (dz[j] < dz[j-1]/m_ratio) {
|
if (dz[j] < dz[j-1]/m_ratio) {
|
||||||
m_loc[j-1] = 1;
|
m_loc.insert(j-1);
|
||||||
m_c[fmt::format("point {}", j-1)] = 1;
|
m_c.insert(fmt::format("point {}", j-1));
|
||||||
m_keep[j-2] = 1;
|
m_keep[j-2] = 1;
|
||||||
m_keep[j-1] = 1;
|
m_keep[j-1] = 1;
|
||||||
m_keep[j] = 1;
|
m_keep[j] = 1;
|
||||||
@ -215,12 +215,12 @@ void Refiner::show()
|
|||||||
m_domain->id()+".\n"
|
m_domain->id()+".\n"
|
||||||
+" New points inserted after grid points ");
|
+" New points inserted after grid points ");
|
||||||
for (const auto& loc : m_loc) {
|
for (const auto& loc : m_loc) {
|
||||||
writelog("{} ", loc.first);
|
writelog("{} ", loc);
|
||||||
}
|
}
|
||||||
writelog("\n");
|
writelog("\n");
|
||||||
writelog(" to resolve ");
|
writelog(" to resolve ");
|
||||||
for (const auto& c : m_c) {
|
for (const auto& c : m_c) {
|
||||||
writelog(string(c.first)+" ");
|
writelog(c + " ");
|
||||||
}
|
}
|
||||||
writelog("\n");
|
writelog("\n");
|
||||||
writeline('#', 78);
|
writeline('#', 78);
|
||||||
|
Loading…
Reference in New Issue
Block a user