37 return check_and_cast<
Quon*>(simulation.getModule(
moduleID));
85 if(msg->isName(
"probeTimer")) {
90 unsigned int maxComponent = 0;
91 for(QuonTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
92 unsigned int count =
getComponentSize(itTopology->second.getModule()->getKey());
93 if(count > maxComponent) {
112 double mnAverage = 0.0;
115 for(QuonTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
116 QuonAOI AOI(itTopology->second.getModule()->getPosition(), itTopology->second.getModule()->getAOI());
118 for(QuonTopology::iterator itI =
Topology.begin(); itI !=
Topology.end(); ++itI) {
119 if(itI != itTopology && AOI.collide(itI->second.getModule()->getPosition())) {
120 QuonSiteMap::iterator currentSite = itTopology->second.getModule()->Sites.find(itI->second.getModule()->getKey());
121 if(currentSite == itTopology->second.getModule()->Sites.end()) {
125 drift += sqrt(currentSite->second->position.distanceSqr(itI->second.getModule()->getPosition()));
131 mnAverage += missing;
132 if(mnMax < missing) {
139 mnAverage /= (double)
Topology.size();
141 drift /= (double)driftCount;
153 else if(msg->isName(
"plotTimer")) {
160 bool missingFound =
false;
162 for(QuonTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
163 QuonAOI AOI(itTopology->second.getModule()->getPosition(), itTopology->second.getModule()->getAOI());
164 for(QuonTopology::iterator itI =
Topology.begin(); itI !=
Topology.end(); ++itI) {
165 if(itI != itTopology && AOI.collide(itI->second.getModule()->getPosition())) {
166 QuonSiteMap::iterator currentSite = itTopology->second.getModule()->Sites.find(itI->second.getModule()->getKey());
167 if(currentSite == itTopology->second.getModule()->Sites.end()) {
176 int range = (int)
Topology.begin()->second.getModule()->getAreaDimension();
177 std::stringstream oss;
178 std::string filename;
179 int simTimeInt, stellen = 1;
180 simTimeInt = (int)SIMTIME_DBL(simTime());
182 for(
int i=0; i<6; i++) {
183 if(!(simTimeInt / stellen)) {
191 filename = oss.str() +
".plot";
192 pltNetwork.open(filename.c_str(), std::ios::out);
193 pltNetwork <<
"set xrange [0:" << range <<
"]" << endl;
194 pltNetwork <<
"set yrange [0:" << range <<
"]" << endl;
198 filename = oss.str() +
".point";
199 pltData.open(filename.c_str(), std::ios::out);
201 pltNetwork <<
"plot '" << filename <<
"' using 1:2 with points pointtype 7,\\" << endl;
204 filename = oss.str() +
".arrow";
205 pltVector.open(filename.c_str(), std::ios::out);
207 pltNetwork <<
" '" << filename <<
"' using 1:2:3:4 with vectors linetype 1" << endl;
211 for(QuonTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
212 pltData << itTopology->second.getModule()->getPosition().x <<
"\t" << itTopology->second.getModule()->getPosition().y << endl;
218 for(QuonTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
219 for(QuonSiteMap::iterator itSites = itTopology->second.getModule()->Sites.begin(); itSites != itTopology->second.getModule()->Sites.end(); ++itSites) {
224 QuonTopology::iterator destNode =
Topology.find(itSites->second->address.getKey());
226 Vector2D relPos = destNode->second.getModule()->getPosition() - itTopology->second.getModule()->getPosition();
227 pltVector << itTopology->second.getModule()->getPosition().x <<
"\t" << itTopology->second.getModule()->getPosition().y <<
"\t"
228 << relPos.
x <<
"\t" << relPos.
y << endl;
232 Vector2D relPos = itSites->second->position - itTopology->second.getModule()->getPosition();
233 pltVector << itTopology->second.getModule()->getPosition().x <<
"\t" << itTopology->second.getModule()->getPosition().y <<
"\t"
234 << relPos.
x <<
"\t" << relPos.
y << endl;
240 for(QuonTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
241 QuonAOI AOI(itTopology->second.getModule()->getPosition(), itTopology->second.getModule()->getAOI());
242 for(QuonTopology::iterator itI =
Topology.begin(); itI !=
Topology.end(); ++itI) {
243 if(itI != itTopology && AOI.collide(itI->second.getModule()->getPosition())) {
244 QuonSiteMap::iterator currentSite = itTopology->second.getModule()->Sites.find(itI->second.getModule()->getKey());
245 if(currentSite == itTopology->second.getModule()->Sites.end()) {
246 Vector2D relPos = itI->second.getModule()->getPosition() - itTopology->second.getModule()->getPosition();
247 pltVector << itTopology->second.getModule()->getPosition().x <<
"\t"
248 << itTopology->second.getModule()->getPosition().y <<
"\t"
249 << relPos.
x <<
"\t" << relPos.
y <<
"\t"
250 << itTopology->second.getModule()->getParentModule()->getParentModule()->getFullName() <<
":"
251 << itTopology->second.getModule()->getKey().toString(16) <<
"\t"
252 << itI->second.getModule()->getParentModule()->getParentModule()->getFullName() <<
":"
253 << itI->second.getModule()->getKey().toString(16) << endl;
267 for(
int i=0; i<=simulation.getLastModuleId(); i++) {
268 cModule* module = simulation.getModule(i);
269 if(module && dynamic_cast<Quon*>(module)) {
270 Quon* quonp = check_and_cast<
Quon*>(module);
281 for(QuonTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
282 itTopology->second.visited =
false;
288 QuonTopology::iterator itEntry =
Topology.find(key);
289 if(itEntry !=
Topology.end() && itEntry->second.visited ==
false) {
291 itEntry->second.visited =
true;
292 Quon* quonp = itEntry->second.getModule();
293 for(QuonSiteMap::iterator itSites = quonp->
Sites.begin(); itSites != quonp->
Sites.end(); ++itSites) {