|
From: <le...@us...> - 2007-01-20 19:37:32
|
Revision: 214
http://svn.sourceforge.net/qcell/?rev=214&view=rev
Author: lessm
Date: 2007-01-20 11:37:30 -0800 (Sat, 20 Jan 2007)
Log Message:
-----------
- some methods add for LocalFunction visualization
Modified Paths:
--------------
trunk/qcell/baseheaders/CalculationData.h
trunk/qcell/baseheaders/LocalFunction.h
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/CalculationData.cpp
trunk/qcell/basesources/LocalFunction.cpp
trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp
Modified: trunk/qcell/baseheaders/CalculationData.h
===================================================================
--- trunk/qcell/baseheaders/CalculationData.h 2007-01-20 17:52:00 UTC (rev 213)
+++ trunk/qcell/baseheaders/CalculationData.h 2007-01-20 19:37:30 UTC (rev 214)
@@ -9,6 +9,7 @@
#include <QDomElement>
#include <QStringList>
#include "BaseDataTypes.h"
+#include "Neighbourhood.h"
class CalculationData : public baseDataTypes
{
@@ -85,6 +86,7 @@
CalculationData & operator = (CalculationData &cData);
+ CalculationData & operator = (Neighbourhood &neighbourhood);
signals:
void dataUpdated();
Modified: trunk/qcell/baseheaders/LocalFunction.h
===================================================================
--- trunk/qcell/baseheaders/LocalFunction.h 2007-01-20 17:52:00 UTC (rev 213)
+++ trunk/qcell/baseheaders/LocalFunction.h 2007-01-20 19:37:30 UTC (rev 214)
@@ -1,6 +1,7 @@
#ifndef _LOCAL_FUNCTION_H
#define _LOCAL_FUNCTION_H
+#include <QObject>
#include <QVector>
#include <QString>
#include <QDomDocument>
@@ -50,11 +51,11 @@
*/
-class LocalFunction
+class LocalFunction : public QObject
{
+ Q_OBJECT
public:
-
enum FUNCTION_TYPE
{
SWITCH,
@@ -69,8 +70,9 @@
QVector<int> freeArguments;
FUNCTION_TYPE functionMode;
int numArg, maxArgVal, numElements, maxRetVal;
- QString script;
+ QString script, coment;
+
protected:
//public:
void resizeValueTable(void);
@@ -138,6 +140,21 @@
QString toXmlString(void);
bool fromXmlString(QString *xmlString);
bool fromDomElement(QDomElement *xmlElement);
+
+ // this for value table
+ int getValueTableSize(void);
+ int getRowNumber(void);
+ int getColumnNumber(void);
+ int getValueAt(int index);
+ void setValueAt(int value, int index);
+
+ // coment for function
+ void setComent(QString &text);
+ QString getComent(void);
+
+signals:
+ // signal emit when resolv used
+ void valueCalculate(QVector<int> args);
};
#endif
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2007-01-20 17:52:00 UTC (rev 213)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2007-01-20 19:37:30 UTC (rev 214)
@@ -67,6 +67,7 @@
QVector<int> getMaxNeighbourhoodValues(void);
QVector<int> getMinNeighbourhoodValues(void);
+
};
#endif
Modified: trunk/qcell/basesources/CalculationData.cpp
===================================================================
--- trunk/qcell/basesources/CalculationData.cpp 2007-01-20 17:52:00 UTC (rev 213)
+++ trunk/qcell/basesources/CalculationData.cpp 2007-01-20 19:37:30 UTC (rev 214)
@@ -953,3 +953,16 @@
fillData(cData.getDataPointer());
return *this;
}
+
+CalculationData & CalculationData::operator = (Neighbourhood &neighbourhood)
+{
+ clearData();
+ int mx, my, mz;
+ QVector<int> nmin = neighbourhood.getMinNeighbourhoodValues();
+ QVector<int> nmax = neighbourhood.getMaxNeighbourhoodValues();
+ mx = nmax[0] - nmax[0];
+ mz = nmax[2] - nmax[2];
+ my = nmax[1] - nmax[1];
+
+ return *this;
+}
Modified: trunk/qcell/basesources/LocalFunction.cpp
===================================================================
--- trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 17:52:00 UTC (rev 213)
+++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 19:37:30 UTC (rev 214)
@@ -19,7 +19,7 @@
break;
case LocalFunction::SWITCH:
- numElements = numArg * maxArgVal;
+ numElements = pow(maxArgVal, numArg);
break;
}
@@ -531,6 +531,7 @@
index = calculateSumsIndex(sums) + calculateSwitchIndex(freeArgs);
break;
}
+ emit valueCalculate(args);
return valueTable[index];
}
@@ -646,3 +647,43 @@
}
return 0;
}
+
+int LocalFunction::getValueTableSize(void)
+{
+ return valueTable.size();
+}
+
+int LocalFunction::getRowNumber(void)
+{
+ return pow(maxArgVal, numArg);
+}
+
+int LocalFunction::getColumnNumber(void)
+{
+ int out = 1;
+ if(sumArguments.size()==0)
+ return 0;
+ for(int i=0;i<sumArguments.size();++i)
+ out *= sumArguments[i].size() * (maxArgVal - 1) + 1;
+ return out;
+}
+
+int LocalFunction::getValueAt(int index)
+{
+ return valueTable[index];
+}
+
+void LocalFunction::setValueAt(int value, int index)
+{
+ valueTable[index] = value;
+}
+
+void LocalFunction::setComent(QString &text)
+{
+ coment = text;
+}
+
+QString LocalFunction::getComent(void)
+{
+ return coment;
+}
\ No newline at end of file
Modified: trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp
===================================================================
--- trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp 2007-01-20 17:52:00 UTC (rev 213)
+++ trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp 2007-01-20 19:37:30 UTC (rev 214)
@@ -113,7 +113,7 @@
// Variants division
lines[0] = lines[0].trimmed();
- int split_nr;
+// int split_nr;
QStringList tmp_division;
format = QRegExp("^\\{(\\d(,|:)){" + QString::number(arguments_nr-1) + "}(\\d)\\}$");
if((format.exactMatch(lines[0])) && (lines[0].count(':') == 1))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|