From: <le...@us...> - 2006-11-30 13:12:48
|
Revision: 32 http://svn.sourceforge.net/qcell/?rev=32&view=rev Author: lessm Date: 2006-11-30 05:12:45 -0800 (Thu, 30 Nov 2006) Log Message: ----------- - Neighbourhood class have QVector<int> arguments support Modified Paths: -------------- trunk/qcell/baseheaders/Neighbourhood.h trunk/qcell/basesources/Neighbourhood.cpp Modified: trunk/qcell/baseheaders/Neighbourhood.h =================================================================== --- trunk/qcell/baseheaders/Neighbourhood.h 2006-11-30 12:58:08 UTC (rev 31) +++ trunk/qcell/baseheaders/Neighbourhood.h 2006-11-30 13:12:45 UTC (rev 32) @@ -10,7 +10,7 @@ struct NContainer { int x, y, z, t; - struct DV + union DV { double dValue; int iValue; @@ -36,11 +36,13 @@ void addNeighbour(int x, int y); void addNeighbour(int x, int y, int z); void addNeighbour(int x, int y, int z, int t); + void addNeighbour(QVector<int> v); void setNeighbourAt(int index, int x); void setNeighbourAt(int index, int x, int y); void setNeighbourAt(int index, int x, int y, int z); void setNeighbourAt(int index, int x, int y, int z, int t); + void setNeighbourAt(int index, QVector<int> v); void clearNeighbourhood(void); int getDimension(void); Modified: trunk/qcell/basesources/Neighbourhood.cpp =================================================================== --- trunk/qcell/basesources/Neighbourhood.cpp 2006-11-30 12:58:08 UTC (rev 31) +++ trunk/qcell/basesources/Neighbourhood.cpp 2006-11-30 13:12:45 UTC (rev 32) @@ -56,6 +56,28 @@ dimension = 4; } +void Neighbourhood::addNeighbour(QVector<int> v) +{ + switch(v.size()) + { + case 1: + addNeighbour(v[0]); + break; + case 2: + addNeighbour(v[0], v[1]); + break; + case 3: + addNeighbour(v[0], v[1], v[2]); + break; + case 4: + addNeighbour(v[0], v[1], v[2], v[3]); + break; + default: + if(v.size()>4) + addNeighbour(v[0], v[1], v[2], v[3]); + } +} + void Neighbourhood::setNeighbourAt(int index, int x) { if(neighbourVector.size()>index) @@ -91,6 +113,27 @@ neighbourVector[index].t = t; } } +void Neighbourhood::setNeighbourAt(int index, QVector<int> v) +{ + switch(v.size()) + { + case 1: + setNeighbourAt(index, v[0]); + break; + case 2: + setNeighbourAt(index, v[0], v[1]); + break; + case 3: + setNeighbourAt(index, v[0], v[1], v[2]); + break; + case 4: + setNeighbourAt(index, v[0], v[1], v[2], v[3]); + break; + default: + if(v.size()>4) + setNeighbourAt(index, v[0], v[1], v[2], v[3]); + } +} void Neighbourhood::clearNeighbourhood(void) { @@ -316,4 +359,4 @@ } break; } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |