Commit 628f7bb8 authored by thomas.forbriger's avatar thomas.forbriger

[TASK] (import_Seitosh): discard contrib/aff/tests

Code in contrib/aff/tests is not required as part of Seitosh.
However, the test code requires additional settings like proper interlanguage
linking (C++ and Fortran). To reduce the constraints on the installation
environment, discard the subdirectory tests in contrib/aff entirely, as well
as all references to the test code made in the Makefile.
parent 09f02025
......@@ -118,9 +118,8 @@ CPPFLAGS=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \
# -------
# files which are to be edited
flist: Makefile tests/Makefile doxydoc.cfg $(README) COPYING \
$(HEADERS) $(SRC) $(TESTS) $(wildcard doxy*.cfg) $(DOXYTXT) \
tests/f77common.inc tests/f77procs.f $(TF_EDIT)
flist: Makefile doxydoc.cfg $(README) COPYING \
$(HEADERS) $(SRC) $(TESTS) $(wildcard doxy*.cfg) $(DOXYTXT)
echo $(filter-out lib/% tests/%,$^) | tr ' ' '\n' | sort > $@
echo $(filter lib/%,$^) | tr ' ' '\n' | sort >> $@
echo $(filter tests/%,$^) | tr ' ' '\n' | sort >> $@
......@@ -138,7 +137,6 @@ clean: ;
-find . -name \*.o | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.d | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.o install-include *.xxx junk* *.a *.so
cd tests; $(MAKE) clean
#======================================================================
# library part
......@@ -228,9 +226,7 @@ DOXYWWWPATH=$(TF_WWWBASEDIR)/libaff
doxyclean: ;/bin/rm -rfv $(TF_WWWBASEDIR)/libaff doxydoc.xxx
DOXYSRC=$(DOXYTXT) $(HEADERS) $(SRC) \
tests/f77procs.P tests/f77procs.f \
tests/f77common.inc tests/f77common_com.P
DOXYSRC=$(DOXYTXT) $(HEADERS) $(SRC)
# create doxygen intermediate configuration
PWD=$(shell env pwd)
......@@ -262,36 +258,6 @@ kdocview: kdoc; $(TF_BROWSER) file:$(KDOCDIR)/index.html &
showsections: $(README)
egrep -n '\\subsection|\\section|\\page' $^
#======================================================================
# delegate test targets
# ---------------------
tests/%.P:
cd tests; echo "#############################"; $(MAKE) $(notdir $@)
tests/f2ctest: tests/f77test.cc install-include libaff.a
cd tests; echo "#############################"; $(MAKE) $(notdir $@)
tests/%: tests/%.cc install-include libaff.a
cd tests; echo "#############################"; $(MAKE) $(notdir $@)
tests/bin%: tests/bin%.cc install-include libaff.a
cd tests; echo "#############################"; $(MAKE) $(notdir $@)
tests/%.run: tests/%
echo "#############################"
$< $(ARG)
/bin/rm -fv $< $<.o
# after each modification to the library this target should be used
compile-tests: \
tests/shapetest.run \
tests/reprtest.run \
tests/arraytest.run \
tests/operatortest.run \
tests/helpertest.run \
tests/f77test.run
#======================================================================
# create package
# --------------
......
*.P
f77common_com.c
f2ctest
f77test
arraytest
subscriptortest
shapetest
simplearraytest
reprtest
seriestest
helpertest
operatortest
functionstest
binarraytest
# this is <Makefile>
# ----------------------------------------------------------------------------
#
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
#
# how to compile libaff tests
#
# ----
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# ----
#
#
# arguments to test programs can be passed through variable ARG
#
# REVISIONS and CHANGES
# 06/12/2002 V1.0 Thomas Forbriger (copied from libcontxx)
# 17/12/2002 V1.1 introduced seriestest
# 22/12/2002 V1.2 started interface test to Fortran 77
# 12/01/2014 V1.3 use FFLAGS instead of FCFLAGS conforming to GNU make
# default rules
#
# ============================================================================
#
CONTRIBDIR=../..
include $(CONTRIBDIR)/Makefile_var
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))
$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
$(call CHECKVARS,TF_LINK_FORTRAN)
# ----------------------------------------------------------------------
CPPFLAGS=-I$(LOCINCLUDEDIR)
LDFLAGS=-L$(LOCLIBDIR)
CXXFLAGS=-fhonor-std -Wall $(FLAGS)
CXXFLAGS=-Wall -pedantic $(FLAGS)
CXXFLAGS=-Wall $(FLAGS)
ARG=
all:
flist: Makefile
echo $^ | tr ' ' '\n' | sort > $@
.PHONY: edit
edit: flist; vim $<
.PHONY: clean
clean: ;
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.P *.code *.o *.bak
-find . -type f -perm +0111 | xargs --no-run-if-empty /bin/rm -v
STANDARDTEST=arraytest subscriptortest shapetest simplearraytest reprtest \
seriestest helpertest operatortest functionstest
BINARYTEST=binarraytest
F77TEST=f77test
EXECUTABLES=$(STANDARDTEST) $(BINARYTEST) $(F77TEST)
$(addsuffix .o,$(STANDARDTEST) $(BINARYTEST) $(F77TEST)): %.o: %.cc
$(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) $(FLAGS)
$(STANDARDTEST): %: %.o; $(CXX) -o $@ $< $(LDFLAGS) -laff
$(BINARYTEST): %: %.o; $(CXX) -o $@ $< $(LDFLAGS) -laff
$(addsuffix .run,$(EXECUTABLES)): %.run: %; $< $(ARG); rm -fv $< $<.o
#======================================================================
#
# Fortran 77 interface test
# -------------------------
F2C=f2c
%.f2c.o: %.f f77common.inc
$(F2C) -C++ -f -u $<
$(CXX) -c -o $@ $(<:.f=.c) $(CXXFLAGS) $(CPPFLAGS) $(FLAGS)
/bin/rm -fv $(<:.f=.c)
%.o: %.f f77common.inc
$(FC) -o $@ -c $< $(FFLAGS) $(FLAGS)
%.code: %.f f77common.inc
$(F2C) -C++ -f -u $<
-/bin/mv -v $(patsubst %.f,%.c,$<) $(patsubst %.f,%.code,$<)
%.P: %.f f77common.inc
$(F2C) -C++ -f -u -P -\!c $<
f77common_com.P: f77procs.f f77common.inc
$(F2C) -C++ -f -u -ec $<
/bin/rm -fv $(patsubst %.f,%.c,$<)
sed -e 's/^struct/extern struct/' $(patsubst %.P,%.c,$@) > $@
f77interface.o: f77interface.cc f77proto.h f77procs.P f77common_com.P
$(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) $(FLAGS)
f2ctest: f77test.o f77procs.f2c.o f77interface.o
$(CXX) -o $@ $^ $(LDFLAGS) -laff -lf2c -lm
f77test: f77test.o f77procs.o f77interface.o
$(CXX) -o $@ $^ $(LDFLAGS) -laff $(TF_LINK_FORTRAN) -lm
#======================================================================
# test illegal conditions
illegal:
-$(MAKE) reprtest FLAGS=-DILLEGAL1
-$(MAKE) seriestest FLAGS=-DILLEGAL1
-$(MAKE) shapetest FLAGS=-DILLEGAL1
-$(MAKE) simplearraytest FLAGS=-DILLEGAL1
-$(MAKE) simplearraytest FLAGS=-DILLEGAL2
-$(MAKE) arraytest FLAGS=-DILLEGAL1
-$(MAKE) arraytest FLAGS=-DILLEGAL2
-$(MAKE) arraytest FLAGS=-DILLEGAL3
-$(MAKE) arraytest FLAGS=-DILLEGAL4
-$(MAKE) arraytest FLAGS=-DILLEGAL5
-$(MAKE) arraytest FLAGS=-DILLEGAL6
-$(MAKE) arraytest FLAGS=-DILLEGAL7
-$(MAKE) f77test FLAGS=-DILLEGAL1
-$(MAKE) f77test FLAGS=-DILLEGAL2
-$(MAKE) f77test FLAGS=-DILLEGAL3
-$(MAKE) f77test FLAGS=-DILLEGAL4
-$(MAKE) f77test FLAGS=-DILLEGAL5
# ----- END OF Makefile -----
/*! \file arraytest.cc
* \brief test array class template (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 09/06/2002
*
* test array class template (implementation)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 09/06/2002 V1.0 Thomas Forbriger
* - 25/11/2002 V1.1 whole array assign
* - 19/12/2002 V1.2 now works for libaff
* - 28/12/2002 V1.3 (thof)
* - new term for containers of const elements
* - 03/01/2003 V1.4 (thof)
* - now tests copyout function
*
* ============================================================================
*/
/*! \example tests/arraytest.cc
*
* Here you can learn about how to use the aff::Array class.
*
* This test program gives an example of the usage of the following classes,
* functions, and preprocessor macros:
* - aff::Array
* - aff::ConstArray
* - aff::Shaper
* - aff::dump
* - aff::dump_array
* - #DUMP
* - #CODE
*
* \sa tests/arraytest.cc
*/
#define AFF_ARRAYTEST_CC_VERSION \
"AFF_ARRAYTEST_CC V1.3"
#define AFF_ARRAYTEST_CC_CVSID \
"$Id$"
#define CONT_INDEXCHECK
#include <aff/dump.h>
#include <aff/array.h>
#include <aff/shaper.h>
#include <aff/subarray.h>
using std::cout;
using std::endl;
using namespace aff;
/*----------------------------------------------------------------------*/
//! print headline
void section(const char* s, const char l='-')
{
cout << endl << s << endl;
const char* p=s;
while (*p) { cout << l; ++p; }
cout << endl;
}
/*======================================================================*/
//! test array functionality
int main()
{
cout << AFF_ARRAYTEST_CC_VERSION << endl;
cout << AFF_ARRAYTEST_CC_CVSID << endl;
section("Test constructors", '=');
section("size-constructor");
{
CODE( Array<float> A(3,4); )
DUMP( A );
}
section("shape-constructor");
{
CODE( Array<float> A(Shaper(4,14)(12)(-5,5)); )
DUMP( A );
}
/*----------------------------------------------------------------------*/
section("Test assignment", '=');
{
CODE( Array<float> A(3,4); );
CODE( A=15.5; );
CODE( dump_array(A); );
CODE( A(2,3)=-2.; );
CODE( A(3,1)=-5.; );
CODE( dump_array(A); );
}
/*----------------------------------------------------------------------*/
section("Test access operators", '=');
{
CODE( Array<int> A(Shaper(-2,2)(10,16)(2)(-1,0)); );
section("fill array");
for(int i=A.f(0); i<=A.l(0); i++)
{
for(int j=A.f(1); j<=A.l(1); j++)
{
for(int k=A.f(2); k<=A.l(2); k++)
{
for(int l=A.f(3); l<=A.l(3); l++)
{
A(i,j,k,l)=(i-A.f(0)+1)+(j-A.f(1)+1)*10
+(k-A.f(2)+1)*100+(l-A.f(3)+1)*1000;
}
}
}
}
CODE( dump_array(A,3); );
CODE( dump_array(A,2); );
CODE( dump_array(A,1); );
CODE( dump_array(A,0); );
DUMP( A.representation() );
}
/*----------------------------------------------------------------------*/
section("Test copy", '=');
section("non-const copy");
{
CODE( Array<float> A(3,4); );
CODE( Array<float> B(A); );
CODE( Array<float> C; );
CODE( C=B; );
CODE( A=15.5; );
CODE( A(2,3)=-2.; );
CODE( A(3,1)=-5.; );
CODE( dump_array(C); );
}
section("const copy");
{
CODE( Array<float> A(3,4); );
CODE( A=15.5; );
CODE( ConstArray<float> B(A); );
CODE( dump_array(B); );
CODE( A(2,3)=-2.; );
CODE( A(3,1)=-5.; );
CODE( Array<float>::Trepresentation H; );
CODE( H=A.representation(); );
CODE( H[5]=-12.; );
CODE( dump_array(B); );
CODE( ConstArray<float>::Trepresentation H2; );
CODE( H2=B.representation(); );
DUMP( H2 );
#ifdef ILLEGAL1
#warning compiling supposedly illegal code
CODE( Array<float> C(B); );
#endif
#ifdef ILLEGAL2
#warning compiling supposedly illegal code
CODE( Array<float> C; );
CODE( C=B; );
#endif
#ifdef ILLEGAL3
#warning compiling supposedly illegal code
CODE( B(1,2)=12.; );
#endif
#ifdef ILLEGAL4
#warning compiling supposedly illegal code
CODE( B=12.; );
#endif
#ifdef ILLEGAL5
#warning compiling supposedly illegal code
CODE( H=B; );
#endif
#ifdef ILLEGAL6
#warning compiling supposedly illegal code
CODE( H2[5]=-12.; );
#endif
}
section("read access to ConstArray and const Array");
{
CODE( Array<int> A(3,3) );
CODE( ConstArray<int> B(A) );
CODE( const Array<int> C(A) );
CODE( A=123 );
CODE( cout << A(2,2) << ", " << B(2,2) << ", " << C(2,2) << endl );
#ifdef ILLEGAL7
#warning compiling supposedly illegal code
CODE( C(1,1)=12; );
#endif
}
section("test copyout function");
{
CODE( Array<int> A(8,8));
section("fill array");
for(int i=A.f(0); i<=A.l(0); i++)
{
for(int j=A.f(1); j<=A.l(1); j++)
{
A(i,j)=(i-A.f(0)+1)+(j-A.f(1)+1)*10;
}
}
CODE( dump_array(A); );
CODE( ConstArray<int> CA(subarray(A)(4,6)(3,5)));
CODE( dump_array(CA); );
CODE( Array<int> B=CA.copyout());
CODE( dump_array(B); );
}
}
/* ----- END OF arraytest.cc ----- */
c this is <f77common.inc>
c ----------------------------------------------------------------------------
c ($Id$)
c
c Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
c
c common block for Fortran test
c
c ----
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
c the Free Software Foundation; either version 2 of the License, or
c (at your option) any later version.
c
c This program is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c GNU General Public License for more details.
c
c You should have received a copy of the GNU General Public License
c along with this program; if not, write to the Free Software
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c ----
c
c REVISIONS and CHANGES
c 22/12/2002 V1.0 Thomas Forbriger
c
c ============================================================================
c
c dimensions for arrays
integer amax, bmax
parameter(amax=10,bmax=20)
c
c used elements in each dimension
integer na, nb
c
c complex array
double complex array(amax,bmax)
c
c common block
common /f77common/ array,na,nb
c
c ----- END OF f77common.inc -----
/*! \file f77interface.cc
* \brief interface functions (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 23/12/2002
*
* interface functions (implementation)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* \sa \ref page_fortran
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 23/12/2002 V1.0 Thomas Forbriger
* - 29/12/2002 V1.1 now uses aff::subarray
* - 03/01/2003 V1.2 (thof)
* - use aff::util::SizeCheckedCast
* - FortranArray now takes container type as template
* argument
*
* ============================================================================
*/
#define AFF_F77INTERFACE_CC_VERSION \
"AFF_F77INTERFACE_CC V1.2"
#define AFF_F77INTERFACE_CC_CVSID \
"$Id$"
// include assertions
#include<aff/lib/error.h>
// include FortranArray stuff
#include<aff/fortranshape.h>
#include<aff/subarray.h>
#include<aff/shaper.h>
#include<aff/lib/checkedcast.h>
/*----------------------------------------------------------------------*/
// include interface prototypes
#include"f77proto.h"
/*----------------------------------------------------------------------*/
// get common block
#include"f77common_com.P"
/*----------------------------------------------------------------------*/
// f2c declarations
#include "f2c.h"
#ifdef __cplusplus
extern "C" {
#endif
// include prototypes of Fortran subroutines
#include"f77procs.P"
//! essential definitions to satisfy linker
int MAIN__()
{
AFF_abort("should never be called!");
}
#ifdef __cplusplus
}
#endif
/*======================================================================*/
namespace f77interface {
//! interface function to Fortran77 subroutine fill
int fill(const aff::Array<int>& a)
{
aff::FortranArray<aff::Array<int> > fa(a);
integer* pa=fa.castedpointer<integer>();
integer n1=fa.last(0);
integer n2=fa.last(1);
integer n3=fa.last(2);
integer l1=fa.dimlast(0);
integer l2=fa.dimlast(1);
integer l3=fa.dimlast(2);
return(fill_(pa, &l1, &n1, &l2, &n2, &l3, &n3));
}
/*----------------------------------------------------------------------*/
//! fill common block through Fortran subroutine
int fillarray(const aff::Array<float>& v1,
const aff::Array<float>& v2)
{
aff::FortranArray<aff::Array<float> > fv1(v1),fv2(v2);
real* p1=fv1.castedpointer<real>();
real* p2=fv2.castedpointer<real>();
integer n1=fv1.last(0);
integer n2=fv2.last(0);
return(fillarray_(p1, p2, &n1, &n2));
}
/*----------------------------------------------------------------------*/
//! read from common block through Fortran subroutine
Tcarray sums()
{
typedef Tcarray::Tvalue Tcvalue;
// prepare array that is large enough
integer maxa,maxb;
comdim_(&maxa, &maxb);
Tcarray result(maxa);
// prepare Fortran view
aff::FortranArray<Tcarray> fa(result);
complex* p=fa.castedpointer<complex>();
integer size;
sums_(p, &maxa, &size);
return(aff::subarray(result)(size));
}
/*----------------------------------------------------------------------*/
//! create view from common
Tzarray viewcommon()
{
typedef Tzarray::Tvalue Tzvalue;
typedef aff::util::SizeCheckedCast<doublecomplex, Tzvalue> Tcast;
integer maxa,maxb;
comdim_(&maxa, &maxb);
Tzvalue* p=Tcast::cast(f77common_.array);
// create a shape
aff::Strided shape(aff::Shaper(1,f77common_.na,maxa)(1,f77common_.nb,maxb));
// create a representation
aff::SharedHeap<Tzvalue> repr(p, shape.memory_size());
// create array and return
return Tzarray(shape, repr);
}
} // namespace f77interface
/* ----- END OF f77interface.cc ----- */
c this is <f77procs.f>
c ----------------------------------------------------------------------------
c ($Id$)
c
c Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
c
c Fortran 77 subroutines
c
c ----
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
c the Free Software Foundation; either version 2 of the License, or
c (at your option) any later version.
c
c This program is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c GNU General Public License for more details.
c
c You should have received a copy of the GNU General Public License
c along with this program; if not, write to the Free Software
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c ----
c
c REVISIONS and CHANGES
c 22/12/2002 V1.0 Thomas Forbriger
c
c ============================================================================
c
subroutine fillarray(vec1, vec2, n1, n2)
c
c writes to common block
c
include 'f77common.inc'
c
integer n1,n2
real vec1(n1),vec2(n2)
c
double complex ime
parameter(ime=(0.d0,1.d0))
c
integer i,j
c
if (n1.gt.amax) stop 'ERROR: first dimension is too large'
if (n2.gt.bmax) stop 'ERROR: second dimension is too large'
na=n1
nb=n2
do i=1,n1
do j=1,n2
array(i,j)=vec1(i)+ime*vec2(j)
enddo
enddo
return
end
c
c----------------------------------------------------------------------
c
subroutine sums(vec,nmax,n)
c
c reads from common block