-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearchFunction.cpp
90 lines (85 loc) · 2.48 KB
/
searchFunction.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "spatialsim/searchFunction.h"
#include "spatialsim/mystruct.h"
#include <vector>
using namespace std;
LIBSBML_CPP_NAMESPACE_USE
variableInfo* searchInfoById(vector<variableInfo*> &varInfoList, const char *varName)
{
//cout << "varName " << varName<< endl;
vector<variableInfo*>::iterator it = varInfoList.begin();
while (it != varInfoList.end()) {
if (strcmp((*it)->id, varName) == 0) {
return *it;
}
it++;
}
return 0;
}
GeometryInfo* searchAvolInfoByDomainType(vector<GeometryInfo*> &geoInfoList, const char *dtId)
{
vector<GeometryInfo*>::iterator it = geoInfoList.begin();
while (it != geoInfoList.end()) {
if (strcmp((*it)->domainTypeId, dtId) == 0) {
return *it;
}
it++;
}
return 0;
}
GeometryInfo* searchAvolInfoByDomain(vector<GeometryInfo*> &geoInfoList, const char *dId)
{
vector<GeometryInfo*>::iterator it = geoInfoList.begin();
while (it != geoInfoList.end()) {
if (strcmp((*it)->domainId, dId) == 0) {
return *it;
}
it++;
}
return 0;
}
GeometryInfo* searchAvolInfoByCompartment(vector<GeometryInfo*> &geoInfoList, const char *cId)
{
vector<GeometryInfo*>::iterator it = geoInfoList.begin();
while (it != geoInfoList.end()) {
if (strcmp((*it)->compartmentId, cId) == 0) {
return *it;
}
it++;
}
return 0;
}
boundaryMembrane* searchBMemInfoByCompartment(vector<boundaryMembrane*> &bMemInfoList, const char *cId)
{//membrane has boundary dondition
vector<boundaryMembrane*>::iterator it = bMemInfoList.begin();
while (it != bMemInfoList.end()) {
if (strcmp((*it)->name, cId) == 0) {
return *it;
}
it++;
}
return 0;
}
boundaryMembrane* searchBMemInfoByAdjacentCompartment(vector<boundaryMembrane*> &bMemInfoList, const char *com)
{//membrane has boundary dondition
vector<boundaryMembrane*>::iterator it = bMemInfoList.begin();
while (it != bMemInfoList.end()) {
if (strcmp((*it)->sCompartment, com) == 0 || strcmp((*it)->tCompartment, com) == 0 ) {
return *it;
}
it++;
}
return 0;
}
variableInfo* searchSInfoByCompartment_Name(vector<variableInfo*> &varInfoList, const char *name, const char *compartment)
{//search species by name & compartment
vector<variableInfo*>::iterator it = varInfoList.begin();
while (it != varInfoList.end()) {
if ( std::string((*it)->id).find(std::string(compartment)) != std::string::npos ) {
if( std::string((*it)->id).find(std::string(name)) != std::string::npos ){
return *it;
}
}
it++;
}
return 0;
}