|
From: <mk...@us...> - 2003-03-20 00:24:51
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv12601/Source
Modified Files:
Enum.cpp Makefile Matrix3.cpp Vector3.cpp
Log Message:
see CHANGES.current
Index: Enum.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Enum.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Enum.cpp 18 Mar 2003 06:41:49 -0000 1.3
--- Enum.cpp 20 Mar 2003 00:24:48 -0000 1.4
***************
*** 28,31 ****
--- 28,35 ----
}
+ Enum::Enum(const Enum &e): _parent(0) {
+ __assign(&e);
+ }
+
Enum::~Enum() {
}
***************
*** 127,130 ****
--- 131,140 ----
}
+ Enumeration::~Enumeration() {
+ _enums.clear();
+ _map.clear();
+ _strings.clear();
+ }
+
const std::vector<Enum> Enumeration::each() const { return _enums; }
***************
*** 184,190 ****
bool Enumeration::__contains__(int i) const { return contains(i); }
bool Enumeration::__contains__(const std::string& i) const { return contains(i); }
! const Enum& Enumeration::__getitem__(int n) const { return _enums[n]; }
! const Enum& Enumeration::__getitem__(const std::string& s) const { return this->operator[](s); }
! const Enum& Enumeration::__getattr_c__(const std::string& s) const {
return this->operator[](s);
}
--- 194,200 ----
bool Enumeration::__contains__(int i) const { return contains(i); }
bool Enumeration::__contains__(const std::string& i) const { return contains(i); }
! const Enum Enumeration::__getitem__(int n) const { return _enums[n]; }
! const Enum Enumeration::__getitem__(const std::string& s) const { return this->operator[](s); }
! const Enum Enumeration::__getattr_c__(const std::string& s) const {
return this->operator[](s);
}
Index: Makefile
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 18 Mar 2003 10:04:05 -0000 1.4
--- Makefile 20 Mar 2003 00:24:48 -0000 1.5
***************
*** 56,59 ****
--- 56,61 ----
rm -f $(MODULES:%=%_wrap.o)
rm -f $(DEPDIR)/*.d
+ rm -f $(TOPDIR)/SimData/_cSimData.so
+ rm -f $(TOPDIR)/SimData/cSimData.py
clean-dependencies:
***************
*** 94,100 ****
--- 96,104 ----
_cSimData.so: $(OBJECTS) cSimData_wrap.o
$(CXX) -Wl,-z,lazyload $(LDOPTS) -o$@ $^
+ cp $@ $(TOPDIR)/SimData
cSimData_wrap.cpp: cSimData.i
$(SWIG) $(SWOPTS) -o $@ $<
+ cp cSimData.py $(TOPDIR)/SimData
cSimData_wrap.o: cSimData_wrap.cpp
Index: Matrix3.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Matrix3.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Matrix3.cpp 28 Jan 2003 23:26:07 -0000 1.2
--- Matrix3.cpp 20 Mar 2003 00:24:48 -0000 1.3
***************
*** 69,74 ****
Matrix3::Matrix3(double fEntry00, double fEntry01, double fEntry02,
! double fEntry10, double fEntry11, double fEntry12,
! double fEntry20, double fEntry21, double fEntry22)
{
rowcol[0][0] = fEntry00;
--- 69,74 ----
Matrix3::Matrix3(double fEntry00, double fEntry01, double fEntry02,
! double fEntry10, double fEntry11, double fEntry12,
! double fEntry20, double fEntry21, double fEntry22)
{
rowcol[0][0] = fEntry00;
***************
*** 84,89 ****
Matrix3::Matrix3(const Vector3& column1, // a matrix is given by 3 column vectors
! const Vector3& column2,
! const Vector3& column3)
{
SetColumn(0, column1);
--- 84,89 ----
Matrix3::Matrix3(const Vector3& column1, // a matrix is given by 3 column vectors
! const Vector3& column2,
! const Vector3& column3)
{
SetColumn(0, column1);
***************
*** 227,230 ****
--- 227,250 ----
}
+ // multiplication (proxy) operators for Python
+
+ Matrix3 Matrix3::__mul__(const Matrix3& m) const {
+ return (*this)*m;
+ }
+
+ Matrix3 Matrix3::__mul__(double v) const {
+ return (*this)*v;
+ }
+
+ Matrix3 Matrix3::__rmul__(double v) const {
+ return (*this)*v;
+ }
+
+ Vector3 Matrix3::__mul__(const Vector3& v) const {
+ return (*this)*v;
+ }
+
+
+ /*
Vector3 operator*(const Matrix3& rkMatrix,
const Vector3& rkPoint) // Checked
***************
*** 233,239 ****
for (int iRow = 0; iRow < 3; ++iRow) {
kProd[iRow] =
! rkMatrix.rowcol[iRow][0]*rkPoint[0] +
! rkMatrix.rowcol[iRow][1]*rkPoint[1] +
! rkMatrix.rowcol[iRow][2]*rkPoint[2];
}
return kProd;
--- 253,259 ----
for (int iRow = 0; iRow < 3; ++iRow) {
kProd[iRow] =
! rkMatrix.rowcol[iRow][0]*rkPoint.x +
! rkMatrix.rowcol[iRow][1]*rkPoint.y +
! rkMatrix.rowcol[iRow][2]*rkPoint.z;
}
return kProd;
***************
*** 241,245 ****
- /*
Vector3 operator* (const Vector3& rkPoint, const Matrix3& rkMatrix)
{
--- 261,264 ----
***************
*** 248,257 ****
{
kProd[iCol] =
! rkPoint[0]*rkMatrix.rowcol[0][iCol] +
! rkPoint[1]*rkMatrix.rowcol[1][iCol] +
! rkPoint[2]*rkMatrix.rowcol[2][iCol];
}
return kProd;
! }*/
Matrix3 Matrix3::operator-() const
--- 267,309 ----
{
kProd[iCol] =
! rkPoint.x*rkMatrix.rowcol[0][iCol] +
! rkPoint.y*rkMatrix.rowcol[1][iCol] +
! rkPoint.z*rkMatrix.rowcol[2][iCol];
}
return kProd;
! }
! */
!
! Vector3 operator*(const Matrix3& rkMatrix, const Vector3& rkPoint)
! {
! double *row0 = &(rkMatrix.rowcol[0][0]);
! double *row1 = &(rkMatrix.rowcol[1][0]);
! double *row2 = &(rkMatrix.rowcol[2][0]);
! double x, y, z;
! x = rkPoint.x * *row0++;
! x += rkPoint.y * *row0++;
! x += rkPoint.z * *row0++;
! y = rkPoint.x * *row1++;
! y += rkPoint.y * *row1++;
! y += rkPoint.z * *row1++;
! z = rkPoint.x * *row2++;
! z += rkPoint.y * *row2++;
! z += rkPoint.z * *row2++;
! return Vector3(x, y, z);
! }
!
!
! Vector3 operator* (const Vector3& rkPoint, const Matrix3& rkMatrix)
! {
! double *row0 = &(rkMatrix.rowcol[0][0]);
! double *row1 = &(rkMatrix.rowcol[1][0]);
! double *row2 = &(rkMatrix.rowcol[2][0]);
! double x, y, z;
! x = rkPoint.x * *row0++ + rkPoint.y * *row1++ + rkPoint.z * *row2++;
! y = rkPoint.x * *row0++ + rkPoint.y * *row1++ + rkPoint.z * *row2++;
! z = rkPoint.x * *row0++ + rkPoint.y * *row1++ + rkPoint.z * *row2++;
! return Vector3(x, y, z);
! }
!
Matrix3 Matrix3::operator-() const
***************
*** 887,907 ****
}
-
- /*
- // Methods for SWIG
- #if defined(SWIG) || defined(SWIGPYTHON)
- std::string Matrix3::__repr__() {
- return asString();
- }
-
- Vector3 Matrix3::__mul__(const Vector3 &v) const {
- return *this * v;
- }
-
- Matrix3 Matrix3::__mul__(double fScalar) const {
- return *this * fScalar;
- }
- #endif // SWIG
- */
--- 939,942 ----
Index: Vector3.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Vector3.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Vector3.cpp 18 Mar 2003 06:41:50 -0000 1.3
--- Vector3.cpp 20 Mar 2003 00:24:48 -0000 1.4
***************
*** 134,138 ****
* Print string representation to a stream.
*/
! void Vector3::Print(FILE * stream)
{
fprintf(stream, "[%f, %f, %f]\n", x, y, z);
--- 134,138 ----
* Print string representation to a stream.
*/
! void Vector3::Print(FILE * stream) const
{
fprintf(stream, "[%f, %f, %f]\n", x, y, z);
***************
*** 141,145 ****
//} // namespace Math
! Matrix3 Vector3::StarMatrix()
{
Matrix3 mat;
--- 141,145 ----
//} // namespace Math
! Matrix3 Vector3::StarMatrix() const
{
Matrix3 mat;
***************
*** 175,187 ****
}
! Vector3 Vector3::Cross(const Vector3 & a) {
return SIMDATA(Cross)(*this, a);
}
! double Vector3::Dot(const Vector3 & a) {
return SIMDATA(Dot)(*this, a);
}
! std::vector<double> Vector3::GetElements() {
std::vector<double> elements;
elements.push_back(x);
--- 175,187 ----
}
! Vector3 Vector3::Cross(const Vector3 & a) const {
return SIMDATA(Cross)(*this, a);
}
! double Vector3::Dot(const Vector3 & a) const {
return SIMDATA(Dot)(*this, a);
}
! std::vector<double> Vector3::GetElements() const {
std::vector<double> elements;
elements.push_back(x);
***************
*** 219,222 ****
--- 219,226 ----
z = Z;
if (n!=3) throw ParseException("SYNTAX ERROR: expecting 3 floats");
+ }
+
+ Vector3 Vector3::__mul__(const Matrix3 & a) const {
+ return (*this)*a;
}
|