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

removed a lot of "namespace prebuilt"

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.
simplerigidarray and rawarfun are tested and working


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1194
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 0d30b529
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.5 2002-12-12 22:08:19 forbrig Exp $
# $Id: Makefile,v 1.6 2002-12-15 20:48:01 forbrig Exp $
#
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
#
......@@ -40,7 +40,7 @@
#
# You will find the installed library header files in $(LOCINCLUDEDIR)/aff
all: install-include libcontxx.a doxydoc
all: install-include libaff.a doxydoc
# files
# -----
......@@ -51,7 +51,8 @@ HEADERS=$(shell find . -name \*.h)
# in the binary version of the library
# (see below for the configuration of a preinstantiated version of template
# code)
SRC=lib/error.cc dump.cc
SRC=lib/error.cc dump.cc lib/strided.cc lib/stridedstepper.cc
SRC=lib/error.cc dump.cc lib/strided.cc
# test programs are placed in a subdirectory
TESTS=$(wildcard tests/*.cc)
# whereever we find a README, we will use it
......@@ -80,7 +81,7 @@ REMCMMNT=remcmmnt
# compiler and preprocessor flags
FLAGS=
CXXFLAGS=-Wall -pedantic $(FLAGS)
CXXFLAGS=-Wall -pedantic $(FLAGS) -O3
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)
......@@ -297,14 +298,15 @@ doxyview: doxydoc doxyfullview
# delegate test targets
# ---------------------
tests/%: tests/%.cc install-include
tests/%: tests/%.cc install-include libaff.a
cd tests; echo "#############################"; $(MAKE) $(notdir $@)
tests/bin%: tests/bin%.cc install-include libcontxx.a
tests/bin%: tests/bin%.cc install-include libaff.a
cd tests; echo "#############################"; $(MAKE) $(notdir $@)
tests/%.run: tests/%
echo "#############################"
$< $(ARG)
/bin/rm -fv $< $<.o
# ----- END OF Makefile -----
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: dump.cc,v 1.1 2002-12-12 22:08:20 forbrig Exp $
* $Id: dump.cc,v 1.2 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \date 12/12/2002
*
......@@ -19,20 +19,13 @@
#define AFF_DUMP_CC_VERSION \
"AFF_DUMP_CC V1.0 "
#define TF_DUMP_CC_CVSID \
"$Id: dump.cc,v 1.1 2002-12-12 22:08:20 forbrig Exp $"
"$Id: dump.cc,v 1.2 2002-12-15 20:48:01 forbrig Exp $"
#include <aff/array.h>
#include <aff/dump.h>
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
/* ----- END OF dump.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: dump.h,v 1.2 2002-12-13 23:48:29 forbrig Exp $
* $Id: dump.h,v 1.3 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \date 12/12/2002
*
......@@ -17,6 +17,8 @@
*
* REVISIONS and CHANGES
* - 12/12/2002 V1.0 Thomas Forbriger
* - 15/12/2002 V1.1 (thof)
* - no need to place this in namespace prebuilt
*
* ============================================================================
*/
......@@ -25,18 +27,14 @@
#ifndef AFF_DUMP_H_VERSION
#define AFF_DUMP_H_VERSION \
"AFF_DUMP_H V1.0 "
"AFF_DUMP_H V1.1"
#define TF_DUMP_H_CVSID \
"$Id: dump.h,v 1.2 2002-12-13 23:48:29 forbrig Exp $"
"$Id: dump.h,v 1.3 2002-12-15 20:48:01 forbrig Exp $"
#include<iostream>
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
using std::endl;
/*! \defgroup group_helpers Debug functions
......@@ -49,7 +47,8 @@ using std::endl;
* \ingroup group_helpers
*/
template<class T>
void dump(const SharedHeap<T>::Tcoc& sharedheap, std::ostream& os=std::cout)
void dump(const typename aff::SharedHeap<T>::Tcoc& sharedheap,
std::ostream& os=std::cout)
{
os << "dump of a SharedHeap object:" << endl;
os << " size: " << sharedheap.size() << endl;
......@@ -62,6 +61,7 @@ void dump(const SharedHeap<T>::Tcoc& sharedheap, std::ostream& os=std::cout)
os << sharedheap[k] << " ";
if (++i>7) { i=0; os << endl; }
}
os << endl;
}
/*----------------------------------------------------------------------*/
......@@ -81,6 +81,7 @@ void dump(const SimpleRigidArray<T,N>& array, std::ostream& os=std::cout)
os << array[k] << " ";
if (++i>7) { i=0; os << endl; }
}
os << endl;
}
/*----------------------------------------------------------------------*/
......@@ -110,10 +111,6 @@ void dump_map(const Strided& shape, std::ostream& os=std::cout);
/*----------------------------------------------------------------------*/
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
/*! \brief Dump any
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: qualified.h,v 1.2 2002-12-08 22:33:53 forbrig Exp $
* $Id: qualified.h,v 1.3 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
......@@ -17,6 +17,8 @@
*
* REVISIONS and CHANGES
* - 08/12/2002 V1.0 copied from libcontxx
* - 15/12/2002 V1.1 (thof)
* - no need to place this in namespace prebuilt
*
* ============================================================================
*/
......@@ -25,16 +27,12 @@
#ifndef AFF_QUALIFIED_H_VERSION
#define AFF_QUALIFIED_H_VERSION \
"AFF_QUALIFIED_H V1.0 "
"AFF_QUALIFIED_H V1.1"
#define AFF_QUALIFIED_H_CVSID \
"$Id: qualified.h,v 1.2 2002-12-08 22:33:53 forbrig Exp $"
"$Id: qualified.h,v 1.3 2002-12-15 20:48:01 forbrig Exp $"
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
namespace util {
/*!\brief These are typedefs for types with/without const qualifier.
......@@ -99,10 +97,6 @@ namespace util {
} // namespace util
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
#endif // AFF_QUALIFIED_H_VERSION (includeguard)
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: range.h,v 1.3 2002-12-13 22:38:24 forbrig Exp $
* $Id: range.h,v 1.4 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
......@@ -16,6 +16,8 @@
*
* REVISIONS and CHANGES
* - 08/12/2002 V1.0 copied from libcontxx
* - 15/12/2002 V1.1 (thof)
* - no need to place this in namespace prebuilt
*
* ============================================================================
*/
......@@ -24,16 +26,12 @@
#ifndef AFF_RANGE_H_VERSION
#define AFF_RANGE_H_VERSION \
"AFF_RANGE_H V1.0 "
"AFF_RANGE_H V1.1"
#define AFF_RANGE_H_CVSID \
"$Id: range.h,v 1.3 2002-12-13 22:38:24 forbrig Exp $"
"$Id: range.h,v 1.4 2002-12-15 20:48:01 forbrig Exp $"
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
/*! \brief Class to hold and manipulate index ranges.
*
* \param T type of value (usually aff::util::Tsubscript, but may differ)
......@@ -118,10 +116,6 @@ template<class T=Tsubscript>
Tvalue Mlast; //!< end of range.
}; // class Range
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
#endif // AFF_RANGE_H_VERSION (includeguard)
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: rawarfun.h,v 1.4 2002-12-13 23:48:29 forbrig Exp $
* $Id: rawarfun.h,v 1.5 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
......@@ -20,6 +20,8 @@
* REVISIONS and CHANGES
* - 08/12/2002 V1.0 copied from libcontxx
* - 11/12/2002 V1.1 introduced mixed type operatrions
* - 15/12/2002 V1.2 (thof)
* - no need to place this in namespace prebuilt
*
* ============================================================================
*/
......@@ -28,18 +30,14 @@
#ifndef AFF_RAWARFUN_H_VERSION
#define AFF_RAWARFUN_H_VERSION \
"AFF_RAWARFUN_H V1.1 "
"AFF_RAWARFUN_H V1.2"
#define AFF_RAWARFUN_H_CVSID \
"$Id: rawarfun.h,v 1.4 2002-12-13 23:48:29 forbrig Exp $"
"$Id: rawarfun.h,v 1.5 2002-12-15 20:48:01 forbrig Exp $"
#include<aff/lib/types.h>
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
namespace util {
//! Recursive functions to inline raw array operations.
......@@ -116,7 +114,7 @@ namespace util {
{
return((*A)+(*B)*Inline<T, I-1>::strideproduct(&(A[1]),&(B[1])));
}
};
}; // class Inline
//! Partial specialization to stop recursion.
template<typename T>
......@@ -136,9 +134,9 @@ namespace util {
{ return (((*A) > (*B))); }
static inline T innerproduct(const T* A, const T* B)
{ return(A[0]*B[0]); }
static inline T strideroduct(const T* A, const T* B)
{ return(A[0]); }
};
static inline T strideproduct(const T* A, const T* B)
{ return(A[0]+B[0]); }
}; // class Inline<T, 1>
/*----------------------------------------------------------------------*/
......@@ -198,7 +196,7 @@ namespace util {
{
return((*A)+(*B)*Inline2<T1, T2, I-1>::strideproduct(&(A[1]),&(B[1])));
}
};
}; // class Inline2
//! Partial specialization to stop recursion.
template<typename T1, typename T2>
......@@ -214,16 +212,12 @@ namespace util {
{ return (((*A) > (*B))); }
static inline T1 innerproduct(const T1* A, const T2* B)
{ return(A[0]*B[0]); }
static inline T1 strideroduct(const T1* A, const T2* B)
{ return(A[0]); }
};
static inline T1 strideproduct(const T1* A, const T2* B)
{ return(A[0]+B[0]); }
}; // class Inline2<T1, T2, 1>
} // namespace util
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
#endif // AFF_RAWARFUN_H_VERSION (includeguard)
......
/*! \file simplearray.h
* \brief a simple rigid array (prototypes)
* \brief a simple rigid array
*
* ----------------------------------------------------------------------------
*
* $Id: simplearray.h,v 1.6 2002-12-15 19:32:52 forbrig Exp $
* $Id: simplearray.h,v 1.7 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
* a simple rigid array (prototypes)
*
* \todo
* Add documentation about usage of this header.
*
* \todo
* The SimpleRigidArray now is in the parent namespace aff. But the inline
* array functions are still placed in util. Give correct scope.
* a simple rigid array
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 08/12/2002 V1.0 copied from libcontxx
* - 11/12/2002 V1.1 introduced extra inner product for mixed types
* - 15/12/2002 V1.2 (thof)
* - no need to place this into namespace prebuilt
*
* ============================================================================
*/
......@@ -31,22 +26,14 @@
#define AFF_SIMPLEARRAY_H_VERSION \
"AFF_SIMPLEARRAY_H V1.1 "
#define AFF_SIMPLEARRAY_H_CVSID \
"$Id: simplearray.h,v 1.6 2002-12-15 19:32:52 forbrig Exp $"
"$Id: simplearray.h,v 1.7 2002-12-15 20:48:01 forbrig Exp $"
#include<aff/lib/types.h>
#include<aff/lib/rawarfun.h>
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
#ifdef AFF_PREBUILT
using namespace aff::prebuilt::util;
#else
using namespace aff::util;
#endif
using namespace aff::util;
/*! \brief A very basic rigid array class (with deep inline copy).
*
......@@ -210,10 +197,6 @@ namespace prebuilt {
const SimpleRigidArray<T, N>& B)
{ return Inline<T, N>::strideproduct(A.pointer(), B.pointer()); }
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
#endif // AFF_SIMPLEARRAY_H_VERSION (includeguard)
......
/*! \file strided_def.h
* \brief shape of a strided array (definitions) (prototypes)
/*! \file strided.cc
* \brief shape of a strided array (definitions)
*
* ----------------------------------------------------------------------------
*
* $Id: strided.cc,v 1.1 2002-12-15 19:32:52 forbrig Exp $
* $Id: strided.cc,v 1.2 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
* shape of a strided array (definitions) (prototypes)
* shape of a strided array (definitions)
* \sa aff::Strided
*
* \note
* Never include this header directly. Here you find code factored out from
* the aff::Strided class. This code may be compiled into a binary library.
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
......@@ -28,36 +24,24 @@
* - reworked shape definition and mapping
* - added straightforward implementations for
* subarrays and slicing
* - 14/12/2002 V1.4 (thof)
* - this now is a compilable source file (no longer a
* header) the code contains not template parameter
* and fits well in the binary library
*
* ============================================================================
*/
#ifndef AFF_STRIDED_H_VERSION
#error "include this only through strided.h"
#endif
// include guard
#ifndef AFF_STRIDED_DEF_H_VERSION
#define AFF_STRIDED_DEF_H_VERSION \
#define AFF_STRIDED_CC_VERSION \
"AFF_STRIDED_DEF_H V1.3"
#define AFF_STRIDED_DEF_H_CVSID \
"$Id: strided.cc,v 1.1 2002-12-15 19:32:52 forbrig Exp $"
#define AFF_STRIDED_CC_CVSID \
"$Id: strided.cc,v 1.2 2002-12-15 20:48:01 forbrig Exp $"
#include<aff/lib/strided.h>
#include<aff/lib/error.h>
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
#ifdef AFF_PREBUILT
#ifndef AFF_COMPILING_LIBRARY
#error "definition read in prebuilt mode and not during library compilation"
#endif
#endif
/*----------------------------------------------------------------------*/
//! instantiate static member (otherwise the linker won't find it)
......@@ -224,12 +208,6 @@ namespace prebuilt {
return(*this);
}
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
#endif // AFF_STRIDED_DEF_H_VERSION (includeguard)
/* ----- END OF strided_def.h ----- */
/* ----- END OF strided.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: strided.h,v 1.9 2002-12-15 19:32:52 forbrig Exp $
* $Id: strided.h,v 1.10 2002-12-15 20:48:01 forbrig Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
......@@ -13,9 +13,6 @@
* \note
* You usually will not include this directly. It is included through array.h
* and binarray.h
*
* \todo
* Needs a maximum dimensionality defining static member.
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
......@@ -34,6 +31,9 @@
* - correct definition of mapping formula
* - provides enough basic functionality
* (including access needed by stepper)
* - 14/12/2002 V1.4 (thof)
* - template-free definition part will now always
* be placed in the binary library
*
* ============================================================================
*/
......@@ -44,17 +44,13 @@
#define AFF_STRIDED_H_VERSION \
"AFF_STRIDED_H V1.3"
#define AFF_STRIDED_H_CVSID \
"$Id: strided.h,v 1.9 2002-12-15 19:32:52 forbrig Exp $"
"$Id: strided.h,v 1.10 2002-12-15 20:48:01 forbrig Exp $"
#include<aff/lib/types.h>
#include<aff/lib/simplearray.h>
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
/*! \brief Shape for a rectangular array layout.
*
* A rectangular array layout is the usual layout for multi-dimensional
......@@ -74,9 +70,6 @@ namespace prebuilt {
* \todo
* rework documentation of Strided
*
* \todo
* do we need using namespace util?
*
* \internal
* \par Mapping of index values into linear representation range
* The shape class defines how index values \a i0, \a i1, etc. are mapped
......@@ -234,16 +227,8 @@ namespace prebuilt {
TIndexVec Mbase; //<! base for each dimension (see index operators)
};
#ifdef AFF_PREBUILT
} // namespace prebuilt
#endif
} // namespace aff
#ifndef AFF_NO_DEFINITIONS
#include <aff/lib/strided_def.h>
#endif
#endif // AFF_STRIDED_H_VERSION (includeguard)
/* ----- END OF strided.h ----- */
/*! \file strided_def.h
* \brief shape of a strided array (definitions) (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: strided_def.h,v 1.7 2002-12-15 19:32:52 forbrig Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
* shape of a strided array (definitions) (prototypes)
* \sa aff::Strided
*
* \note
* Never include this header directly. Here you find code factored out from
* the aff::Strided class. This code may be compiled into a binary library.
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 08/12/2002 V1.0 copied from libcontxx
* - 11/12/2002 V1.1 major revision (thof)
* - removed template parameter
* - calculates base for index operator of
* each dimensionality
* - 12/12/2002 V1.2 (thof)
* - added shrink and collapse
* - 13/12/2002 V1.3 (thof)
* - reworked shape definition and mapping
* - added straightforward implementations for
* subarrays and slicing
*
* ============================================================================
*/
#ifndef AFF_STRIDED_H_VERSION
#error "include this only through strided.h"
#endif
// include guard
#ifndef AFF_STRIDED_DEF_H_VERSION
#define AFF_STRIDED_DEF_H_VERSION \
"AFF_STRIDED_DEF_H V1.3"
#define AFF_STRIDED_DEF_H_CVSID \
"$Id: strided_def.h,v 1.7 2002-12-15 19:32:52 forbrig Exp $"
#include<aff/lib/error.h>
namespace aff {
#ifdef AFF_PREBUILT
namespace prebuilt {
#endif
#ifdef AFF_PREBUILT
#ifndef AFF_COMPILING_LIBRARY
#error "definition read in prebuilt mode and not during library compilation"
#endif
#endif
/*----------------------------------------------------------------------*/
//! instantiate static member (otherwise the linker won't find it)
const Tdim Strided::Mmax_dimen;
/*----------------------------------------------------------------------*/
//! construct do given size and first index
Strided::Strided(const TSizeVec& size,
const Tsubscript& first,
const Tsubscript& shift)
{
TSizeVec one(1);
AFF_assert((!inline_anylarger(one,size)),
"ERROR (Strided): size must be at least one");
Mfirst=first;
Mstride[0]=1;
Mlast[0]=Mfirst[0]+size[0]-1;
for(Tdim i=1; i<Mmax_dimen; i++)
{
Mstride[i]=Mstride[i-1]*size[i-1];