Commit d8b2f747 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

concept seems to be correct

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1479
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent d507e899
# this is <Makefile> # this is <Makefile>
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# $Id: Makefile,v 1.20 2003-06-27 18:12:50 tforb Exp $ # $Id: Makefile,v 1.21 2004-02-10 09:57:18 tforb Exp $
# #
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) # Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
# #
...@@ -335,6 +335,7 @@ compile-tests: \ ...@@ -335,6 +335,7 @@ compile-tests: \
tests/shapetest.run \ tests/shapetest.run \
tests/reprtest.run \ tests/reprtest.run \
tests/arraytest.run \ tests/arraytest.run \
tests/operatortest.run \
tests/helpertest.run \ tests/helpertest.run \
tests/f77test.run tests/f77test.run
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: README.changelog,v 1.44 2004-02-10 09:33:04 tforb Exp $ * $Id: README.changelog,v 1.45 2004-02-10 09:57:19 tforb Exp $
* *
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
* *
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/*! \page page_changelog ChangeLog (AFF) /*! \page page_changelog ChangeLog (AFF)
$Id: README.changelog,v 1.44 2004-02-10 09:33:04 tforb Exp $ $Id: README.changelog,v 1.45 2004-02-10 09:57:19 tforb Exp $
\sa \ref page_project_status \sa \ref page_project_status
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
- removed lib/iteratable.h - removed lib/iteratable.h
- explained this decision: - explained this decision:
\ref sec_design_interface_nobaseclass \ref sec_design_interface_nobaseclass
- started with operators:
arrayoperators.h, seriesoperators.h, and lib/operators.h
- introduced tests/operatortest.h
- \b 07/02/2004 (thof) - \b 07/02/2004 (thof)
- index limit set operations available through aff::Series - index limit set operations available through aff::Series
...@@ -201,7 +204,7 @@ ...@@ -201,7 +204,7 @@
/*! \page page_project_status Project status (AFF) /*! \page page_project_status Project status (AFF)
$Id: README.changelog,v 1.44 2004-02-10 09:33:04 tforb Exp $ $Id: README.changelog,v 1.45 2004-02-10 09:57:19 tforb Exp $
\sa \ref page_changelog \sa \ref page_changelog
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: arrayoperators.h,v 1.1 2004-02-10 09:33:05 tforb Exp $ * $Id: arrayoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 10/02/2004 * \date 10/02/2004
* *
...@@ -18,17 +18,19 @@ ...@@ -18,17 +18,19 @@
*/ */
// include guard // include guard
#ifndef TF_ARRAYOPERATORS_H_VERSION #ifndef AFF_ARRAYOPERATORS_H_VERSION
#define TF_ARRAYOPERATORS_H_VERSION \ #define AFF_ARRAYOPERATORS_H_VERSION \
"TF_ARRAYOPERATORS_H V1.0 " "AFF_ARRAYOPERATORS_H V1.0 "
#define TF_ARRAYOPERATORS_H_CVSID \ #define AFF_ARRAYOPERATORS_H_CVSID \
"$Id: arrayoperators.h,v 1.1 2004-02-10 09:33:05 tforb Exp $" "$Id: arrayoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $"
namespace tf { #include<aff/array.h>
} #define AFF_OPERATORS_CLASS aff::Array
#include <aff/lib/operators.h>
#undef AFF_OPERATORS_CLASS
#endif // TF_ARRAYOPERATORS_H_VERSION (includeguard) #endif // AFF_ARRAYOPERATORS_H_VERSION (includeguard)
/* ----- END OF arrayoperators.h ----- */ /* ----- END OF arrayoperators.h ----- */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: operators.h,v 1.1 2004-02-10 09:33:06 tforb Exp $ * $Id: operators.h,v 1.2 2004-02-10 09:57:20 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 10/02/2004 * \date 10/02/2004
* *
...@@ -18,17 +18,35 @@ ...@@ -18,17 +18,35 @@
*/ */
// include guard // include guard
#ifndef TF_OPERATORS_H_VERSION #ifndef AFF_OPERATORS_CLASS
#error "never ever inlcude this from your code"
#endif
#define TF_OPERATORS_H_VERSION \ #include<aff/iterator.h>
"TF_OPERATORS_H V1.0 "
#define TF_OPERATORS_H_CVSID \
"$Id: operators.h,v 1.1 2004-02-10 09:33:06 tforb Exp $"
namespace tf { namespace aff {
} template<class T>
AFF_OPERATORS_CLASS<T> operator*(const AFF_OPERATORS_CLASS<T>& c,
const typename AFF_OPERATORS_CLASS<T>::Tvalue& v)
{
typename AFF_OPERATORS_CLASS<T> retval(c.copyout());
for (aff::Iterator<AFF_OPERATORS_CLASS<T> > i(retval);
i.valid(); ++i)
{ (*i) *= v; }
return(retval);
}
#endif // TF_OPERATORS_H_VERSION (includeguard) template<class T>
AFF_OPERATORS_CLASS<T> operator*=(AFF_OPERATORS_CLASS<T>& c,
const typename AFF_OPERATORS_CLASS<T>::Tvalue& v)
{
typename AFF_OPERATORS_CLASS<T> retval(c);
for (aff::Iterator<AFF_OPERATORS_CLASS<T> > i(retval);
i.valid(); ++i)
{ (*i) *= v; }
return(retval);
}
}
/* ----- END OF operators.h ----- */ /* ----- END OF operators.h ----- */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: seriesoperators.h,v 1.1 2004-02-10 09:33:05 tforb Exp $ * $Id: seriesoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 10/02/2004 * \date 10/02/2004
* *
...@@ -18,17 +18,19 @@ ...@@ -18,17 +18,19 @@
*/ */
// include guard // include guard
#ifndef TF_SERIESOPERATORS_H_VERSION #ifndef AFF_SERIESOPERATORS_H_VERSION
#define TF_SERIESOPERATORS_H_VERSION \ #define AFF_SERIESOPERATORS_H_VERSION \
"TF_SERIESOPERATORS_H V1.0 " "AFF_SERIESOPERATORS_H V1.0 "
#define TF_SERIESOPERATORS_H_CVSID \ #define AFF_SERIESOPERATORS_H_CVSID \
"$Id: seriesoperators.h,v 1.1 2004-02-10 09:33:05 tforb Exp $" "$Id: seriesoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $"
namespace tf { #include<aff/series.h>
} #define AFF_OPERATORS_CLASS aff::Series
#include <aff/lib/operators.h>
#undef AFF_OPERATORS_CLASS
#endif // TF_SERIESOPERATORS_H_VERSION (includeguard) #endif // AFF_SERIESOPERATORS_H_VERSION (includeguard)
/* ----- END OF seriesoperators.h ----- */ /* ----- END OF seriesoperators.h ----- */
# this is <Makefile> # this is <Makefile>
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# $Id: Makefile,v 1.10 2002-12-29 00:09:06 forbrig Exp $ # $Id: Makefile,v 1.11 2004-02-10 09:57:20 tforb Exp $
# #
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) # Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
# #
...@@ -39,7 +39,7 @@ clean: ; ...@@ -39,7 +39,7 @@ clean: ;
-find . -type f -perm +0111 | xargs --no-run-if-empty /bin/rm -v -find . -type f -perm +0111 | xargs --no-run-if-empty /bin/rm -v
STANDARDTEST=arraytest subscriptortest shapetest simplearraytest reprtest \ STANDARDTEST=arraytest subscriptortest shapetest simplearraytest reprtest \
seriestest helpertest seriestest helpertest operatortest
BINARYTEST=binarraytest BINARYTEST=binarraytest
F77TEST=f77test F77TEST=f77test
EXECUTABLES=$(STANDARDTEST) $(BINARYTEST) $(F77TEST) EXECUTABLES=$(STANDARDTEST) $(BINARYTEST) $(F77TEST)
......
/*! \file operatortest.cc
* \brief test operator functions
*
* ----------------------------------------------------------------------------
*
* $Id: operatortest.cc,v 1.1 2004-02-10 09:57:21 tforb Exp $
* \author Thomas Forbriger
* \date 10/02/2004
*
* test operator functions
*
* Copyright (c) 2004 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 10/02/2004 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define OPERATORTEST_VERSION \
"OPERATORTEST V1.0 test operator functions"
#define OPERATORTEST_CVSID \
"$Id: operatortest.cc,v 1.1 2004-02-10 09:57:21 tforb Exp $"
#include <iostream>
#include <aff/array.h>
#include <aff/dump.h>
#include <aff/arrayoperators.h>
using std::cout;
using std::cerr;
using std::endl;
/*! \example tests/operatortest.cc
*
* Here you can learn how to use operators with aff classes.
*
* This test program gives an example of the usage of the following classes,
* functions, and preprocessor macros:
* - aff::Array
* - aff::ConstArray
* - aff::dump
* - aff::dump_array
* - #DUMP
* - #CODE
*
* \sa tests/operatortest.cc
*/
int main(int iargc, char* argv[])
{
cout << OPERATORTEST_VERSION << endl;
cout << OPERATORTEST_CVSID << endl;
CODE(aff::Array<double> A(3,3);)
CODE(A=14.;)
CODE(dump_array(A));
CODE(aff::Array<double> B = A * 5.;)
CODE(dump_array(B));
CODE(B*=0.2);
CODE(dump_array(B));
}
/* ----- END OF operatortest.cc ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment