Commit 4b30e1bf authored by thomas.forbriger's avatar thomas.forbriger

[TASK] (vendor_Seitosh): Seitosh vendor drop from 1.2.2013

Replay vendor drop as took place in the original subversion repository of
DENISE. Source code from the subversion repository of TFSoftware was copied to
vendor branches aff, cseife, fourier, and stfinv.

aff:     subversion revision 372
cseife:  subversion revision 369
fourier: subversion revision 375
stfinv:  subversion revision 378

Source code is copied from tag directories 20130201

Notice: The contents of this commit are not in sync with the corresponding
export tags as present in the Seitosh repository. This must be due to
unintentional modification of files when copying contents as tagged for export
in TFSoftware to the vendor branch in the subversion repository of (formerly
called FWI_elastic/DENISE).
parents
this is <COPYING>
============================================================================
libaff
------
$Id: COPYING 4964 2013-02-01 13:27:42Z lrehor $
============================================================================
Copyright (C) 2002 by Thomas Forbriger and Wolfgang Friederich
Copyright (C) 2013 by Thomas Forbriger
The source code and other files in this directory are part of libaff. libaff
is a template library. Part of the code compiles to libaff.a
libaff 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
----- END OF COPYING -----
/*! \file Carray.h
* \brief classes to interface raw C arrays (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: Carray.h 3957 2011-05-16 14:46:43Z tforb $
* \author Thomas Forbriger
* \date 14/05/2011
*
* classes to interface raw C arrays (prototypes)
*
* Copyright (c) 2011 by Thomas Forbriger (BFO Schiltach)
*
* ----
* 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
* ----
*
*
* REVISIONS and CHANGES
* - 14/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef AFF_CARRAY_H_VERSION
#define AFF_CARRAY_H_VERSION \
"AFF_CARRAY_H V1.0 "
#define AFF_CARRAY_H_CVSID \
"$Id: Carray.h 3957 2011-05-16 14:46:43Z tforb $"
#include<aff/array.h>
#include<aff/lib/checkedcast.h>
namespace aff {
/*! \brief Interface class to raw memory (C style array)
*
* This class together with aff::CArray is provided as an interface for
* users which have to provide the contents of an array through raw memory
* pointers in C style.
* Both classes take an aff::ConstArray or aff::Array instance respectively
* as an argument for their constructor.
* They provide a pointer to raw memory through their member functions
* pointer() and castedpointer().
* If a pointer \c p to the raw memeory behind \c array is defined by
* \code
* aff::Array<T> array;
* aff::CArray<T> carray(array);
* T* p=carray.pointer();
* \endcode
* then the array element \c array(i0,i1,i2,i3) is addressed by
* \code
* p[i0*s0+i1*s1+i2*s2+i3*s3]
* \endcode
* where the index value ranges are
* - \c i0=0,1,... \c n0-1
* - \c i1=0,1,... \c n1-1
* - \c i2=0,1,... \c n2-1
* - \c i3=0,1,... \c n3-1
*
* and
* - \c n0=carray.size(0)
* - \c n1=carray.size(1)
* - \c n2=carray.size(2)
* - \c n3=carray.size(3)
*
* and
* - \c s0=carray.stride(0)
* - \c s1=carray.stride(1)
* - \c s2=carray.stride(2)
* - \c s3=carray.stride(3)
*
* \note
* The pointers passed by the access functions of this class are (certainly)
* not reference counted.
* Make sure to keep an instance of one of the arrays maintining the
* underlying memory allocation as long as these pointers are in use.
*
* \sa helpertest.cc
*/
template<class T>
class ConstCArray
{
public:
/*! \name Various types
*
* In particular due to our concept of const-correctness we need
* several typedefs to declare types derived from the element type of
* the array.
*
* \sa \ref sec_design_interface_typedef
* \sa \ref sec_design_const
*/
//@{
//! Type of array to be interfaced
typedef ConstArray<T> Tarray;
//! Type of representation
typedef typename Tarray::Trepresentation Trepresentation;
//! Type of shape
typedef typename Tarray::Tshape Tshape;
//! we use this for one of the access operators
typedef typename Tshape::TSizeVec TSizeVec;
//! Element type
typedef typename Tarray::Tvalue Tvalue;
//! Type of pointer to element
typedef typename Tarray::Tpointer Tpointer;
//! Type of reference to element
typedef typename Tarray::Treference Treference;
//! const element type
typedef typename Tarray::Tconst_value Tconst_value;
//! Type of pointer to const element
typedef typename Tarray::Tconst_pointer Tconst_pointer;
//! Type of reference to const element
typedef typename Tarray::Tconst_reference Tconst_reference;
//! Type of this array
typedef ConstCArray<T> Tcontainer;
//! Type of the array of const values
typedef Tcontainer Tcontainer_of_const;
//! Short for Tcontainer_of_const
typedef Tcontainer Tcoc;
//@}
/*-----------------------------------------------------------------*/
/*! \name Constructors
*
* No copy constructors or copy operators are provided since this is
* provided as an interface class only.
*/
//@{
//! construct from shape and representation
ConstCArray(const Tarray& array)
: Mrepresentation(array.representation())
{
Tshape shape=array.shape();
// index range is zero based
shape.setfirst(typename Tshape::TIndexVec(0));
// offset to first element in represented memory
Moffset=shape.first_offset();
// strides
Mstride=shape.stride();
// sizes
Msize=shape.last();
for (unsigned i=0; i<Msize.size(); ++i)
{
++Msize[i];
}
}
//@}
/*------------------------------------------------------------------*/
/*! \name Shape access
*/
//@{
//! size of dimension \par i
const Tsize& size(const Tsubscript& i) const
{ return (Msize[i]); }
//! stride of dimension \par i
const Tsize& stride(const Tsubscript& i) const
{ return Mstride[i]; }
//! size of dimensions
const TSizeVec& size() const
{ return (Msize); }
//! strides of dimensions
const TSizeVec& stride() const
{ return Mstride; }
//@}
/*-----------------------------------------------------------------*/
/*! \name Memory access
*
*/
//@{
//! return pointer to first element in Fortran layout
Tconst_pointer pointer() const
{ return(&Mrepresentation[this->offset()]); }
/*! \brief return type-casted pointer to first element in Fortran
* layout
*
* The cast checks for const-correctness and type-size. But you have
* to ensure that there is a meaningful relation between both types
* involved.
*
* \sa aff::util::SizeCheckedCast
*/
template<class TT>
TT* castedpointer() const
{ return(SizeCheckedCast<Tconst_value,TT>::cast(this->pointer())); }
//@}
protected:
//! pass offset to derived class
const typename TSizeVec::Tvalue& offset() const { return Moffset; }
private:
//! representation member
Trepresentation Mrepresentation;
//! sizes of dimensions
TSizeVec Msize;
//! strides of dimensions
TSizeVec Mstride;
//! offset to first index
typename TSizeVec::Tvalue Moffset;
}; // class ConstCArray
/*======================================================================*/
/*! \brief Interface class to raw memory (C style array)
*
* See aff::ConstCArray for the basic concepts used here.
*
* \sa aff::ConstCArray
*/
template<class T>
class CArray:
public ConstCArray<T>
{
public:
/*! \name Various types
*
* In particular due to our concept of const-correctness we need
* several typedefs to declare types derived from the element type of
* the array.
*
* \sa \ref sec_design_interface_typedef
* \sa \ref sec_design_const
*/
//@{
//! Type of array to be interfaced
typedef aff::Array<T> Tarray;
//! Base class
typedef aff::ConstCArray<T> Tbase;
//! Type of representation
typedef typename Tarray::Trepresentation Trepresentation;
//! Type of shape
typedef typename Tarray::Tshape Tshape;
//! we use this for one of the access operators
typedef typename Tshape::TSizeVec TSizeVec;
//! Element type
typedef typename Tarray::Tvalue Tvalue;
//! Type of pointer to element
typedef typename Tarray::Tpointer Tpointer;
//! Type of reference to element
typedef typename Tarray::Treference Treference;
//! const element type
typedef typename Tarray::Tconst_value Tconst_value;
//! Type of pointer to const element
typedef typename Tarray::Tconst_pointer Tconst_pointer;
//! Type of reference to const element
typedef typename Tarray::Tconst_reference Tconst_reference;
//! Type of this array
typedef CArray<T> Tcontainer;
//! Type of the array of const values
typedef Tbase Tcontainer_of_const;
//! Short for Tcontainer_of_const
typedef Tcontainer Tcoc;
//@}
/*-----------------------------------------------------------------*/
/*! \name Constructors
*
* No copy constructors or copy operators are provided since this is
* provided as an interface class only.
*/
//@{
//! construct from shape and representation
CArray(const Tarray& array)
: Tbase(array), Mrepresentation(array.representation())
{ }
//@}
/*-----------------------------------------------------------------*/
/*! \name Memory access
*
*/
//@{
//! return pointer to first element in Fortran layout
Tpointer pointer() const
{ return(&Mrepresentation[this->offset()]); }
/*! \brief return type-casted pointer to first element in Fortran
* layout
*
* The cast checks for const-correctness and type-size. But you have
* to ensure that there is a meaningful relation between both types
* involved.
*
* \sa aff::util::SizeCheckedCast
*/
template<class TT>
TT* castedpointer() const
{ return(SizeCheckedCast<Tvalue,TT>::cast(this->pointer())); }
//@}
private:
//! my (mutable) data representation
Trepresentation Mrepresentation;
}; // class CArray
} // namespace aff
#endif // AFF_CARRAY_H_VERSION (includeguard)
/* ----- END OF Carray.h ----- */
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile 4964 2013-02-01 13:27:42Z lrehor $
#
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
#
# libaff is the "Array Friederich Forbriger", a container for numbers
#
# It is published under terms of the GNU General Public License.
#
# ----
# 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
# ----
#
# A note on header files:
# We extensively comment class declarations within the header files. The
# reduce compilation time when using the library code, comments will be
# stripped from the header files that are exportet. These stripped versions
# are placed in the source code path with name *.h.strip and will be linked to
# INCINSTALLPATH with name *.h.
#
# Although comment stripping could be done by perl with an elaborate regular
# expression, we prefer the remcmmnt command by Jari Laaksonen. You can find
# the code at
# http://www.eti.pg.gda.pl/KATEDRY/kecs/lab-cpp/snippets/
# If it is not available to you, you should set TF_REMCMMNT=cat (see below)
#
# REVISIONS and CHANGES
# 06/12/2002 V1.0 Thomas Forbriger
# 27/12/2002 V1.1 doxygen reads Fortran code and files generated by f2c
# 03/01/2003 V1.2 improved white-space-eating awk-script
# 04/01/2003 V1.3 corrected yesterday's change
# 28/03/2006 V1.4 provide a package
# 11/12/2007 V1.5 library and test programs compile well on a 64bit
# systems; the Fortran interface was tested with g77
# and f2c (not yet with gfortran)
# 17/08/2010 V1.6 prepare for new environment settings
# 18/09/2010 V1.7 TF_WWWBASEDIR and TF_REMCMMNT must be used
# 10/11/2010 V1.8 removed fragments for binarry
# 17/01/2011 V1.9 distinguish library creation and installation
# 27/07/2011 V1.10 give precedence to $LOCINCLUDEDIR over
# $SERVERINCLUDEDIR
#
# ============================================================================
#
# environment variables
# ---------------------
#
# You will like to set the following environment variables:
#
# LOCINCLUDEDIR Defines the path where header files will be copied for
# usage in your own projects. You will pass this path to
# the precompiler with the -I option.
# LOCLIBDIR Defines the path where the binary library will be
# placed.
# TF_WWWBASEDIR Defines the path to your personal homepage. That's the
# place where doxygen output will be written too (see
# below).
#
# You will find the installed library header files in $(LOCINCLUDEDIR)/aff
.PHONY: all
all: install doc
.PHONY: doc
doc: doxydoc
LIBRARIES=libaff.a libaff.so
.PHONY: install
install: $(addprefix $(LOCLIBDIR)/,$(LIBRARIES))
$(LOCLIBDIR)/%: install-include %
mkdir -pv $(LOCLIBDIR)
/bin/mv -fv $(word 2,$^) $(LOCLIBDIR)
# ============================================================================
# a variable definition to check variable settings
# ------------------------------------------------
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))
# check for required variables
$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR TF_WWWBASEDIR)
#======================================================================
# files and paths
# ---------------
# all header files used within this project
HEADERS=$(shell find . -name \*.h)
# all source code to be compiled to object files and to be included
# 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 lib/strided.cc lib/stridedstepper.cc \
lib/seriesstepper.cc fortranshape.cc
# test programs are placed in a subdirectory
TESTS=$(wildcard tests/*.cc)
# whereever we find a README, we will use it
README=$(shell find . -name README) README.changelog README.groups
# place where we will copy header files
INCINSTALLPATH=$(LOCINCLUDEDIR)/aff
# place where we will copy the binary library
LIBINSTALLPATH=$(LOCLIBDIR)
# name of headers with comments stripped off (these are linked to your include
# directory)
STRIPHEADER=$(addsuffix .strip,$(notdir $(HEADERS)))
# name of installed (exported) header files (these are the names in your
# include directory)
INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(filter-out ./tests/%,$(HEADERS)))
#======================================================================
# comments can be removed from headers
# ------------------------------------
# if defined, empty lines are kept in comment-stripped headers
# to synchronize line numbers (necessary during library debugging)
EMPTYPRINT=1
#EMPTYPRINT=0
# define this to be cat in case you do not have remcmmnt available
ifndef TF_REMCMMNT
TF_REMCMMNT=cat
endif
#REMCMMNT=remcmmnt
#REMCMMNT=cat
#======================================================================
# compiler and preprocessor flags
# -------------------------------
FLAGS=
FLAGS+=$(MYFLAGS) -fPIC
CXXFLAGS+=-Wall $(FLAGS) -O3
LDFLAGS=$(addprefix -L,$(LOCLIBDIR) $(subst :, ,$(SERVERLIBDIR)))
CPPFLAGS=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \
$(FLAGS)
#======================================================================
# targets
# -------
# files which are to be edited
flist: Makefile tests/Makefile doxydoc.cfg $(README) COPYING \
$(HEADERS) $(SRC) $(TESTS) $(wildcard doxy*.cfg) \
tests/f77common.inc tests/f77procs.f
echo $(filter-out lib/% tests/%,$^) | tr ' ' '\n' | sort > $@
echo $(filter lib/%,$^) | tr ' ' '\n' | sort >> $@
echo $(filter tests/%,$^) | tr ' ' '\n' | sort >> $@
# Offers you a list of files to edit (ask Thomas for appropriate vim
# configuration).
.PHONY: edit
edit: flist; vim $<
# Target clean removes everything except the source code, headers and
# documentation. (See also doxyclean)
.PHONY: clean
clean: ;
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.o | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.d | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.h.strip | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.o install-include libcontxx.a *.xxx junk* *.a *.so
cd tests; $(MAKE) clean
#======================================================================
# library part
# ============
#
# create the binary library
# -------------------------
LIBOBS=$(ALLOBS) $(patsubst %.cc,%.o,$(SRC))
LIBOBS=$(patsubst %.cc,%.o,$(SRC))
libaff.a: $(INSTHEADER) $(LIBOBS)
ar rcv $@ $(LIBOBS)
ranlib $@
libaff.so: $(INSTHEADER) $(LIBOBS)
$(CXX) $(CXXFLAGS) -shared -o $@ $(LIBOBS)
#======================================================================
# dependencies
# ------------
#
# The compiler is used to create dependency files, which are included below.
%.d: %.cc
$(SHELL) -ec '$(CXX) -M $(CPPFLAGS) $(TMPPARDEF) $< \
| sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
> $@; \
[ -s $@ ] || rm -f $@'
include $(patsubst %.cc,%.d,$(SRC))
# this include will be used once we initiate the precompiled library version
# until then it's just waiting here
#-include $(patsubst %.o,%.d,$(ALLOBS))
#======================================================================
# header files
# ------------
#
# Since we extensively document the class structures within the header files,
# these should be stripped for the production version (otherwise the compiler
# has to scan all comments on each compile). Stripping is done by the rule