diff --git a/contrib/.gitignore b/contrib/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..749cfece5a5ad4a97cf479b354dd8f29b55eea2f --- /dev/null +++ b/contrib/.gitignore @@ -0,0 +1,3 @@ +doc +bin +header diff --git a/contrib/Makefile_var b/contrib/Makefile_var index 813988e01efe5c2d8cd445cdc8f6e388725ab253..1f0be2cda1efb18bd1c1e79167555c57973fae75 100644 --- a/contrib/Makefile_var +++ b/contrib/Makefile_var @@ -1,12 +1,39 @@ -# This is a file for environment variables used in Makefiles in aff fourier stfinv +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2015 by Thomas Forbriger (BFO Schiltach) +# +# set variables expected by vendor Makefiles +# +# REVISIONS and CHANGES +# 02/11/2015 V1.0 Thomas Forbriger +# +# ============================================================================ +# +# This file is included (via make include statement) by Makefiles in +# aff, fourier, stfinv, and libcseife +# +# Its purpose is to set make variables which are expected by vendor Makefiles. +# +# ============================================================================ -LOCINCLUDEDIR=../header +# extract relative path to contrib with respect of including Makefile +CONTRIBDIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST)))) -LOCLIBDIR=../bin -LOCBINDIR=../bin +# ---------------------------------------------------------------------------- +# set values required by vendor Makefiles +LOCINCLUDEDIR=$(CONTRIBDIR)/header -TF_WWWBASEDIR=$HOME/public_html/txt/cxx +LOCLIBDIR=$(CONTRIBDIR)/bin +LOCBINDIR=$(CONTRIBDIR)/bin + +TF_WWWBASEDIR=$(CONTRIBDIR)/doc TF_BROWSER=firefox +# set Fortran compiler if not yet set in environment +ifeq "$(origin FC)" "default" FC=/usr/bin/g77-3.3 +endif + +# ----- END OF Makefile_var ----- diff --git a/contrib/aff/COPYING b/contrib/aff/COPYING index 6312daf8c773f4d1f4ea4cf08d35ad7b2c4cff91..bbe3ff12866232a4d67ead94ad7f11683fd2de0f 100644 --- a/contrib/aff/COPYING +++ b/contrib/aff/COPYING @@ -2,7 +2,7 @@ this is ============================================================================ libaff ------ -$Id: COPYING 4964 2013-02-01 13:27:42Z lrehor $ +$Id$ ============================================================================ Copyright (C) 2002 by Thomas Forbriger and Wolfgang Friederich diff --git a/contrib/aff/Carray.h b/contrib/aff/Carray.h index 1e3f46511fa7d79a855002767f7426cd6d0f99cd..15287254e20a8e2503d3a09ae85ae481a5e1e31d 100644 --- a/contrib/aff/Carray.h +++ b/contrib/aff/Carray.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: Carray.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 14/05/2011 * @@ -40,7 +40,7 @@ #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 $" + "$Id$" #include #include diff --git a/contrib/aff/Makefile b/contrib/aff/Makefile index d20b3d525d68982a1a8957d06354689f3c4fd5bb..242cea98353939dc950d407f2064446d765984f2 100644 --- a/contrib/aff/Makefile +++ b/contrib/aff/Makefile @@ -1,6 +1,6 @@ # this is # ---------------------------------------------------------------------------- -# $Id: Makefile 4964 2013-02-01 13:27:42Z lrehor $ +# $Id$ # # Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) # @@ -24,19 +24,10 @@ # 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. +# Please have a look at the README file coming along with the source code in +# this directory for further notes regarding provided functionality, +# prerequisites and installation. # -# 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 @@ -52,26 +43,12 @@ # 17/01/2011 V1.9 distinguish library creation and installation # 27/07/2011 V1.10 give precedence to $LOCINCLUDEDIR over # $SERVERINCLUDEDIR +# 26/01/2014 eliminate comment stripping # # ============================================================================ -# -# 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 -include ../Makefile_var +CONTRIBDIR=.. +include $(CONTRIBDIR)/Makefile_var .PHONY: all @@ -113,36 +90,19 @@ SRC=lib/error.cc dump.cc lib/strided.cc lib/stridedstepper.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 +README=$(shell find . -name README) +# the frame of doxygen documentation is palced in text files +DOXYTXT=$(shell find . -name doxygen\*.txt) # 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 # ------------------------------- @@ -158,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) \ - tests/f77common.inc tests/f77procs.f +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 >> $@ @@ -177,9 +136,7 @@ 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 + -/bin/rm -vf flist *.o install-include *.xxx junk* *.a *.so #====================================================================== # library part @@ -218,35 +175,12 @@ include $(patsubst %.cc,%.d,$(SRC)) #====================================================================== # 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 -# below and is controlled by the variables TF_REMCMMNT and EMPTYPRINT (see -# above). - -# comment stripping -# ----------------- -$(call CHECKVARS,TF_REMCMMNT EMPTYPRINT) - -# awk rule assumes that the first non-comment line starts with '#' -# and that the first (copyright) comment end with pattern "^ */" -%.h.strip: %.h - awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\ - /^#/ { hot=0; } \ - { if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@ - $(TF_REMCMMNT) $< | awk 'BEGIN {hot=0;} \ - /^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print ""; } next; } \ - /^#/ { hot=1; } { if (hot) print; }' >> $@ - -#---------------------------------------------------------------------- -.PRECIOUS: %.h.strip $(call CHECKVAR,INCINSTALLPATH) -$(INCINSTALLPATH)/%.h: %.h.strip - mkdir -vp $(dir $@) - -rm -fv $@ - /bin/cp -vpd $< $@ +$(INCINSTALLPATH)/%.h: %.h + @mkdir -vp $(dir $@) + -@rm -fv $@ + @/bin/cp -vpd $< $@ # install header files .PHONY: install-include @@ -292,9 +226,7 @@ DOXYWWWPATH=$(TF_WWWBASEDIR)/libaff doxyclean: ;/bin/rm -rfv $(TF_WWWBASEDIR)/libaff doxydoc.xxx -DOXYSRC=$(README) $(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) @@ -326,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 # -------------- diff --git a/contrib/aff/README b/contrib/aff/README index ee454360322cf6422efe482242286695d94d524f..f5fc068f7e739610556f106058b9752cc3e05b4b 100644 --- a/contrib/aff/README +++ b/contrib/aff/README @@ -1,973 +1,45 @@ -/*! \file libaff/README - * \brief C++ containers for numbers (libaff) - * - * ---------------------------------------------------------------------------- - * - * $Id: README 4964 2013-02-01 13:27:42Z lrehor $ - * - * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) - * - * ---- - * 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 - * ---- - * - * C++ containers for numbers (libaff) - * - * This file contains: - * - documentation of namespace aff - * - mainpage text - * - documentation for pages: - * - \ref page_design - * - \ref page_using - * - \ref page_notes - * - \ref page_naming - * - * REVISIONS and CHANGES - * - 06/12/2002 V1.0 Thomas Forbriger (copied from libcontxx) - * - 20/12/2002 V1.1 (thof) - * - complete revision of this file - * - there are major gaps in - * -# \ref sec_design_multidimensional - * -# \ref page_using - * - 28/12/2002 V1.2 (thof) - * - new term for containers of const elements - * - added documentation regarding the concept of - * const correctness - * - added documentation regarding member typedefs - * - 29/12/2002 V1.3 (thof) - * - added section about replicated shared heap base - * class (\ref sec_design_replicated) - * - added section about sparse interface - * (\ref sec_design_interface_sparse) - * - added section about accessing internals - * (\ref sec_design_interface_internals) - * - reflect changes to Subarray and Slice - * - tell about class hierarchies and member data vs. - * inheritance - * - 04/01/2003 V1.4 (thof) - * - added section about Tcontainer typedef - * (\ref sec_design_interface_tcontainer) - * - 10/02/2004 V1.5 (thof) - * - added section about decision against interface - * base classes - * (\ref sec_design_interface_nobaseclass) - * - 10/11/2010 V1.6 (thof) - * - code fragments for precompiled templates are - * removed from the library (\ref sec_design_binary) - * - 14/05/2011 V1.7 (thof) - * - add info on raw-major and column-major order - * - 15/05/2011 V1.8 (thof) - * - reordered documentation, movde modules to - * README.groups - * - * ============================================================================ - */ - -/*! \brief Root namespace of library - - This namespace contains all modules of the library - (see \ref sec_main_modules). - Here you should find all components, the user needs to work with this - library. - */ -namespace aff { -} // namespace aff - -/*======================================================================*/ - -/*! \mainpage - -\author Thomas Forbriger -\author Wolfgang Friederich -\since December 2002 -\date December 2002 -\version V1.0 -$Id: README 4964 2013-02-01 13:27:42Z lrehor $ - - Contents of this page: - - \ref sec_main_aims - - \ref sec_main_need - - \ref sec_main_peculiar - - \ref sec_main_modules - - Additional information: - - \ref page_changelog - - \ref page_project_status - - \ref page_using - - \ref page_array_layout - - \ref page_design - - \ref page_naming - - \ref page_representation - - \ref page_fortran - -\section sec_main_aims Aims of the library - - The AFF (Array of Friederich and Forbriger) is a lightweight class library. - It offers a simple and easy to use container for numbers as is necessary in - numerical code. The offered array always has a rectangular strided layout, - reference semantics (through counted references) and a Fortran layout in - memory. The interface is intentionally kept sparse to keep compilation times - small. The array itself is meant to be used to pass numbers from one program - module to the other. If you want to exploit the power of expression - templates, pass the array contents to something like Blitz++. - - - Contents of this page: - -\section sec_main_peculiar Peculiarities of AFF - -\par Containers use counted references -All containers (e.g. aff::Array, aff::Series) use counted references to access -global memory. Assigning one container object to another just assigns the -reference. Both will use the same data in memory afterwards. -\sa \ref page_representation. - -\par Const-correctness for array elements -In this library we follow provide functionality to write const-correct code -with regard to the array container and with regard to its element values. -\sa \ref sec_design_const. - -\par Multidimensional arrays -Every aff::Array of this class has aff::Strided::Mmax_dimen dimensions. -Construction and access for lower dimensionality is provided. In the case of -using less dimensions, the size of the unused dimensions is 1 by default and -its index is inherently set to the first index. -\sa \ref sec_design_multidimensional. - -\section sec_main_need Why do we need this array library - - One major reason for replacing Fortran77 by C++ in numerical code is the - convenience in expressing logistics. Data of different type and size may be - packed into classes and encapsulated from the outside world. Most numerical - results are to be stored in arrays, multi-dimensional arrays in particular. - This library provides the basic functionality for storing many data of the - same type in memory, passing them around between subroutines in an efficient - way and accessing them through convenient interfaces. The main purpose of - this library is not calculation but managing (passing between program - modules, selection of subsets of the data) large amounts of numbers. In the - future it might provide interfaces to libraries like blitz++ for finite - difference calculations, MTL for linear algebra calculations, and POOMA for - parallel computations. - - \sa http://www.sophya.org/, http://www.boost.org - -\section sec_main_modules Modules of the library - - The main module is the array class aff::Array. It provides basic - functionality through its interface. See the explanation there. - It is presented in aff/array.h - The object code is placed in libaff.a. - - \sa \ref group_array, \ref group_array_extensions -*/ - -/*======================================================================*/ - -/*! \page page_design Design decisions - - Contents of this page: - - \ref sec_design_interface - - \ref sec_design_interface_sparse - - \ref sec_design_interface_typedef - - \ref sec_design_interface_tcontainer - - \ref sec_design_interface_internals - - \ref sec_design_interface_nobaseclass - - \ref sec_design_threeclasses - - \ref sec_design_hierarchy - - \ref sec_design_replicated - - \ref sec_design_replicated_fact - - \ref sec_design_replicated_problem - - \ref sec_design_replicated_solution - - \ref sec_design_copy - - \ref sec_design_namespaces - - \ref sec_design_binary - - \ref sec_design_multidimensional - - \ref sec_design_const - - \ref sec_design_const_problem - - \ref sec_design_const_approach - - \ref sec_design_const_alternatives - - \ref sec_design_const_general - -\section sec_design_interface Common interface concepts - -\subsection sec_design_interface_sparse Sparse interfaces - - The class library is intended to be a light-weight library. This means it - should offer basic functionality in terms of multidimensional containers - with counted references (and not more in first place). We do not like to - include a tremendous amount of code for specialized concepts (like subranges - or expression templates in Blitz++) each time we just need a small array. - Thus the header files providing array declarations (aff/array.h and the - files included therein) should be as sparse as possible. All extra - functionality like iterators (aff::Iterator presented in aff/iterator.h) or - slices (aff::Slice presented in aff/slice.h) should be external to the - aff::Array class. This allows us to load their definitions only where - needed. However, this approach requires that the internals of aff::Array are - exposed to the outside through appropriate functions (see - \ref sec_design_interface_internals). - -\subsection sec_design_interface_typedef Member typedefs - - Class templates like aff::Iterator may be used with any container class, - that provides an appropriate interface. This interface convention concerns - the access to the type of related objects. I will explain by example: - - We use an iterator \c i which was declared - \code aff::Iterator i \endcode - for a container of type \c Cont, it expects to find a corresponding - container class that promises constness of the elements through - \code Cont::Tcontainer_of_const \endcode - or short - \code Cont::Tcoc \endcode - - For aff::ConstArray the type aff::ConstArray::Tcoc is just the class itself. - However aff::Array::Tcoc gives an aff::ConstArray. - - \sa aff::SharedHeap::Tcontainer_of_const - \sa aff::ConstSharedHeap::Tcontainer_of_const - \sa aff::Array::Tcontainer_of_const - \sa aff::ConstArray::Tcontainer_of_const - \sa aff::Series::Tcontainer_of_const - \sa aff::ConstSeries::Tcontainer_of_const - - In the same way we may access the appropriate element type through - \code Cont::Tvalue \endcode - which is \c T for aff::Array and \c const \T for aff::ConstArray. - However a - \code Cont::Tconst_value \endcode - will always provide a type with const qualifier. - - \sa aff::Array::Tvalue - \sa aff::Array::Tconst_value - \sa aff::ConstArray::Tvalue - \sa aff::ConstArray::Tconst_value - \sa aff::Series::Tvalue - \sa aff::Series::Tconst_value - \sa aff::ConstSeries::Tvalue - \sa aff::ConstSeries::Tconst_value - - In the same way we may access the type of the appropriate representation - by \code Cont::Trepresentation \endcode - - \sa aff::Array::Trepresentation - \sa aff::ConstArray::Trepresentation - \sa aff::Series::Trepresentation - \sa aff::ConstSeries::Trepresentation - - \b Notice: Using these typedefs (and also the typedefs for the shape class, - etc.) improves the maintainability of your code. Think of using the $HOME - variable in shell scripts. Once the name of your home directory changes, you - need not modify all your shell scripts. Now consider one day your shape - class might be renamed... - -\subsection sec_design_interface_tcontainer Member typedef Tcontainer - - \par Design decision: - Every class that can be converted to a container type, should provide a - member typedef \c Tcontainer and an appropriate conversion operator. - - \sa aff::util::Slice - \sa aff::util::Subarray - \sa aff::deepcopy - - \par Background - aff::deepcopy is a good example for function designed to deal with any - container. There may be others in the future, like global arithmetic - operators or sum-reduction. Due to its generality the function template puts - no restrictions on its template arguments. You may instantiate that template - for any class. In some sense this is bad practice and we have to resolve - ambiguities and support type conversions. In particular, think of feeding a - subarray (class aff::util::Subarray) to one of these whole-array functions - (this might be one of the most interesting uses). aff::util::Subarray easily - matches the template parameter, but does not offer the member functions - necessary for element access. - - \par - Hence we must ensure conversion of the aff::util::Subarray to its container - class. In our concept this is done with in aff::deepcopy. It looks for a - Tcontainer typedef in the argument class definitions and converts the class - objects to its corresponding container class before the copy operation. - - \par - Barton and Nackman propose another concept. Using their scheme we would - introduce a general Container class, - \code - template - class Container { - public: - typedef C& Tcontainer_reference; - Container(Tcontainer_reference c): M(c) { } - operator Tcontainer_reference() { return(M); } - private: - Tcontainer_reference M; - }; - \endcode - that takes a special container class as - a template argument and initializes a member data reference to an object of - this class in its constructors. We would then derive aff::Array from this - class by - \code - template - class Array: public Container > { }; - \endcode - This way any reference to a container (aff::Array, aff:Series, - aff::ConstArray, etc.) can be converted to a Container class object, which - agein offers a conversion operator to a reference to its leaf class. - Container-specific functions then are declared - \code - template - void deecopy(const Container& source, Container& target); - \endcode - deepcopy than can only be called for objects that are derived from - Container. - - \par Trade-offs - The Barton and Nackman trick involves another member data field in each - container class to hold the reference in the Container base class. - aff::Array would have to extra member data fields, because aff::Array and - aff::ConstArray both must inherit from Container. I regard this as a partial - violation to our concept of sparse interfaces. and small data types and - discard this option. - - \par - However, our concept requires to create a full copy of at least the target - container in each whole-array operation. This would not be necessary - generally. Generally we would operate directly on the aff::Array reference - passed as target of the operation. - - \par - With the Barton and Nackman trick this copy operation would only be - necessary with class objects, that are not directly derived from Container, - as are aff::util::Subarray and companions. However, for those we would have - to introduce specializations (overloaded functions) of whole-array - operations, that first perform the conversion (creating an aff::Array or - else) and then call the function that takes Container arguments. - - \par Alternative - The cheapest alternative (with respect to runtime overhead in the - whole-array function and in the container classes aff::Array, etc.) is to - delegate the problem to aff::util::Subarray and companions. We could - introduce a member data field in them of type Tarray. This would allow for a - member function returning a reference to this member. There should be no - runtime overhead, since every subarray must once be converted to an array to - be useful (now this conversion takes place outside aff::util::Subarray). - But this would involve the inconvenience to call an extra member function in - Subarray, when passing to a whole-array function. - The template argument type of the corresponding whole-array function remains - unrestricted (totally unchecked). - -\subsection sec_design_interface_internals Accessing internals - - Providing extended functionality outside of aff::Array (see - \ref sec_design_interface_sparse) requires, that aff::Array, - aff::ConstArray, aff::Series, and aff::ConstSeries expose some of their - internals. This concerns the underlying shape as well as the represented - data. - - aff::ConstArray and aff::ConstSeries provide a read-only reference to the - data (i.e. an aff::ConstSharedHeap object) through their member-functions - aff::ConstArray::representation and - aff::ConstSeries::representation, respectively. - In the same way aff::Array and aff::Series return an aff::SharedHeap through - their representation member function. - - All of them return a copy of their shape through the member functions - aff::Array::shape, aff::ConstArray::shape, aff::Series::shape, and - aff::ConstSeries::shape, respectively. The type of the appropriate shape is - available through a member typedef (see \ref sec_design_interface_typedef). - - In return all containers provide a constructor that takes a representation - and a shape object and checks for their consistency. - -\subsection sec_design_interface_nobaseclass Decision against a base class to express common interface - - This library contains different classes that provide common interfaces. For - example all aff::ConstArray, aff::Array, aff::Series and aff::ConstSeries - provide the necessary interface to be used together with aff::Iterator or - aff::Browser. A rather elegant way to express this commonality in a template - context is the Barton and Nackman trick. All containers that can work - together with aff::Iterater sould have to inherit from a class - aff::Iteratable. The base class is templated, takes the iteratable class as - template parameter and stores a reference to the instance of the iteratable - class. This way each iteratable class can be converted to aff::Iteratable, - which again returns a reference to the classes iteratable features in the - appropriate context. - - This way of expressing common interfaces makes the whole classes more - complicated than necessary to provide their elementary functionality. We - have to store an extra reference to the leaf class object for each feature, - we will express this way. And we have to include a whole bunsch of extra - code for each feature. Since we prefer \ref sec_design_interface_sparse this - method was rejected. - -
-\section sec_design_threeclasses Three classes for one container - - One container class like aff::Array or aff::Series is made up from its class - definition together with two other classes like the representation in - aff::SharedHeap and a shape like aff::Strided or aff::LinearShape. - Why not put all this functionality within one class like aff::Array? - -# aff::Array and aff::Series are class templates because they shall be - provided for any element type the user desires. - Consequently for each element type in use a separate instantiation of - this template class must be compiled. - The code describing the shape of the memory layout and the way index - values to raw memory have to be calculated is completely independent from - the element type of the container. - The shapes code can be compiled once for all template instantiations - needed. - For this reason it is efficient to provide this code in a separate class. - -# The containers in this library use reference counted pointers to raw - memory. - This way they share data in memory. - The default way to copy containers is a shallow copy, where only a - reference is copied (see \ref page_representation). - Using a seperate class aff::SharedHeap to handle these reference counted - pointers allows us to share memory between containers of different types, - i.e. an aff::Series and an aff::Array. - -
-\section sec_design_hierarchy Class hierarchy: member data vs. inheritance - - Containers like aff::Array rely on functionality provided by other classes. - They are based on shapes like aff::Strided and memory representations like - aff::SharedHeap (see \ref page_representation). - - \par An array isn't a shape. - Thus it would look like better design to use shapes as member data. - We prefer, \b however, to derive privately from the shape classes. - This hides them from the outside (apart from explicit access - - see \ref sec_design_interface_internals). - At the same time we make use of using declarations to provide access to - member functions like aff::Strided::size() that make also sense as a member - of aff::Array. - - \par An array is some kind of memory representation. - Thus it would look like proper design to derive an array from a - representation class. - We prefer, \b however, to use the memory representation as a private - member. - We think of the representation as an individual and independent object - that can be passed (e.g.) from an aff::Array to and aff::Series. - Also due to the replication of the representation in aff::Array - (see \ref sec_design_replicated) and the distinction between containers - that allow data modification and containers that allow only read access - this leads to a clearer design. - This is reflected by the conciseness of the array constructors. - Use the representation class as member data should introduce no runtime - overhead. - The full class specification including member data is available at - compile-time. - This should enable compilers to do excessive inlining. - -
-\section sec_design_replicated Replicated ConstSharedHeap - -\subsection sec_design_replicated_fact Design decision - aff::Array has a member of type aff::SharedHeap (which is exposed to the - outside through aff::Array::representation), which itself inherits from - aff::ConstSharedHeap. - At the same time aff::ConstArray has a member of type aff::Array and - inherits itself from aff::ConstSharedHeap (which is exposed to the outside - through aff::ConstArray::representation). - Thus the class aff::ConstSharedHeap is replicated in aff::Array and it - is not replicated by deriving from virtual base classes a virtual base - class. - - The same applies to aff::Series and aff::ConstSeries. - -\subsection sec_design_replicated_problem Where is the problem? - Having an array object \c a declared - \code aff::Array a; \endcode where \c T is any type, we want to pass this - object to a function that promises constness of the elements (see - \ref sec_design_const). The function is thus declared - \code void func(const aff::ConstArray&); \endcode - and we want to use it like - \code func(a) \endcode - Consequently we must offer a way to convert an - \code aff::Array& \endcode - to an - \code aff::ConstArray& \endcode - implicitely. - This is done by deriving aff::Array publicly from aff::ConstArray. - - The memory representation is needed by both, aff::Array and its base - class. Hence aff::ConstArray has to inherit from the representation. It - would be natural for aff::ConstArray to inherit from aff::ConstSharedHeap - only. However, since the derived aff::Array needs full access to an - aff::SharedHeap (to expose the representation to the outside), we might - tend to derive aff::ConstArray from aff::SharedHeap privately, - allowing only read access and conversion to aff::ConstSharedHeap. - - Why is this a problem? - Consider the inside of the above function. We might know, that the columns - of the passed array contain seismogram waveforms. And we might like to - access them in an appropriate way (i.e. through an interface that provides - waveform operations), though just reading - not modifying - the data. Then - we would like to code something like - \code - template - void func(const aff::ConstArray& a) - { - // cycle all seismograms - for (Tsubscript iseis=a.f(1); iseis<=a.l(1); iseis++) - { - // extract shape - aff::Strided shape(a.shape()); - // collapse to waveform iseis - shape.collapse(1,iseis); - // create a time series - aff::ConstSeries waveform(a.representation(), - shape.size(), shape.first_offset()); - // operate on time series (e.g. recursive filter) - some_waveform_operation(waveform); - } - } - \endcode - - The above example requires that we can construct an aff::ConstSeries from - an aff::ConstSharedHeap (which is returned by - aff::ConstArray::representation). The same problem appears together with - aff::ConstArray, when creating a subarray or slice from an aff::ConstArray - with aff::subarray or aff::slice and aff::ConstArray itself knowing nothing - about slices, etc. - - Constructing aff::ConstArray from an aff::ConstSharedHeap sounds a natural - operation. However, aff::ConstArray will ask for an aff::SharedHeap, if we - derive from aff::SharedHeap (as sketched above). Conclusion: aff::ConstArray - must use an aff::ConstSharedHeap only. At the same time we must hold - the full aff::SharedHeap together with the aff::Array object, since this must - return an aff::SharedHeap through aff::Array::representation to allow the - above operation (accessing data through aff::Series or constructing a - slice - see \ref sec_design_interface_sparse). - -\subsection sec_design_replicated_solution Solution - The most convincing solution (IMHO) to this problem is to use an - (additional) member of type aff::SharedHeap in aff::Array which - inherits from aff::ConstArray. - In consequence aff::ConstSharedHeap is then a replicated within - aff::Array. For a proper design we might consider to make - aff::ConstSharedHeap a virtual base, thus avoiding member data duplication. - This would, however, introduce an extra level of indirection (additional to - the indirection when accessing the heap data through the pointer to the - aff::util::SHeap struct in aff::ConstSharedHeap). On the other hand, fully - replicating the base aff::ConstSharedHeap just adds one member data pointer - (the pointer to the aff::util::SHeap struct) to the data block in aff::Array - (which already contains many bytes from the aff::Strided base). This - overhead is not considered significant. - - \b But \b notice: We now must take care to synchronize the aff::SharedHeap - base of aff::Array and the aff::ConstSharedHeap base of aff::ConstArray - during construction. This is no major concern, but it is error-prone to some - degree. It is, however, much easier to keep them synchronous when using - member data instead of inheritance. - -
-\section sec_design_copy Copy constructor and copy operator - - Usually we would expect the copy operator and the copy constructor to have - the same semantics. Here the copy constructor of aff::Array must have - reference semantics (it does a shallow copy). This is necessary to allow - arrays as return values from functions. In this case the copy constructor is - automatically invoked. Reference semantics ensure a minimal overhead. in - terms of memory usage and execution time. - - In the case of the copy (assignment) operator things are less clear: - If we define the - copy operator to have reference semantics, it has the same behaviour as the - copy constructor. That is what we usually would expect. An expression like - \code - A=B; - \endcode - means that array \c A drops its reference to the memory location it was - pointing to and forgets its previous shape. Following this statement array - \c A will refer to the same memory location as array \c B and will have the - same shape. Both are indistinguishable. - - However, in many cases (most cases?) we will use the copy (assignment) - operator in the - sense of a mathematical equation. This may read like - \code - A=B+C; - \endcode - although expressions like this are not yet supported by the library - features. In this case we do not mean that \c A should drop it reference. - \c A may refer to an array in memory which is also referred by other array - instances. And we want these values to be set to the result of the operation - \c B + \c C. In that case the copy operator should have deep copy semantics. - - \par Design decision - The classes aff::Array and aff::Series provide copy (assignment) operators - with shallow copy semantics. - The automatically created copy constructor and copy operator do just right - for this. - This is sensible, because we are not offering mathematical array operations. - This operations may be delegated to a wrapper class in the future, which - then also may provide expression templates and an appropriate assignment - operator. - -
-\section sec_design_namespaces Namespaces - - We group all code in two namespaces. Major modules which will be accessed by - the user are placed in namepsace aff. Modules meant to be used internally are - placed in aff::util. - Use directives like - \code - using namespace aff; - \endcode - or - \code - using aff::Array; - \endcode - for convenient access. - -
-\section sec_design_binary Binary library - -\note - The option to provide precompiled templates is finally removed from the - library. -\date 10/11/2010 - -
-\section sec_design_multidimensional Multidimensional arrays - - \todo - Explain Wolfgangs idea of multidimensional arrays. - -
-\section sec_design_const Notes on the const-correctness of arrays - -\subsection sec_design_const_problem Where is the problem? - When passing a container (i.e. an array) to a function, we would like to - promise that the values in the container are not modified, in case the - function uses only read-access. Consider a declaration - \code void func(const int& v) \endcode - of a function that takes and argument of type \c int an promises that this - will not be modified. Passing by reference is used, because this is more - efficient than passing by value (in particular for large objects - which is - not the case for \c int, but for an array). - And qualifying the type \c const promises that the - value passed by reference will not be changed. - - A declaration - \code void func(const Array& v) \endcode - does not what we want (see \ref sec_design_const_general). It just - promises the constness of the container, not of the data. Within the - function the passed reference may be assigned to a non-const \c Array, - which allows modification of the data (see \ref page_representation). - - Thus we must use something like - \code void func(const ConstArray& v) \endcode - where \c ConstArray does not allow modification of the data (be no - means - copying and conversions included) and may be derived from an - \c Array by a trivial conversion (like a conversion to a public base - class). - -\subsection sec_design_const_approach The approach used in this library - - We distinguish between the constness of the array and the constness of the - elements. A definition - \code - aff::Array A(12,12); - const aff::Array B(A); - \endcode - means that array \c B is a constant array initialized to array \c A. This - means, that the container is constant. Its shape and reference may not be - changed. - - If you want to define constness of the contained values (e.g. when passing - an array to a function), you have to use - \code - aff::ConstArray C(A); - \endcode - which defines that the contents of \c C may not be changed (i.e. they are of - type \c const \c int. - They are still refering to the same data in memory. - If you modify data elements through \c A, this will be visible through \c C. - - An array for elements of type \c T is derived from an array for elements of - type \c const \c T. - Functions that only need read access to arrays should be declared like - \code - void func(const aff::ConstArray& array); - \endcode - and may be called like - \code - aff::Array A(12,12); - func(A); - \endcode - The type conversion from \code aff::Array \endcode to - \code const aff::ConstArray& \endcode is trivial and has no runtime - overhead. - - Each container class must deal with this issue on its own. Sorry... - - \sa aff::ConstSharedHeap - \sa aff::ConstArray - \sa aff::ConstSeries - -\par Restrictions for containers with const qualifier - In 7/2005 we changed the design decision of not allowing data modification - through containers that are declared const. - Strictly distinguishing between constness of the container and constness of - the contained data allows to modify data through an object \c c that - was declared - \code const Array c; \endcode - The containers in this library (aff::Array, etc.) allow data modification - through instances declared const. This may appear surprising to users of the - library. However, since it is possible to create a copy of a const container - at any place and modifying the data through this copy, we would regard a - different behaviour as a false promise. - - To ensure true constness of the data, you have to assign to the base class - of the container. - Any container class (e.g. \c Cont) provides the type of container for const - elements through a typedef Tcontainer_of_const - (i.e. \c Cont::Tcontainer_of_const) or short Tcoc. - Remember that a \c const \c aff::Array always - may be assigned to a mutable aff::Array, which in turn allows modification - of the data! - -\subsection sec_design_const_alternatives Alternatives - - Three alternatives to this concept have been discussed (and discarded). - Both have the appealing property of needing only one class definition for - each container (in contrast to a class and a base class in our case). - Additionally both would offer name commonality for containers of non-const - elements and containers of const elements. - -\par Using arrays with element type const T - A rather straight approach is to use the element type \c const \c T - where an array of elements of type \c T should be used, that we do not allow - to be changed. This design concept can be accomplished with a special traits - class that is specialized for \c const \c T and allows to derive a mutable - or const version of any type. By further providing appropriate conversion - operators, an \code Array \endcode could be converted to an - \code Array, \endcode both sharing the same elements in memory. - In this approach, however, both container classes are completely - independent (although having the same name) due to their different template - arguments. The conversion to the container for const elements is not a - trivial conversion (like for a reference to a reference of a public base - class) and must be done explicitely. That's inconvenient for the most common - use (i.e. passing a container to a function). - -\par Deriving from a template specialization - The name commonality could still be achieved by deriving the Array from - template specialization Array. In this case the specialization must - be used as a base class before it is actually defined. That's improper - design. - -\par Ensuring constness of elements through const qualifier of functions - We could strictly follow the concept (as we do anyway to some extent) to - couple the constness of the container to the constness of the contained - data. This is done by const qualifiers to member functions that allow - modification of the data. To avoid pitfalls, - we have to consider copy operators - and copy constructors then too. Both must not promise const-ness to their - arguments. While this works in principle, we would end up with a container - class which doesn't allow copies of const instances. Hence we could not - return a container from a function, that ensures that the accessed data - cannot be modified. - -\subsection sec_design_const_general General considerations - - Arrays using the shared heap representation have reference semantics. - Different instances will access the same data in memory. Copying an array - instance just copies a reference to the data. This mechanism is not obvious - to the compiler. The array instances are values in the sense of C++ types - and not references. Passing an \c const \c aff::Array to a function does - not prohibit the function from assigning this instance to a non-const - \c aff::Array, which then references the same memory area and allows the - modification of the values contained in the array. - - Generally it has to be defined, what is meant by declaring an array instance - to be \c const. In the first place this means constness of the container to - the compiler. The compiler will ensure, that the container (array class) is - not changed, thus no data member of the array is changed. This means that - the array will keep the reference to the same data and that the - index-mapping defined by the array shape may not be changed. However, the - compiler will not prevent to change any data, the array refers to. - - We may define access operators that have a non-const version that returns a - reference to the data, allowing to change the data values together with a - const version that returns a value of const reference, thus preventing the - data from being changed through an instance that is declared const. However, - the compiler will always allow to create a non-const copy of a const array - instance. In the sense of const-ness of C++ data, this does not violate the - const-ness of the source of the copy. The shape of the original array may - not be changed. Only the shape of the copy may be changed. But the data of - the original array may now be changed through the copied instance, since our - array classes implicitly have reference semantic. Thus we have to - distinguish between const-ness of the container (array class instance) and - the contained data (values in memory the arrays refers to). - - In this library we will not provide a const and a non-const version of the - array classes. With templated code it is more convenient to use an array - with element type \c const \c T as the const version of an array with - element type \c T. To allow conversion of an instance with element type \c T - to an instance of type \c const \c T, we use the version for elements of - type \c const \c T as a base classe. - - - The need of const-correctness is discussed in "Chapter 1 Introduction, - C++ Conventions, Implementation of Vector and Matrix Classes" of - "Numerical Recipes in C++". A link to a PDF file of this chapter is - provided at "http://www.nr.com/cpp-blurb.html". - - The "C++ FAQ Lite" discusses many aspects of const-correctness in Chapter - 18, which you find at - "http://www.inf.uni-konstanz.de/~kuehl/cpp/cppfaq.htm/const-correctness.html". - - You may find my thoughts about const-correctness with containers that - have reference semantics at - "http://www.geophysik.uni-frankfurt.de/~forbrig/txt/cxx/tutorial/consthandle.doc/doc/html/index.html". - -*/ - -/*======================================================================*/ - -/*! \page page_using HOWTO use this library - - Contents of this page: - - \ref sec_using_constructor - - \ref sec_using_examples - -\section sec_using_constructor Constructing arrays - Arrays are most easy constructed by means of the aff::Shaper. - If you want e.g. define an array \c A of element type int with Fortran - layout, three dimensions and the index ranges [-2:2], [1:4], and [6:10] you - have to code - \code - using namespace aff; - Array A(Shaper(-2,2)(4)(6,10)); - \endcode - The shaper is presented in aff/shaper.h. - -\section sec_using_examples Example code - The test programs may serve as examples for using this library: - - tests/arraytest.cc - - tests/shapetest.cc - - tests/reprtest.cc - - tests/simplearraytest.cc - -\todo -We need more text and examples. - -*/ - - -/*======================================================================*/ - -/*! \page page_naming Naming conventions - - Contents of this page: - - \ref sec_naming_identifiers - - \ref sec_naming_macros - - \ref sec_naming_files - -\section sec_naming_identifiers Classes, Typedefs, etc. - - During coding it is sometimes helpfull to recognize the meaning of an - identifier due to some signals in irs name. Therefor the following - guidelines are used. The nameing of template parameters is left free for - convenience. - - \par Classes - - Class names always start with a capital letter. - - \par Typedefs - - Typedefs always start with a capital \c T. - - \par Member data - - Member data identifiers always start with a capital \c M. - -\section sec_naming_macros Preprocessor macros - - Preprocessor macros like include-guards should have the prefix "AFF_". - The macros in the \ref group_helpers are an exception to this rule. - -\section sec_naming_files Filenames - - Files with the extension \c .cc contain only non-template definitions. Files - with the extension \c .h may contain prototypes, class declarations or - template code. Files ending on \c def.h contain template code definitions - that is factored out to be compilable into a binary library for explicit - instantiation. - - The main directory %aff contains headers that are usually included by the - user. A subdirectory %aff/lib contains additional headers that are mostly - used internally. - -*/ - -/*======================================================================*/ - -/*! \page page_array_layout Array layout +this is +============================================================================ +AFF --- A container for numbers +------------------------------- +$Id$ +============================================================================ + +For compilation instructions see README.1st in the root directory of the tar-ball or +http://gpitrsvn.gpi.uni-karlsruhe.de:8000/TFSoftware/wiki/docs/installation + +The AFF (Array of Friederich and Forbriger) is a lightweight class library. It +offers a simple and easy to use container for numbers as is necessary in +numerical code. The offered array always has a rectangular strided layout, +reference semantics (through counted references) and a Fortran layout in +memory. The interface is intentionally kept sparse to keep compilation times +small. The array itself is meant to be used to pass numbers from one program +module to the other. If you want to exploit the power of expression templates, +pass the array contents to something like Blitz++. + +Installation +------------ + 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 + in the Makefile). + + make all installs headers, binary libraries and documentation + +You will find the installed library header files in $(LOCINCLUDEDIR)/aff + +Dependencies +------------ + external dependencies: - + internal dependencies: - - The array class template aff::Array uses the shape class aff::Strided. - Usually and in particular when constructed by using aff::Shaper, - aff::Strided uses a Fortran like column-major layout in memory. - aff::FortranArray and aff::util::FortranShape are provided to interface - Fortran code with such kind of arrays. - Nevertheless aff::Array together with aff::Strided is able to address a - row-major C like memory layout too. - Classes to interface raw memory arrays are presented in Carray.h. - - By definition the first index \f$ i \f$ on a two-dimenional matrix - \f$ A_{ij} \f$ as represented by the array - \c A(i,j) is the row index while the second index \f$ j \f$ is the - column index. - If elements of the two-dimensional matrix or array are arranged in linear - computer memory, there are two options: - - \section sec_array_layout_column_major Column major layout - - When traversing the linear representation in memory byte by byte in - increasing address order the elements of the first column in order of - increasing row index are passed first. - Next the elements of the second column are passed in increasing row order - and so forth. - When labelling the array elements in linear memory, the first index - varies quicker than the second index of the array if the elements are - traversed in increasing address order. - This is called the "column major order" and is the usualy layout of - Fortran arrays. - Column major layout is described in detail at - http://en.wikipedia.org/wiki/Row-major_order#Column-major_order - - \section sec_array_layout_row_major Row major layout - - When traversing the linear representation in memory byte by byte in - increasing address order the elements of the first row in order of - increasing column index are passed first. - Next the elements of the second row are passed in increasing column order - and so forth. - When labelling the array elements in linear memory, the second index - varies quicker than the first index of the array if the elements are - traversed in increasing address order. - This is called the "row major order" and is the usualy layout of - C arrays. - - Row major layout is described in detail at - http://en.wikipedia.org/wiki/Row-major_order#Row-major_order - - \todo - Provide details on indexing raw memory in both layouts here. - */ +Detailed documentation is provided through doxygen source code. See target +doxydoc in the Makefile. -// ----- END OF README ----- +----- END OF README ----- diff --git a/contrib/aff/README.export b/contrib/aff/README.export deleted file mode 100644 index 7f0bea9572979e653407f0db111ec59ae92896af..0000000000000000000000000000000000000000 --- a/contrib/aff/README.export +++ /dev/null @@ -1,26 +0,0 @@ -this is -============================================================================ -aff ---- -$Id$ -============================================================================ - -This directory contains source code for the library aff. It was exportet -from TF_Software to DENISE. DENISE is hosted in the Trac-/svn-project -FWI_elastic (http://gpitrsvn.gpi.uni-karlsruhe.de/repos/FWI_elastic/DENISE). - - -See COPYING for copyright and license information. - - - -Exports: - Each time this source code is exported to DENISE the current version is - tagged. The directory containing the tagged version is named by the day - of the export (yyyymmdd) and can be found in - http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/export/aff. - - 19/10/2011 First export of the version tagged in 20111019 - 01/02/2013 Export of version tagged in 20130201 - ------ END OF README ----- diff --git a/contrib/aff/Wff.siklst b/contrib/aff/Wff.siklst deleted file mode 100644 index a18409dece427be3082534a55cc84970b45ce623..0000000000000000000000000000000000000000 --- a/contrib/aff/Wff.siklst +++ /dev/null @@ -1,15 +0,0 @@ -# -# SIK Auswahl fuer FF library -# -*.c *.h *.f ?akefile *.inc *.cc *.tcc -# -# when working with m4 -*.m4 *.fpp -# -README* -# -# there are CVS working directories -CVS -# -# doxygen configuration -*.cfg diff --git a/contrib/aff/array.h b/contrib/aff/array.h index a0e66a23b7d5fc2b7bde6c84e97a80513497e7f7..5a4370fd519872f45cfab7bfd114e42e23a1f00e 100644 --- a/contrib/aff/array.h +++ b/contrib/aff/array.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: array.h 4004 2011-06-21 19:28:23Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -136,7 +136,7 @@ #define AFF_ARRAY_H_VERSION \ "AFF_ARRAY_H V1.2" #define AFF_ARRAY_H_CVSID \ - "$Id: array.h 4004 2011-06-21 19:28:23Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/arrayoperators.h b/contrib/aff/arrayoperators.h index 69916455f44ad933aff7ec65fc1b6fb0302a0db5..36f37b3267397c798566fe70e2005803f33a139f 100644 --- a/contrib/aff/arrayoperators.h +++ b/contrib/aff/arrayoperators.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: arrayoperators.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 10/02/2004 * @@ -39,7 +39,7 @@ #define AFF_ARRAYOPERATORS_H_VERSION \ "AFF_ARRAYOPERATORS_H V1.0 " #define AFF_ARRAYOPERATORS_H_CVSID \ - "$Id: arrayoperators.h 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include diff --git a/contrib/aff/converters.h b/contrib/aff/converters.h index 34ee3b73f2cf12fb3f2cd51257141f6306afe2a1..e794b0aa8392644504494505ef6e34fc2719245a 100644 --- a/contrib/aff/converters.h +++ b/contrib/aff/converters.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: converters.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 15/05/2011 * @@ -40,7 +40,7 @@ #define AFF_CONVERTERS_H_VERSION \ "AFF_CONVERTERS_H V1.0 " #define AFF_CONVERTERS_H_CVSID \ - "$Id: converters.h 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/doxydoc.cfg b/contrib/aff/doxydoc.cfg index a6b29a01677d2f064ba824d2f7bdae98109abaf7..a178b33cf8b1d3a04894692f959a92349210bbc8 100644 --- a/contrib/aff/doxydoc.cfg +++ b/contrib/aff/doxydoc.cfg @@ -89,9 +89,7 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- INPUT = ./ INPUT_ENCODING = UTF-8 -FILE_PATTERNS = README \ - README.changelog \ - README.groups \ +FILE_PATTERNS = doxygen*.txt \ *.h \ *.cc RECURSIVE = YES diff --git a/contrib/aff/README.changelog b/contrib/aff/doxygen.changelog.txt similarity index 98% rename from contrib/aff/README.changelog rename to contrib/aff/doxygen.changelog.txt index dfc412e2053619f4fc71167d0ab01eea3391f3a6..ceeb673bcff7c0454472aecd3f35d601b419a7fb 100644 --- a/contrib/aff/README.changelog +++ b/contrib/aff/doxygen.changelog.txt @@ -1,9 +1,9 @@ -/*! \file README.changelog +/*! \file doxygen.changelog.txt * \brief ChangeLog for C++ containers for numbers (libaff) * * ---------------------------------------------------------------------------- * - * $Id: README.changelog 4964 2013-02-01 13:27:42Z lrehor $ + * $Id$ * * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) * @@ -31,13 +31,14 @@ * * REVISIONS and CHANGES * - 17/12/2002 V1.0 Thomas Forbriger + * - 12/06/2013 V1.1 renamed file * * ============================================================================ */ /*! \page page_changelog ChangeLog (AFF) - $Id: README.changelog 4964 2013-02-01 13:27:42Z lrehor $ + $Id$ \sa \ref page_project_status @@ -290,7 +291,7 @@ /*! \page page_project_status Project status (AFF) - $Id: README.changelog 4964 2013-02-01 13:27:42Z lrehor $ + $Id$ \sa \ref page_changelog @@ -521,4 +522,4 @@ */ -// ----- END OF README.changelog ----- +// ----- END OF doxygen.changelog.txt ----- diff --git a/contrib/aff/README.groups b/contrib/aff/doxygen.groups.txt similarity index 97% rename from contrib/aff/README.groups rename to contrib/aff/doxygen.groups.txt index 4b8d7182bc9422b07ea91013fe17d2f04b29ffa4..2b9d96f45d4d31fb693bee854a123546048f343b 100644 --- a/contrib/aff/README.groups +++ b/contrib/aff/doxygen.groups.txt @@ -1,9 +1,9 @@ -/*! \file libaff/README.groups +/*! \file libaff/doxygen.groups.txt * \brief groups in libaff * * ---------------------------------------------------------------------------- * - * $Id: README.groups 4964 2013-02-01 13:27:42Z lrehor $ + * $Id$ * * Copyright (c) 2011 by Thomas Forbriger (BFO) * @@ -27,6 +27,7 @@ * * REVISIONS and CHANGES * - 15/05/2011 V1.0 Thomas Forbriger + * - 12/06/2013 V1.1 renamed file * \todo @@ -132,4 +133,4 @@ /*======================================================================*/ -// ----- END OF README.groups ----- +// ----- END OF doxygen.groups.txt ----- diff --git a/contrib/aff/doxygen.txt b/contrib/aff/doxygen.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed3c81d4eb8478ffd594f9291ff3c41808441d13 --- /dev/null +++ b/contrib/aff/doxygen.txt @@ -0,0 +1,975 @@ +/*! \file libaff/doxygen.txt + * \brief C++ containers for numbers (libaff) + * + * ---------------------------------------------------------------------------- + * + * $Id$ + * + * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) + * + * ---- + * 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 + * ---- + * + * C++ containers for numbers (libaff) + * + * This file contains: + * - documentation of namespace aff + * - mainpage text + * - documentation for pages: + * - \ref page_design + * - \ref page_using + * - \ref page_notes + * - \ref page_naming + * + * REVISIONS and CHANGES + * - 06/12/2002 V1.0 Thomas Forbriger (copied from libcontxx) + * - 20/12/2002 V1.1 (thof) + * - complete revision of this file + * - there are major gaps in + * -# \ref sec_design_multidimensional + * -# \ref page_using + * - 28/12/2002 V1.2 (thof) + * - new term for containers of const elements + * - added documentation regarding the concept of + * const correctness + * - added documentation regarding member typedefs + * - 29/12/2002 V1.3 (thof) + * - added section about replicated shared heap base + * class (\ref sec_design_replicated) + * - added section about sparse interface + * (\ref sec_design_interface_sparse) + * - added section about accessing internals + * (\ref sec_design_interface_internals) + * - reflect changes to Subarray and Slice + * - tell about class hierarchies and member data vs. + * inheritance + * - 04/01/2003 V1.4 (thof) + * - added section about Tcontainer typedef + * (\ref sec_design_interface_tcontainer) + * - 10/02/2004 V1.5 (thof) + * - added section about decision against interface + * base classes + * (\ref sec_design_interface_nobaseclass) + * - 10/11/2010 V1.6 (thof) + * - code fragments for precompiled templates are + * removed from the library (\ref sec_design_binary) + * - 14/05/2011 V1.7 (thof) + * - add info on raw-major and column-major order + * - 15/05/2011 V1.8 (thof) + * - reordered documentation, movde modules to + * README.groups + * - 12/06/2013 V1.9 (thof) + * - renamed file + * + * ============================================================================ + */ + +/*! \brief Root namespace of library + + This namespace contains all modules of the library + (see \ref sec_main_modules). + Here you should find all components, the user needs to work with this + library. + */ +namespace aff { +} // namespace aff + +/*======================================================================*/ + +/*! \mainpage + +\author Thomas Forbriger +\author Wolfgang Friederich +\since December 2002 +\date December 2002 +\version V1.0 +$Id$ + + Contents of this page: + - \ref sec_main_aims + - \ref sec_main_need + - \ref sec_main_peculiar + - \ref sec_main_modules + + Additional information: + - \ref page_changelog + - \ref page_project_status + - \ref page_using + - \ref page_array_layout + - \ref page_design + - \ref page_naming + - \ref page_representation + - \ref page_fortran + +\section sec_main_aims Aims of the library + + The AFF (Array of Friederich and Forbriger) is a lightweight class library. + It offers a simple and easy to use container for numbers as is necessary in + numerical code. The offered array always has a rectangular strided layout, + reference semantics (through counted references) and a Fortran layout in + memory. The interface is intentionally kept sparse to keep compilation times + small. The array itself is meant to be used to pass numbers from one program + module to the other. If you want to exploit the power of expression + templates, pass the array contents to something like Blitz++. + + + Contents of this page: + +\section sec_main_peculiar Peculiarities of AFF + +\par Containers use counted references +All containers (e.g. aff::Array, aff::Series) use counted references to access +global memory. Assigning one container object to another just assigns the +reference. Both will use the same data in memory afterwards. +\sa \ref page_representation. + +\par Const-correctness for array elements +In this library we follow provide functionality to write const-correct code +with regard to the array container and with regard to its element values. +\sa \ref sec_design_const. + +\par Multidimensional arrays +Every aff::Array of this class has aff::Strided::Mmax_dimen dimensions. +Construction and access for lower dimensionality is provided. In the case of +using less dimensions, the size of the unused dimensions is 1 by default and +its index is inherently set to the first index. +\sa \ref sec_design_multidimensional. + +\section sec_main_need Why do we need this array library + + One major reason for replacing Fortran77 by C++ in numerical code is the + convenience in expressing logistics. Data of different type and size may be + packed into classes and encapsulated from the outside world. Most numerical + results are to be stored in arrays, multi-dimensional arrays in particular. + This library provides the basic functionality for storing many data of the + same type in memory, passing them around between subroutines in an efficient + way and accessing them through convenient interfaces. The main purpose of + this library is not calculation but managing (passing between program + modules, selection of subsets of the data) large amounts of numbers. In the + future it might provide interfaces to libraries like blitz++ for finite + difference calculations, MTL for linear algebra calculations, and POOMA for + parallel computations. + + \sa http://www.sophya.org/, http://www.boost.org + +\section sec_main_modules Modules of the library + + The main module is the array class aff::Array. It provides basic + functionality through its interface. See the explanation there. + It is presented in aff/array.h + The object code is placed in libaff.a. + + \sa \ref group_array, \ref group_array_extensions +*/ + +/*======================================================================*/ + +/*! \page page_design Design decisions + + Contents of this page: + - \ref sec_design_interface + - \ref sec_design_interface_sparse + - \ref sec_design_interface_typedef + - \ref sec_design_interface_tcontainer + - \ref sec_design_interface_internals + - \ref sec_design_interface_nobaseclass + - \ref sec_design_threeclasses + - \ref sec_design_hierarchy + - \ref sec_design_replicated + - \ref sec_design_replicated_fact + - \ref sec_design_replicated_problem + - \ref sec_design_replicated_solution + - \ref sec_design_copy + - \ref sec_design_namespaces + - \ref sec_design_binary + - \ref sec_design_multidimensional + - \ref sec_design_const + - \ref sec_design_const_problem + - \ref sec_design_const_approach + - \ref sec_design_const_alternatives + - \ref sec_design_const_general + +\section sec_design_interface Common interface concepts + +\subsection sec_design_interface_sparse Sparse interfaces + + The class library is intended to be a light-weight library. This means it + should offer basic functionality in terms of multidimensional containers + with counted references (and not more in first place). We do not like to + include a tremendous amount of code for specialized concepts (like subranges + or expression templates in Blitz++) each time we just need a small array. + Thus the header files providing array declarations (aff/array.h and the + files included therein) should be as sparse as possible. All extra + functionality like iterators (aff::Iterator presented in aff/iterator.h) or + slices (aff::Slice presented in aff/slice.h) should be external to the + aff::Array class. This allows us to load their definitions only where + needed. However, this approach requires that the internals of aff::Array are + exposed to the outside through appropriate functions (see + \ref sec_design_interface_internals). + +\subsection sec_design_interface_typedef Member typedefs + + Class templates like aff::Iterator may be used with any container class, + that provides an appropriate interface. This interface convention concerns + the access to the type of related objects. I will explain by example: + + We use an iterator \c i which was declared + \code aff::Iterator i \endcode + for a container of type \c Cont, it expects to find a corresponding + container class that promises constness of the elements through + \code Cont::Tcontainer_of_const \endcode + or short + \code Cont::Tcoc \endcode + + For aff::ConstArray the type aff::ConstArray::Tcoc is just the class itself. + However aff::Array::Tcoc gives an aff::ConstArray. + + \sa aff::SharedHeap::Tcontainer_of_const + \sa aff::ConstSharedHeap::Tcontainer_of_const + \sa aff::Array::Tcontainer_of_const + \sa aff::ConstArray::Tcontainer_of_const + \sa aff::Series::Tcontainer_of_const + \sa aff::ConstSeries::Tcontainer_of_const + + In the same way we may access the appropriate element type through + \code Cont::Tvalue \endcode + which is \c T for aff::Array and \c const \T for aff::ConstArray. + However a + \code Cont::Tconst_value \endcode + will always provide a type with const qualifier. + + \sa aff::Array::Tvalue + \sa aff::Array::Tconst_value + \sa aff::ConstArray::Tvalue + \sa aff::ConstArray::Tconst_value + \sa aff::Series::Tvalue + \sa aff::Series::Tconst_value + \sa aff::ConstSeries::Tvalue + \sa aff::ConstSeries::Tconst_value + + In the same way we may access the type of the appropriate representation + by \code Cont::Trepresentation \endcode + + \sa aff::Array::Trepresentation + \sa aff::ConstArray::Trepresentation + \sa aff::Series::Trepresentation + \sa aff::ConstSeries::Trepresentation + + \b Notice: Using these typedefs (and also the typedefs for the shape class, + etc.) improves the maintainability of your code. Think of using the $HOME + variable in shell scripts. Once the name of your home directory changes, you + need not modify all your shell scripts. Now consider one day your shape + class might be renamed... + +\subsection sec_design_interface_tcontainer Member typedef Tcontainer + + \par Design decision: + Every class that can be converted to a container type, should provide a + member typedef \c Tcontainer and an appropriate conversion operator. + + \sa aff::util::Slice + \sa aff::util::Subarray + \sa aff::deepcopy + + \par Background + aff::deepcopy is a good example for function designed to deal with any + container. There may be others in the future, like global arithmetic + operators or sum-reduction. Due to its generality the function template puts + no restrictions on its template arguments. You may instantiate that template + for any class. In some sense this is bad practice and we have to resolve + ambiguities and support type conversions. In particular, think of feeding a + subarray (class aff::util::Subarray) to one of these whole-array functions + (this might be one of the most interesting uses). aff::util::Subarray easily + matches the template parameter, but does not offer the member functions + necessary for element access. + + \par + Hence we must ensure conversion of the aff::util::Subarray to its container + class. In our concept this is done with in aff::deepcopy. It looks for a + Tcontainer typedef in the argument class definitions and converts the class + objects to its corresponding container class before the copy operation. + + \par + Barton and Nackman propose another concept. Using their scheme we would + introduce a general Container class, + \code + template + class Container { + public: + typedef C& Tcontainer_reference; + Container(Tcontainer_reference c): M(c) { } + operator Tcontainer_reference() { return(M); } + private: + Tcontainer_reference M; + }; + \endcode + that takes a special container class as + a template argument and initializes a member data reference to an object of + this class in its constructors. We would then derive aff::Array from this + class by + \code + template + class Array: public Container > { }; + \endcode + This way any reference to a container (aff::Array, aff:Series, + aff::ConstArray, etc.) can be converted to a Container class object, which + agein offers a conversion operator to a reference to its leaf class. + Container-specific functions then are declared + \code + template + void deecopy(const Container& source, Container& target); + \endcode + deepcopy than can only be called for objects that are derived from + Container. + + \par Trade-offs + The Barton and Nackman trick involves another member data field in each + container class to hold the reference in the Container base class. + aff::Array would have to extra member data fields, because aff::Array and + aff::ConstArray both must inherit from Container. I regard this as a partial + violation to our concept of sparse interfaces. and small data types and + discard this option. + + \par + However, our concept requires to create a full copy of at least the target + container in each whole-array operation. This would not be necessary + generally. Generally we would operate directly on the aff::Array reference + passed as target of the operation. + + \par + With the Barton and Nackman trick this copy operation would only be + necessary with class objects, that are not directly derived from Container, + as are aff::util::Subarray and companions. However, for those we would have + to introduce specializations (overloaded functions) of whole-array + operations, that first perform the conversion (creating an aff::Array or + else) and then call the function that takes Container arguments. + + \par Alternative + The cheapest alternative (with respect to runtime overhead in the + whole-array function and in the container classes aff::Array, etc.) is to + delegate the problem to aff::util::Subarray and companions. We could + introduce a member data field in them of type Tarray. This would allow for a + member function returning a reference to this member. There should be no + runtime overhead, since every subarray must once be converted to an array to + be useful (now this conversion takes place outside aff::util::Subarray). + But this would involve the inconvenience to call an extra member function in + Subarray, when passing to a whole-array function. + The template argument type of the corresponding whole-array function remains + unrestricted (totally unchecked). + +\subsection sec_design_interface_internals Accessing internals + + Providing extended functionality outside of aff::Array (see + \ref sec_design_interface_sparse) requires, that aff::Array, + aff::ConstArray, aff::Series, and aff::ConstSeries expose some of their + internals. This concerns the underlying shape as well as the represented + data. + + aff::ConstArray and aff::ConstSeries provide a read-only reference to the + data (i.e. an aff::ConstSharedHeap object) through their member-functions + aff::ConstArray::representation and + aff::ConstSeries::representation, respectively. + In the same way aff::Array and aff::Series return an aff::SharedHeap through + their representation member function. + + All of them return a copy of their shape through the member functions + aff::Array::shape, aff::ConstArray::shape, aff::Series::shape, and + aff::ConstSeries::shape, respectively. The type of the appropriate shape is + available through a member typedef (see \ref sec_design_interface_typedef). + + In return all containers provide a constructor that takes a representation + and a shape object and checks for their consistency. + +\subsection sec_design_interface_nobaseclass Decision against a base class to express common interface + + This library contains different classes that provide common interfaces. For + example all aff::ConstArray, aff::Array, aff::Series and aff::ConstSeries + provide the necessary interface to be used together with aff::Iterator or + aff::Browser. A rather elegant way to express this commonality in a template + context is the Barton and Nackman trick. All containers that can work + together with aff::Iterater sould have to inherit from a class + aff::Iteratable. The base class is templated, takes the iteratable class as + template parameter and stores a reference to the instance of the iteratable + class. This way each iteratable class can be converted to aff::Iteratable, + which again returns a reference to the classes iteratable features in the + appropriate context. + + This way of expressing common interfaces makes the whole classes more + complicated than necessary to provide their elementary functionality. We + have to store an extra reference to the leaf class object for each feature, + we will express this way. And we have to include a whole bunsch of extra + code for each feature. Since we prefer \ref sec_design_interface_sparse this + method was rejected. + +
+\section sec_design_threeclasses Three classes for one container + + One container class like aff::Array or aff::Series is made up from its class + definition together with two other classes like the representation in + aff::SharedHeap and a shape like aff::Strided or aff::LinearShape. + Why not put all this functionality within one class like aff::Array? + -# aff::Array and aff::Series are class templates because they shall be + provided for any element type the user desires. + Consequently for each element type in use a separate instantiation of + this template class must be compiled. + The code describing the shape of the memory layout and the way index + values to raw memory have to be calculated is completely independent from + the element type of the container. + The shapes code can be compiled once for all template instantiations + needed. + For this reason it is efficient to provide this code in a separate class. + -# The containers in this library use reference counted pointers to raw + memory. + This way they share data in memory. + The default way to copy containers is a shallow copy, where only a + reference is copied (see \ref page_representation). + Using a seperate class aff::SharedHeap to handle these reference counted + pointers allows us to share memory between containers of different types, + i.e. an aff::Series and an aff::Array. + +
+\section sec_design_hierarchy Class hierarchy: member data vs. inheritance + + Containers like aff::Array rely on functionality provided by other classes. + They are based on shapes like aff::Strided and memory representations like + aff::SharedHeap (see \ref page_representation). + + \par An array isn't a shape. + Thus it would look like better design to use shapes as member data. + We prefer, \b however, to derive privately from the shape classes. + This hides them from the outside (apart from explicit access - + see \ref sec_design_interface_internals). + At the same time we make use of using declarations to provide access to + member functions like aff::Strided::size() that make also sense as a member + of aff::Array. + + \par An array is some kind of memory representation. + Thus it would look like proper design to derive an array from a + representation class. + We prefer, \b however, to use the memory representation as a private + member. + We think of the representation as an individual and independent object + that can be passed (e.g.) from an aff::Array to and aff::Series. + Also due to the replication of the representation in aff::Array + (see \ref sec_design_replicated) and the distinction between containers + that allow data modification and containers that allow only read access + this leads to a clearer design. + This is reflected by the conciseness of the array constructors. + Use the representation class as member data should introduce no runtime + overhead. + The full class specification including member data is available at + compile-time. + This should enable compilers to do excessive inlining. + +
+\section sec_design_replicated Replicated ConstSharedHeap + +\subsection sec_design_replicated_fact Design decision + aff::Array has a member of type aff::SharedHeap (which is exposed to the + outside through aff::Array::representation), which itself inherits from + aff::ConstSharedHeap. + At the same time aff::ConstArray has a member of type aff::Array and + inherits itself from aff::ConstSharedHeap (which is exposed to the outside + through aff::ConstArray::representation). + Thus the class aff::ConstSharedHeap is replicated in aff::Array and it + is not replicated by deriving from virtual base classes a virtual base + class. + + The same applies to aff::Series and aff::ConstSeries. + +\subsection sec_design_replicated_problem Where is the problem? + Having an array object \c a declared + \code aff::Array a; \endcode where \c T is any type, we want to pass this + object to a function that promises constness of the elements (see + \ref sec_design_const). The function is thus declared + \code void func(const aff::ConstArray&); \endcode + and we want to use it like + \code func(a) \endcode + Consequently we must offer a way to convert an + \code aff::Array& \endcode + to an + \code aff::ConstArray& \endcode + implicitely. + This is done by deriving aff::Array publicly from aff::ConstArray. + + The memory representation is needed by both, aff::Array and its base + class. Hence aff::ConstArray has to inherit from the representation. It + would be natural for aff::ConstArray to inherit from aff::ConstSharedHeap + only. However, since the derived aff::Array needs full access to an + aff::SharedHeap (to expose the representation to the outside), we might + tend to derive aff::ConstArray from aff::SharedHeap privately, + allowing only read access and conversion to aff::ConstSharedHeap. + + Why is this a problem? + Consider the inside of the above function. We might know, that the columns + of the passed array contain seismogram waveforms. And we might like to + access them in an appropriate way (i.e. through an interface that provides + waveform operations), though just reading - not modifying - the data. Then + we would like to code something like + \code + template + void func(const aff::ConstArray& a) + { + // cycle all seismograms + for (Tsubscript iseis=a.f(1); iseis<=a.l(1); iseis++) + { + // extract shape + aff::Strided shape(a.shape()); + // collapse to waveform iseis + shape.collapse(1,iseis); + // create a time series + aff::ConstSeries waveform(a.representation(), + shape.size(), shape.first_offset()); + // operate on time series (e.g. recursive filter) + some_waveform_operation(waveform); + } + } + \endcode + + The above example requires that we can construct an aff::ConstSeries from + an aff::ConstSharedHeap (which is returned by + aff::ConstArray::representation). The same problem appears together with + aff::ConstArray, when creating a subarray or slice from an aff::ConstArray + with aff::subarray or aff::slice and aff::ConstArray itself knowing nothing + about slices, etc. + + Constructing aff::ConstArray from an aff::ConstSharedHeap sounds a natural + operation. However, aff::ConstArray will ask for an aff::SharedHeap, if we + derive from aff::SharedHeap (as sketched above). Conclusion: aff::ConstArray + must use an aff::ConstSharedHeap only. At the same time we must hold + the full aff::SharedHeap together with the aff::Array object, since this must + return an aff::SharedHeap through aff::Array::representation to allow the + above operation (accessing data through aff::Series or constructing a + slice - see \ref sec_design_interface_sparse). + +\subsection sec_design_replicated_solution Solution + The most convincing solution (IMHO) to this problem is to use an + (additional) member of type aff::SharedHeap in aff::Array which + inherits from aff::ConstArray. + In consequence aff::ConstSharedHeap is then a replicated within + aff::Array. For a proper design we might consider to make + aff::ConstSharedHeap a virtual base, thus avoiding member data duplication. + This would, however, introduce an extra level of indirection (additional to + the indirection when accessing the heap data through the pointer to the + aff::util::SHeap struct in aff::ConstSharedHeap). On the other hand, fully + replicating the base aff::ConstSharedHeap just adds one member data pointer + (the pointer to the aff::util::SHeap struct) to the data block in aff::Array + (which already contains many bytes from the aff::Strided base). This + overhead is not considered significant. + + \b But \b notice: We now must take care to synchronize the aff::SharedHeap + base of aff::Array and the aff::ConstSharedHeap base of aff::ConstArray + during construction. This is no major concern, but it is error-prone to some + degree. It is, however, much easier to keep them synchronous when using + member data instead of inheritance. + +
+\section sec_design_copy Copy constructor and copy operator + + Usually we would expect the copy operator and the copy constructor to have + the same semantics. Here the copy constructor of aff::Array must have + reference semantics (it does a shallow copy). This is necessary to allow + arrays as return values from functions. In this case the copy constructor is + automatically invoked. Reference semantics ensure a minimal overhead. in + terms of memory usage and execution time. + + In the case of the copy (assignment) operator things are less clear: + If we define the + copy operator to have reference semantics, it has the same behaviour as the + copy constructor. That is what we usually would expect. An expression like + \code + A=B; + \endcode + means that array \c A drops its reference to the memory location it was + pointing to and forgets its previous shape. Following this statement array + \c A will refer to the same memory location as array \c B and will have the + same shape. Both are indistinguishable. + + However, in many cases (most cases?) we will use the copy (assignment) + operator in the + sense of a mathematical equation. This may read like + \code + A=B+C; + \endcode + although expressions like this are not yet supported by the library + features. In this case we do not mean that \c A should drop it reference. + \c A may refer to an array in memory which is also referred by other array + instances. And we want these values to be set to the result of the operation + \c B + \c C. In that case the copy operator should have deep copy semantics. + + \par Design decision + The classes aff::Array and aff::Series provide copy (assignment) operators + with shallow copy semantics. + The automatically created copy constructor and copy operator do just right + for this. + This is sensible, because we are not offering mathematical array operations. + This operations may be delegated to a wrapper class in the future, which + then also may provide expression templates and an appropriate assignment + operator. + +
+\section sec_design_namespaces Namespaces + + We group all code in two namespaces. Major modules which will be accessed by + the user are placed in namepsace aff. Modules meant to be used internally are + placed in aff::util. + Use directives like + \code + using namespace aff; + \endcode + or + \code + using aff::Array; + \endcode + for convenient access. + +
+\section sec_design_binary Binary library + +\note + The option to provide precompiled templates is finally removed from the + library. +\date 10/11/2010 + +
+\section sec_design_multidimensional Multidimensional arrays + + \todo + Explain Wolfgangs idea of multidimensional arrays. + +
+\section sec_design_const Notes on the const-correctness of arrays + +\subsection sec_design_const_problem Where is the problem? + When passing a container (i.e. an array) to a function, we would like to + promise that the values in the container are not modified, in case the + function uses only read-access. Consider a declaration + \code void func(const int& v) \endcode + of a function that takes and argument of type \c int an promises that this + will not be modified. Passing by reference is used, because this is more + efficient than passing by value (in particular for large objects - which is + not the case for \c int, but for an array). + And qualifying the type \c const promises that the + value passed by reference will not be changed. + + A declaration + \code void func(const Array& v) \endcode + does not what we want (see \ref sec_design_const_general). It just + promises the constness of the container, not of the data. Within the + function the passed reference may be assigned to a non-const \c Array, + which allows modification of the data (see \ref page_representation). + + Thus we must use something like + \code void func(const ConstArray& v) \endcode + where \c ConstArray does not allow modification of the data (be no + means - copying and conversions included) and may be derived from an + \c Array by a trivial conversion (like a conversion to a public base + class). + +\subsection sec_design_const_approach The approach used in this library + + We distinguish between the constness of the array and the constness of the + elements. A definition + \code + aff::Array A(12,12); + const aff::Array B(A); + \endcode + means that array \c B is a constant array initialized to array \c A. This + means, that the container is constant. Its shape and reference may not be + changed. + + If you want to define constness of the contained values (e.g. when passing + an array to a function), you have to use + \code + aff::ConstArray C(A); + \endcode + which defines that the contents of \c C may not be changed (i.e. they are of + type \c const \c int. + They are still refering to the same data in memory. + If you modify data elements through \c A, this will be visible through \c C. + + An array for elements of type \c T is derived from an array for elements of + type \c const \c T. + Functions that only need read access to arrays should be declared like + \code + void func(const aff::ConstArray& array); + \endcode + and may be called like + \code + aff::Array A(12,12); + func(A); + \endcode + The type conversion from \code aff::Array \endcode to + \code const aff::ConstArray& \endcode is trivial and has no runtime + overhead. + + Each container class must deal with this issue on its own. Sorry... + + \sa aff::ConstSharedHeap + \sa aff::ConstArray + \sa aff::ConstSeries + +\par Restrictions for containers with const qualifier + In 7/2005 we changed the design decision of not allowing data modification + through containers that are declared const. + Strictly distinguishing between constness of the container and constness of + the contained data allows to modify data through an object \c c that + was declared + \code const Array c; \endcode + The containers in this library (aff::Array, etc.) allow data modification + through instances declared const. This may appear surprising to users of the + library. However, since it is possible to create a copy of a const container + at any place and modifying the data through this copy, we would regard a + different behaviour as a false promise. + + To ensure true constness of the data, you have to assign to the base class + of the container. + Any container class (e.g. \c Cont) provides the type of container for const + elements through a typedef Tcontainer_of_const + (i.e. \c Cont::Tcontainer_of_const) or short Tcoc. + Remember that a \c const \c aff::Array always + may be assigned to a mutable aff::Array, which in turn allows modification + of the data! + +\subsection sec_design_const_alternatives Alternatives + + Three alternatives to this concept have been discussed (and discarded). + Both have the appealing property of needing only one class definition for + each container (in contrast to a class and a base class in our case). + Additionally both would offer name commonality for containers of non-const + elements and containers of const elements. + +\par Using arrays with element type const T + A rather straight approach is to use the element type \c const \c T + where an array of elements of type \c T should be used, that we do not allow + to be changed. This design concept can be accomplished with a special traits + class that is specialized for \c const \c T and allows to derive a mutable + or const version of any type. By further providing appropriate conversion + operators, an \code Array \endcode could be converted to an + \code Array, \endcode both sharing the same elements in memory. + In this approach, however, both container classes are completely + independent (although having the same name) due to their different template + arguments. The conversion to the container for const elements is not a + trivial conversion (like for a reference to a reference of a public base + class) and must be done explicitely. That's inconvenient for the most common + use (i.e. passing a container to a function). + +\par Deriving from a template specialization + The name commonality could still be achieved by deriving the Array from + template specialization Array. In this case the specialization must + be used as a base class before it is actually defined. That's improper + design. + +\par Ensuring constness of elements through const qualifier of functions + We could strictly follow the concept (as we do anyway to some extent) to + couple the constness of the container to the constness of the contained + data. This is done by const qualifiers to member functions that allow + modification of the data. To avoid pitfalls, + we have to consider copy operators + and copy constructors then too. Both must not promise const-ness to their + arguments. While this works in principle, we would end up with a container + class which doesn't allow copies of const instances. Hence we could not + return a container from a function, that ensures that the accessed data + cannot be modified. + +\subsection sec_design_const_general General considerations + + Arrays using the shared heap representation have reference semantics. + Different instances will access the same data in memory. Copying an array + instance just copies a reference to the data. This mechanism is not obvious + to the compiler. The array instances are values in the sense of C++ types + and not references. Passing an \c const \c aff::Array to a function does + not prohibit the function from assigning this instance to a non-const + \c aff::Array, which then references the same memory area and allows the + modification of the values contained in the array. + + Generally it has to be defined, what is meant by declaring an array instance + to be \c const. In the first place this means constness of the container to + the compiler. The compiler will ensure, that the container (array class) is + not changed, thus no data member of the array is changed. This means that + the array will keep the reference to the same data and that the + index-mapping defined by the array shape may not be changed. However, the + compiler will not prevent to change any data, the array refers to. + + We may define access operators that have a non-const version that returns a + reference to the data, allowing to change the data values together with a + const version that returns a value of const reference, thus preventing the + data from being changed through an instance that is declared const. However, + the compiler will always allow to create a non-const copy of a const array + instance. In the sense of const-ness of C++ data, this does not violate the + const-ness of the source of the copy. The shape of the original array may + not be changed. Only the shape of the copy may be changed. But the data of + the original array may now be changed through the copied instance, since our + array classes implicitly have reference semantic. Thus we have to + distinguish between const-ness of the container (array class instance) and + the contained data (values in memory the arrays refers to). + + In this library we will not provide a const and a non-const version of the + array classes. With templated code it is more convenient to use an array + with element type \c const \c T as the const version of an array with + element type \c T. To allow conversion of an instance with element type \c T + to an instance of type \c const \c T, we use the version for elements of + type \c const \c T as a base classe. + + - The need of const-correctness is discussed in "Chapter 1 Introduction, + C++ Conventions, Implementation of Vector and Matrix Classes" of + "Numerical Recipes in C++". A link to a PDF file of this chapter is + provided at "http://www.nr.com/cpp-blurb.html". + - The "C++ FAQ Lite" discusses many aspects of const-correctness in Chapter + 18, which you find at + "http://www.inf.uni-konstanz.de/~kuehl/cpp/cppfaq.htm/const-correctness.html". + - You may find my thoughts about const-correctness with containers that + have reference semantics at + "http://www.geophysik.uni-frankfurt.de/~forbrig/txt/cxx/tutorial/consthandle.doc/doc/html/index.html". + +*/ + +/*======================================================================*/ + +/*! \page page_using HOWTO use this library + + Contents of this page: + - \ref sec_using_constructor + - \ref sec_using_examples + +\section sec_using_constructor Constructing arrays + Arrays are most easy constructed by means of the aff::Shaper. + If you want e.g. define an array \c A of element type int with Fortran + layout, three dimensions and the index ranges [-2:2], [1:4], and [6:10] you + have to code + \code + using namespace aff; + Array A(Shaper(-2,2)(4)(6,10)); + \endcode + The shaper is presented in aff/shaper.h. + +\section sec_using_examples Example code + The test programs may serve as examples for using this library: + - tests/arraytest.cc + - tests/shapetest.cc + - tests/reprtest.cc + - tests/simplearraytest.cc + +\todo +We need more text and examples. + +*/ + + +/*======================================================================*/ + +/*! \page page_naming Naming conventions + + Contents of this page: + - \ref sec_naming_identifiers + - \ref sec_naming_macros + - \ref sec_naming_files + +\section sec_naming_identifiers Classes, Typedefs, etc. + + During coding it is sometimes helpfull to recognize the meaning of an + identifier due to some signals in irs name. Therefor the following + guidelines are used. The nameing of template parameters is left free for + convenience. + + \par Classes + + Class names always start with a capital letter. + + \par Typedefs + + Typedefs always start with a capital \c T. + + \par Member data + + Member data identifiers always start with a capital \c M. + +\section sec_naming_macros Preprocessor macros + + Preprocessor macros like include-guards should have the prefix "AFF_". + The macros in the \ref group_helpers are an exception to this rule. + +\section sec_naming_files Filenames + + Files with the extension \c .cc contain only non-template definitions. Files + with the extension \c .h may contain prototypes, class declarations or + template code. Files ending on \c def.h contain template code definitions + that is factored out to be compilable into a binary library for explicit + instantiation. + + The main directory %aff contains headers that are usually included by the + user. A subdirectory %aff/lib contains additional headers that are mostly + used internally. + +*/ + +/*======================================================================*/ + +/*! \page page_array_layout Array layout + + The array class template aff::Array uses the shape class aff::Strided. + Usually and in particular when constructed by using aff::Shaper, + aff::Strided uses a Fortran like column-major layout in memory. + aff::FortranArray and aff::util::FortranShape are provided to interface + Fortran code with such kind of arrays. + Nevertheless aff::Array together with aff::Strided is able to address a + row-major C like memory layout too. + Classes to interface raw memory arrays are presented in Carray.h. + + By definition the first index \f$ i \f$ on a two-dimenional matrix + \f$ A_{ij} \f$ as represented by the array + \c A(i,j) is the row index while the second index \f$ j \f$ is the + column index. + If elements of the two-dimensional matrix or array are arranged in linear + computer memory, there are two options: + + \section sec_array_layout_column_major Column major layout + + When traversing the linear representation in memory byte by byte in + increasing address order the elements of the first column in order of + increasing row index are passed first. + Next the elements of the second column are passed in increasing row order + and so forth. + When labelling the array elements in linear memory, the first index + varies quicker than the second index of the array if the elements are + traversed in increasing address order. + This is called the "column major order" and is the usualy layout of + Fortran arrays. + + Column major layout is described in detail at + http://en.wikipedia.org/wiki/Row-major_order#Column-major_order + + \section sec_array_layout_row_major Row major layout + + When traversing the linear representation in memory byte by byte in + increasing address order the elements of the first row in order of + increasing column index are passed first. + Next the elements of the second row are passed in increasing column order + and so forth. + When labelling the array elements in linear memory, the second index + varies quicker than the first index of the array if the elements are + traversed in increasing address order. + This is called the "row major order" and is the usualy layout of + C arrays. + + Row major layout is described in detail at + http://en.wikipedia.org/wiki/Row-major_order#Row-major_order + + \todo + Provide details on indexing raw memory in both layouts here. + */ + +// ----- END OF doxygen.txt ----- diff --git a/contrib/aff/dump.cc b/contrib/aff/dump.cc index dc602eb8a92d1972447fadefd6b364df3157439a..dbf2cdd59ee33abc79fd4b0992055d04bbfb28d3 100644 --- a/contrib/aff/dump.cc +++ b/contrib/aff/dump.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump.cc 3117 2010-08-12 12:07:25Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 12/12/2002 * @@ -41,7 +41,7 @@ #define AFF_DUMP_CC_VERSION \ "AFF_DUMP_CC V1.1" #define AFF_DUMP_CC_CVSID \ - "$Id: dump.cc 3117 2010-08-12 12:07:25Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/dump.h b/contrib/aff/dump.h index 3ae740930b6d265ddec31a79a073cb079440b64c..c5071928dbd9d79dabb54ea65784881240c1ccc8 100644 --- a/contrib/aff/dump.h +++ b/contrib/aff/dump.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 12/12/2002 * @@ -53,7 +53,7 @@ #define AFF_DUMP_H_VERSION \ "AFF_DUMP_H V1.3" #define TF_DUMP_H_CVSID \ - "$Id: dump.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" /*! \defgroup group_helpers Debug functions */ diff --git a/contrib/aff/fortranshape.cc b/contrib/aff/fortranshape.cc index 9633a335248ae6b72231f6ad42785dfb1c051de4..cb9d51439246323de6a759d5e8c699fc9aad7711 100644 --- a/contrib/aff/fortranshape.cc +++ b/contrib/aff/fortranshape.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fortranshape.cc 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 23/12/2002 * @@ -35,7 +35,7 @@ #define AFF_FORTRANSHAPE_CC_VERSION \ "AFF_FORTRANSHAPE_CC V1.0 " #define AFF_FORTRANSHAPE_CC_CVSID \ - "$Id: fortranshape.cc 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/fortranshape.h b/contrib/aff/fortranshape.h index 0a90333d0439b816e1a61de6a13ace6e95f56b6d..b0c5322e87c15d5c363d64353de6fc9cc7a41440 100644 --- a/contrib/aff/fortranshape.h +++ b/contrib/aff/fortranshape.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fortranshape.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 23/12/2002 * @@ -47,7 +47,7 @@ #define AFF_FORTRANSHAPE_H_VERSION \ "AFF_FORTRANSHAPE_H V1.2" #define AFF_FORTRANSHAPE_H_CVSID \ - "$Id: fortranshape.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/functions/absmax.h b/contrib/aff/functions/absmax.h index 1f6839fbeac62340a3333abab266c9d56895008c..f19c33924d96c43d44cb4894aa7658be23c48c4e 100644 --- a/contrib/aff/functions/absmax.h +++ b/contrib/aff/functions/absmax.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: absmax.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 09/03/2010 * @@ -40,7 +40,7 @@ #define AFF_ABSMAX_H_VERSION \ "AFF_ABSMAX_H V1.0 " #define AFF_ABSMAX_H_CVSID \ - "$Id: absmax.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/functions/avg.h b/contrib/aff/functions/avg.h index ca434b209aafa83a0460fc1bf6b01593e59d2168..0ef1c1999511c0043c0c8a64ae71c563ab64a57b 100644 --- a/contrib/aff/functions/avg.h +++ b/contrib/aff/functions/avg.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: avg.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/03/2005 * @@ -40,7 +40,7 @@ #define AFF_AVG_H_VERSION \ "AFF_AVG_H V1.1 " #define AFF_AVG_H_CVSID \ - "$Id: avg.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/functions/histo.h b/contrib/aff/functions/histo.h index 9712dfcec7b1b11ccc56921b0b2bf2ddd7c97b20..c666c3c0f7b5398309a63db92999b36300b0723b 100644 --- a/contrib/aff/functions/histo.h +++ b/contrib/aff/functions/histo.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: histo.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 28/04/2005 * @@ -39,7 +39,7 @@ #define AFF_HISTO_H_VERSION \ "AFF_HISTO_H V1.0 " #define AFF_HISTO_H_CVSID \ - "$Id: histo.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/functions/max.h b/contrib/aff/functions/max.h index b50e1cefc29a466d1ad32197b1798ad7d357160f..4b2dd4e107d12865f1d9d6ea967ed22465e83d59 100644 --- a/contrib/aff/functions/max.h +++ b/contrib/aff/functions/max.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: max.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/03/2005 * @@ -40,7 +40,7 @@ #define AFF_MAX_H_VERSION \ "AFF_MAX_H V1.1 " #define AFF_MAX_H_CVSID \ - "$Id: max.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/functions/min.h b/contrib/aff/functions/min.h index e2ac27da510706a4fa65500811a1dd90feefd7ed..f976bfc36fa1fa5dc81c6f3a1d910f5a51c9723b 100644 --- a/contrib/aff/functions/min.h +++ b/contrib/aff/functions/min.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: min.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/03/2005 * @@ -40,7 +40,7 @@ #define AFF_MIN_H_VERSION \ "AFF_MIN_H V1.1 " #define AFF_MIN_H_CVSID \ - "$Id: min.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/functions/rms.h b/contrib/aff/functions/rms.h index fb189edf7decd6561a68aeb8fa388133755772c0..b45b211d9f4ee411506b60935c120e81972cf14b 100644 --- a/contrib/aff/functions/rms.h +++ b/contrib/aff/functions/rms.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: rms.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/03/2005 * @@ -41,7 +41,7 @@ #define AFF_RMS_H_VERSION \ "AFF_RMS_H V1.2" #define AFF_RMS_H_CVSID \ - "$Id: rms.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/functions/sqrsum.h b/contrib/aff/functions/sqrsum.h index f0e7d022578b0ebebbf70ae0325116842ecafbbb..c06ef3271cdb48110aaa878a1b80d754030613d3 100644 --- a/contrib/aff/functions/sqrsum.h +++ b/contrib/aff/functions/sqrsum.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: sqrsum.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 13/06/2007 * @@ -39,7 +39,7 @@ #define AFF_SQRSUM_H_VERSION \ "AFF_SQRSUM_H V1.0 " #define AFF_SQRSUM_H_CVSID \ - "$Id: sqrsum.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/functions/sum.h b/contrib/aff/functions/sum.h index 80411a82442b21ae1475154602f05cd7325b5d49..6d5705dce58bb09e8e5024291b18ce1eed68298a 100644 --- a/contrib/aff/functions/sum.h +++ b/contrib/aff/functions/sum.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: sum.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 13/06/2007 * @@ -39,7 +39,7 @@ #define AFF_SUM_H_VERSION \ "AFF_SUM_H V1.0 " #define AFF_SUM_H_CVSID \ - "$Id: sum.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/functions/valmap.h b/contrib/aff/functions/valmap.h index 7955906aefca57a34c6fd600ead887b0bc9e8687..029b1b978b67cec006502918c92bc9520cf0ecb4 100644 --- a/contrib/aff/functions/valmap.h +++ b/contrib/aff/functions/valmap.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: valmap.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/03/2005 * @@ -39,7 +39,7 @@ #define AFF_VALMAP_H_VERSION \ "AFF_VALMAP_H V1.0 " #define AFF_VALMAP_H_CVSID \ - "$Id: valmap.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/iterator.h b/contrib/aff/iterator.h index 79ef62130fb0ed11160584a24be55692a00227ee..123972b04166b5898c3d78dcb2f441c5b9b21e41 100644 --- a/contrib/aff/iterator.h +++ b/contrib/aff/iterator.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: iterator.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -55,7 +55,7 @@ #define AFF_ITERATOR_H_VERSION \ "AFF_ITERATOR_H V1.4" #define AFF_ITERATOR_H_CVSID \ - "$Id: iterator.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/checkedcast.h b/contrib/aff/lib/checkedcast.h index b20d285131df01339f3d72b9e299638fa8fa140e..e14eccc261fca44e59553ae9a5954b3513e19c26 100644 --- a/contrib/aff/lib/checkedcast.h +++ b/contrib/aff/lib/checkedcast.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: checkedcast.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 03/01/2003 * @@ -41,7 +41,7 @@ #define AFF_CHECKEDCAST_H_VERSION \ "AFF_CHECKEDCAST_H V1.0" #define AFF_CHECKEDCAST_H_CVSID \ - "$Id: checkedcast.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" namespace aff { namespace util { diff --git a/contrib/aff/lib/collector.h b/contrib/aff/lib/collector.h index b56d6b8d547f7d5b18aff9ff1084b1f6b591a144..8379e173481ff66efd4e1291217e17a8a2000205 100644 --- a/contrib/aff/lib/collector.h +++ b/contrib/aff/lib/collector.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: collector.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/03/2005 * @@ -40,7 +40,7 @@ #define AFF_COLLECTOR_H_VERSION \ "AFF_COLLECTOR_H V1.1" #define AFF_COLLECTOR_H_CVSID \ - "$Id: collector.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/deepcopy.h b/contrib/aff/lib/deepcopy.h index f426b0c15c23de8eb3ab954993cc4c2aa566732b..6622e81053d62c76fedd87d55350b8a165a67ff1 100644 --- a/contrib/aff/lib/deepcopy.h +++ b/contrib/aff/lib/deepcopy.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: deepcopy.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 29/12/2002 * @@ -49,7 +49,7 @@ #define AFF_DEEPCOPY_H_VERSION \ "AFF_DEEPCOPY_H V1.2" #define AFF_DEEPCOPY_H_CVSID \ - "$Id: deepcopy.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" namespace aff { diff --git a/contrib/aff/lib/README b/contrib/aff/lib/doxygen.lib.txt similarity index 99% rename from contrib/aff/lib/README rename to contrib/aff/lib/doxygen.lib.txt index 771ef039b10dc0267b57fcd2fe851e8cdf398d99..b8d132039e70575e0ddeb54842b4fb2fa8279fbb 100644 --- a/contrib/aff/lib/README +++ b/contrib/aff/lib/doxygen.lib.txt @@ -1,9 +1,9 @@ -/*! \file libaff/lib/README +/*! \file libaff/lib/doxygen.lib.txt * \brief Some more specific or more advanced topics * * ---------------------------------------------------------------------------- * - * $Id: README 4964 2013-02-01 13:27:42Z lrehor $ + * $Id$ * * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) * @@ -39,6 +39,8 @@ * - doxygen now reads Fortran and f2c generated code * - 28/12/2002 V1.3 (thof) * - new term for containers of const elements + * - 12/06/2013 V1.4 (thof) + * - renamed file * * ============================================================================ */ @@ -390,4 +392,4 @@ Aspects to consider: \subsection sec_fortran_f77procsp tests/f77procs.P \verbinclude tests/f77procs.P */ -// ----- END OF README ----- +// ----- END OF doxygen.lib.txt ----- diff --git a/contrib/aff/lib/dump_array.h b/contrib/aff/lib/dump_array.h index 172994babd673ad535328fc96e61306d38182265..d1757d19a5649b9585f768f449cb4f073e01b1bf 100644 --- a/contrib/aff/lib/dump_array.h +++ b/contrib/aff/lib/dump_array.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump_array.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -47,7 +47,7 @@ #define AFF_DUMP_ARRAY_H_VERSION \ "AFF_DUMP_ARRAY_H V1.2" #define AFF_DUMP_ARRAY_H_CVSID \ - "$Id: dump_array.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/dump_macros.h b/contrib/aff/lib/dump_macros.h index 5769aec2723f02d5a6898a8459fdd104fe405a80..e15a026203725b96b5528e620eab2a1718aca6ff 100644 --- a/contrib/aff/lib/dump_macros.h +++ b/contrib/aff/lib/dump_macros.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump_macros.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -54,7 +54,7 @@ #define AFF_DUMP_MACROS_H_VERSION \ "AFF_DUMP_MACROS_H V1.2" #define AFF_DUMP_MACROS_H_CVSID \ - "$Id: dump_macros.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/dump_series.h b/contrib/aff/lib/dump_series.h index 5b1b5a3859a26596745d970a9f17b2fa173af40b..4bfb799a1f131914491fedc5231195bb28f4930c 100644 --- a/contrib/aff/lib/dump_series.h +++ b/contrib/aff/lib/dump_series.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump_series.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -44,7 +44,7 @@ #define AFF_DUMP_SERIES_H_VERSION \ "AFF_DUMP_SERIES_H V1.1" #define AFF_DUMP_SERIES_H_CVSID \ - "$Id: dump_series.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/dump_sharedheap.h b/contrib/aff/lib/dump_sharedheap.h index aa363e9b90fbde91a645de7cdf56aed40a46d289..d0b87b2f25c28e21b3b35984b4eff23ff0089551 100644 --- a/contrib/aff/lib/dump_sharedheap.h +++ b/contrib/aff/lib/dump_sharedheap.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump_sharedheap.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -46,7 +46,7 @@ #define AFF_DUMP_SHAREDHEAP_H_VERSION \ "AFF_DUMP_SHAREDHEAP_H V1.2" #define AFF_DUMP_SHAREDHEAP_H_CVSID \ - "$Id: dump_sharedheap.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/dump_simplerigidarray.h b/contrib/aff/lib/dump_simplerigidarray.h index 361d125093d2599b878d8d6f219973d204d40d04..26a9c4289fd0e2d16bc3ef56b1274e01106f5709 100644 --- a/contrib/aff/lib/dump_simplerigidarray.h +++ b/contrib/aff/lib/dump_simplerigidarray.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump_simplerigidarray.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -41,7 +41,7 @@ #define AFF_DUMP_SIMPLERIGIDARRAY_H_VERSION \ "AFF_DUMP_SIMPLERIGIDARRAY_H V1.0 " #define AFF_DUMP_SIMPLERIGIDARRAY_H_CVSID \ - "$Id: dump_simplerigidarray.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/dump_strided.h b/contrib/aff/lib/dump_strided.h index 6c2ea72df571da7914343bc822ba37a8de6f0d1f..c89d056d45a0e599ed6b1076e993fcf05c87a470 100644 --- a/contrib/aff/lib/dump_strided.h +++ b/contrib/aff/lib/dump_strided.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: dump_strided.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -41,7 +41,7 @@ #define AFF_DUMP_STRIDED_H_VERSION \ "AFF_DUMP_STRIDED_H V1.0 " #define AFF_DUMP_STRIDED_H_CVSID \ - "$Id: dump_strided.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/error.cc b/contrib/aff/lib/error.cc index 3dcab98b03eb97f219bb7cc82571637764c624a2..f26b047c4e662023fdfca8c1de9b34354a50c317 100644 --- a/contrib/aff/lib/error.cc +++ b/contrib/aff/lib/error.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: error.cc 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 27/11/2002 * @@ -41,7 +41,7 @@ #define AFF_ERROR_CC_VERSION \ "AFF_ERROR_CC V1.2" #define AFF_ERROR_CC_CVSID \ - "$Id: error.cc 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/error.h b/contrib/aff/lib/error.h index 82dc4d7cca972008cb17ddfadee29ed7a72a76c2..da58fb5fa27bf3a7db43a709c4a2c5fc57a60a17 100644 --- a/contrib/aff/lib/error.h +++ b/contrib/aff/lib/error.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: error.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 27/11/2002 * @@ -50,7 +50,7 @@ #define AFF_ERROR_H_VERSION \ "AFF_ERROR_H V1.2" #define AFF_ERROR_H_CVSID \ - "$Id: error.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/linearshape.h b/contrib/aff/lib/linearshape.h index f0b19d5db4c4d711da79f3b0df03c689b8719800..e1c441b9a66412a1de9b1e87ef699cde7eea0b31 100644 --- a/contrib/aff/lib/linearshape.h +++ b/contrib/aff/lib/linearshape.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: linearshape.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 23/12/2003 * @@ -48,7 +48,7 @@ #define AFF_LINEARSHAPE_H_VERSION \ "AFF_LINEARSHAPE_H V1.4" #define AFF_LINEARSHAPE_H_CVSID \ - "$Id: linearshape.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" namespace aff { diff --git a/contrib/aff/lib/mapper.h b/contrib/aff/lib/mapper.h index 2e321e2d1be3e9b652f9ec4409ae202a3c6fb422..38b03d3098425cad5d397621a4ac46bf2248411c 100644 --- a/contrib/aff/lib/mapper.h +++ b/contrib/aff/lib/mapper.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: mapper.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/03/2005 * @@ -39,7 +39,7 @@ #define AFF_MAPPER_H_VERSION \ "AFF_MAPPER_H V1.0 " #define AFF_MAPPER_H_CVSID \ - "$Id: mapper.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/operators.h b/contrib/aff/lib/operators.h index 80aecb4494fc40e8eed9fce68c2fa38a716ae71a..1ddfe30545c89faac84dd5e73d01e1d2eebf0b50 100644 --- a/contrib/aff/lib/operators.h +++ b/contrib/aff/lib/operators.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: operators.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 10/02/2004 * diff --git a/contrib/aff/lib/rawarfun.h b/contrib/aff/lib/rawarfun.h index 46170112c410108fb929e4b3c7dd33383d44018b..5a05483626195f6fe752391df0d1497c322531e3 100644 --- a/contrib/aff/lib/rawarfun.h +++ b/contrib/aff/lib/rawarfun.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: rawarfun.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -50,7 +50,7 @@ #define AFF_RAWARFUN_H_VERSION \ "AFF_RAWARFUN_H V1.3" #define AFF_RAWARFUN_H_CVSID \ - "$Id: rawarfun.h 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/seriesstepper.cc b/contrib/aff/lib/seriesstepper.cc index 9d46bb9b3ce1f1f6ed10dcf99ebe1adb10dce7d3..54ca49884d81bcf5a76d4032be47ebadf9f825a8 100644 --- a/contrib/aff/lib/seriesstepper.cc +++ b/contrib/aff/lib/seriesstepper.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: seriesstepper.cc 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/12/2002 * @@ -35,7 +35,7 @@ #define AFF_SERIESSTEPPER_CC_VERSION \ "AFF_SERIESSTEPPER_CC V1.0" #define AFF_SERIESSTEPPER_CC_CVSID \ - "$Id: seriesstepper.cc 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/seriesstepper.h b/contrib/aff/lib/seriesstepper.h index 0b0bd048891e408e52ec93329e81dd1f9cdee40a..e128aacdae2a530f911b48759f95c94370913160 100644 --- a/contrib/aff/lib/seriesstepper.h +++ b/contrib/aff/lib/seriesstepper.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: seriesstepper.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 20/12/2002 * @@ -46,7 +46,7 @@ #define AFF_SERIESSTEPPER_H_VERSION \ "AFF_SERIESSTEPPER_H V1.2" #define AFF_SERIESSTEPPER_H_CVSID \ - "$Id: seriesstepper.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/sharedheap.h b/contrib/aff/lib/sharedheap.h index 2192f02b52d337ac485327af7bd425e9afaef8aa..30025be65dd3190551cdd0fbdaaaee53d441b0e9 100644 --- a/contrib/aff/lib/sharedheap.h +++ b/contrib/aff/lib/sharedheap.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: sharedheap.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -69,7 +69,7 @@ #define AFF_SHAREDHEAP_H_VERSION \ "AFF_SHAREDHEAP_H V1.8" #define AFF_SHAREDHEAP_H_CVSID \ - "$Id: sharedheap.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/sharedheap_def.h b/contrib/aff/lib/sharedheap_def.h index 1d7dd973ab1deb1e83f4af6633c0438c6066c1cb..604ff927cf094c3f1e8fb9e19cffef6a03ec0622 100644 --- a/contrib/aff/lib/sharedheap_def.h +++ b/contrib/aff/lib/sharedheap_def.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: sharedheap_def.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -58,7 +58,7 @@ #define AFF_SHAREDHEAP_DEF_H_VERSION \ "AFF_SHAREDHEAP_DEF_H V1.4" #define AFF_SHAREDHEAP_DEF_H_CVSID \ - "$Id: sharedheap_def.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" namespace aff { diff --git a/contrib/aff/lib/simplearray.h b/contrib/aff/lib/simplearray.h index 245965b891c5c2754102aced0ee6192e99e35277..19ecde3d9e5318f4d4d219be32dcfe20d26ecb65 100644 --- a/contrib/aff/lib/simplearray.h +++ b/contrib/aff/lib/simplearray.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: simplearray.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -46,7 +46,7 @@ #define AFF_SIMPLEARRAY_H_VERSION \ "AFF_SIMPLEARRAY_H V1.4" #define AFF_SIMPLEARRAY_H_CVSID \ - "$Id: simplearray.h 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/strided.cc b/contrib/aff/lib/strided.cc index 4ff1820b00dd93df4d32568de0381526cadbd7dc..8b441bcae1fdec9d3ee5c25299be4d3a03f1a4c2 100644 --- a/contrib/aff/lib/strided.cc +++ b/contrib/aff/lib/strided.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: strided.cc 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -60,7 +60,7 @@ #define AFF_STRIDED_CC_VERSION \ "AFF_STRIDED_DEF_H V1.8" #define AFF_STRIDED_CC_CVSID \ - "$Id: strided.cc 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/strided.h b/contrib/aff/lib/strided.h index d2c75538e5c21850e6a13e3683e705780ad55795..c83c8b52dd74b8b375e808df62c031a6e54a9580 100644 --- a/contrib/aff/lib/strided.h +++ b/contrib/aff/lib/strided.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: strided.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -71,7 +71,7 @@ #define AFF_STRIDED_H_VERSION \ "AFF_STRIDED_H V1.8" #define AFF_STRIDED_H_CVSID \ - "$Id: strided.h 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/lib/stridedstepper.cc b/contrib/aff/lib/stridedstepper.cc index 8d09662fa97b00e38cab22d8be379619a98b5448..153363cf0556b23b547286f40939abad0710d647 100644 --- a/contrib/aff/lib/stridedstepper.cc +++ b/contrib/aff/lib/stridedstepper.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: stridedstepper.cc 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -43,7 +43,7 @@ #define AFF_STRIDEDSTEPPER_CC_VERSION \ "AFF_STRIDEDSTEPPER_DEF_H V1.2" #define AFF_STRIDEDSTEPPER_CC_CVSID \ - "$Id: stridedstepper.cc 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/stridedstepper.h b/contrib/aff/lib/stridedstepper.h index e17be2396b306f591888f9d9cfcd2b28141d12b5..39bd6d50158dfe286e7e8669884c311e84fc2323 100644 --- a/contrib/aff/lib/stridedstepper.h +++ b/contrib/aff/lib/stridedstepper.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: stridedstepper.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -51,7 +51,7 @@ #define AFF_STRIDEDSTEPPER_H_VERSION \ "AFF_STRIDEDSTEPPER,H_H V1.3" #define AFF_STRIDEDSTEPPER_H_CVSID \ - "$Id: stridedstepper.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/lib/types.h b/contrib/aff/lib/types.h index 915dae7bd0f558dc7654a1b88a8449412ebd820f..260f5b259398964e77f192e72415e48ee2ada7d3 100644 --- a/contrib/aff/lib/types.h +++ b/contrib/aff/lib/types.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: types.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -42,7 +42,7 @@ #define AFF_TYPES_H_VERSION \ "AFF_TYPES_H V1.0 " #define AFF_TYPES_H_CVSID \ - "$Id: types.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/olib/binarray.cc b/contrib/aff/olib/binarray.cc index 4255c443feb581281aaf14674e387d4edb5a9c63..28cd001a369bd1df409d267f97dc7edf596694a6 100644 --- a/contrib/aff/olib/binarray.cc +++ b/contrib/aff/olib/binarray.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: binarray.cc 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 01/05/2002 * @@ -44,7 +44,7 @@ #define TF_BINARRAY_CC_VERSION \ "TF_BINARRAY_CC V1.1 " #define TF_BINARRAY_CC_CVSID \ - "$Id: binarray.cc 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/series.h b/contrib/aff/series.h index 505226c660fa3b9c4d6aa8b7d61c254dbddbc717..f7d0de07b79a6304b8facd2cc2c4bd13dd9b1959 100644 --- a/contrib/aff/series.h +++ b/contrib/aff/series.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: series.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 17/12/2002 * @@ -85,7 +85,7 @@ #define AFF_SERIES_H_VERSION \ "AFF_SERIES_H V1.12" #define AFF_SERIES_H_CVSID \ - "$Id: series.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/seriesoperators.h b/contrib/aff/seriesoperators.h index c749282a4aea04837504257ab013110b0824eee4..4718bb0b0c9ff92aa4a1c68e3210baeb155fc0ba 100644 --- a/contrib/aff/seriesoperators.h +++ b/contrib/aff/seriesoperators.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: seriesoperators.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 10/02/2004 * @@ -39,7 +39,7 @@ #define AFF_SERIESOPERATORS_H_VERSION \ "AFF_SERIESOPERATORS_H V1.0 " #define AFF_SERIESOPERATORS_H_CVSID \ - "$Id: seriesoperators.h 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include diff --git a/contrib/aff/shaper.h b/contrib/aff/shaper.h index d08057170c0383cd107a171ff85d98106b3194a3..3a33d58e71bfbafa7eaf2c3774a7d5eacbab3ca9 100644 --- a/contrib/aff/shaper.h +++ b/contrib/aff/shaper.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: shaper.h 3957 2011-05-16 14:46:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \since 08/12/2002 * @@ -54,7 +54,7 @@ #define AFF_SHAPER_H_VERSION \ "AFF_SHAPER_H V1.6" #define AFF_SHAPER_H_CVSID \ - "$Id: shaper.h 3957 2011-05-16 14:46:43Z tforb $" + "$Id$" #include #include diff --git a/contrib/aff/slice.h b/contrib/aff/slice.h index ae552b0b87b818ef11fd2279332bf352b006c052..8975b70d417648e50fbbd7edc3fd014da38df0bc 100644 --- a/contrib/aff/slice.h +++ b/contrib/aff/slice.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: slice.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -52,7 +52,7 @@ #define AFF_SLICE_H_VERSION \ "AFF_SLICE_H V1.4" #define AFF_SLICE_H_CVSID \ - "$Id: slice.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/subarray.h b/contrib/aff/subarray.h index 1f27ef577ea3f482224dc14404acefe1906dfbf0..c143b9a13d392b78c3d0b18fb1f4ed3595b0f9e9 100644 --- a/contrib/aff/subarray.h +++ b/contrib/aff/subarray.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: subarray.h 3084 2010-08-10 16:01:03Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 19/12/2002 * @@ -50,7 +50,7 @@ #define AFF_SUBARRAY_H_VERSION \ "AFF_SUBARRAY_H V1.3" #define AFF_SUBARRAY_H_CVSID \ - "$Id: subarray.h 3084 2010-08-10 16:01:03Z tforb $" + "$Id$" #include diff --git a/contrib/aff/tests/Makefile b/contrib/aff/tests/Makefile deleted file mode 100644 index e083b9b78e9a5c49701423be8d4e002b34fe9d82..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/Makefile +++ /dev/null @@ -1,129 +0,0 @@ -# this is -# ---------------------------------------------------------------------------- -# $Id: Makefile 4964 2013-02-01 13:27:42Z lrehor $ -# -# 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 -# -# ============================================================================ -# -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 -# ------------------------- -FC=g77 -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 $< $(FCFLAGS) $(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 -lg2c -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 ----- diff --git a/contrib/aff/tests/arraytest.cc b/contrib/aff/tests/arraytest.cc deleted file mode 100644 index 9c233e4e0fe919944f7851d9b91c3a9359865b2e..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/arraytest.cc +++ /dev/null @@ -1,240 +0,0 @@ -/*! \file arraytest.cc - * \brief test array class template (implementation) - * - * ---------------------------------------------------------------------------- - * - * $Id: arraytest.cc 3084 2010-08-10 16:01:03Z tforb $ - * \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: arraytest.cc 3084 2010-08-10 16:01:03Z tforb $" - -#define CONT_INDEXCHECK - -#include -#include -#include -#include - -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 A(3,4); ) - DUMP( A ); - } - section("shape-constructor"); - { - CODE( Array A(Shaper(4,14)(12)(-5,5)); ) - DUMP( A ); - } - - /*----------------------------------------------------------------------*/ - - section("Test assignment", '='); - { - CODE( Array 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 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 A(3,4); ); - CODE( Array B(A); ); - CODE( Array 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 A(3,4); ); - CODE( A=15.5; ); - CODE( ConstArray B(A); ); - CODE( dump_array(B); ); - CODE( A(2,3)=-2.; ); - CODE( A(3,1)=-5.; ); - CODE( Array::Trepresentation H; ); - CODE( H=A.representation(); ); - CODE( H[5]=-12.; ); - CODE( dump_array(B); ); - CODE( ConstArray::Trepresentation H2; ); - CODE( H2=B.representation(); ); - DUMP( H2 ); - -#ifdef ILLEGAL1 -#warning compiling supposedly illegal code - CODE( Array C(B); ); -#endif - -#ifdef ILLEGAL2 -#warning compiling supposedly illegal code - CODE( Array 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 A(3,3) ); - CODE( ConstArray B(A) ); - CODE( const Array 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 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 CA(subarray(A)(4,6)(3,5))); - CODE( dump_array(CA); ); - CODE( Array B=CA.copyout()); - CODE( dump_array(B); ); - } -} - -/* ----- END OF arraytest.cc ----- */ diff --git a/contrib/aff/tests/f77common.inc b/contrib/aff/tests/f77common.inc deleted file mode 100644 index 0f52525dab5c540e7d0ed4dfd46c01f79ddf0cff..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/f77common.inc +++ /dev/null @@ -1,43 +0,0 @@ -c this is -c ---------------------------------------------------------------------------- -c ($Id: f77common.inc 3084 2010-08-10 16:01:03Z tforb $) -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 ----- diff --git a/contrib/aff/tests/f77interface.cc b/contrib/aff/tests/f77interface.cc deleted file mode 100644 index 87b0aa964a5ec57a8769ad9adf0a9e0bebd255d4..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/f77interface.cc +++ /dev/null @@ -1,157 +0,0 @@ -/*! \file f77interface.cc - * \brief interface functions (implementation) - * - * ---------------------------------------------------------------------------- - * - * $Id: f77interface.cc 3084 2010-08-10 16:01:03Z tforb $ - * \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: f77interface.cc 3084 2010-08-10 16:01:03Z tforb $" - -// include assertions -#include -// include FortranArray stuff -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -// 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& a) -{ - aff::FortranArray > fa(a); - integer* pa=fa.castedpointer(); - 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& v1, - const aff::Array& v2) -{ - aff::FortranArray > fv1(v1),fv2(v2); - real* p1=fv1.castedpointer(); - real* p2=fv2.castedpointer(); - 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 fa(result); - complex* p=fa.castedpointer(); - 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 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 repr(p, shape.memory_size()); - // create array and return - return Tzarray(shape, repr); -} - -} // namespace f77interface - -/* ----- END OF f77interface.cc ----- */ diff --git a/contrib/aff/tests/f77procs.f b/contrib/aff/tests/f77procs.f deleted file mode 100644 index 96124c7c21b244d454552dd484948fc6f811a3e4..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/f77procs.f +++ /dev/null @@ -1,141 +0,0 @@ -c this is -c ---------------------------------------------------------------------------- -c ($Id: f77procs.f 3084 2010-08-10 16:01:03Z tforb $) -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 -c - include 'f77common.inc' -c - complex vec(nmax) - integer n,nmax -c - integer i,j -c - if (nb.gt.nmax) stop 'ERROR: vector too small' - n=nb - do i=1,nb - vec(i)=(0.,0.) - do j=1,na - vec(i)=vec(i)+array(j,i) - enddo - enddo - return - end -c -c---------------------------------------------------------------------- -c - double complex function total(i) -c -c returns a value derived from common block -c - include 'f77common.inc' -c - integer i -c - double complex result - integer j -c - if ((i.lt.1).or.(i.gt.na)) stop 'ERROR: illegal index' - result=(0.d0,0.d0) - do j=1,nb - result=result+array(i,j) - enddo - total=result - return - end -c -c---------------------------------------------------------------------- -c - subroutine fill(a, ld1, n1, ld2, n2, ld3, n3) -c -c fill a three-domensional array that was passed to the subroutine -c - integer ld1,n1,ld2,n2,ld3,n3 - integer a(ld1,ld2,ld3) -c - integer i,j,k -c - do i=1,n1 - do j=1,n2 - do k=1,n3 - a(i,j,k)=i+10*j+100*k - enddo - enddo - enddo -c - return - end -c -c---------------------------------------------------------------------- -c - subroutine comdim(maxa, maxb) -c -c we have no access to the defined dimensions of the common block -c this subroutines passes the values to the rest of the world -c - integer maxa,maxb -c - include 'f77common.inc' -c - maxa=amax - maxb=bmax -c - return - end -c -c ----- END OF f77procs.f ----- diff --git a/contrib/aff/tests/f77proto.h b/contrib/aff/tests/f77proto.h deleted file mode 100644 index 6aa821655d05cf2d71ab2cb91a1423d14e1cf125..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/f77proto.h +++ /dev/null @@ -1,110 +0,0 @@ -/*! \file f77proto.h - * \brief prototypes for Fortran interface (prototypes) - * - * ---------------------------------------------------------------------------- - * - * $Id: f77proto.h 3084 2010-08-10 16:01:03Z tforb $ - * \author Thomas Forbriger - * \date 22/12/2002 - * - * prototypes for Fortran interface (prototypes) - * - * ---- - * 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 - * \sa f77interface - * - * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) - * - * REVISIONS and CHANGES - * - 22/12/2002 V1.0 Thomas Forbriger - * - 27/12/2002 V1.1 (thof) - * - now provides some documentation - * - * ============================================================================ - */ - -// include guard -#ifndef AFF_F77PROTO_H_VERSION - -#define AFF_F77PROTO_H_VERSION \ - "AFF_F77PROTO_H V1.1" -#define AFF_F77PROTO_H_CVSID \ - "$Id: f77proto.h 3084 2010-08-10 16:01:03Z tforb $" - -#include - -#include - -/*! \brief This namespace collects all test functions for interfacing Fortran 77 - * - * \sa \ref page_fortran - * \sa tests/f77test.cc - * \sa tests/f77interface.cc - */ -namespace f77interface { - -typedef aff::Array > Tcarray; -typedef aff::Array > Tzarray; - -/*! \brief fill an AFF array thorugh a Fortran subroutine - * - * An aff::Array object is passed to the Fortran subroutine fill and is - * filled with values there. - * The concept is discussed on page "\ref page_fortran". - */ -int fill(const aff::Array& fa); - -/*! \brief fill the Fortran common-block array - * - * Two aff::Array objects are passed to the Fortran subroutine - * fillarray which calculates complex values from the elements of these arrays - * and fills the array in common-block \c f77common which is defined in - * tests/f77common.inc. - * - * The concept is discussed on page "\ref page_fortran". - */ -int fillarray(const aff::Array& v1, - const aff::Array& v2); - -/*! \brief returns results from Fortran subroutine sums - * - * The Fortran subroutine sums calculates column-sums from the array in the - * common block. These values are return in an - * \code aff::Array > \endcode object. - * - * The concept is discussed on page "\ref page_fortran". - */ -Tcarray sums(); - -/*! \brief returns direct access to Fortran common block - * - * This function returns a - * \code aff::Array > \endcode object, which offers - * direct read/write access to the array in the Fortran common block - * f77common. - * - * The concept is discussed on page "\ref page_fortran". - */ -Tzarray viewcommon(); - -} // namespace f77interface - - -#endif // AFF_F77PROTO_H_VERSION (includeguard) - -/* ----- END OF f77proto.h ----- */ diff --git a/contrib/aff/tests/f77test.cc b/contrib/aff/tests/f77test.cc deleted file mode 100644 index adca5ce34e37efdb5084d83e3d94a9a1a9fb0c05..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/f77test.cc +++ /dev/null @@ -1,243 +0,0 @@ -/*! \file f77test.cc - * \brief test interfacing Fortran code (implementation) - * - * ---------------------------------------------------------------------------- - * - * $Id: f77test.cc 3084 2010-08-10 16:01:03Z tforb $ - * \author Thomas Forbriger - * \date 22/12/2002 - * - * test interfacing Fortran code (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 - * ---- - * - * Activate sections for testing illegal constructs by passing macros - * ILLEGAL1, ILLEGAL2, ILLEGAL3, ILLEGAL4, ILLEGAL5 to the preprocessor. Use - * option -DILLEGAL1 etc. - * - * \sa \ref page_fortran - * - * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) - * - * REVISIONS and CHANGES - * - 22/12/2002 V1.0 Thomas Forbriger - * - 29/12/2002 V1.1 (thof) - * - new uses new function aff::subarray - * - new uses new function aff::slice - * - 03/01/2003 V1.2 (thof) - * - test aff::util::SizeCheckedCast - * - * ============================================================================ - */ - -/*! \example tests/f77test.cc - * - * Passing arrays to Fortran 77 code and retrieving array structures - * from Fortran 77 common blocks. - * - * This test program gives an example of the usage of the following classes, - * functions, and preprocessor macros: - * - aff::FortranArray - * - aff::FortranShape - * - aff::Array - * - aff::util::SizeCheckedCast - * - #DUMP - * - #CODE - * - * \sa tests/f77test.cc - * \sa \ref page_fortran - */ - -#define AFF_F77TEST_CC_VERSION \ - "AFF_F77TEST_CC V1.2" -#define AFF_F77TEST_CC_CVSID \ - "$Id: f77test.cc 3084 2010-08-10 16:01:03Z tforb $" - -#include -#include -#include -#include -#include -#include -#include -#include "f77proto.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; -} - -/*======================================================================*/ - -/*! \brief test array interface to Fortran 77 - * - * \sa \ref page_fortran - */ -int main() -{ - cout << AFF_F77TEST_CC_VERSION << endl; - cout << AFF_F77TEST_CC_CVSID << endl; - - // First we test the shape class that should support passing arrays to - // Fortran 77 functions - section("FortranShape:", '='); - { - section("Full Layout"); - // we create a test array with known Fortran layout - CODE(Strided strided(Shaper(1,10,20)(1,5,10)(1,30)(20))); - // dump this shape - DUMP(strided); - // create Fortran shape from this (should be identical to known) - CODE(aff::util::FortranShape fs1(strided)); - // and dump this - DUMP(fs1.first()); - DUMP(fs1.last()); - DUMP(fs1.dimlast()); - cout << "fs1.offset(): " << fs1.offset() << endl; - - section("Sliced Subshape"); - // now take shape of a subarray - CODE(Strided subshape(strided)); - CODE(subshape.shrink(0,2).shrink(1,3,5).shrink(3,10,20)); - CODE(subshape.collapse(2,15)); - // create Fortran shape from this - CODE(aff::util::FortranShape fs2(subshape)); - // and dump this - DUMP(fs2.first()); - DUMP(fs2.last()); - DUMP(fs2.dimlast()); - cout << "fs2.offset(): " << fs2.offset() << endl; - } - - /*----------------------------------------------------------------------*/ - - section("Pass array to Fortran via subroutine arguments:", '='); - { - // create an array and fill it - CODE(Array A(Shaper(-3,3)(9)(-1,1))); - CODE(A=-55); - // create a subarray view and fill this through Fortran - CODE(Array B=subarray(A)(-2,2)(3,7)(0)); - CODE(f77interface::fill(B)); - // dump the result - CODE(dump_array(A)); - // do it again for a slice - CODE(f77interface::fill(slice(A)()(2))); - CODE(dump_array(A)); - } - - /*----------------------------------------------------------------------*/ - - section("Access to common block:", '='); - { - // prepare to vectors to pass to fillarray - CODE(Array v1(5)); - CODE(Array v2(3)); - CODE(for(int i=v1.f(0); i<=v1.l(0); i++) { v1(i)=2.*i; }); - CODE(for(int i=v2.f(0); i<=v2.l(0); i++) { v2(i)=.5*i; }); - // fill common block through Fortran 77 subroutine - CODE(f77interface::fillarray(v1, v2)); - // get a view on the common block and dump it - CODE(f77interface::Tzarray Z(f77interface::viewcommon())); - CODE(dump_array(Z)); - // call Fortran subroutine sum and dump result - CODE(dump_array(f77interface::sums())); - CODE(typedef f77interface::Tzarray::Tvalue Tzvalue); - // write directly to common block through a subarray - CODE(subarray(Z)(2,4)=Tzvalue(-10.)); - // and dump the effect - CODE(dump_array(Z)); - CODE(dump_array(f77interface::sums())); - } - - /*----------------------------------------------------------------------*/ - - section("Size-checked casts:", '='); - { - CODE(typedef std::complex Ticvalue); - CODE(typedef std::complex Tcvalue); - CODE(Array v1(1)); - CODE(ConstArray v2(v1)); - CODE(FortranArray > fv1(v1)); - CODE(FortranArray > fv2(v2)); - CODE(v1(1)=Ticvalue(3,7)); - CODE(cout << v1(1) << ", " << v2(1) << endl); - CODE(Ticvalue *icp=fv1.castedpointer()); - CODE(*icp=Ticvalue(35,60)); - CODE(cout << v1(1) << ", " << v2(1) << endl); - CODE(const Ticvalue *cicp1=fv1.castedpointer()); - CODE(const Ticvalue *cicp2=fv2.castedpointer()); - CODE(cout << *cicp1 << ", " << *cicp2 << endl); - section("That's dangerous:",' '); - CODE(Tcvalue *cp=fv1.castedpointer()); - CODE(*cp=Ticvalue(35,60)); - CODE(cout << v1(1) << ", " << v2(1) << endl); - CODE(double *dp=fv1.castedpointer()); - CODE(*dp=35.e12); - CODE(cout << v1(1) << ", " << v2(1) << endl); - - section("Test illegal usage (only if activated through macro-definition):", - ' '); - CODE(Array iv1(1)); - CODE(ConstArray iv2(iv1)); - CODE(FortranArray > fiv1(iv1)); - CODE(FortranArray > fiv2(iv2)); - CODE(iv1(1)=50); - CODE(cout << iv1(1) << ", " << iv2(1) << endl); - CODE(int *iv1p=fiv1.pointer()); - CODE(const int *iv2p=fiv2.pointer()); - CODE(cout << *iv1p << ", " << *iv2p << endl); -#ifdef ILLEGAL1 -#warning intentionally compiling illegal code: -#warning direct discard of const qualifier in conversion from non-const - CODE(int *ip1=fiv1.castedpointer()); -#endif -#ifdef ILLEGAL2 -#warning intentionally compiling illegal code: -#warning direct discard of const qualifier in conversion from const array - CODE(int *ip2=fiv2.castedpointer()); -#endif -#ifdef ILLEGAL3 -#warning intentionally compiling illegal code: -#warning discards const in conversion (reinterpret_cast) - CODE(int *ip3=fiv2.castedpointer()); -#endif -#ifdef ILLEGAL4 -#warning intentionally compiling illegal code: -#warning direct type mismatch - CODE(float *ip4=fiv1.castedpointer()); -#endif -#ifdef ILLEGAL5 -#warning intentionally compiling illegal code: -#warning wrong type size in conversion through reinterpret_cast - CODE(double *ip5=fiv1.castedpointer()); -#endif - } - -} // main - -/* ----- END OF f77test.cc ----- */ diff --git a/contrib/aff/tests/functionstest.cc b/contrib/aff/tests/functionstest.cc deleted file mode 100644 index a7a37e647bbba8bc4b03356021a6ea1af892f15b..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/functionstest.cc +++ /dev/null @@ -1,97 +0,0 @@ -/*! \file functionstest.cc - * \brief test function templates - * - * ---------------------------------------------------------------------------- - * - * $Id: functionstest.cc 3084 2010-08-10 16:01:03Z tforb $ - * \author Thomas Forbriger - * \date 20/03/2005 - * - * test function templates - * - * ---- - * 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) 2005 by Thomas Forbriger (BFO Schiltach) - * - * REVISIONS and CHANGES - * - 20/03/2005 V1.0 Thomas Forbriger - * - 19/06/2006 V1.1 check functions with containers of const - * - * ============================================================================ - */ -#define FUNCTIONSTEST_VERSION \ - "FUNCTIONSTEST V1.1 test function templates" -#define FUNCTIONSTEST_CVSID \ - "$Id: functionstest.cc 3084 2010-08-10 16:01:03Z tforb $" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace aff; - -using std::cout; -using std::cerr; -using std::endl; - -typedef std::map Tvalmap; - -int main(int iargc, char* argv[]) -{ - CODE( typedef aff::Array Tarray ); - CODE( Tarray A(3,4) ); - CODE( A=5 ); - CODE( Tarray::Tcoc AC=A ); - CODE( subarray(A)(1,1)(2,4)=2. ); - CODE( subarray(A)(2,3)(1,2)=1. ); - CODE( subarray(A)(2,3)(3,4)=-7. ); - CODE( dump_array(A) ); - CODE( cout << aff::func::avg(A) << endl ); - CODE( cout << aff::func::rms(A) << endl ); - CODE( cout << aff::func::max(A) << endl ); - CODE( cout << aff::func::min(A) << endl ); - CODE( cout << aff::func::absmax(A) << endl ); - CODE( cout << aff::func::min(AC) << endl ); - CODE( cout << aff::func::sum(A) << endl ); - CODE( cout << aff::func::sqrsum(A) << endl ); - CODE( typedef aff::func::util::Extracthisto::Tmap Tmap ); - CODE( Tmap mymap=aff::func::histo(A) ); - CODE( typedef Tmap::const_iterator Tmapit ); - CODE( for (Tmapit i=mymap.begin(); i!=mymap.end(); ++i) \ - { cout << i->first << "\t" << i->second << endl; } ); - CODE( Tvalmap avalmap ); - CODE( avalmap[-4.]=1 ); - CODE( avalmap[1.]=2 ); - CODE( avalmap[2.]=3 ); - CODE( avalmap[5.]=4 ); - CODE( aff::Array B= - aff::func::valmap(A, avalmap) ); - CODE( dump_array(B) ); -} - -/* ----- END OF functionstest.cc ----- */ diff --git a/contrib/aff/tests/helpertest.cc b/contrib/aff/tests/helpertest.cc deleted file mode 100644 index c9102a739a8291c6639ccd7300b84d5b5eec8180..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/helpertest.cc +++ /dev/null @@ -1,339 +0,0 @@ -/*! \file helpertest.cc - * \brief test helpers like iterator, subarray and slice (implementation) - * - * ---------------------------------------------------------------------------- - * - * $Id: helpertest.cc 3957 2011-05-16 14:46:43Z tforb $ - * \author Thomas Forbriger - * \date 23/12/2002 - * - * test helpers like iterator, subarray and slice (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 - * - 23/12/2002 V1.0 Thomas Forbriger - * - 28/12/2002 V1.1 (thof) - * - new term for containers of const elements - * - 29/12/2002 V1.2 (thof) - * - new subarray function - * - test subarray of ConstArray - * - new slice function - * - test slice of ConstArray - * - now no resolution conflicts with const containers - * are experienced anymore - * - 10/12/2007 V1.3 (thof) - * - scanning a const array requires a Browser - * - 15/05/2011 V1.4 (thof) - * - test aff::CArray - * - test helpers in converters.h - * - * ============================================================================ - */ -#define AFF_HELPERTEST_CC_VERSION \ - "AFF_HELPERTEST_CC V1.4" -#define AFF_HELPERTEST_CC_CVSID \ - "$Id: helpertest.cc 3957 2011-05-16 14:46:43Z tforb $" - -/*! \example tests/helpertest.cc - * - * Test helper classes. - * - * This test program gives an example of the usage of the following classes, - * functions, and preprocessor macros: - * - \ref group_array_extensions - * - \ref group_series_extensions - * - aff::CArray - * - aff::Iterator - * - aff::util::Subarray - * - aff::subarray - * - aff::utl::Slice - * - aff::slice - * - aff::Array - * - aff::ConstArray - * - aff::Shaper - * - aff::dump - * - aff::dump_array - * - #DUMP - * - #CODE - * - * \sa tests/helpertest.cc - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -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 for passing subarrays and slices -template -void printarray(const ConstArray& array) -{ - cout << endl; - cout << "Received array in function:" << endl; - dump_array(array); -} - -/*======================================================================*/ - -//! test helper classes -int main() -{ - cout << AFF_HELPERTEST_CC_VERSION << endl; - cout << AFF_HELPERTEST_CC_CVSID << endl; - - section("Preparing test array"); - CODE( Array A(Shaper(-2,2)(-3,3)) ); - CODE( dump_array(A) ); - - section("Tests for class Iterator", '='); - { - CODE(int i=0); - CODE(for( Iterator > I(A); I.valid(); ++I) - { *I=i; i++; }); - CODE( dump_array(A) ); - CODE( ConstArray CA(A.copyout()) ); - CODE( i=1); - // use a browser here - CODE(for( Browser > I(CA); I.valid(); ++I) - { cout << i << ", " << *I << endl; i++; }); - } - - CODE( ConstArray OrigA(A.copyout()) ); - - /*----------------------------------------------------------------------*/ - - section("Tests for class Subarray", '='); - { - section("First mode: Use a Subarray object just for initialization",'.'); - CODE(Array B=aff::util::Subarray >(A)(-1,1)(-2,2)); - CODE( dump_array(B) ); - CODE(B=-5); - CODE( dump_array(A) ); - // you must explicitely create an array through member function array() - CODE(printarray(aff::util::Subarray >(A)(-2,0)(-3,0).array())); - } - - section("Tests of subarray function", '-'); - { - CODE( A.copyin(OrigA) ); - section("First mode: Use a Subarray object just for initialization",'.'); - CODE(Array B=subarray(A)(-1,1)(-2,2)); - CODE( dump_array(B) ); - CODE(B=-5); - CODE( dump_array(A) ); - section("Second mode: Create a Subarray object to which you can assign", - '.'); - CODE(subarray(A)()(1,2)=100); - CODE(subarray(A)(1,1)=-200); - CODE( dump_array(A) ); - // you must explicitely create an array through member function array() - CODE(printarray(subarray(A)(-2,0)(-3,0).array())); - } - - section("Test for subarray of ConstArray",'-'); - { - CODE( dump_array(OrigA) ); - CODE(ConstArray B=subarray(OrigA)(-1,1)(-2,2)); - CODE( dump_array(B) ); - // you must explicitely create an array through member function array() - CODE(printarray(subarray(OrigA)(-2,0)(-3,0).array())); - } - - /*----------------------------------------------------------------------*/ - - section("Tests for class Slice", '='); - { - CODE( A.copyin(OrigA) ); - section("First mode: Use a Slice object just for initialization",'.'); - CODE(Array B=aff::util::Slice >(A)(1,-1)); - CODE( dump_array(B) ); - CODE(B=555); - CODE( dump_array(A) ); - // you must explicitely create an array through member function array() - CODE(printarray(aff::util::Slice >(A)(-2).array())); - } - - section("Test slice function", '-'); - { - CODE( A.copyin(OrigA) ); - section("First mode: Use a Slice object just for initialization",'.'); - CODE(Array B=slice(A)(1,-1)); - CODE( dump_array(B) ); - CODE(B=555); - CODE( dump_array(A) ); - section("Second mode: Create a Slice object to which you can assign", - '.'); - CODE(slice(A)()(1)=666); - CODE(slice(A)(0)=-777); - CODE( dump_array(A) ); - // you must explicitely create an array through member function array() - CODE(printarray(slice(A)(-2).array())); - } - - section("Test slice of ConstArray",'-'); - { - CODE( dump_array(OrigA) ); - CODE(ConstArray B=slice(OrigA)(1,-1)); - CODE( dump_array(B) ); - // you must explicitely create an array through member function array() - CODE(printarray(slice(OrigA)(-2).array())); - } - - /*----------------------------------------------------------------------*/ - - section("Mixed tests", '='); - - section("Iterator on a Subarray"); - { - CODE(int i=501); - CODE(Array B=subarray(A)(-1,1)(-2,2)); - CODE(for( Iterator > I(B); I.valid(); ++I) - { *I=i; i++; }); - CODE( dump_array(A) ); - } - - section("Iterator on a Slice"); - { - CODE(int i=-801); - CODE(Array B=slice(A)(1)); - CODE(for( Iterator > I(B); I.valid(); ++I) - { *I=i; i++; }); - CODE( dump_array(A) ); - } - - section("Extract copy of subarray"); - { - CODE(Array B=subarray(A)(-1,1)(-1,1)); - CODE(dump_array(B)); - CODE(Array C=B.copyout()); - CODE(dump_array(C)); - } - - /*----------------------------------------------------------------------*/ - - section("Test external access interfaces", '='); - - section("Test interface to raw memory array: aff::CArray"); - { - CODE( Array A(Shaper(2)(10,16)(-2,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( Array B=aff::slice(A)(0,2)(2,-1); ) - CODE( printarray(B) ); - CODE( CArray C(B); ) - section("fill C array"); - CODE( int* p=C.pointer(); ) - CODE( - for (unsigned i=0; i A(-3,4); ) - CODE( for (int i=A.f(); i<=A.l(); ++i) { A(i)=i; }) - CODE( dump(A); ) - CODE( aff::CSeries CS(A); ) - CODE( int* p=CS.pointer(); ) - CODE( for (int i=0; i S=series_from_raw_memory(p, CS.size()); ) - CODE( dump(S); ) - } - - /*----------------------------------------------------------------------*/ - - section("Test converters", '='); - - section("Test conversion from Array to Series"); - { - CODE( Array A(Shaper(2,9)(10,12)(0,2)(2,4)); ); - 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( Array B=aff::slice(A)(1,11)(1,1)(1,3); ) - CODE( printarray(B) ); - CODE( Series C=series_from_array(B); ) - CODE( dump(C); ) - CODE( ConstArray D=B; ) - CODE( ConstSeries E=series_from_array(D); ) - CODE( dump(E); ) - } -} - -/* ----- END OF helpertest.cc ----- */ diff --git a/contrib/aff/tests/operatortest.cc b/contrib/aff/tests/operatortest.cc deleted file mode 100644 index 270b8e15b1e5f1f64f8e42d82066bc29a017e270..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/operatortest.cc +++ /dev/null @@ -1,159 +0,0 @@ -/*! \file operatortest.cc - * \brief test operator functions - * - * ---------------------------------------------------------------------------- - * - * $Id: operatortest.cc 3084 2010-08-10 16:01:03Z tforb $ - * \author Thomas Forbriger - * \date 10/02/2004 - * - * test operator functions - * - * ---- - * 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) 2004 by Thomas Forbriger (BFO Schiltach) - * - * REVISIONS and CHANGES - * - 10/02/2004 V1.0 Thomas Forbriger - * - 05/07/2005 V1.1 check operators on containers declared const - * - * ============================================================================ - */ -#define OPERATORTEST_VERSION \ - "OPERATORTEST V1.1 test operator functions" -#define OPERATORTEST_CVSID \ - "$Id: operatortest.cc 3084 2010-08-10 16:01:03Z tforb $" - -#include -#include -#include -#include -#include -#include -#include -#include - -using std::cout; -using std::cerr; -using std::endl; - -/*----------------------------------------------------------------------*/ - -//! 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; -} - -/*======================================================================*/ - -/*! \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; - - section("Test array operators", '='); - section("Normal array with unary operator"); - CODE(aff::Array A(4,4)); - CODE(A=14.); - CODE(dump_array(A)); - CODE(A+=500.); - CODE(dump_array(A)); - - section("Access through subarray"); - CODE(aff::Array Asub=aff::subarray(A)(2,3)(2,3)); - CODE(Asub/=200); - CODE(dump_array(A)); - - section("binary operator"); - CODE(aff::Array B(A)); - CODE(B=A*5); - CODE(dump_array(B)); - - section("test implicit type conversion"); - CODE(B=10.); - CODE(dump_array(B)); - CODE(B*=0.2); - CODE(dump_array(B)); - CODE(B*=4L); - CODE(dump_array(B)); - CODE(B*=0xa0); - CODE(dump_array(B)); - - section("test advanced type conversion"); - CODE(aff::Array > C(3,3);) - CODE(C=std::complex(14.,2.);) - CODE(dump_array(C)); - CODE(C*=0.2); - CODE(dump_array(C)); - - section("test binary operator with constant input"); - CODE(aff::ConstArray D(A)); - CODE(aff::Array E(D*2.)); - CODE(dump_array(E)); - - section("mixed implicit operations"); - CODE(dump_array((D*5.)-12L)); - - section("Test series operators", '='); - section("test scalar operators"); - CODE(aff::Series F(-3,3)); - CODE(F=5.); - DUMP(F); - CODE(F/=25.); - DUMP(F); - - section("test vector operators"); - CODE(aff::Series G(5)); - CODE(G=5.); - DUMP(G); - DUMP(F+G); - CODE(aff::Series H); - CODE(H=F+G); - DUMP(H); - CODE(H -= F); - DUMP(H); - DUMP((H *= G + 0.2) + 0.2); - DUMP(H); - DUMP(100+H); - DUMP(H+100); - CODE(const aff::Series CH(H)); - DUMP(CH+100); - DUMP(CH -= 10); - DUMP(CH); -} - -/* ----- END OF operatortest.cc ----- */ diff --git a/contrib/aff/tests/reprtest.cc b/contrib/aff/tests/reprtest.cc deleted file mode 100644 index d4000a0d7371f1d50c0f8727a356e206710e74c9..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/reprtest.cc +++ /dev/null @@ -1,140 +0,0 @@ -/*! \file reprtest.cc - * \brief test representation classes (implementation) - * - * ---------------------------------------------------------------------------- - * - * $Id: reprtest.cc 3084 2010-08-10 16:01:03Z tforb $ - * \author Thomas Forbriger - * \date 10/05/2002 - * - * test representation classes (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 - * ---- - * - * \todo - * Test ALL constructors etc intensively! - * - * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) - * - * REVISIONS and CHANGES - * - 10/05/2002 V1.0 Thomas Forbriger - * - 16/12/2002 V1.1 (thof) - * - compiles and works - * - 28/12/2002 V1.2 (thof) - * - new term for containers of const elements - * - 31/12/2002 V1.3 (thof) - * - initializing an aff::ConstSharedHeap to a defined - * size is a useless exercise - * - * ============================================================================ - */ -#define AFF_REPRTEST_CC_VERSION \ - "AFF_REPRTEST_CC V1.3" -#define AFF_REPRTEST_CC_CVSID \ - "$Id: reprtest.cc 3084 2010-08-10 16:01:03Z tforb $" - -#include -#include - -using std::cout; -using std::endl; - -/*! \example tests/reprtest.cc - * - * Test representation class aff::SharedHeap. - * - * This test program gives an example of the usage of the following classes - * and preprocessor macros: - * - aff::SharedHeap - * - aff::ConstSharedHeap - * - #DUMP - * - #CODE - * - * \sa tests/reprtest.cc - */ - -//! print headline -void section(const char* s) -{ - cout << endl - << s << endl; - const char* p=s; - while (*p) { - cout << "-"; - ++p; - } - cout << endl; -} - -//! testing SharedHeap -int main() -{ - cout << AFF_REPRTEST_CC_VERSION << endl; - cout << AFF_REPRTEST_CC_CVSID << endl; - - section("array dimensions"); - CODE( const int N=10; ) - CODE( const int N2=23; ) - - section("instantiate arrays"); - CODE( aff::SharedHeap A(N); ) - CODE( aff::SharedHeap B(N2); ) -#ifdef SENSELESS -#warning intentionally compiling senseless code - CODE( aff::ConstSharedHeap Cuseless(N2); ) -#endif - CODE( aff::ConstSharedHeap C; ) - CODE( aff::SharedHeap D(N2); ) - - section("create a const reference to D"); - CODE( aff::SharedHeap::Tcoc E(D); ) - - section("const int array should share memory with int array"); - CODE( C=B; ) - - section("fill arrays"); - CODE( for (int i=0; i::Tcontainer_of_const(A) ); - DUMP( B ); - DUMP( C ); - DUMP( E ); - - section("modify C through B"); - CODE( B[8]=632; ) - DUMP( C ); - -#ifdef ILLEGAL1 - // you may activate this section by passing -DILLEGAL1 to the compiler - section("modify C directly - is illegal"); - C[9]=354; - DUMP( C ); -#endif - - section("make B a reference to A"); - CODE( B=A; ) - section("modification should be visible through B"); - CODE( A[5]=453; ) - DUMP( B ); - section("but C holds the original values"); - DUMP( C ); -} - -/* ----- END OF reprtest.cc ----- */ diff --git a/contrib/aff/tests/seriestest.cc b/contrib/aff/tests/seriestest.cc deleted file mode 100644 index 0018edf8c3a32b92250c9f3fb4091e063f5aabb5..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/seriestest.cc +++ /dev/null @@ -1,99 +0,0 @@ -/*! \file seriestest.cc - * \brief test aff::Series class (implementation) - * - * ---------------------------------------------------------------------------- - * - * $Id: seriestest.cc 3084 2010-08-10 16:01:03Z tforb $ - * \author Thomas Forbriger - * \date 17/12/2002 - * - * test aff::Series class (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 - * - 17/12/2002 V1.0 Thomas Forbriger - * - 28/12/2002 V1.1 (thof) - * - new term for containers of const elements - * - 19/12/2003 V1.2 (thof) - * - working on series container - * - * ============================================================================ - */ -#define AFF_SERIESTEST_CC_VERSION \ - "AFF_SERIESTEST_CC V1.2" -#define AFF_SERIESTEST_CC_CVSID \ - "$Id: seriestest.cc 3084 2010-08-10 16:01:03Z tforb $" - -#include -#include - -using std::cout; -using std::endl; - -/*! \example tests/seriestest.cc - * - * Test series class aff::Series. - * - * \sa tests/seriestest.cc - */ - -//! print headline -void section(const char* s) -{ - cout << endl - << s << endl; - const char* p=s; - while (*p) { - cout << "-"; - ++p; - } - cout << endl; -} - -//! testing SharedHeap -int main() -{ - cout << AFF_SERIESTEST_CC_VERSION << endl; - cout << AFF_SERIESTEST_CC_CVSID << endl; - - section("array dimensions"); - CODE( const int N=5 ); - CODE( const int N2=-5 ); - - section("create a series container"); - CODE( aff::Series A ); - CODE( aff::Series B(N) ); - CODE( aff::Series C(N2,N) ); - DUMP( A ); - DUMP( B ); - DUMP( C ); - CODE( A=B ); - DUMP( A ); - CODE( aff::ConstSeries D(C) ); - CODE( for (int i=C.first(); i<=C.last(); i++) { C(i)=i; } ); - DUMP( D ); -#ifdef ILLEGAL1 - CODE( D(6)=10 ); -#endif - CODE( D.shift(300) ); - DUMP( D ); -} - -/* ----- END OF seriestest.cc ----- */ diff --git a/contrib/aff/tests/shapetest.cc b/contrib/aff/tests/shapetest.cc deleted file mode 100644 index 6ee96a24b29a0f89cff705202b509752c9973cb6..0000000000000000000000000000000000000000 --- a/contrib/aff/tests/shapetest.cc +++ /dev/null @@ -1,217 +0,0 @@ -/*! \file shapetest.cc - * \brief test shape classes (implementation) - * - * ---------------------------------------------------------------------------- - * - * $Id: shapetest.cc 3084 2010-08-10 16:01:03Z tforb $ - * \author Thomas Forbriger - * \date 25/05/2002 - * - * test shape classes (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 - * - 25/05/2002 V1.0 Thomas Forbriger - * - 18/12/2002 V1.1 (thof) - * - started test of Strided (aff) - * - test works - * - 19/12/2002 V1.2 (thof) - * - print valid() of stepper too - * - 09/01/2003 V1.3 (thof) - * - using too many bracket operators now triggers - * an exception in aff::Shaper - * - * ============================================================================ - */ -#define AFF_SHAPETEST_CC_VERSION \ - "AFF_SHAPETEST_CC V1.3" -#define AFF_SHAPETEST_CC_CVSID \ - "$Id: shapetest.cc 3084 2010-08-10 16:01:03Z tforb $" - -#include -#include -#include -#include - -using std::cout; -using std::endl; -using namespace aff; - -/*! \example tests/shapetest.cc - * - * Test shape aff::Strided, the shaper class aff::Shaper, - * and the helper class aff::util::StridedStepper - * - * This test program gives an example of the usage of the following classes, - * functions, and preprocessor macros: - * - aff::Strided - * - aff::StridedStepper - * - aff::Shaper - * - aff::dump - * - aff::dump_map - * - #DUMP - * - #CODE - * - * \sa tests/shapetest.cc - */ - -/*----------------------------------------------------------------------*/ - -//! 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; -} - -/*----------------------------------------------------------------------*/ - -//! print value of a bool -const char* bvalue(const bool& b) -{ if (b) return("true"); return("false"); } - -/*----------------------------------------------------------------------*/ - -//! print value of a bool -#define BOOLIS( S ) cout << " *** " << #S << ": " << bvalue(S); - -/*----------------------------------------------------------------------*/ - -//! cycle steppers -void steppers(const Strided& shape, const int& nmax=30) -{ - StridedStepper s1(shape), s2(shape); - s2.tolast(); - for (int i=0; i -c ---------------------------------------------------------------------------- -c ($Id: Ffilters.f 4966 2013-02-01 13:46:50Z lrehor $) -c -c Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) -c -c ready made filters -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 -c REVISIONS and CHANGES -c 11/11/2002 V1.0 Thomas Forbriger -c -cS -c ============================================================================ -c - subroutine foufil_revision -c -c print library code revision -c -cE - print *,'$Id: Ffilters.f 4966 2013-02-01 13:46:50Z lrehor $' - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_clear -c -c initialize fourier filters -c set to period mode to be compatible with seife -c - include 'filters.inc' -c -cE -c - call fou_clear - call foufil_period -c - return - end -c -cS -c---------------------------------------------------------------------- -c - double precision function foufil_omega(in) -c -c calculate angular frequency -c in: will be treated as a frequency given in Hz, if fourier_frequency is true -c otherwise it will be treated as a period given in sec -c - include 'filters.inc' -c - double precision in -c -cE -c - double precision pi2, value - parameter(pi2=2.d0*3.14159265358979d0) -c - if (fourier_frequency) then - value=pi2*in - else - value=pi2/in - endif -c - foufil_omega=value -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_frequency -c -c set frequency mode -c - include 'filters.inc' -c -cE - fourier_frequency=.true. -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_period -c -c set period mode -c - include 'filters.inc' -c -cE - fourier_frequency=.false. -c - return - end -c -c====================================================================== -c define filters -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_int -c -c integrate once -c -cE - double complex value - value=(0.d0,0.d0) - call fou_pole(value) - value=(0.d0,1.d0) - call fou_cdenom(value) -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_dif -c -c differentiate once -c -cE - double complex value - value=(0.d0,0.d0) - call fou_zero(value) - value=(0.d0,1.d0) - call fou_cnumer(value) -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_hpb(in, ord) -c -c Butterworth high pass filter -c in: frequency or period (cf. foufil_omega) -c ord: order of filter -c - double precision in - integer ord -c -cE - double precision foufil_omega, omega, pi - integer i - double complex ime, pole, zero - parameter (ime=(0.d0,1.d0), pi=3.1415926535897931159d0) -c - if (ord.lt.1) stop 'ERROR (foufil_hpb): illegal order' - omega=foufil_omega(in) -c - zero=(0.d0,0.d0) - do i=1,ord - call fou_zero(zero) - pole=omega*exp(ime*pi*(2.d0*i-1.d0)/(2.d0*ord)) - call fou_pole(pole) - enddo -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_lpb(in, ord) -c -c Butterworth low pass filter -c in: frequency or period (cf. foufil_omega) -c ord: order of filter -c - double precision in - integer ord -c -cE - double precision foufil_omega, omega, pi - integer i - double complex ime, pole, cfac - parameter (ime=(0.d0,1.d0), pi=3.1415926535897931159d0) -c - if (ord.lt.1) stop 'ERROR (foufil_hpb): illegal order' - omega=foufil_omega(in) -c - cfac=-ime*omega - do i=1,ord - call fou_cnumer(cfac) - pole=omega*exp(ime*pi*(2.d0*i-1.d0)/(2.d0*ord)) - call fou_pole(pole) - enddo -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_lp2(in, h) -c -c second order low pass filter -c in: frequency or period (cf. foufil_omega) -c h: damping as a fraction of critical -c - double precision in, h -c -cE - double precision foufil_omega, omega - double complex ime, pole, cfac - parameter (ime=(0.d0,1.d0)) -c - omega=foufil_omega(in) -c - cfac=-ime*omega - call fou_cnumer(cfac) - call fou_cnumer(cfac) - pole=omega*(ime*h+sqrt(1.d0-h*h)) - call fou_pole(pole) - pole=omega*(ime*h-sqrt(1.d0-h*h)) - call fou_pole(pole) -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine foufil_hp2(in, h) -c -c second order high pass filter -c in: frequency or period (cf. foufil_omega) -c h: damping as a fraction of critical -c - double precision in, h -c -cE - double precision foufil_omega, omega - double complex ime, pole, zero - parameter (ime=(0.d0,1.d0)) -c - omega=foufil_omega(in) -c - zero=(0.d0,0.d0) - call fou_zero(zero) - call fou_zero(zero) - pole=omega*(ime*h+sqrt(1.d0-h*h)) - call fou_pole(pole) - pole=omega*(ime*h-sqrt(1.d0-h*h)) - call fou_pole(pole) -c - return - end -c - -c -c ----- END OF filters.f ----- diff --git a/contrib/fourier/Fpolesnzeroes.f b/contrib/fourier/Fpolesnzeroes.f deleted file mode 100644 index 3e0dce7d4e3bbf9156c1993c6fbedef3d975845a..0000000000000000000000000000000000000000 --- a/contrib/fourier/Fpolesnzeroes.f +++ /dev/null @@ -1,283 +0,0 @@ -c this is -c ---------------------------------------------------------------------------- -c ($Id: Fpolesnzeroes.f 4966 2013-02-01 13:46:50Z lrehor $) -c -c Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) -c -c pole and zero access 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 -c REVISIONS and CHANGES -c 11/11/2002 V1.0 Thomas Forbriger -c 13/11/2002 V1.1 introduce waterlevel to omega -c -cS -c ============================================================================ -c - subroutine fou_revision -c -c print library code revision -c -cE - print *, - & '$Id: Fpolesnzeroes.f 4966 2013-02-01 13:46:50Z lrehor $' - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_clear -c -c initialize poles and zeros database -c - include 'polesnzeros.inc' -c -cE - call fou_normal - fourier_numer=(1.d0,0.d0) - fourier_denom=(1.d0,0.d0) - fourier_npoles=0 - fourier_nzeros=0 -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_inverse -c -c set inverse flag -c all following coefficients will be treated as inverse filters -c - include 'polesnzeros.inc' -c -cE -c - fourier_normal=.false. -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_normal -c -c reset inverse flag -c all following coefficients will be treated as normal filters -c - include 'polesnzeros.inc' -c -cE -c - fourier_normal=.true. -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_pole(pole) -c -c set one pole -c - double complex pole -c - include 'polesnzeros.inc' -c -cE -c - if (fourier_normal) then - if (fourier_npoles.lt.fourier_nmax) then - fourier_npoles=fourier_npoles+1 - fourier_poles(fourier_npoles)=pole - else - stop 'ERROR (fourier_pole): too many poles' - endif - else - if (fourier_nzeros.lt.fourier_nmax) then - fourier_nzeros=fourier_nzeros+1 - fourier_zeros(fourier_nzeros)=pole - else - stop 'ERROR (fourier_pole): too many zeros' - endif - endif -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_zero(zero) -c -c set one zero -c - double complex zero -c - include 'polesnzeros.inc' -c -cE -c - if (fourier_normal) then - if (fourier_nzeros.lt.fourier_nmax) then - fourier_nzeros=fourier_nzeros+1 - fourier_zeros(fourier_nzeros)=zero - else - stop 'ERROR (fourier_zero): too many zeros' - endif - else - if (fourier_npoles.lt.fourier_nmax) then - fourier_npoles=fourier_npoles+1 - fourier_poles(fourier_npoles)=zero - else - stop 'ERROR (fourier_zero): too many poles' - endif - endif -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_numer(factor) -c -c set one numerator factor -c - double precision factor -c - include 'polesnzeros.inc' -c -cE -c - if (fourier_normal) then - fourier_numer=factor*fourier_numer - else - fourier_denom=factor*fourier_denom - endif -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_denom(factor) -c -c set one denominator factor -c - double precision factor -c - include 'polesnzeros.inc' -c -cE -c - if (fourier_normal) then - fourier_denom=factor*fourier_denom - else - fourier_numer=factor*fourier_numer - endif -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_cnumer(factor) -c -c set one complex numerator factor -c - double complex factor -c - include 'polesnzeros.inc' -c -cE -c - if (fourier_normal) then - fourier_numer=factor*fourier_numer - else - fourier_denom=factor*fourier_denom - endif -c - return - end -c -cS -c---------------------------------------------------------------------- -c - subroutine fou_cdenom(factor) -c -c set one complex denominator factor -c - double complex factor -c - include 'polesnzeros.inc' -c -cE -c - if (fourier_normal) then - fourier_denom=factor*fourier_denom - else - fourier_numer=factor*fourier_numer - endif -c - return - end -c -cS -c---------------------------------------------------------------------- -c - double complex function fou_eval(om) -c -c evaluate filter response coefficient at real frequency om -c the function applies a waterlevel of 1.d-30 to om -c - double precision om -c - include 'polesnzeros.inc' -c -cE - double complex value, thenumer, thedenom, omega - integer i -c - omega=max(1.d-30,om) -c - thenumer=(1.d0,0.d0) - do i=1,fourier_nzeros - thenumer=thenumer*(omega-fourier_zeros(i)) - enddo -c - thedenom=(1.d0,0.d0) - do i=1,fourier_npoles - thedenom=thedenom*(omega-fourier_poles(i)) - enddo -c - value=thenumer*fourier_numer/(fourier_denom*thedenom) -c - fou_eval=value -c - return - end -c -c ----- END OF polesnzeroes.f ----- diff --git a/contrib/fourier/Makefile b/contrib/fourier/Makefile index 29decc6b2839c4009468198f13475b05788e1915..f0be36c59bd7e9c867fcca40e519e9f20efa08f4 100644 --- a/contrib/fourier/Makefile +++ b/contrib/fourier/Makefile @@ -1,13 +1,13 @@ # this is # ---------------------------------------------------------------------------- -# $Id: Makefile 4966 2013-02-01 13:46:50Z lrehor $ +# $Id$ # # Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) # # Fourier coefficients library # # ---- -# This program is free software; you can redistribute it and/or modify +# libfourier 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. @@ -22,13 +22,15 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ---- # -# provide Fourier coefficients of filter responses etc. +# Fourier library: Operations in the Fourier domain +# ================================================= # -# this library makes use of libaff -# libaff must be installed first +# Please have a look at the README file coming along with the source code in +# this directory for further notes regarding provided functionality, +# prerequisites and installation. # # REVISIONS and CHANGES -# 07/11/2002 V1.0 Thomas Forbriger +# 07/11/2002 V1.0 Thomas Forbriger (thof) # 05/01/2003 V1.1 uuuhhhhhh # had to resolve a specific problem: my library # procuded object files for Fortran code with the same @@ -49,19 +51,21 @@ # C++ object files # 17/01/2011 V1.8 distinguish library creation and installation # 29/01/2013 V1.9 added tarball rules +# 26/01/2014 (thof): no longer strip comments from header files # # ============================================================================ # -include ../Makefile_var +CONTRIBDIR=.. +include $(CONTRIBDIR)/Makefile_var .PHONY: all all: install doc .PHONY: doc -doc: doxydoc libfourier.doc +doc: doxydoc -LIBRARIES=libfourier.a libfourierxx.a +LIBRARIES=libfourierxx.a #shared: libfourierxx.so .PHONY: install @@ -72,7 +76,8 @@ $(LOCLIBDIR)/%: install-include % #---------------------------------------------------------------------- -flist: Makefile $(wildcard *.f *.inc *.h *.cc *.c README *.cfg) COPYING +flist: Makefile $(wildcard *.f *.inc *.h *.cc *.c README *.cfg) COPYING \ + $(DOXYTXT) echo $^ | tr ' ' '\n' | sort > $@ .PHONY: edit @@ -80,11 +85,10 @@ edit: flist; vim $< .PHONY: clean clean: - -/bin/rm -fv *.o *.bak *.doc *.o77 flist *.of2c + -/bin/rm -fv *.o *.bak *.o77 flist *.of2c -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 *.xxx junk* *.a *.so # ============================================================================ @@ -141,36 +145,6 @@ libfourier.a: $(LIBOBS) $(RANLIB) $@ # ============================================================================ -# -# 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) -# -# ============================================================================ -# -# 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). - # files # ----- @@ -185,29 +159,18 @@ SRC=fcommand.cc filters.cc polesnzeroes.cc fftwaff.cc error.cc fftwaffar.cc TESTS=$(wildcard tests/*.cc) # whereever we find a README, we will use it README=$(shell find . -name README) +# the frame of doxygen documentation is palced in text files +DOXYTXT=$(shell find . -name doxygen\*.txt) # place where we will copy header files INCINSTALLPATH=$(LOCINCLUDEDIR)/fourier # 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))) -# 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 - # compiler and preprocessor flags FLAGS= #CXXFLAGS += -Wall -pedantic $(FLAGS) -O3 @@ -242,33 +205,11 @@ include $(patsubst %.cc,%.d,$(SRC)) #====================================================================== # 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 -# below and is controlled by the variables TF_REMCMMNT and EMPTYPRINT (see -# above). - -# comment stripping -# ----------------- - -# awk rule assumes that the first non-comment line starts with '#' -# and that the first (copyright) comment end with pattern "^ */" -%.h.strip: %.h - awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\ - /^#/ { hot=0; } \ - { if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@ - $(TF_REMCMMNT) $< | awk 'BEGIN {hot=0;} \ - /^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print ""; } next; } \ - /^#/ { hot=1; } { if (hot) print; }' >> $@ - -#---------------------------------------------------------------------- -.PRECIOUS: %.h.strip -$(INCINSTALLPATH)/%.h: %.h.strip - mkdir -vp $(dir $@) - -rm -fv $@ - /bin/cp -vpd $< $@ +$(INCINSTALLPATH)/%.h: %.h + @mkdir -vp $(dir $@) + -@rm -fv $@ + @/bin/cp -vpd $< $@ # install header files .PHONY: install-include @@ -330,7 +271,7 @@ DOXYWWWPATH=$(TF_WWWBASEDIR)/libfourier doxyclean: ;/bin/rm -rfv $(DOXYWWWPATH) doxydoc.xxx -DOXYSRC=$(README) $(HEADERS) $(SRC) +DOXYSRC=$(DOXYTXT) $(HEADERS) $(SRC) # create doxygen intermediate configuration PWD=$(shell env pwd) @@ -368,14 +309,6 @@ fullpackage: $(TF_MAKEPKG) PACKAGEEXPORT="trunk/src/libs/libfourier:src" \ PACKAGETARGETS="src:install: src:doc:" \ PACKAGELIBS="libaff" -.PHONY: srcpackage -srcpackage: $(TF_MAKEPKG) - $(MAKE) -f $< \ - PACKAGE=libfourier \ - PACKAGESRCONLY=yes \ - PACKAGEEXPORT="trunk/src/libs/libfourier:src" \ - PACKAGETARGETS="src:install: src:doc:" \ - PACKAGELIBS="-" endif # ----- END OF Makefile ----- diff --git a/contrib/fourier/README b/contrib/fourier/README index cbdc8119f54df17cdd79721e5e56703420202107..29e43fc4137ba520e4af272f10b6c13357d74e46 100644 --- a/contrib/fourier/README +++ b/contrib/fourier/README @@ -1,118 +1,47 @@ -/*! \file libfourier/README - * \brief C++ library to operate on Fourier transforms (libfourierxx) - * - * ---------------------------------------------------------------------------- - * - * $Id: README 3555 2010-12-11 16:46:58Z tforb $ - * - * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) - * - * C++ library to operate on Fourier transforms (libfourierxx) - * - * REVISIONS and CHANGES - * - 02/10/2007 V1.0 Thomas Forbriger (started README) - * - * ============================================================================ - */ +this is +============================================================================ +FOURIER --- Fourier coefficients library +------------------------------- +$Id$ +============================================================================ -/*! \mainpage +For compilation instructions see README.1st in the root directory of the tar-ball or +http://gpitrsvn.gpi.uni-karlsruhe.de:8000/TFSoftware/wiki/docs/installation -\author Thomas Forbriger -\since 2002 -\date $Date: 2007-10-02 18:49:08 $ -\version $Id: README 3555 2010-12-11 16:46:58Z tforb $ +The library provides modules to perform Fourier transformations and to +operate on Fourier transforms.An interface to FFTW is available.Signal +filters can be defined by their Fourier domain response function and applied +to the Fourier transform of a signal. libaff is used to store Fourier +coefficients and time series samples.Further stuff will be collected in +this library in the future. -The library provides modules to perform Fourier transformations and to operate -on Fourier transforms. -An interface to FFTW is available. -Signal filters can be defined by their response spectrum and applied to a -Fourier transform. -libaff is used to store Fourier coefficients and time series samples. -Further stuff will be collected in this library in the future. - -*/ +Binary libraries +---------------- + libfourier.a Fortran library + libfourierxx.a C++ library -/*======================================================================*/ +Dependencies +------------ + libaff is required to compile the binary libraries + fftw3 is required for the C++ library + doxygen is required to process source code documentation -/*! \page page_fftw3 Scaling of Fourier transform in FFTW3 - * - * \section sec_fftw3_library Fourier transformation in the FFTW3 library - * - * The FFTW3 reference - * http://www.fftw.org/fftw3_doc/The-1d-Discrete-Fourier-Transform-_0028DFT_0029.html#The-1d-Discrete-Fourier-Transform-_0028DFT_0029 - * tells: - * \verbatim - * 4.8.1 The 1d Discrete Fourier Transform (DFT) - * - * The forward (FFTW_FORWARD) discrete Fourier transform (DFT) of a 1d complex - * array X of size n computes an array Y, where: - * - * Y_k = sum_{j=0}^{n-1} X_j exp(-2i pi j k / n) - * - * The backward (FFTW_BACKWARD) DFT computes: - * - * X_k = sum_{j=0}^{n-1} Y_j exp(+2i pi j k / n) - * - * FFTW computes an unnormalized transform, in that there is no coefficient in - * front of the summation in the DFT. In other words, applying the forward and - * then the backward transform will multiply the input by n. - * - * From above, an FFTW_FORWARD transform corresponds to a sign of -1 in the - * exponent of the DFT. Note also that we use the standard in-order output - * orderingthe k-th output corresponds to the frequency k/n (or k/T, where T - * is your total sampling period). For those who like to think in terms of - * positive and negative frequencies, this means that the positive frequencies - * are stored in the first half of the output and the negative frequencies are - * stored in backwards order in the second half of the output. (The frequency - * -k/n is the same as the frequency (n-k)/n.) - * \endverbatim - * - * The forward transform is: - * \f[ - * Y_k = \sum_{j=0}^{n-1} X_j e^{-i 2 \pi \frac{j k}{n}} - * \f] - * - * The backward transform is: - * \f[ - * X_k = \sum_{j=0}^{n-1} Y_j e^{i 2 \pi \frac{j k}{n}} - * \f] - * - * \section sec_fftw3_integral_transform Integral transform scaling - * - * The Fourier transform presented here is scaled to represent the Fourier - * integral transform pair - * \f[ - * \tilde{s}(\omega) = \int\limits_{-\infty}^{+\infty} - * s(t)\,e^{-i\omega t}\frac{\textrm{d}\omega}{2\pi} - * = \int\limits_{0}^{N\Delta t} - * s(t)\,e^{-i\omega t}\frac{\textrm{d}\omega}{2\pi} - * \f] - * with \f$s(t)=0\f$ for \f$t<0\f$ and \f$t>T=N\Delta t\f$ - * and - * \f[ - * s(t) = \int\limits_{-\infty}^{+\infty} - * \tilde{s}(\omega)\,e^{i\omega t}\,\textrm{d}t - * = \int\limits_{-\pi/(N\Delta t)}^{+\pi/(N\Delta t)} - * \tilde{s}(\omega)\,e^{i\omega t}\,\textrm{d}t - * \f] - * with \f$\tilde{s}(\omega)=0\f$ - * for \f$|\omega|>\pi/T=\pi/(N\Delta t)\f$. - * - * The FFTW3 transformation consequently has to be scaled according to - * \f[ - * Y_k = \sum_{j=0}^{N-1} X_j e^{-i 2 \pi \frac{j k}{N}} \Delta t - * \f] - * and - * \f[ - * X_k = \sum_{j=0}^{N-1} Y_j e^{i 2 \pi \frac{j k}{N}} \frac{1}{N\Delta t} - * \f] - * - * Where \f$X_k=s(t=k\Delta t)\f$ is the time series - * with \f$N\f$ samples at \f$\Delta t\f$ sampling interval. - * \f$Y_k=\tilde{s}(\omega=k\Delta \omega)\f$ are samples of the Fourier - * integral transform, where - * \f$\Delta\omega=2\pi/T\f$ and \f$T=N\Delta t\f$. - * - */ +Installation +------------ + 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 + in the Makefile). -// ----- END OF README ----- +make all installs headers, binary libraries and documentation + + +Detailed documentation is provided through libfourier.doc (fortran code) +and doxygen source code. See target doxydoc in the Makefile. + +----- END OF README ----- diff --git a/contrib/fourier/README.export b/contrib/fourier/README.export deleted file mode 100644 index 628aa93791e088d823685d1544883ec04d8dcf51..0000000000000000000000000000000000000000 --- a/contrib/fourier/README.export +++ /dev/null @@ -1,27 +0,0 @@ -this is -============================================================================ -fourier -------- -$Id$ -============================================================================ - -This directory contains source code for the library fourier. It was exportet -from TF_Software to DENISE. DENISE is hosted in the Trac-/svn-project -FWI_elastic . - - - -See COPYING for copyright and license information. - - - -Exports: - Each time this source code is exported to DENISE the current version is - tagged. The directory containing the tagged version is named by the day - of the export (yyyymmdd) and can be found in - http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/export/fourier. - - 19/10/2011 First export of the version tagged in 20111019 - 01/02/2013 Export of version tagged in 20130201 - ------ END OF README ----- diff --git a/contrib/fourier/cfftwtest.c b/contrib/fourier/cfftwtest.c index f43f481c2a7973d78267c4cdb9ca588570c27721..f1e3d566c61a617d9f5ccd0c9bad696a61df1ff6 100644 --- a/contrib/fourier/cfftwtest.c +++ b/contrib/fourier/cfftwtest.c @@ -3,10 +3,10 @@ * * ---------------------------------------------------------------------------- * - * $Id: cfftwtest.c 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -42,7 +42,7 @@ #define TF_CFFTWTEST_C_VERSION \ "TF_CFFTWTEST_C V1.0 " #define TF_CFFTWTEST_C_CVSID \ - "$Id: cfftwtest.c 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/cxxfftwartest.cc b/contrib/fourier/cxxfftwartest.cc index 9d644f0c52646c94aae2ae8af23f9fd6caa64e29..d50de5495b9616d967f1114b9a4f0a7d4e868ad1 100644 --- a/contrib/fourier/cxxfftwartest.cc +++ b/contrib/fourier/cxxfftwartest.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: cxxfftwartest.cc 4120 2011-09-08 08:27:43Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 16/05/2011 * @@ -12,7 +12,7 @@ * Copyright (c) 2011 by Thomas Forbriger (BFO Schiltach) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -38,7 +38,7 @@ #define CXXFFTWARTEST_VERSION \ "CXXFFTWARTEST V1.2 test fftw3 array engine" #define CXXFFTWARTEST_CVSID \ - "$Id: cxxfftwartest.cc 4120 2011-09-08 08:27:43Z tforb $" + "$Id$" // use the input/output facilities from the standard library #include diff --git a/contrib/fourier/cxxfftwtest.cc b/contrib/fourier/cxxfftwtest.cc index a2e8f7bf9b12786fa1f82ca424b98df1306975bf..53c8f758b9de1fde25a5edf044631612fb2df820 100644 --- a/contrib/fourier/cxxfftwtest.cc +++ b/contrib/fourier/cxxfftwtest.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: cxxfftwtest.cc 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 12/09/2007 * @@ -12,7 +12,7 @@ * Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -36,7 +36,7 @@ #define CXXFFTWTEST_VERSION \ "CXXFFTWTEST V1.1 a small test program for fftw when called from C++" #define CXXFFTWTEST_CVSID \ - "$Id: cxxfftwtest.cc 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/doxydoc.cfg b/contrib/fourier/doxydoc.cfg index 98cedddb0a04f5d78cb5e6cc052f1a8c9232f68d..a5f60113fc1f4b74e25db7b545db28dd84690d5e 100644 --- a/contrib/fourier/doxydoc.cfg +++ b/contrib/fourier/doxydoc.cfg @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Fourier library: Operates in the Fourier domain" +PROJECT_NAME = "Fourier library: Operations in the Fourier domain" PROJECT_NUMBER = OUTPUT_DIRECTORY = CREATE_SUBDIRS = NO @@ -89,8 +89,7 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- INPUT = ./ INPUT_ENCODING = UTF-8 -FILE_PATTERNS = README \ - README.changelog \ +FILE_PATTERNS = doxygen*.txt \ *.h *.f \ *.cc RECURSIVE = YES diff --git a/contrib/fourier/doxygen.txt b/contrib/fourier/doxygen.txt new file mode 100644 index 0000000000000000000000000000000000000000..02a666c4daf4ff9ee2a62c0452da5c6e0446af9b --- /dev/null +++ b/contrib/fourier/doxygen.txt @@ -0,0 +1,133 @@ +/*! \file libfourier/doxygen.txt + * \brief C++ library to operate on Fourier transforms (libfourierxx) + * + * ---------------------------------------------------------------------------- + * + * $Id$ + * + * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) + * + * C++ library to operate on Fourier transforms (libfourierxx) + * + * ---- + * libfourier 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 + * - 02/10/2007 V1.0 Thomas Forbriger (started README) + * - 18/07/2013 V1.1 tmetz (renamed file) + * ============================================================================ + */ + +/*! \mainpage +\author Thomas Forbriger +\since 2002 +\date $Date$ +\version $Id$ + +The library provides modules to perform Fourier transformations and to operate +on Fourier transforms. +An interface to FFTW is available. +Signal filters can be defined by their Fourier domain response function and +applied to the Fourier transform of a signal. +libaff is used to store Fourier coefficients and time series samples. +Further stuff will be collected in this library in the future. + +*/ + +/*======================================================================*/ + +/*! \page page_fftw3 Scaling of Fourier transform in FFTW3 + * + * \section sec_fftw3_library Fourier transformation in the FFTW3 library + * + * The FFTW3 reference + * http://www.fftw.org/fftw3_doc/The-1d-Discrete-Fourier-Transform-_0028DFT_0029.html#The-1d-Discrete-Fourier-Transform-_0028DFT_0029 + * tells: + * \verbatim + * 4.8.1 The 1d Discrete Fourier Transform (DFT) + * + * The forward (FFTW_FORWARD) discrete Fourier transform (DFT) of a 1d complex + * array X of size n computes an array Y, where: + * + * Y_k = sum_{j=0}^{n-1} X_j exp(-2i pi j k / n) + * + * The backward (FFTW_BACKWARD) DFT computes: + * + * X_k = sum_{j=0}^{n-1} Y_j exp(+2i pi j k / n) + * + * FFTW computes an unnormalized transform, in that there is no coefficient in + * front of the summation in the DFT. In other words, applying the forward and + * then the backward transform will multiply the input by n. + * + * From above, an FFTW_FORWARD transform corresponds to a sign of -1 in the + * exponent of the DFT. Note also that we use the standard in-order output + * orderingthe k-th output corresponds to the frequency k/n (or k/T, where T + * is your total sampling period). For those who like to think in terms of + * positive and negative frequencies, this means that the positive frequencies + * are stored in the first half of the output and the negative frequencies are + * stored in backwards order in the second half of the output. (The frequency + * -k/n is the same as the frequency (n-k)/n.) + * \endverbatim + * + * The forward transform is: + * \f[ + * Y_k = \sum_{j=0}^{n-1} X_j e^{-i 2 \pi \frac{j k}{n}} + * \f] + * + * The backward transform is: + * \f[ + * X_k = \sum_{j=0}^{n-1} Y_j e^{i 2 \pi \frac{j k}{n}} + * \f] + * + * \section sec_fftw3_integral_transform Integral transform scaling + * + * The Fourier transform presented here is scaled to represent the Fourier + * integral transform pair + * \f[ + * \tilde{s}(\omega) = \int\limits_{-\infty}^{+\infty} + * s(t)\,e^{-i\omega t}\frac{\textrm{d}\omega}{2\pi} + * = \int\limits_{0}^{N\Delta t} + * s(t)\,e^{-i\omega t}\frac{\textrm{d}\omega}{2\pi} + * \f] + * with \f$s(t)=0\f$ for \f$t<0\f$ and \f$t>T=N\Delta t\f$ + * and + * \f[ + * s(t) = \int\limits_{-\infty}^{+\infty} + * \tilde{s}(\omega)\,e^{i\omega t}\,\textrm{d}t + * = \int\limits_{-\pi/(N\Delta t)}^{+\pi/(N\Delta t)} + * \tilde{s}(\omega)\,e^{i\omega t}\,\textrm{d}t + * \f] + * with \f$\tilde{s}(\omega)=0\f$ + * for \f$|\omega|>\pi/T=\pi/(N\Delta t)\f$. + * + * The FFTW3 transformation consequently has to be scaled according to + * \f[ + * Y_k = \sum_{j=0}^{N-1} X_j e^{-i 2 \pi \frac{j k}{N}} \Delta t + * \f] + * and + * \f[ + * X_k = \sum_{j=0}^{N-1} Y_j e^{i 2 \pi \frac{j k}{N}} \frac{1}{N\Delta t} + * \f] + * + * Where \f$X_k=s(t=k\Delta t)\f$ is the time series + * with \f$N\f$ samples at \f$\Delta t\f$ sampling interval. + * \f$Y_k=\tilde{s}(\omega=k\Delta \omega)\f$ are samples of the Fourier + * integral transform, where + * \f$\Delta\omega=2\pi/T\f$ and \f$T=N\Delta t\f$. + * + */ + +// ----- END OF doxygen.txt ----- diff --git a/contrib/fourier/error.cc b/contrib/fourier/error.cc index 3ad128eef97692c98f530eee492ec73f5eb461d7..1568ae92e5f27849382f19323741aa677e5420ca 100644 --- a/contrib/fourier/error.cc +++ b/contrib/fourier/error.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: error.cc 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 11/09/2007 * @@ -12,7 +12,7 @@ * Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -36,7 +36,7 @@ #define FOURIER_ERROR_CC_VERSION \ "FOURIER_ERROR_CC V1.1" #define FOURIER_ERROR_CC_CVSID \ - "$Id: error.cc 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/error.h b/contrib/fourier/error.h index 988d3009c47cd6f6fead89c6ddffeabd139cb5af..f77dd2b7b19cb5e74c3b549a871db214943c5dc9 100644 --- a/contrib/fourier/error.h +++ b/contrib/fourier/error.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: error.h 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 11/09/2007 * @@ -12,7 +12,7 @@ * Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -40,7 +40,7 @@ #define FOURIER_ERROR_H_VERSION \ "FOURIER_ERROR_H V1.0" #define FOURIER_ERROR_H_CVSID \ - "$Id: error.h 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" namespace fourier { diff --git a/contrib/fourier/fcommand.cc b/contrib/fourier/fcommand.cc index be15494f42f824956e997adffc090c5a123ba74b..f61cea9270882009ea898936ff0ae9a6a41a51b6 100644 --- a/contrib/fourier/fcommand.cc +++ b/contrib/fourier/fcommand.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fcommand.cc 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 05/01/2003 * @@ -12,7 +12,7 @@ * Copyright (c) 2003 by Thomas Forbriger (IMG Frankfurt) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -36,7 +36,7 @@ #define TF_FCOMMAND_CC_VERSION \ "TF_FCOMMAND_CC V1.0 " #define TF_FCOMMAND_CC_CVSID \ - "$Id: fcommand.cc 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/fcommand.h b/contrib/fourier/fcommand.h index 90bef778630dfcdb6e46f0401ac10e291743e9a0..65b42a6ab4be7eb0dfeec45e10727192a7c5d427 100644 --- a/contrib/fourier/fcommand.h +++ b/contrib/fourier/fcommand.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fcommand.h 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 05/01/2003 * @@ -12,7 +12,7 @@ * Copyright (c) 2003 by Thomas Forbriger (IMG Frankfurt) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -40,7 +40,7 @@ #define TF_FCOMMAND_H_VERSION \ "TF_FCOMMAND_H V1.0 " #define TF_FCOMMAND_H_CVSID \ - "$Id: fcommand.h 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/fftwaff.cc b/contrib/fourier/fftwaff.cc index 4584e7996d139536e4565a3ffff19564536b12d6..359af71115f8a0304027467c91654e8fe663a0bb 100644 --- a/contrib/fourier/fftwaff.cc +++ b/contrib/fourier/fftwaff.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fftwaff.cc 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 11/07/2006 * @@ -12,7 +12,7 @@ * Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -43,7 +43,7 @@ #define TF_FFTWAFF_CC_VERSION \ "TF_FFTWAFF_CC V1.4" #define TF_FFTWAFF_CC_CVSID \ - "$Id: fftwaff.cc 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/fftwaff.h b/contrib/fourier/fftwaff.h index ee2f6cac898038d7d520b0ed7d7a01747b598610..625016f931fe8d710efc14fcc655063c6748000b 100644 --- a/contrib/fourier/fftwaff.h +++ b/contrib/fourier/fftwaff.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fftwaff.h 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 11/07/2006 * @@ -12,7 +12,7 @@ * link with -lrfftw -lfftw -lm -laff * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -76,7 +76,7 @@ #define TF_FFTWAFF_H_VERSION \ "TF_FFTWAFF_H V1.3" #define TF_FFTWAFF_H_CVSID \ - "$Id: fftwaff.h 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #ifdef FFTWFALLBACK diff --git a/contrib/fourier/fftwaffar.cc b/contrib/fourier/fftwaffar.cc index 9b4ed68c282c56da6eeae1067a44d9c535d1c580..c61c2b09d40d0f39d1740f0ac8bb387762d04dbb 100644 --- a/contrib/fourier/fftwaffar.cc +++ b/contrib/fourier/fftwaffar.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fftwaffar.cc 3975 2011-05-28 14:58:37Z tforb $ + * $Id$ * \author Thomas Forbriger * \date 13/05/2011 * @@ -12,7 +12,7 @@ * Copyright (c) 2011 by Thomas Forbriger (BFO Schiltach) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -38,7 +38,7 @@ #define TF_FFTWAFFAR_CC_VERSION \ "TF_FFTWAFFAR_CC V1.1" #define TF_FFTWAFFAR_CC_CVSID \ - "$Id: fftwaffar.cc 3975 2011-05-28 14:58:37Z tforb $" + "$Id$" #include #include diff --git a/contrib/fourier/fftwaffar.h b/contrib/fourier/fftwaffar.h index 82e251ff5da975118a83f7411ae14735d3442bbb..2c7b033d15c597d1e3eb9a1b2db68ebbe22bd76d 100644 --- a/contrib/fourier/fftwaffar.h +++ b/contrib/fourier/fftwaffar.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: fftwaffar.h 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 13/05/2011 * @@ -12,7 +12,7 @@ * Copyright (c) 2011 by Thomas Forbriger (BFO Schiltach) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -45,7 +45,7 @@ #define TF_FFTWAFFAR_H_VERSION \ "TF_FFTWAFFAR_H V1.2" #define TF_FFTWAFFAR_H_CVSID \ - "$Id: fftwaffar.h 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/filters.cc b/contrib/fourier/filters.cc index c806b686b6df78f10a62b5bc4f5e701be462adc0..78654cae6f49c153e5669029ac0fccdaf14a0d3d 100644 --- a/contrib/fourier/filters.cc +++ b/contrib/fourier/filters.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: filters.cc 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 05/01/2003 * @@ -12,7 +12,7 @@ * Copyright (c) 2003 by Thomas Forbriger (IMG Frankfurt) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -36,7 +36,7 @@ #define TF_FILTER_CC_VERSION \ "TF_FILTER_CC V1.0 " #define TF_FILTER_CC_CVSID \ - "$Id: filters.cc 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/filters.h b/contrib/fourier/filters.h index f2268a31fc6072ca4df2c3bd6f58286518bcf658..256156c7d8310eea5828cedd4935b5d182a5be43 100644 --- a/contrib/fourier/filters.h +++ b/contrib/fourier/filters.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: filters.h 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 05/01/2003 * @@ -12,7 +12,7 @@ * Copyright (c) 2003 by Thomas Forbriger (IMG Frankfurt) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -42,7 +42,7 @@ #define TF_FILTERS_H_VERSION \ "TF_FILTERS_H V1.0 " #define TF_FILTERS_H_CVSID \ - "$Id: filters.h 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include diff --git a/contrib/fourier/filters.inc b/contrib/fourier/filters.inc index 685a8c30eb0ec50a4899118b1b9cca5c5db9d4fd..7a95a655d4f6951faa03d40257d01a04d57388bb 100644 --- a/contrib/fourier/filters.inc +++ b/contrib/fourier/filters.inc @@ -1,13 +1,13 @@ c this is c ---------------------------------------------------------------------------- -c ($Id: filters.inc 4966 2013-02-01 13:46:50Z lrehor $) +c ($Id$) c c Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) c c some filter settings c c ---- -c This program is free software; you can redistribute it and/or modify +c libfourier 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. diff --git a/contrib/fourier/polesnzeroes.cc b/contrib/fourier/polesnzeroes.cc index 654dbc6fb1fff9d0bec046fe882a5c6d8001f198..20f7a4aedb8518f696d08431f86a887291342746 100644 --- a/contrib/fourier/polesnzeroes.cc +++ b/contrib/fourier/polesnzeroes.cc @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: polesnzeroes.cc 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 05/01/2003 * @@ -12,7 +12,7 @@ * Copyright (c) 2003 by Thomas Forbriger (IMG Frankfurt) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -35,7 +35,7 @@ #define TF_POLESNZEROES_CC_VERSION \ "TF_POLESNZEROES_CC V1.0 " #define TF_POLESNZEROES_CC_CVSID \ - "$Id: polesnzeroes.cc 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include diff --git a/contrib/fourier/polesnzeroes.h b/contrib/fourier/polesnzeroes.h index 40e5c010af26bb582baa83d8354f74b7148f6053..226c03b890e630300fd116e4e5142785c540791b 100644 --- a/contrib/fourier/polesnzeroes.h +++ b/contrib/fourier/polesnzeroes.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: polesnzeroes.h 4966 2013-02-01 13:46:50Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 05/01/2003 * @@ -12,7 +12,7 @@ * Copyright (c) 2003 by Thomas Forbriger (IMG Frankfurt) * * ---- - * This program is free software; you can redistribute it and/or modify + * libfourier 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. @@ -39,7 +39,7 @@ #define TF_POLESNZEROES_H_VERSION \ "TF_POLESNZEROES_H V1.0 " #define TF_POLESNZEROES_H_CVSID \ - "$Id: polesnzeroes.h 4966 2013-02-01 13:46:50Z lrehor $" + "$Id$" #include #include diff --git a/contrib/fourier/polesnzeros.inc b/contrib/fourier/polesnzeros.inc index e5b969fd46bda0515a377183b756ec38f0d03672..aee044ea82c37329938fc7805c5c504c36bbb65e 100644 --- a/contrib/fourier/polesnzeros.inc +++ b/contrib/fourier/polesnzeros.inc @@ -1,12 +1,12 @@ c this is cS c ---------------------------------------------------------------------------- -c ($Id: polesnzeros.inc 4966 2013-02-01 13:46:50Z lrehor $) +c ($Id$) c c Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) c c ---- -c This program is free software; you can redistribute it and/or modify +c libfourier 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. diff --git a/contrib/header/.gitignore b/contrib/header/.gitignore deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/contrib/libcseife/COPYING b/contrib/libcseife/COPYING index c873bc9cea3ca348795ea8d6d13e1ba0287259fe..0fb662764df8e1f2bfff902d5c9debf14cca6217 100644 --- a/contrib/libcseife/COPYING +++ b/contrib/libcseife/COPYING @@ -2,13 +2,14 @@ this is ============================================================================ libseife -------- -$Id: COPYING 4961 2013-02-01 12:52:09Z lrehor $ +$Id$ ============================================================================ The source code in this directory is part of libseife which compiles to libseifa. and libcseife.a Copyright (C) 1984 by Erhard Wielandt +Copyright (C) 1996 by Wolfgang Friederich Copyright (C) 2013 by Thomas Forbriger ---- diff --git a/contrib/libcseife/Makefile b/contrib/libcseife/Makefile index cd113a80256c4a680f27ba17a3d95ec486c41087..c27221dfb3a4f39c0d2e15cfb2630457cc3162e3 100644 --- a/contrib/libcseife/Makefile +++ b/contrib/libcseife/Makefile @@ -1,10 +1,12 @@ # this is # ---------------------------------------------------------------------------- -# ($Id: Makefile 4961 2013-02-01 12:52:09Z lrehor $) +# ($Id$) # # 25/10/2000 by Thomas Forbriger (IMGF Frankfurt) # # libseife Makefile +# +# seife: seismic waveform filters # # ---- # This program is free software; you can redistribute it and/or modify @@ -22,25 +24,11 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ---- # -# This library contains code which was extracted from the program seife.f -# by Erhard Wielandt. The original version was written in 1984 at ETH Zurich. -# The code can be obtained through -# http://www.software-for-seismometry.de/ -# -# The frontpage of http://www.software-for-seismometry.de/ tells (Jan. 2013): -# -# Welcome to Erhard Wielandt's website for free seismological software -# -# This website offers free software for practical use, especially for the -# design, calibration, and testing of seismographs. It also contains -# educational software and other material used in courses and workshops on -# seismometry. Special problems of seismometry and theoretical seismology are -# treated in the 'misc. texts'. -# If you are interested in software, please start from the software overview. +# Please have a look at the README file coming along with the source code in +# this directory for further notes regarding provided functionality, +# prerequisites and installation. # -# The code from seife.f was extracted to a library by Wolfgang Friederich in -# 1996. The current version of libseife is a an extended code collection based -# on the abovementioned code. +#============================================================================= # # REVISIONS and CHANGES # 25/10/2000 V1.0 Thomas Forbriger @@ -52,12 +40,13 @@ # 15/11/2010 V1.4 do not use fdep.sh # 17/11/2010 V1.5 libseifemon.a is out of use # 17/01/2011 V1.6 distinguish library creation and installation -# 10/06/2011 V1.7 preparing Makefile for export of cseife to -# the DENISE code by Lisa Rehor # # ============================================================================ # +CONTRIBDIR=.. +include $(CONTRIBDIR)/Makefile_var + .PHONY: all all: install doc @@ -67,46 +56,86 @@ doc: LIBRARIES=libcseife.a .PHONY: install -install: - $(MAKE) $(LIBRARIES) +install: $(addprefix $(LOCLIBDIR)/,$(LIBRARIES)) +$(LOCLIBDIR)/%: install-include % + mkdir -pv $(LOCLIBDIR) + /bin/mv -fv $(word 2,$^) $(LOCLIBDIR) # ============================================================================ +CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1))) +CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var))) + +$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR) + +#---------------------------------------------------------------------- + CLIBSRC=$(wildcard cseife*.c) HEADERS=$(shell find . -name \*.h) +INCINSTALLPATH=$(LOCINCLUDEDIR) +LIBINSTALLPATH=$(LOCLIBDIR) +# name of installed (exported) header files +INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(notdir $(HEADERS))) .PHONY: clean edit clean: -find . -name \*.d | xargs --no-run-if-empty /bin/rm -v -find . -name \*.o | xargs --no-run-if-empty /bin/rm -v -find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v + -find . -name \*.o77 | xargs --no-run-if-empty /bin/rm -v -/bin/rm -fv flist - -/bin/rm -fv *.a + -/bin/rm -fv install-include *.a edit: flist ; vim flist -flist: $(wildcard Makefile *.c *.h) COPYING +flist: $(wildcard subs/*.f *.f Makefile *.c *.h subs/*.inc) COPYING \ + $(TF_EDIT) README echo $^ | tr ' ' '\n' | sort > $@ AR=ar AS=as RANLIB=ranlib -CC=mpicc FLAGS += $(MYFLAGS) CFLAGS += -O3 -Wall $(FLAGS) -CPPFLAGS=$(addprefix -I,.) \ +FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash -Isubs $(FLAGS) +LDFLAGS+=$(addprefix -L,$(LOCLIBDIR) $(subst :, ,$(SERVERLIBDIR))) +CPPFLAGS+=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \ $(FLAGS) +SUBS=$(patsubst %.f,%.o,$(wildcard subs/*.f)) + +%.o: %.f + $(FC) -O2 -o $@ -c $< $(FFLAGS) .c.o: $(CC) $(CFLAGS) $< -c $(CPPFLAGS) +#====================================================================== +# Fortran include dependencies +%.d: %.f + echo $<: $(addprefix subs/,$(shell cat $< | egrep '^ +include' | cut -f 2 -d \' | sort | uniq)) > $@ +include $(patsubst %.f,%.d,$(wildcard subs/*.f)) + +#====================================================================== + +$(INCINSTALLPATH)/%.h: %.h + mkdir -p $(INCINSTALLPATH) + -rm -fv $@ + /bin/cp -vpd $< $@ + +.PHONY: install-include +install-include: $(INSTHEADER) #====================================================================== # reinstall target # is necessary in case of header file problems (e.g. remcmmnt not installed) +.PHONY: clean-include +clean-include: + /bin/rm -fv $(INSTHEADER) + .PHONY: reinstall reinstall: $(MAKE) clean + $(MAKE) clean-include $(MAKE) install #====================================================================== @@ -126,10 +155,24 @@ reinstall: include $(patsubst %.c,%.d,$(CLIBSRC)) libcseife.a: $(patsubst %.c,%.o,$(CLIBSRC)) +libseife.a: $(SUBS) -libcseife.a: +libcseife.a libseife.a: $(AR) rcv $@ $^ $(RANLIB) $@ +#====================================================================== +# create package +# -------------- +# is delegated to Makefile.packages +ifdef TF_MAKEPKG +.PHONY: package +package: $(TF_MAKEPKG) + $(MAKE) -f $< \ + PACKAGE=libseife \ + PACKAGEEXPORT="trunk/src/libs/libseife:src" \ + PACKAGETARGETS="src:all:" \ + PACKAGELIBS="-" +endif # # ----- END OF Makefile ----- diff --git a/contrib/libcseife/README b/contrib/libcseife/README index e866f240847a0bf33fc643d9dc301603ab50b1b4..6f01851dedc66904967231b85841a2b9868ac7e0 100644 --- a/contrib/libcseife/README +++ b/contrib/libcseife/README @@ -1,27 +1,41 @@ this is ============================================================================ -cseife ------- +SEIFE --- seismic waveform filters +---------------------------------- $Id$ ============================================================================ -This directory contains source code for the library cseife. It was exportet -from TF_Software to DENISE. DENISE is hosted in the Trac-/svn-project -FWI_elastic (http://gpitrsvn.gpi.uni-karlsruhe.de/repos/FWI_elastic/DENISE). +For compilation instructions see README.1st in the root directory of the tar-ball or +http://gpitrsvn.gpi.uni-karlsruhe.de:8000/TFSoftware/wiki/docs/installation +libseife is a collection of Fortran 77 functions and subroutines for time +series analysis and digital filters. It is a full-grown signal processing +toolbox. A C API to the Fortran 77 code is provided as well. +This library contains code which was extracted from the program seife.f +by Erhard Wielandt. The original version was written in 1984 at ETH Zurich. +The code can be obtained through +http://www.software-for-seismometry.de/ -See COPYING for copyright and license information. +The code from seife.f was extracted to a library by Wolfgang Friederich in +1996. The current version of libseife is a an extended code collection based +on the abovementioned code. + +Installation +------------ +environment variables: + LOCLIBDIR defines location of binary libraries + LOCINCLUDEDIR defines location of C header files (prototypes) + +Fortran version: libseife.a +C version: libcseife.a + +make all installs headers and binary libraries + +Dependencies +------------ + external dependencies: - + internal dependencies: - -Exports: - Each time this source code is exported to DENISE the current version is - tagged. The directory containing the tagged version is named by the day - of the export (yyyymmdd) and can be found in - http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/export/cseife. - - 10/06/2011 First export of the version tagged in 20110610 - 01/02/2013 Export of version tagged in 20130201 - - ----- END OF README ----- diff --git a/contrib/libcseife/cseife.c b/contrib/libcseife/cseife.c index 6ac93fffaa8d6c0a85ef374f370ed6d31a3cc9ff..6e3907ac06522816a797cd89b1802a4698a66458 100644 --- a/contrib/libcseife/cseife.c +++ b/contrib/libcseife/cseife.c @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: cseife.c 4961 2013-02-01 12:52:09Z lrehor $ + * $Id$ * * ---- * This program is free software; you can redistribute it and/or modify @@ -38,7 +38,7 @@ #define TF_CSEIFE_C_VERSION \ "TF_CSEIFE_C V1.2" #define TF_CSEIFE_C_CVSID \ - "$Id: cseife.c 4961 2013-02-01 12:52:09Z lrehor $" + "$Id$" #include #include diff --git a/contrib/libcseife/cseife.h b/contrib/libcseife/cseife.h index 0bdde1c7b4e32c9aa5544aa7a8221e17a8bdc1cc..5b2286bead36f03eb585be66d473a013edbb4dc1 100644 --- a/contrib/libcseife/cseife.h +++ b/contrib/libcseife/cseife.h @@ -3,7 +3,7 @@ * * ---------------------------------------------------------------------------- * - * $Id: cseife.h 4961 2013-02-01 12:52:09Z lrehor $ + * $Id$ * \author Thomas Forbriger * \date 14/01/2005 * @@ -41,7 +41,7 @@ #define TF_CSEIFE_H_VERSION \ "TF_CSEIFE_H V1.2" #define TF_CSEIFE_H_CVSID \ - "$Id: cseife.h 4961 2013-02-01 12:52:09Z lrehor $" + "$Id$" #define SEIFE_EXIT_FAILURE 1 diff --git a/contrib/libcseife/cseife_deriv.c b/contrib/libcseife/cseife_deriv.c index 71a3ca839258252eb4b0642b737ca31cf9ea5934..1805c7c7d45d800fdd9a7de41929699acc6252e8 100644 --- a/contrib/libcseife/cseife_deriv.c +++ b/contrib/libcseife/cseife_deriv.c @@ -7,7 +7,7 @@ * This algorithm was part of seife.f. A current version of seife.f can be * obtained from http://www.software-for-seismometry.de/ * - * $Id: cseife_deriv.c 4961 2013-02-01 12:52:09Z lrehor $ + * $Id$ * * ---- * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #define TF_CSEIFE_DERIV_C_VERSION \ "TF_CSEIFE_DERIV_C V1.0 " #define TF_CSEIFE_DERIV_C_CVSID \ - "$Id: cseife_deriv.c 4961 2013-02-01 12:52:09Z lrehor $" + "$Id$" #include diff --git a/contrib/libcseife/cseife_gauss.c b/contrib/libcseife/cseife_gauss.c index ff238c7a8c0ea5c996f2f07a0db60ccd6f6ea57f..9d6ed2a56230182c29463b0e0d4b336158ce9ecb 100644 --- a/contrib/libcseife/cseife_gauss.c +++ b/contrib/libcseife/cseife_gauss.c @@ -7,7 +7,7 @@ * This algorithm was part of seife.f. A current version of seife.f can be * obtained from http://www.software-for-seismometry.de/ * - * $Id: cseife_gauss.c 4961 2013-02-01 12:52:09Z lrehor $ + * $Id$ * * ---- * This program is free software; you can redistribute it and/or modify @@ -38,7 +38,7 @@ #define TF_CSEIFE_GAUSS_C_VERSION \ "TF_CSEIFE_GAUSS_C V1.1" #define TF_CSEIFE_GAUSS_C_CVSID \ - "$Id: cseife_gauss.c 4961 2013-02-01 12:52:09Z lrehor $" + "$Id$" #include #include diff --git a/contrib/libcseife/cseife_rekfl.c b/contrib/libcseife/cseife_rekfl.c index 4ed454f009d01d542bbfe8d383a2ce665d757c3d..64772289d80f24fc333b5e330695a777637e3641 100644 --- a/contrib/libcseife/cseife_rekfl.c +++ b/contrib/libcseife/cseife_rekfl.c @@ -7,7 +7,7 @@ * This algorithm was part of seife.f. A current version of seife.f can be * obtained from http://www.software-for-seismometry.de/ * - * $Id: cseife_rekfl.c 4961 2013-02-01 12:52:09Z lrehor $ + * $Id$ * * ---- * This program is free software; you can redistribute it and/or modify @@ -38,7 +38,7 @@ #define TF_CSEIFE_REKFL_C_VERSION \ "TF_CSEIFE_REKFL_C V1.1" #define TF_CSEIFE_REKFL_C_CVSID \ - "$Id: cseife_rekfl.c 4961 2013-02-01 12:52:09Z lrehor $" + "$Id$" #include #include diff --git a/contrib/libcseife/cseife_rfk.c b/contrib/libcseife/cseife_rfk.c index 34abcac8c3c32932e7f0271a285718748f955119..a0c1431daca4823f4623a0f29ce56b0076e56247 100644 --- a/contrib/libcseife/cseife_rfk.c +++ b/contrib/libcseife/cseife_rfk.c @@ -7,7 +7,7 @@ * This algorithm was part of seife.f. A current version of seife.f can be * obtained from http://www.software-for-seismometry.de/ * - * $Id: cseife_rfk.c 4961 2013-02-01 12:52:09Z lrehor $ + * $Id$ * * ---- * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #define TF_CSEIFE_RFK_C_VERSION \ "TF_CSEIFE_RFK_C V1.0 " #define TF_CSEIFE_RFK_C_CVSID \ - "$Id: cseife_rfk.c 4961 2013-02-01 12:52:09Z lrehor $" + "$Id$" #include #include diff --git a/contrib/libcseife/cseife_tides.c b/contrib/libcseife/cseife_tides.c index 7e7f0114168f81019d6819460e4dc407af189e7f..ff686fdf91df9be4cf0ca7773d6eaee2a6ea98be 100644 --- a/contrib/libcseife/cseife_tides.c +++ b/contrib/libcseife/cseife_tides.c @@ -7,7 +7,7 @@ * This algorithm was part of seife.f. A current version of seife.f can be * obtained from http://www.software-for-seismometry.de/ * - * $Id: cseife_tides.c 4961 2013-02-01 12:52:09Z lrehor $ + * $Id$ * * ---- * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #define TF_CSEIFE_TIDES_C_VERSION \ "TF_CSEIFE_TIDES_C V1.0 " #define TF_CSEIFE_TIDES_C_CVSID \ - "$Id: cseife_tides.c 4961 2013-02-01 12:52:09Z lrehor $" + "$Id$" #include #include diff --git a/contrib/libcseife/subs/seife_common.inc b/contrib/libcseife/subs/seife_common.inc new file mode 100644 index 0000000000000000000000000000000000000000..66c5d86b01e6bbd5fd6451c5a46b00a36d16905a --- /dev/null +++ b/contrib/libcseife/subs/seife_common.inc @@ -0,0 +1,25 @@ +c this is +c ---------------------------------------------------------------------------- +c ($Id$) +c +c Copyright (c) 2005 by Thomas Forbriger (BFO Schiltach) +c +c common block to set debug mode +c +c REVISIONS and CHANGES +c 11/07/2005 V1.0 Thomas Forbriger +c +c ============================================================================ +c +c NOTICE: since the linker refuses to link blockdata subroutines that are +c placed in separate object files, we have to attach the initializing +c blockdata subroutine to one of our souce code files. +c +c Decision: the blockdata statement will be placed in seife_rfk.f +c +c debug mode is active, when .true. + logical ldebug +c + common /seife_global_flags/ ldebug +c +c ----- END OF seife_common.inc ----- diff --git a/contrib/stfinv/.gitignore b/contrib/stfinv/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1b855f82e3032f01b9a85e618973aaf0746bc59f --- /dev/null +++ b/contrib/stfinv/.gitignore @@ -0,0 +1,17 @@ +# this is <.gitignore> +# ============================================================================ +# files to be ignored by git +# -------------------------- +# files in src/libs/libstfinv +# --------------------------- +# +# source code documentation +*.doc +*usage.cc +*usage.h +# +# binary executables of programs in test directory +tooltest +onlinehelp +# +# ----- END OF .gitignore ----- diff --git a/contrib/stfinv/COPYING b/contrib/stfinv/COPYING index d2401a94d331956c3288ac0fe83346662cdbed14..2502bed94341e41f343874f21a3a0aebf720785b 100644 --- a/contrib/stfinv/COPYING +++ b/contrib/stfinv/COPYING @@ -1,15 +1,27 @@ this is ============================================================================ -libstfinv ---------- -$Id: COPYING 4968 2013-02-01 13:58:05Z lrehor $ +STFINV -- library for determination of source wavelet correction filter ============================================================================ -Copyright (c) 2011,2013 by Thomas Forbriger +Copyright (c) 2011, 2013 by Thomas Forbriger +Copyright (c) 2011 Lisa Rehor (C test code) +Copyright (c) 2011 Martin Schäfer (C test code) +Copyright (c) 2011 Thomas Bohlen (C test code) +Copyright (c) 2011 Colorado School of Mines (segy.h in C test code) The source code in this directory is part of libstfinv which compiles to libstfinv.a +Most components od the library are provided under terms of the +GNU General Public License + +Please check + test_libstfinv/src/LEGAL_STATEMENT_segy_h and + test_libstfinv_withpairs/src/LEGAL_STATEMENT_segy_h +for specific licensing conditions applying to source code used in the test +programs + +---- libstfinv 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 @@ -23,5 +35,6 @@ 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 ----- diff --git a/contrib/stfinv/Makefile b/contrib/stfinv/Makefile index 3a2955d50c47b25d3fca9ed66765b7e47756d47d..88d4a4217ff731bb2744c106463e3f882b1993ba 100644 --- a/contrib/stfinv/Makefile +++ b/contrib/stfinv/Makefile @@ -1,6 +1,5 @@ # this is # ---------------------------------------------------------------------------- -# $Id: Makefile 4968 2013-02-01 13:58:05Z lrehor $ # # Copyright (c) 2011 by Thomas Forbriger (BFO Schiltach) # @@ -26,12 +25,14 @@ # required in addition to libstfinv. # # REVISIONS and CHANGES -# 05/05/2011 V1.0 Thomas Forbriger +# 05/05/2011 V1.0 Thomas Forbriger (thof) +# 03/02/2014 thof: do not strip comments from header files # # ============================================================================ # -include ../Makefile_var +CONTRIBDIR=.. +include $(CONTRIBDIR)/Makefile_var .PHONY: all all: install doxydoc @@ -48,6 +49,33 @@ $(LOCLIBDIR)/%: install-include % /bin/mv -fv $(word 2,$^) $(LOCLIBDIR) # ============================================================================ +# select groups of files +# they are used for editing and to create object file lists and dependencies + +# whereever we find a README, we will use it +README=$(filter-out %.bak,$(shell find . -name README\*)) +# the frame of doxygen documentation is palced in text files +DOXYTXT=$(shell find . -name doxygen\*.txt) +# C++ and C source code +SOURCEFILES=$(filter-out %usage.h, $(filter-out %usage.cc, \ + $(wildcard *.h *.cc *.c tests/*.cc tests/*.c tests/*.inp) \ + $(wildcard test*/src/*.c) \ + $(wildcard test*/src/*.h) \ + $(wildcard test*/src/LEGAL*h))) +# LaTeX formatted documentation +DOCFILES=$(wildcard doc/*.tex doc/Makefile) +# end-user usage information +USAGEFILES=$(wildcard usage/*usage.txt) +# editional files to be edited +EDITFILES=Makefile $(README) \ + $(DOXYTXT) $(DOCFILES) $(USAGEFILES) \ + $(SOURCEFILES) \ + $(wildcard *.cfg) \ + $(wildcard test*/src/Makefile) \ + COPYING +# ============================================================================ +# check for settings expected in the environment +# ---------------------------------------------- # CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1))) CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var))) @@ -56,9 +84,14 @@ CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var))) $(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR) $(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR) -LIBHEADERS=$(filter-out none,$(wildcard *.h)) +# ====================================================================== +# +LIBHEADERS=$(filter-out none,$(wildcard *.h)) \ + $(patsubst usage/%.txt,%.h,$(USAGEFILES)) + +LIBCCSRC=$(filter-out none,$(wildcard *.cc)) \ + $(patsubst usage/%.txt,%.cc,$(USAGEFILES)) -LIBCCSRC=$(filter-out none,$(wildcard *.cc)) LIBCSRC=$(filter-out none,$(wildcard *.c)) TESTHEADERS=$(wildcard tests/*.h) @@ -72,40 +105,37 @@ TESTCBIN=$(patsubst tests/%.c,%,$(TESTCSRC)) INCINSTALLPATH=$(LOCINCLUDEDIR)/stfinv LIBINSTALLPATH=$(LOCLIBDIR) -# name of headers with comments stripped off -STRIPHEADER=$(addsuffix .strip,$(notdir $(LIBHEADERS))) # name of installed (exported) header files INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(notdir $(LIBHEADERS))) -# if defined, empty lines are kept in stripped comment headers -# to synchronize line numbers -EMPTYPRINT=1 -#EMPTYPRINT=0 - -# define this to be cat in case you do not have remcmmnt available -ifndef TF_REMCMMNT -TF_REMCMMNT=cat -endif # -# general part -# ------------ -# +# compiler flags +# -------------- FLAGS= FLAGS+=-fPIC $(MYFLAGS) CXXFLAGS+=-Wall $(FLAGS) LDFLAGS+=-L$(LOCLIBDIR) CPPFLAGS+=-I$(LOCINCLUDEDIR) $(FLAGS) - -EDITFILES=Makefile README $(wildcard *.cfg *.h *.cc *.c tests/*.cc tests/*.c) \ - test_libstfinv/README test_libstfinv/Test_libstfinv.inp \ - $(wildcard test_libstfinv/src/*.c) \ - $(wildcard test_libstfinv/src/*.h) \ - test_libstfinv/src/Makefile COPYING - -flist: $(EDITFILES) - echo $^ | tr ' ' '\n' | sort > $@ +# +# source code editing and directory clean-up +# ------------------------------------------ + +flist: $(EDITFILES) $(TF_EDIT) + echo $(filter-out $(DOCFILES) $(SOURCEFILES) \ + $(USAGEFILES),$(EDITFILES)) \ + | tr ' ' '\n' | sort > $@ + echo '----' >> $@ + echo $(filter-out test%,$(SOURCEFILES)) | tr ' ' '\n' | sort >> $@ + echo '----' >> $@ + echo $(USAGEFILES) | tr ' ' '\n' | sort >> $@ + echo '----' >> $@ + echo $(filter test%,$(SOURCEFILES)) | tr ' ' '\n' | sort >> $@ + echo '----' >> $@ + echo $(DOCFILES) | tr ' ' '\n' | sort >> $@ + echo '----' >> $@ + echo $(TF_EDIT) | tr ' ' '\n' | sort >> $@ .PHONY: edit edit: flist; vim $< @@ -116,8 +146,9 @@ clean: ; -find . -name \*.o | xargs --no-run-if-empty /bin/rm -v -find . -name \*.d | xargs --no-run-if-empty /bin/rm -v -find . -name \*.hd | xargs --no-run-if-empty /bin/rm -v - -find . -name \*.strip | xargs --no-run-if-empty /bin/rm -v -/bin/rm -vf flist *.a *.so *.xxx $(TESTCBIN) $(TESTCCBIN) + -/bin/rm -fv $(patsubst %.txt,%.h,$(USAGEFILES)) + -/bin/rm -fv $(patsubst %.txt,%.cc,$(USAGEFILES)) #====================================================================== # pattern rules @@ -148,25 +179,8 @@ libstfinv.a: $(patsubst %.cc,%.o,$(LIBCCSRC)) \ ranlib $@ #---------------------------------------------------------------------- -# comment stripping - -%.hd: %.h; echo $(notdir $<.strip): $< > $@ -include $(patsubst %.h,%.hd,$(LIBHEADERS) $(TESTHEADERS)) - -# first awk rule assumes that the first non-comment line starts with '#' -# and that the first (copyright) comment end with pattern "^ */" -%.h.strip: - awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\ - /^#/ { hot=0; } \ - { if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@ - $(TF_REMCMMNT) $< | awk 'BEGIN {hot=0;} \ - /^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print; } next; } \ - /^#/ { hot=1; } { if (hot) print; }' >> $@ - -#---------------------------------------------------------------------- - -$(INCINSTALLPATH)/%.h: %.h.strip +$(INCINSTALLPATH)/%.h: %.h mkdir -p $(INCINSTALLPATH) -rm -fv $@ /bin/cp -vpd $< $@ @@ -187,6 +201,36 @@ reinstall: $(MAKE) clean-include $(MAKE) install + +# ====================================================================== +# source code generators +# ====================== +# +# description and online texts +# ---------------------------- +# The following rules convert ordinary ASCII text files into C++ source code, +# providing functions to output usage information (online help) +# +# Such text files use names with the pattern *usage.txt +# Automatically generated source code is excluded from editing and versioning +# +%usage.cc %usage.h: usage/%usage.txt + echo "// DO NOT EDIT: this file is automatically derived from $<" \ + > $(patsubst usage/%.txt,%.h,$<) + echo "extern char $(patsubst usage/%.txt,%,$<)[];" \ + >> $(patsubst usage/%.txt,%.h,$<) + echo "// DO NOT EDIT: this file is automatically derived from $<" \ + > $(patsubst usage/%.txt,%.cc,$<) + echo "#include \"$(patsubst usage/%.txt,%.h,$<)\"" \ + >> $(patsubst usage/%.txt,%.cc,$<) + echo "char $(patsubst usage/%.txt,%,$<)[]=" \ + >> $(patsubst usage/%.txt,%.cc,$<) + echo "{" >> $(patsubst usage/%.txt,%.cc,$<) + cat $< | egrep -v '^#' | sed -e 's/\\/\\\\/g' | sed -e 's/"/\\"/g' \ + | sed -e 's/$$/\\n"/' | sed -e 's/^/ "/'\ + >> $(patsubst usage/%.txt,%.cc,$<) + echo "};" >> $(patsubst usage/%.txt,%.cc,$<) + #====================================================================== # documentation part # ------------------ @@ -214,15 +258,9 @@ DOXYWWWPATH=$(TF_WWWBASEDIR)/libstfinv doxyclean: ;/bin/rm -rfv $(DOXYWWWPATH) doxydoc.xxx -onlinehelp.xxx: onlinehelp - echo '/*! \page page_help Online help texts' > $@ - echo '\verbatim' >> $@ - ./$< -help 2>&1 >> $@ 2>&1 - echo '\endverbatim' >> $@ - echo '*/' >> $@ - -DOXYSRC=$(LIBCCSRC) $(LIBCSRC) $(LIBHEADERS) README $(TESTCCSRC) $(TESTCSRC) \ - onlinehelp.xxx Makefile +DOXYSRC=$(DOXYTXT) $(LIBCCSRC) $(LIBCSRC) $(LIBHEADERS)\ + $(TESTCCSRC) $(TESTCSRC) \ + Makefile PWD=$(shell env pwd) # create doxygen intermediate configuration @@ -242,42 +280,4 @@ doxydoc: $(DOXYWWWPATH)/html/index.html doxyview: $(DOXYWWWPATH)/html/index.html $(TF_BROWSER) file:$< & -#====================================================================== -# create package -# -------------- -# is delegated to Makefile.packages -ifdef TF_MAKEPKG -.PHONY: package -package: $(TF_MAKEPKG) - $(MAKE) -f $< \ - PACKAGE=libstfinv \ - PACKAGEEXPORT="trunk/src/libs/libstfinv:src" \ - PACKAGETARGETS="src:all:" \ - PACKAGELIBS="-" -.PHONY: srcpackage -srcpackage: $(TF_MAKEPKG) - $(MAKE) -f $< \ - PACKAGE=libstfinv \ - PACKAGESRCONLY=yes \ - PACKAGEEXPORT="trunk/src/libs/libstfinv:src" \ - PACKAGETARGETS="src:all:" \ - PACKAGELIBS="-" -.PHONY: fullpackage -fullpackage: $(TF_MAKEPKG) - $(MAKE) -f $< \ - PACKAGE=libstfinvwithlibs \ - PACKAGEEXPORT="trunk/src/libs/libstfinv:src" \ - PACKAGETARGETS="src:all:" \ - PACKAGELIBS="libaff libfourier" -endif - -#====================================================================== -# test code -# --------- - -$(TESTCCBIN): %: tests/%.o libstfinv.a - $(CXX) $(FLAGS) -o $@ $^ -I$(LOCINCLUDEDIR) \ - -ltfxx -lfourierxx -lfftw3 -laff \ - -L$(LOCLIBDIR) - # ----- END OF Makefile ----- diff --git a/contrib/stfinv/README b/contrib/stfinv/README index b89824421fa10f72e98ee92bb77d9498249fd4ce..356c6ef53307630b44078105d3dd802bf5d83cf1 100644 --- a/contrib/stfinv/README +++ b/contrib/stfinv/README @@ -1,497 +1,121 @@ -/*! \file libstfinv/README - * \brief STFINV library: seek source wavelet correction filter (libstfinv) - * - * ---------------------------------------------------------------------------- - * - * $Id: README 4968 2013-02-01 13:58:05Z lrehor $ - * - * Copyright (c) 2011 by Thomas Forbriger (BFO, Schiltach) - * - * The source code in this directory is part of libstfinv which compiles to - * libstfinv.a - * - * ---- - * libstfinv 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 - * ---- - * - * STFINV library: seek source wavelet correction filter (libstfinv) - * - * This file contains: - * - documentation of namespace stfinv - * - mainpage text - * - * REVISIONS and CHANGES - * - 05/05/2011 V1.0 Thomas Forbriger - * - 05/10/2011 V1.1 added code fragments for using waveform pairs - * - * ============================================================================ - */ - -/*! \brief Root namespace of library - - */ -namespace stfinv { -} // namespace stfinv - -/*======================================================================*/ - -/*! \mainpage - -\author Thomas Forbriger -\since May 2011 -\date May 2011 -\version V1.0 -$Id: README 4968 2013-02-01 13:58:05Z lrehor $ - - Contents of this page: - - \ref main_sec_users - - \ref main_subsec_introduction - - \ref main_subsec_libraries - - \ref main_subsec_parameters - - \ref main_subsec_cusers - - \ref main_subsec_cxxusers - - \ref main_sec_implementers - - Currently implemented \ref engines as well as parameters to control the - processing are described in the \ref page_help. - - \section main_sec_users The library libstfinv for users - - \subsection main_subsec_introduction Introduction - - The purpose of this library is to provide methods for the derivation of - source wavelet correction filters - in approaches to full waveform inversion. - Given a set of recorded data and a set of synthetic data (typically, - but not necessarilly the impulse response of the subsurface) a source - wavelet correction filter - is obtained due to some optimization citerion. - The synthetic waveforms are convolved with this filter - wavelet and the convolved - synthetics as well as the wavelet itself are returned to the user. - - The source wavelet correction filter - in this context not necessarily is the actual - force time history of the source used in the experiment or a similar - quantity of physical meaning. - The source wavelet correction filter - simply is the wavelet which minimizes the misfit - between synthetic and recorded waveforms due to some misfit condition, if - the synthetics are concolved with this wavelet. - In particular this implies that the synthetics not necessarily need be the - impulse response (Greens function) of the subsurface, they may simply be - synthetic waveforms computed for some generic source wavelet (like a - Ricker wavelet). - The derived source wavelet correction filter - then has to be understood with respect to - this generic wavelet. - - The library provides different \ref engines to find an optimal source - wavelet correction filter. - The basic steps of operation are: - -# Initialize an engine. - In this step pointers to arrays are passed to - the engine together with some header information. - The engines memorizes these pointers and expects to find the recorded - data as well as the synthetics at the inidcated locations in memory. - -# Call the run()-function of the engine. - The engine takes the recorded and synthetic data currently found at - the memory arrays, calculates an optimzed correction filter - wavelet and returns the - wavelet together with the convolved synthetics by copying them to the - memory locations inidicated by the initializer of the engine. - This step is repeated after each computation of synthetic data. - -# Remove the engine once you terminate the iteration of inversion. - - \subsection main_subsec_libraries Libraries required by libstfinv - - Programs using this library will require the following libraries in - addition: - - - libfourierxx (available from TFSoftware) - - libfftw3 - - libaff (available from TFSoftware) - - C programs will further be required to link against - - - libstdc++ - - \subsection main_subsec_parameters How to construct parameter strings - A specific engine is selected by passing a parameter string to the library - interface like function ::initstfinvengine() or the constructor of the - interface class stfinv::STFEngine::STFEngine(). - This parameter string may further contain parameters to control the - execution mode of the engine. - - The parameter string starts with an ID-sequence identifying the desired - engine. - This ID-sequences are stored in stfinv::STFEngineFDLeastSquares::ID - for the Fourier domain least squares engine. - In the parameter string the ID-sequence is terminated by a colon (:). - - After selecting the desired engine, the interface function strips of the - ID-sequence as well as the colon from the parameter string and initializes - the engine, passing the references to user workspace as well as the rest - of the parameter string. - The rest of the parameter string may consist of several control - parameters being separated by colons (:). - Each control parameter may just be a flag (switch to turn an option on) or - may come along with a parameter value. - The value of the parameter is separated by an equal sign (=). - - \par Examples - - To select frequency domain least squares - (stfinv::STFEngineFDLeastSquares) and shift the returned source - correction wavelet - by 0.4s and switch on verbose mode, pass the following - parameter string: - \verbatim fdlsq:tshift=0.4:verbose \endverbatim - - To select stfinv::STFEngineIdentity and to switch on debug level 4: - \verbatim ident:DEBUG=4 \endverbatim - - To select stfinv::STFEngineFDLeastSquares, apply offset dependent - weights and use a power of two to speed up the FFT: - \verbatim fdlsq:pow2:exp=1.4 \endverbatim - - - \subsection main_subsec_cusers The C application programming interface (API) - - The library provides a \ref cinterface. - - \subsection main_subsec_cxxusers The C++ application programming interface (API) - - The library provides a \ref cxxinterface. - - \section main_sec_implementers The libraray libstfinv for implementers - - Implementers of new engines should copy files like stfinvidentity.h and - stfinvidentity.cc and implement a new class which inherits from - stfinv::STFBaseEngine. - Most of the framework can simply be copied. - The core function is the virtual function like - stfinv::STFEngineIdentity::exec() which actuall determines the source - wavelet correction filter. - For the implementation there are some \ref tools provided in the library. - - Do not forget to provide a unique ID like stfinv::STFEngineIdentity::ID - and a short description like in stfinv::STFEngineIdentity::description. - Further an online help text like produced by - stfinv::STFEngineIdentity::classhelp() are recommended. - - After having successfully implemented the engine, it must be made - available through - stfinv::STFEngine::STFEngine(). - Online help is made available through stfinv::STFEngine::help() and - stfinv::help(). - - See the stfinv::STFBaseEngine, where we explain - how the initialization takes place. - - See \ref page_design for details on the engine design. - -\todo - Engines I consider to implement: - - stf which just applies a scalar factor: - stfinv::STFEngineIdentity - - stf read from file (always the same stf, independent of data and - synthetics): - stfinv::STFEngineFixedWavelet - - stf which normalizes the synthetics in the Fourier domain; this ensures - that data and synthetic always contain the same signal energy; this avoid - a zero stf during the first iterations starting from a new inappropriate - initial model: - stfinv::STFEngineNormalize - - causal and time limited stf as found by convolution condition in the time - domain; this is a solution to a system of linear equations and will - requires LAPACK: - stfinv::STFEngineFiniteCausal - -\date 24.06.2011 - -*/ - -/*======================================================================*/ - -/*! \brief C interface to libstfinv - -\defgroup cinterface C interface (API) to libstfinv - -All data structures and function prototypes are presented in -\ref stfinv.h - -\par Overview - -When using libstfinv from a C program, the first step is to initialize the -engine by calling ::initstfinvengine(). The engine will keep references to -the memory locations where time series samples are stored. You can update -the content of these locations as you like, e.g. by storing a new set of -synthetic seismograms therein. Upon each call to ::runstfinvengine() a new -source wavelet correction filter -will be derived and stored at its place in -memory. At the same time the synthetic waveforms are convolved with the -filter wavelet and stored at the memory location reserved for the -convolved synthetics. It is good style to call ::freestfinvengine() when -you have finished. This will remove the engine from memory. This call -should at least be issued when the pointers to the memory locations for -time series samples as passed to ::initstfinvengine() become invalid. - -\par Code fragments - -All expressions \c [...] in the code fragments below have to be replaced with -proper C expression appropriate for your program. - -Consider you like to use this interface in a C program. -You have data for \c nrec receivers each with \c nsamp samples and \c dt -sampling interval: -\code -usigned int nrec = [...]; -usigned int nsamp = [...]; -float dt = [...]; -\endcode -Then you have to initialize a reference to your workspace: -\code -struct CTriples data; -data.n=nrec; -data.triples=(struct CWaveformTriple *)malloc(nrec*sizeof(struct CWaveformTriple)); -if (data.triples == NULL) { abort(); } -\endcode -You then have to fill the waveform triple structures with appropriate header -information and pointers to your data arrays: -\code -for (usigned int i=0; i +============================================================================ +STFINV -- library for determination of source wavelet correction filter +============================================================================ + +Purpose +------- +Create and apply a source wavelet correction filter for full-waveform +inversion of field data. + +Description +----------- +The purpose of this library (libstfinv) is to provide methods for the +derivation of source wavelet correction filters in approaches to full waveform +inversion. Given a set of recorded data and a set of synthetic data +(typically, but not necessarilly the expected impulse response of the +subsurface) a source wavelet correction filter is obtained by application of a +user-selectable optimization citerion. The synthetic waveforms are convolved +with this filter wavelet and the convolved synthetics as well as the wavelet +itself are returned to the user. + +The effective time history of the seismic source used in field recordings is +not well known in most cases. This applies in particular to transient sources +(like explosives or hammer blows). The so-called 'source-time-function' might +even vary from shot to shot. For this reason it is not possible to use an +appropriate source-time-function in the initial simulation of synthetic data +in an approach of full-waveform inversion. However, after synthetic data have +been calculated using a generic source-time-function, a correction filter can +be constructed such that an improved source-time-function will reduce the +misfit to the recorded data. + +The software library libstfinv provides several constrained and unconstrained +approaches to finding an optimized source-wavelet correction filter. It is +flexible and capable of being extended with further approaches in the future. +The program soutifu supports application directly to seismic time series data +files. + +Software library: libstfinv +--------------------------- +The library libstfinv provides a C++ API (application programming interface) +as well as a C API to the user of the library. A Fortran API is not yet +implemented but could be constructed on top of the C API without effort. The +library provides several approaches (procedures) to finding an optimized +source wavelet correction filter. Each of the procedures is addressed through +the same API, such that programs using the library could immediately benefit +from a new approach after its implementation and without need to modify +consumer programs. The different procedures are encapsulated in so-called +'engines'. The procedures are fully controllable by the end-user through +configuration string sequences which are passed to the library. + +Stand-alone binary executable: soutifu +-------------------------------------- +A stand-alone binary executable soutifu is provided as well, which makes use +of this library. It can be applied directly to seismic time series data files +and provides access to all engines and supports a variety of data file +formats. + +soutifu is provided in directory src/ts/wf within Seitosh. + +Documentation +============= +doxygen source code documentation +--------------------------------- +Detailed documentation of concept and implementation is provided in the source +code. doxygen can be used to create appropriate html files. See target +doxydoc in the Makefile. The libraries API is described there. + +Introductory texts are provided in doxygen.txt and are used in the doxygen +documentation. + +User documentation +------------------ +The theory behind the Fourier domain least squares engine is outlined by +Lisa Groos (2013, Appendix F, page 146). She also describes a way to find an +approrpiate water level by application of the L-curve criterion (Groos, 2013, +Appendix G, page 148). + +Fragments of a user documentation in LaTeX are propared in subdirectory doc. + +Online user documentation to be output by the software itself is provided in +*usage.txt files. End-user documentation is assembled from these text files +and provided by the library through help() and usage() functions. The program +tests/onlinehelp Provides access to these texts. Just issue + + make onlinehelp + ./onlinhelp + +to get access. + +A short descrpition of the library and the accompanying program soutifu is +provided on the OpenTOAST web-page: +http://www.opentoast.de/Data_analysis_code_soutifu_and_libstfinv.php + +Lisa Groos. 2013. 2D full waveform inversion of shallow seismic Rayleigh waves. + Dissertation, Karlsruher Institut für Technologie. + http://nbn-resolving.org/urn:nbn:de:swb:90-373206 + +Installation +============ +See README.md and INSTALL.md in the root directory of the repository for +general installation instructions. + +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 + in the Makefile). + +make all installs headers, binary libraries and documentation + +Dependencies +------------ +This library requires code from libaff and libfourierxx. +Am external dependency is fftw3 +The testprogram requires libtfxx in addition. + +----- END OF README ----- diff --git a/contrib/stfinv/README.export b/contrib/stfinv/README.export deleted file mode 100644 index aeae73acd086ba624b77b82313785b42fe58acfb..0000000000000000000000000000000000000000 --- a/contrib/stfinv/README.export +++ /dev/null @@ -1,26 +0,0 @@ -this is -============================================================================ -stfinv ------- -$Id$ -============================================================================ - -This directory contains source code for the library stfinv. It was exportet -from TF_Software to DENISE. DENISE is hosted in the Trac-/svn-project -FWI_elastic (http://gpitrsvn.gpi.uni-karlsruhe.de/repos/FWI_elastic/DENISE). - - -See COPYING fo copyright and license information. - - - -Exports: - Each time this source code is exported to DENISE the current version is - tagged. The directory containing the tagged version is named by the day - of the export (yyyymmdd) and can be found in - http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/export/stfinv. - - 19/10/2011 First export of the version tagged in 20111019 - 01/02/2013 Export of version tagged in 20130201 - ------ END OF README ----- diff --git a/contrib/stfinv/README.files b/contrib/stfinv/README.files new file mode 100644 index 0000000000000000000000000000000000000000..5c25dba7c2de5b2fbe90a32e3abfe8dffbf08d69 --- /dev/null +++ b/contrib/stfinv/README.files @@ -0,0 +1,145 @@ +this is +============================================================================ +description of source files presented in src/libs/libstfinv +----------------------------------------------------------- + +Source code and usage texts +=========================== + +Engine base classes +------------------- + + Abstract base class for engines to derive source correction filter + ------------------------------------------------------------------ + class stfinv::STFBaseEngine + stfinvbase.cc + stfinvbase.h + + Source code also contains waveform containers. + + Handle-class to access any engine in the library (C++ API) + ---------------------------------------------------------- + class stfinv::STFEngine + stfinvany.cc + stfinvany.h + + Base class for all engines which operate in the Fourier domain + -------------------------------------------------------------- + class stfinv::STFFourierDomainEngine + stfinvfourier.cc + stfinvfourier.h + +Engines +------- + Fourier domain least squares engine + ----------------------------------- + class stfinv::STFEngineFDLeastSquares + stfinvfdleastsquares.cc + stfinvfdleastsquares.h + + Engine to find a finite, causal source time-history in time domain + ------------------------------------------------------------------ + class stfinv::STFEngineFiniteCausal + stfinvfinitecausal.cc + stfinvfinitecausal.h + + Engine to provide a fixed wavelet + --------------------------------- + class stfinv::STFEngineFixedWavelet + stfinvfixedstf.cc + stfinvfixedstf.h + + Engine to apply a scalar factor + ------------------------------- + class stfinv::STFEngineIdentity + stfinvidentity.cc + stfinvidentity.h + + Normalization engine + -------------------- + class stfinv::STFEngineNormalize + stfinvnormalize.cc + stfinvnormalize.h + +C API to library +---------------- +stfinv.cc +stfinv.h + +Internal functions +------------------ +fouriertools.cc +fouriertools.h +parameterhandler.cc +parameterhandler.h +tools.cc +tools.h +waveformheader.h + +Debugging and error handling +---------------------------- +debug.h +error.cc +error.h + +C API test programs +------------------- +test_libstfinv/ +test_libstfinv_withpairs/ + +Programs to test internal components of the library +--------------------------------------------------- +tests/ + +Documentation +============= +doc/ +doxydoc.cfg +doxygen.txt +doxygen_end_users.txt +doxygen_implementers.txt +doxygen_library_users.txt + +end-user usage instructions +--------------------------- +summary: more or less just a short list of options or description of purpose +description: a detailed description of theory of operation and all available + parameters; possibly together with examples + + description of overall library: + usage/stfinv_summary_usage.txt + usage/stfinv_description_usage.txt + + description of prodecure selection and configuration: + usage/stfinvany_description_usage.txt + usage/stfinvany_summary_usage.txt + + description of options available for all procedures: + usage/stfinvbase_description_usage.txt + usage/stfinvbase_summary_usage.txt + + description of Fourier domain least squares procedure: + usage/stfinvfdleastsquares_description_usage.txt + usage/stfinvfdleastsquares_summary_usage.txt + + description of procedure for finite causal filter: + usage/stfinvfinitecausal_description_usage.txt + usage/stfinvfinitecausal_summary_usage.txt + + description of procedure for fixed filter: + usage/stfinvfixedstf_description_usage.txt + usage/stfinvfixedstf_summary_usage.txt + + description of common options for procedures in the Fourier domain: + usage/stfinvfourier_description_usage.txt + usage/stfinvfourier_summary_usage.txt + + description of scaling procedure: + usage/stfinvidentity_description_usage.txt + usage/stfinvidentity_summary_usage.txt + + description of normalization procedure: + usage/stfinvnormalize_description_usage.txt + usage/stfinvnormalize_summary_usage.txt + +----- END OF README.files ----- diff --git a/contrib/stfinv/README.status b/contrib/stfinv/README.status new file mode 100644 index 0000000000000000000000000000000000000000..d0aed0fa3123778cbad35383e880647f50e3fa83 --- /dev/null +++ b/contrib/stfinv/README.status @@ -0,0 +1,41 @@ +this is +============================================================================ +status of the library +===================== + +General library +--------------- +Both, C++ and C API are implemented and operational. + +Currently available engines: + ident: identity: just apply a scalar factor + fdlsq: least squares in the frequency domain + +Fourier domain least squares engine (fdlsq) +------------------------------------------- +class stfinv::STFEngineFDLeastSquares + Operates in the Fourier domain. + Status: Implemented and fully operational. + +Engine to find a finite, causal source time-history in time domain +------------------------------------------------------------------ +class stfinv::STFEngineFiniteCausal + Status: Not yet implemented + +Engine to provide a fixed wavelet (fix) +--------------------------------------- +class stfinv::STFEngineFixedWavelet + Status: Not yet implemented + +Engine to apply a scalar factor (ident) +--------------------------------------- +class stfinv::STFEngineIdentity + Status: Implemented and fully operational. + +Normalization engine +-------------------- +class stfinv::STFEngineNormalize + Operates in the Fourier domain. + Status: Implemented, not yet tested + +----- END OF README.status ----- diff --git a/contrib/stfinv/debug.h b/contrib/stfinv/debug.h index 68e0d24cddafc12bc3704154184acf4d23899c34..6a1db153907192f2fa39fbed8e8227d6173060f7 100644 --- a/contrib/stfinv/debug.h +++ b/contrib/stfinv/debug.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: debug.h 4008 2011-06-21 21:14:34Z tforb $ * \author Thomas Forbriger * \date 05/05/2011 * @@ -38,9 +37,7 @@ #ifndef STFINV_DEBUG_H_VERSION #define STFINV_DEBUG_H_VERSION \ - "STFINV_DEBUG_H V1.0 " -#define STFINV_DEBUG_H_CVSID \ - "$Id: debug.h 4008 2011-06-21 21:14:34Z tforb $" + "STFINV_DEBUG_H V1.0" /*! \brief produce debug output * \ingroup misc_h diff --git a/contrib/stfinv/doc/Makefile b/contrib/stfinv/doc/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9a0aa16ea87782166323373162177b685b798535 --- /dev/null +++ b/contrib/stfinv/doc/Makefile @@ -0,0 +1,33 @@ +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2013 by Thomas Forbriger (BFO Schiltach) +# +# LaTeX documentation for libstfinv +# +# REVISIONS and CHANGES +# 13/02/2013 V1.0 Thomas Forbriger +# +# ============================================================================ +# + +all: + +flist: Makefile $(wildcard *.tex) + 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 + +%.dvi: %.tex; latex $(patsubst %.tex,%,$<) +%.ps: %.dvi; dvips -ta4 $(patsubst %.dvi,%,$<) +%.pdf: %.dvi; pdflatex $(patsubst %.dvi,%,$<) +%.psp: %.ps; gv -infoSilent $<; /bin/rm -fv $< +%.x: %.dvi; xdvi -s 4 $(patsubst %.dvi,%,$<) + +# ----- END OF Makefile ----- diff --git a/contrib/stfinv/doc/libstfinv.tex b/contrib/stfinv/doc/libstfinv.tex new file mode 100644 index 0000000000000000000000000000000000000000..a380d77103874bd40a957c4f50a07fc6997ca54a --- /dev/null +++ b/contrib/stfinv/doc/libstfinv.tex @@ -0,0 +1,140 @@ +% this is +% ---------------------------------------------------------------------------- +% +% Copyright (c) 2013 by Thomas Forbriger (BFO Schiltach) +% +% libstfinv +% +% REVISIONS and CHANGES +% 13/02/2013 V1.0 Thomas Forbriger +% +% ============================================================================ +% +\documentclass{article} +\newcommand{\version}{2013/02/13 V1.0} +\usepackage{ngerman} +\usepackage{pslatex} +\usepackage{anysize} +\usepackage{amsmath} +\usepackage{graphicx} +\selectlanguage{english} +%---------------------------------------------------------------------- +\newcommand{\libstfinv}{\texttt{libstfinv}} +\newcommand{\Fourier}[1]{\ensuremath{\tilde{#1}}} +\newcommand{\Fd}{\ensuremath{\Fourier{d}}} +%\newcommand{\Fs}{\ensuremath{\Fourier{s}}} +%\newcommand{\Sg}{\ensuremath{g}} +%\newcommand{\Fq}{\ensuremath{\Fourier{q}}} +\newcommand{\Fs}{\ensuremath{\Fourier{g}}} +\newcommand{\Sg}{\ensuremath{s}} +\newcommand{\Fq}{\ensuremath{\Fourier{c}}} +\newcommand{\Fg}{\ensuremath{\Fourier{\Sg}}} +\newcommand{\FQl}{\ensuremath{\Fourier{\Sg}_{l}^{\text{opt}}}} +\newcommand{\So}{\ensuremath{\omega}} +\newcommand{\Sf}{\ensuremath{f}} +\newcommand{\Sr}{\ensuremath{r}} +\newcommand{\Ssk}{\ensuremath{\sum\limits_{k=1}^{M}}} +\newcommand{\SslN}{\ensuremath{\sum\limits_{l=0}^{N-1}}} +\newcommand{\Silk}{\ensuremath{_{lk}}} +\newcommand{\Scc}{\ensuremath{^{\ast}}} +\newcommand{\SmE}{\ensuremath{\overline{E}}} +\newcommand{\Se}{\ensuremath{\epsilon}} +%---------------------------------------------------------------------- +\begin{document} +\title{\libstfinv} +\author{Thomas Forbriger\\ \texttt{\version}} +\date{(\today, BFO Schiltach)} +\maketitle +\section{Internals of \libstfinv\ engines} +While the \texttt{doxygen} generated documentation gives the relation in a +implementation specific quantities, this document uses the end-user +perspective. + +\subsection{Fourier domain least squares} +Let $\Fd_{lk}$ be the complex Fourier expansion coefficient at frequency +$\So_l=l\,\Delta\So$ for the time series recorded at offset $\Sr_k$ to the +source. +The corresponding Fourier coefficient for the synthetic waveform is +$\Fs\Silk$. +The synthetic waveform is numerically simulated for +some model of subsurface structure and a time history of the source +used to excite the synthetic wavefield which is given by +$N$ Fourier coefficients $\Fg_l$. +$\Fd\Silk$, $\Fs\Silk$, and $\Fg_l$ are complex numbers. + +This engine returns filter coefficients +\begin{equation} +\Fq_l=\frac{\Ssk\Sf^2_k\,\Fs\Silk\Scc\,\Fd\Silk}{M\,\SmE\,\Se^2+ +\Ssk\Sf^2_k\,\left|\Fs\Silk\right|^2} +\label{eq:least:squares:solution} +\end{equation} +such that $\FQl=\Fq_l\,\Fg_l$ +are Fourier coefficients of an optimized time history of the source. +Here $\Fs\Silk\Scc$ is the complex conjugate of $\Fs\Silk$ +and +\begin{equation} +\SmE=\frac{1}{M\,N}\SslN\Ssk\Sf^2_k\,\left|\Fs\Silk\right|^2 +\end{equation} +is the average power of the Fourier coefficients $\Fs\Silk$ scaled by +$\Sf_k$. +The optimized time history of the source provides an improved fit of the +synthetics $\Fq_l\,\Fs\Silk$ to the recorded data $\Fd\Silk$ in a +least-squares sense. +This is equivalent to minimizing the least-squares objective function +\begin{equation} +F(\Fq_l;\Se)=\SslN\Ssk\Sf^2_k\,\left|\Fd\Silk-\Fq_l\Fs\Silk\right|^2 ++M\,\SmE\,\Se^2\SslN\left|\Fq_l\right|^2 +\label{eq:least:squares:error} +\end{equation} +with respect to the real and imaginary parts of all $\Fq_l$. +While eq.~\eqref{eq:least:squares:error} makes the least-squares approach +obvious, eq.~\eqref{eq:least:squares:solution} demonstrates that the solution +is a water-level deconvolution, essentially. + +By means of the +scaling coefficients $\Sf_k$ we can make sure that all receivers +$k$ contribute to an equal average amount to +eq.~\eqref{eq:least:squares:error}. +The coefficients could be chosen +\begin{equation} +\Sf_k=\sqrt{\frac{N}{\SslN\left|\Fs\Silk\right|^2}} +\end{equation} +such that the average power +\begin{equation} +\frac{1}{N}\SslN\Sf^2_k\,\left|\Fs\Silk\right|^2=1 +\end{equation} +for each $k$. +In the actual implementation we prefer +\begin{equation} +\Sf_k=\left(\frac{\Sr_k}{1\,\text{m}}\right)^\kappa +\end{equation} +using $\kappa$ to adjust a compensation for a power law attenuation with +offset $\Sr$. +Alternatively, $\Sf_k$ can be made large for small $\Sr_k$, such that the +source correction filter primarily is obtained from near-offset records. +This is achieved by choosing $\kappa$ small or even negative and +might by preferable in early stages of the inversion when the model of +the subsurface structure is hardly able to produce waves at correct +propagation velocity. + +With $\Se=0$ the $\Fq_l$ in eq.~\eqref{eq:least:squares:error} optimize the +data fit only. +At frequencies where $\Fs\Silk$ become small with respect to the noise in +$\Fd\Silk$, the solution in eq.~\eqref{eq:least:squares:solution} develops a +singularity (for $\Fs\Silk\rightarrow0$). +A finite $\Se$ is used to keep the least-squares solution regular +by introducing a stabilizing penalty to the objective function in +eq.~\eqref{eq:least:squares:error} and +a water-level to the denominator of eq.~\eqref{eq:least:squares:solution}. +The $\Fq_l$ are damped (kept artificially small) as the +average power +\begin{equation} +\frac{1}{M}\Ssk\Sf_k^2\left|\Fs\Silk\right|^2 +\end{equation} +of the scaled synthetics $\Sf_k\Fs\Silk$ at frequency $\So_l$ becomes smaller +than a fraction $\Se^2$ of the overall average power $\SmE$ of the scaled +synthetics $\Sf_k\Fs\Silk$. +$\Se^2$ is the waterlevel-parameter to be passed to the engine. +\end{document} + +% ----- END OF libstfinv.tex ----- diff --git a/contrib/stfinv/doc/stfinv_base.tex b/contrib/stfinv/doc/stfinv_base.tex new file mode 100644 index 0000000000000000000000000000000000000000..85f8dce75f09e6f67521fce4b73227acfd2b8879 --- /dev/null +++ b/contrib/stfinv/doc/stfinv_base.tex @@ -0,0 +1,14 @@ +% this is +% ---------------------------------------------------------------------------- +% $Id: $ +% +% Copyright (c) 2014 by Thomas Forbriger (BFO Schiltach) +% +% documentation of base class features +% +% REVISIONS and CHANGES +% 24/02/2014 V1.0 Thomas Forbriger +% +% ============================================================================ +% +% ----- END OF stfinv_base.tex ----- diff --git a/contrib/stfinv/doc/stfinv_fdbase.tex b/contrib/stfinv/doc/stfinv_fdbase.tex new file mode 100644 index 0000000000000000000000000000000000000000..946c5303bd0f9aadf52d48fba2f5705959a67410 --- /dev/null +++ b/contrib/stfinv/doc/stfinv_fdbase.tex @@ -0,0 +1,14 @@ +% this is +% ---------------------------------------------------------------------------- +% $Id: $ +% +% Copyright (c) 2014 by Thomas Forbriger (BFO Schiltach) +% +% documentation of Fourier-domain class features +% +% REVISIONS and CHANGES +% 24/02/2014 V1.0 Thomas Forbriger +% +% ============================================================================ +% +% ----- END OF stfinv_fdbase.tex ----- diff --git a/contrib/stfinv/doc/stfinv_fdleastsquares.tex b/contrib/stfinv/doc/stfinv_fdleastsquares.tex new file mode 100644 index 0000000000000000000000000000000000000000..347d948765a86db4866d6b1ca41a870ca5c830fe --- /dev/null +++ b/contrib/stfinv/doc/stfinv_fdleastsquares.tex @@ -0,0 +1,14 @@ +% this is +% ---------------------------------------------------------------------------- +% $Id: $ +% +% Copyright (c) 2014 by Thomas Forbriger (BFO Schiltach) +% +% documentation of Fourier-domain least-squares approach +% +% REVISIONS and CHANGES +% 24/02/2014 V1.0 Thomas Forbriger +% +% ============================================================================ +% +% ----- END OF stfinv_fdleastsquares.tex ----- diff --git a/contrib/stfinv/doc/stfinv_identity.tex b/contrib/stfinv/doc/stfinv_identity.tex new file mode 100644 index 0000000000000000000000000000000000000000..9d4142da240da75c13af96feb48f3b565a7e579c --- /dev/null +++ b/contrib/stfinv/doc/stfinv_identity.tex @@ -0,0 +1,14 @@ +% this is +% ---------------------------------------------------------------------------- +% $Id: $ +% +% Copyright (c) 2014 by Thomas Forbriger (BFO Schiltach) +% +% documentation of STFEngineIdentity +% +% REVISIONS and CHANGES +% 24/02/2014 V1.0 Thomas Forbriger +% +% ============================================================================ +% +% ----- END OF stfinv_identity.tex ----- diff --git a/contrib/stfinv/doc/stfinv_normalize.tex b/contrib/stfinv/doc/stfinv_normalize.tex new file mode 100644 index 0000000000000000000000000000000000000000..f2a257a466e070e1c50a405c40e7e943740c61d2 --- /dev/null +++ b/contrib/stfinv/doc/stfinv_normalize.tex @@ -0,0 +1,14 @@ +% this is +% ---------------------------------------------------------------------------- +% $Id: $ +% +% Copyright (c) 2014 by Thomas Forbriger (BFO Schiltach) +% +% documentation of STFEngineNormalize +% +% REVISIONS and CHANGES +% 24/02/2014 V1.0 Thomas Forbriger +% +% ============================================================================ +% +% ----- END OF stfinv_normalize.tex ----- diff --git a/contrib/stfinv/doxydoc.cfg b/contrib/stfinv/doxydoc.cfg index 1c5050afbddf091005f1d08c0cca423d23cb8065..f47c57054fd02194e12f5026dd830a056d4b6ed4 100644 --- a/contrib/stfinv/doxydoc.cfg +++ b/contrib/stfinv/doxydoc.cfg @@ -89,7 +89,7 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- INPUT = ./ INPUT_ENCODING = UTF-8 -FILE_PATTERNS = README onlinehelp.xxx \ +FILE_PATTERNS = doxygen*.txt \ *.h \ *.cc RECURSIVE = YES @@ -97,7 +97,7 @@ EXCLUDE = .svn test_libstfinv EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXCLUDE_SYMBOLS = -EXAMPLE_PATH = tests +EXAMPLE_PATH = tests usage EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = diff --git a/contrib/stfinv/doxygen.txt b/contrib/stfinv/doxygen.txt new file mode 100644 index 0000000000000000000000000000000000000000..d548effc93246aa0bc1987560187625be48dbb9b --- /dev/null +++ b/contrib/stfinv/doxygen.txt @@ -0,0 +1,139 @@ +/*! \file libstfinv/doxygen.txt + * \brief STFINV library: seek source wavelet correction filter (libstfinv) + * + * ---------------------------------------------------------------------------- + * + * Copyright (c) 2011 by Thomas Forbriger (BFO, Schiltach) + * + * The source code in this directory is part of libstfinv which compiles to + * libstfinv.a + * + * ---- + * libstfinv 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 + * ---- + * + * STFINV library: seek source wavelet correction filter (libstfinv) + * + * This file contains: + * - documentation of namespace stfinv + * - mainpage text + * + * REVISIONS and CHANGES + * - 05/05/2011 V1.0 Thomas Forbriger + * - 05/10/2011 V1.1 added code fragments for using waveform pairs + * - 18/07/2013 V1.2 tmetz (renamed file) + * ============================================================================ + */ + +/*! \brief Root namespace of library + + */ +namespace stfinv { +} // namespace stfinv + +/*======================================================================*/ + +/*! \mainpage + +\author Thomas Forbriger +\since May 2011 +\date October 2015 +\version V1.0 + +\par Purpose +This library provides methods for the derivation of source +wavelet correction filters in approaches to full waveform inversion. + +\par Table of contents +- \ref page_end_users + - \ref page_eu_sec_users + - \ref page_eu_subsec_introduction + - \ref page_eu_subsec_parameters + - \ref page_eu_sec_texts +- \ref page_users + - \ref page_u_sec_users + - \ref page_u_subsec_introduction + - \ref page_u_subsec_libraries +- \ref page_implementers + - \ref page_i_sec_implementers + - \ref page_i_subsec_cusers + - \ref page_i_subsec_cxxusers + - \ref page_i_sec_design + - \ref page_i_subsec_design_initialization + +Currently implemented \ref engines as well as parameters to control the +processing are described in the \ref page_help. + +\todo + Engines I consider to implement: + - stf which just applies a scalar factor: + stfinv::STFEngineIdentity + - stf read from file (always the same stf, independent of data and + synthetics): + stfinv::STFEngineFixedWavelet + - stf which normalizes the synthetics in the Fourier domain; this ensures + that data and synthetic always contain the same signal energy; this avoid + a zero stf during the first iterations starting from a new inappropriate + initial model: + stfinv::STFEngineNormalize + - causal and time limited stf as found by convolution condition in the time + domain; this is a solution to a system of linear equations and will + requires LAPACK: + stfinv::STFEngineFiniteCausal + +\todo + Replace reference \ref page_help by verbatim display of usage texts + +\date 04.10.2015 + +*/ + +/*======================================================================*/ + +/*! \brief Engines implemented in libstfinv + +\defgroup engines Engines + +\todo + A detailed description for implementers is still missing + +\date 05.05.2011 + */ + +/*======================================================================*/ + +/*! \brief Tools and utilities used by the libstfinv engines + +\defgroup tools Internal tools and utilities + +\todo + A detailed description for implementers is still missing + +\date 05.05.2011 + */ + +/*======================================================================*/ + +/*! \brief Error handling module + +\defgroup group_error Error handling module + +\todo + A detailed description for implementers is still missing + +\date 04.10.2015 + */ + +// ----- END OF doxygen.txt ----- diff --git a/contrib/stfinv/doxygen_end_users.txt b/contrib/stfinv/doxygen_end_users.txt new file mode 100644 index 0000000000000000000000000000000000000000..792b49219a2d80e594f8c69847bf94379334e574 --- /dev/null +++ b/contrib/stfinv/doxygen_end_users.txt @@ -0,0 +1,144 @@ +/*! \file doxygen_end_users.txt + * \brief Information for library end users + * + * ---------------------------------------------------------------------------- + * + * \author Thomas Forbriger + * \date 04/10/2015 + * + * Information for library end users + * + * ---- + * libstfinv 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) 2015 by Thomas Forbriger (BFO Schiltach) + * + * REVISIONS and CHANGES + * - 04/10/2015 V1.0 Thomas Forbriger + * + * ============================================================================ + */ + +/*! \page page_end_users Information for end-users + +\par Contents of this page +- \ref page_eu_sec_users + - \ref page_eu_subsec_introduction + - \ref page_eu_subsec_parameters +- \ref page_eu_sec_texts + - \ref page_eu_subsec_texts_lib + - \ref page_eu_subsec_texts_any + - \ref page_eu_subsec_texts_base + - \ref page_eu_subsec_texts_fourier + - \ref page_eu_subsec_texts_identity + - \ref page_eu_subsec_texts_fdleastsquares + +\section page_eu_sec_users The library libstfinv for end-users + +\subsection page_eu_subsec_introduction Introduction + + The purpose of this library is to provide methods for the derivation of + source wavelet correction filters + in approaches to full waveform inversion. + Given a set of recorded data and a set of synthetic data (typically, + but not necessarilly the impulse response of the subsurface) a source + wavelet correction filter + is obtained due to some optimization citerion. + The synthetic waveforms are convolved with this filter + wavelet and the convolved + synthetics as well as the wavelet itself are returned to the user. + + The source wavelet correction filter + in this context not necessarily is the actual + force time history of the source used in the experiment or a similar + quantity of physical meaning. + The source wavelet correction filter + simply is the wavelet which minimizes the misfit + between synthetic and recorded waveforms due to some misfit condition, if + the synthetics are concolved with this wavelet. + In particular this implies that the synthetics not necessarily need be the + impulse response (Greens function) of the subsurface, they may simply be + synthetic waveforms computed for some generic source wavelet (like a + Ricker wavelet). + The derived source wavelet correction filter + then has to be understood with respect to + this generic wavelet. + +\subsection page_eu_subsec_parameters How to construct parameter strings + A specific engine is selected by passing a parameter string to the library + interface like function ::initstfinvengine() or the constructor of the + interface class stfinv::STFEngine::STFEngine(). + This parameter string may further contain parameters to control the + execution mode of the engine. + + The parameter string starts with an ID-sequence identifying the desired + engine. + This ID-sequences are stored in stfinv::STFEngineFDLeastSquares::ID + for the Fourier domain least squares engine. + In the parameter string the ID-sequence is terminated by a colon (:). + + After selecting the desired engine, the interface function strips of the + ID-sequence as well as the colon from the parameter string and initializes + the engine, passing the references to user workspace as well as the rest + of the parameter string. + The rest of the parameter string may consist of several control + parameters being separated by colons (:). + Each control parameter may just be a flag (switch to turn an option on) or + may come along with a parameter value. + The value of the parameter is separated by an equal sign (=). + + \par Examples + - To select frequency domain least squares + (stfinv::STFEngineFDLeastSquares) and shift the returned source + correction wavelet + by 0.4s and switch on verbose mode, pass the following + parameter string: + \verbatim fdlsq:tshift=0.4:verbose \endverbatim + - To select stfinv::STFEngineIdentity and to switch on debug level 4: + \verbatim ident:DEBUG=4 \endverbatim + - To select stfinv::STFEngineFDLeastSquares, apply offset dependent + weights and use a power of two to speed up the FFT: + \verbatim fdlsq:pow2:exp=1.4 \endverbatim + + +\section page_eu_sec_texts End-user usage information text files + +\subsection page_eu_subsec_texts_lib Summary and detailed description for overall library +\verbinclude ./stfinv_summary_usage.txt +\verbinclude ./stfinv_description_usage.txt + +\subsection page_eu_subsec_texts_any Summary and detailed description in handle class +\verbinclude ./stfinvany_summary_usage.txt +\verbinclude ./stfinvany_description_usage.txt + +\subsection page_eu_subsec_texts_base Summary and detailed description in base class +\verbinclude ./stfinvbase_summary_usage.txt +\verbinclude ./stfinvbase_description_usage.txt + +\subsection page_eu_subsec_texts_fourier Summary and detailed description in Fourier class +\verbinclude ./stfinvfourier_summary_usage.txt +\verbinclude ./stfinvfourier_description_usage.txt + +\subsection page_eu_subsec_texts_identity Summary and detailed description for scaling procedure +\verbinclude ./stfinvidentity_summary_usage.txt +\verbinclude ./stfinvidentity_description_usage.txt + +\subsection page_eu_subsec_texts_fdleastsquares Summary and detailed description for Fourier least squares procedure +\verbinclude ./stfinvfdleastsquares_summary_usage.txt +\verbinclude ./stfinvfdleastsquares_description_usage.txt +*/ + +/* ----- END OF doxygen_end_users.txt ----- */ diff --git a/contrib/stfinv/doxygen_implementers.txt b/contrib/stfinv/doxygen_implementers.txt new file mode 100644 index 0000000000000000000000000000000000000000..a82fc3ac8a9ddaefdd3d8bcccb9b41cbce4c7ca1 --- /dev/null +++ b/contrib/stfinv/doxygen_implementers.txt @@ -0,0 +1,450 @@ +/*! \file doxygen_implementers.txt + * \brief Information for library implementers + * + * ---------------------------------------------------------------------------- + * + * \author Thomas Forbriger + * \date 04/10/2015 + * + * Information for library implementers + * + * ---- + * libstfinv 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) 2015 by Thomas Forbriger (BFO Schiltach) + * + * REVISIONS and CHANGES + * - 04/10/2015 V1.0 Thomas Forbriger + * + * ============================================================================ + */ + +/*! \page page_implementers Information for library implementers + +\par Contents of this page +- \ref page_i_sec_implementers + - \ref page_i_subsec_cusers + - \ref page_i_subsec_cxxusers +- \ref page_i_sec_design + - \ref page_i_subsec_design_initialization +- \ref page_i_sec_documentation + - \ref page_i_subsec_adressees + - \ref page_i_subsec_locations + +\section page_i_sec_implementers The library libstfinv for implementers + + Implementers of new engines should copy files like stfinvidentity.h and + stfinvidentity.cc and implement a new class which inherits from + stfinv::STFBaseEngine. + Most of the framework can simply be copied. + The core function is the virtual function like + stfinv::STFEngineIdentity::exec() which actuall determines the source + wavelet correction filter. + For the implementation there are some \ref tools provided in the library. + + Do not forget to provide a unique ID like stfinv::STFEngineIdentity::ID + and a short description like in stfinv::STFEngineIdentity::description. + Further an online help text like produced by + stfinv::STFEngineIdentity::classhelp() are recommended. + + After having successfully implemented the engine, it must be made + available through + stfinv::STFEngine::STFEngine(). + Online help is made available through stfinv::STFEngine::help() and + stfinv::help(). + + See the stfinv::STFBaseEngine, where we explain + how the initialization takes place. + + See \ref page_i_sec_design for details on the engine design. + + See \ref page_u_subsec_introduction for a general introduction and + description of the libraries workflow. + +\subsection page_i_subsec_cusers The C application programming interface (API) + + The library provides a \ref cinterface. + Examples for using the \ref cinterface are given in the section + Detailed Description of the documentation for the \ref cinterface. + +\subsection page_i_subsec_cxxusers The C++ application programming interface (API) + + The library provides a \ref cxxinterface. + Examples for using the \ref cxxinterface are given in the section + Detailed Description of the documentation for the \ref cxxinterface. + +*/ + +/*======================================================================*/ + +/*! \page page_implementers + + \section page_i_sec_design Design considerations + + \subsection page_i_subsec_design_initialization Initialization of classes + + It would have been nice to implement the classes in a way that default + parameters are collected automatically and that the constructors care about + parameter key values not matching a default parameter. + Without tests for matching key values typos by the user may remain + unnoticed. + + Default values either must be provided in a static data structure or must be + collected in a top down manner beginning at the child class proceeding to + the parents. + Collection of default parameters must be finished before passing the actual + parameters to the parameter map stfinv::STFBaseEngine::Mparamap. + The sequence in which the constructors are called is the other way round. + Constructor processing naturally starts at the base class and proceeds in + direction of the children. + At the same time a base class constructor is not able to call a virtual + function of the child, since the child not actually is constructed at this + time. + + Implementing a check for default parameter matches cannot easily be + implemented within the constructors. + A second sequence of initializing member function would be necessary. + The constructor of the derived class would have to initiate this process + thus ultimately terminating the chain of inheritance. + + Since all other initialization takes place in the order starting at the base + class, I do not check the key values and prefer the simple and straight + forward way of implementation. + + The handling of stfinv::STFBaseEngine::Mparamap is entirely encapsulated in + the base class. + For this reason it should be possible to implement parameter keyword checks + in the future is desired with relatively small effort. + +\date 10.05.2011 + */ + +/*======================================================================*/ + +/*! \page page_implementers + +\section page_i_sec_documentation Documentation of the library + +\subsection page_i_subsec_adressees Addressees of documentation +\par End-users + These are end-users of the software. + They are not concerned with the libraries API (application programming + interface). + They just apply a software which uses libstfinv to seismic data. + End-users require information on how to select one of the provided engines + and how to control these engines by parameter values. +\par Users + Users of the library use libstfinv within their own software project. + They required detailed information regarding the API and its parameters. + Questions to be addressed are: How are waveform data transferred to and + from the library? How can user selected parameters be passed to the + library? +\par Implementers + They aim to implement new features in libstfinv or to fix bugs. + Such new features could be a new engine or just new functionality for an + existing engine. + Information required concerns the general design of the library, how + classes interact and derive from each other. + Implementers must be pointed to locations, where base classes must receive + new lines to address a newly implemented class. + +\subsection page_i_subsec_locations Locations of documentation +\par Source code + Within the C++ source code files all software modules and in particular + their implementation are described. + Apart from the actual classes, functions, and parameters + this comprises also the theory of operation and mathematics of the + implemented approaches. + These more fundamental information typically if given in the "Detailed + Description" sections of the class documentation. + +\par doxygen text files + Files matching name pattern doxygen*.txt contain documentation text with + format commands appropriate for doxygen. + They are processed in the creation of the html documentation of libstfinv. + These files contain general considerations for end-users, library users and + implementers. + +\par usage text files + Files matching name pattern *usage.txt in subdirectory usage contain usage + documentation addressing end-users. + End-users are not concerned with programming and library API. + They use software, which is linked against libstfinv and apply those + programs to their time series files. + This documentation should contain all relevant information on how to select + an engine and how to control the actual processing by passing parameters to + the engine. + Contents of these files will be processed to C++ source code and will be + provided through help-functions of the software modules. + + \par + *summary_usage.txt files provide a short summary of the implemented approach + and a summary of available parameters. + + \par + *description_usage.txt files provide a detailed description of theory of + operation and detailed information regarding control parameters. + + \par + Usage text files shall be output in two different ways: + -# The summary for all available engines is output together with a summary + for the overall library. + The summary for engine bases like stfinv::STFFourierDomainEngine is + output exactly once and after the list of operational engines. + This is controlled by the API. + It is implemented in stfinv::STFEngine::help() and called by + stfinv::help(). + -# The detailed description for one selected engine is output together with + detailed description for the overall library. + This is delegated by the API to static member functions of operational + engine classes. + stfinv::STFEngine::usage(const std::string& id, std::ostream& + os=std::cout) prints the detailed description of + the general part of the library and then calls the static member function + usage of the engine selected through string \p id. + The usage function of the engine class prints its detailed usage + information and, if appropriate, calls the usage function of the base + class. + Function stfinv::usage() is provided in the \ref cinterface and calls + stfinv::STFEngine::usage. + +\par LaTeX files + In subdirectory doc a set of LaTeX files is created. + These files may contain extended end-user documentation including relevant + mathematics. + +\date 4.10.2015 + */ + +/*======================================================================*/ + +/*! \brief C interface to libstfinv + +\defgroup cinterface C interface (API) to libstfinv + +All data structures and function prototypes are presented in +\ref stfinv.h + +\par Overview + +When using libstfinv from a C program, the first step is to initialize the +engine by calling ::initstfinvengine(). The engine will keep references to +the memory locations where time series samples are stored. You can update +the content of these locations as you like, e.g. by storing a new set of +synthetic seismograms therein. Upon each call to ::runstfinvengine() a new +source wavelet correction filter +will be derived and stored at its place in +memory. At the same time the synthetic waveforms are convolved with the +filter wavelet and stored at the memory location reserved for the +convolved synthetics. It is good style to call ::freestfinvengine() when +you have finished. This will remove the engine from memory. This call +should at least be issued when the pointers to the memory locations for +time series samples as passed to ::initstfinvengine() become invalid. + +\par Code fragments + +All expressions \c [...] in the code fragments below have to be replaced with +proper C expression appropriate for your program. + +Consider you like to use this interface in a C program. +You have data for \c nrec receivers each with \c nsamp samples and \c dt +sampling interval: +\code +usigned int nrec = [...]; +usigned int nsamp = [...]; +float dt = [...]; +\endcode +Then you have to initialize a reference to your workspace: +\code +struct CTriples data; +data.n=nrec; +data.triples=(struct CWaveformTriple *)malloc(nrec*sizeof(struct CWaveformTriple)); +if (data.triples == NULL) { abort(); } +\endcode +You then have to fill the waveform triple structures with appropriate header +information and pointers to your data arrays: +\code +for (usigned int i=0; i #include diff --git a/contrib/stfinv/error.h b/contrib/stfinv/error.h index fd57859d1fdc48e45dc660d4d95ce1f7ee371ade..7d29c76689d2f824ebc6cdf21b0642b1a3c74a00 100644 --- a/contrib/stfinv/error.h +++ b/contrib/stfinv/error.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: error.h 3973 2011-05-28 14:40:41Z tforb $ * \author Thomas Forbriger * \date 05/05/2011 * @@ -39,16 +38,11 @@ #define STFINV_ERROR_H_VERSION \ "STFINV_ERROR_H V1.0" -#define STFINV_ERROR_H_CVSID \ - "$Id: error.h 3973 2011-05-28 14:40:41Z tforb $" #include namespace stfinv { -/*! \defgroup group_error Error handling module - */ - /*! \brief Base class for exceptions * * This is an exception base class. It holds some information about the diff --git a/contrib/stfinv/fouriertools.cc b/contrib/stfinv/fouriertools.cc index 42edfb2adc9abb12fee4dc066709bc647e78330d..a4da07ef79ee14ec88cc9c535cac8701ebb55ff9 100644 --- a/contrib/stfinv/fouriertools.cc +++ b/contrib/stfinv/fouriertools.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: fouriertools.cc 3915 2011-05-06 22:04:25Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -34,9 +33,7 @@ * ============================================================================ */ #define STFINV_FOURIERTOOLS_CC_VERSION \ - "STFINV_FOURIERTOOLS_CC V1.0 " -#define STFINV_FOURIERTOOLS_CC_CVSID \ - "$Id: fouriertools.cc 3915 2011-05-06 22:04:25Z tforb $" + "STFINV_FOURIERTOOLS_CC V1.0" #include diff --git a/contrib/stfinv/fouriertools.h b/contrib/stfinv/fouriertools.h index 59d1c6eb8b0e288d396db7dfe4ca390a74ab9420..439679adf027ed227e4feef08e8beb3a4764e6c9 100644 --- a/contrib/stfinv/fouriertools.h +++ b/contrib/stfinv/fouriertools.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: fouriertools.h 3915 2011-05-06 22:04:25Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -38,9 +37,7 @@ #ifndef STFINV_FOURIERTOOLS_H_VERSION #define STFINV_FOURIERTOOLS_H_VERSION \ - "STFINV_FOURIERTOOLS_H V1.0 " -#define STFINV_FOURIERTOOLS_H_CVSID \ - "$Id: fouriertools.h 3915 2011-05-06 22:04:25Z tforb $" + "STFINV_FOURIERTOOLS_H V1.0" namespace stfinv { diff --git a/contrib/stfinv/parameterhandler.cc b/contrib/stfinv/parameterhandler.cc index d5dc005d472e06d945528b155095611502b6ac6b..21fb10461c9da6e636ba99715819e3982365a0e8 100644 --- a/contrib/stfinv/parameterhandler.cc +++ b/contrib/stfinv/parameterhandler.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: parameterhandler.cc 3926 2011-05-10 18:54:17Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -34,9 +33,7 @@ * ============================================================================ */ #define STFINV_PARAMETERHANDLER_CC_VERSION \ - "STFINV_PARAMETERHANDLER_CC V1.0 " -#define STFINV_PARAMETERHANDLER_CC_CVSID \ - "$Id: parameterhandler.cc 3926 2011-05-10 18:54:17Z tforb $" + "STFINV_PARAMETERHANDLER_CC V1.0" #include #include diff --git a/contrib/stfinv/parameterhandler.h b/contrib/stfinv/parameterhandler.h index 1ca614f4c3452e3ab09a25b219fe9b3e3db00649..7c3295fb8dafb91325089ff9e6fc0f26f67d77aa 100644 --- a/contrib/stfinv/parameterhandler.h +++ b/contrib/stfinv/parameterhandler.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: parameterhandler.h 3973 2011-05-28 14:40:41Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -38,9 +37,7 @@ #ifndef STFINV_PARAMETERHANDLER_H_VERSION #define STFINV_PARAMETERHANDLER_H_VERSION \ - "STFINV_PARAMETERHANDLER_H V1.0 " -#define STFINV_PARAMETERHANDLER_H_CVSID \ - "$Id: parameterhandler.h 3973 2011-05-28 14:40:41Z tforb $" + "STFINV_PARAMETERHANDLER_H V1.0" #include #include diff --git a/contrib/stfinv/stfinv.cc b/contrib/stfinv/stfinv.cc index 9da3478bc5fa921f6eb7ed70559a3188f2df1ad8..fbfdd6d4427f183859871dc0c0892fac2ab82db5 100644 --- a/contrib/stfinv/stfinv.cc +++ b/contrib/stfinv/stfinv.cc @@ -3,8 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinv.cc 4968 2013-02-01 13:58:05Z lrehor $ - * * ---- * 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 @@ -33,13 +31,12 @@ * - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 05/10/2011 V1.2 correction: initstfinvenginewithpairs was named * incorrectly initstfinvenginepairs + * - 14/10/2015 V1.3 new end-user usage functions * * ============================================================================ */ #define STFINV_STFINV_C_VERSION \ - "STFINV_STFINV_C V1.2" -#define STFINV_STFINV_C_CVSID \ - "$Id: stfinv.cc 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINV_C V1.3" #include #include @@ -168,10 +165,24 @@ void freestfinvengine() /*----------------------------------------------------------------------*/ +void printengines() +{ + stfinv::engines(); +} // void printengines() + +/*----------------------------------------------------------------------*/ + void printhelp() { - stfinv::STFEngine::help(); stfinv::help(); } // void printhelp() +/*----------------------------------------------------------------------*/ + +void printusage(char* id) +{ + std::string selectid(id); + stfinv::usage(selectid); +} // void printhelp(age(char* id) + /* ----- END OF stfinv.cc ----- */ diff --git a/contrib/stfinv/stfinv.h b/contrib/stfinv/stfinv.h index faeef7120e45c76e3e806fa2d0adbe7184f54811..a98e8bc2bc34a3323ede42d7864a5228c4cf9d21 100644 --- a/contrib/stfinv/stfinv.h +++ b/contrib/stfinv/stfinv.h @@ -4,7 +4,6 @@ * \ingroup cinterface * ---------------------------------------------------------------------------- * - * $Id: stfinv.h 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -34,6 +33,7 @@ * - 28/06/2011 V1.1 requires extern declaration for C++ since binary * code is compiled by C++ compiler, not C compiler * - 30/09/2011 V1.2 implemented handling of additional time series pairs + * - 14/10/2015 V1.3 new end-user usage functions * * ============================================================================ */ @@ -42,9 +42,7 @@ #ifndef STFINV_STFINV__H_VERSION #define STFINV_STFINV__H_VERSION \ - "STFINV_STFINV__H V1.2" -#define STFINV_STFINV__H_CVSID \ - "$Id: stfinv.h 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINV__H V1.3" #include @@ -219,7 +217,7 @@ struct CPairs { * \param parameters * Parameters to select one of the engines as well as to control the engines * are passed in a character sequence. - * See also \ref main_subsec_parameters + * See also \ref page_eu_subsec_parameters */ void initstfinvengine(struct CTriples triples, struct CWaveform stf, @@ -259,7 +257,7 @@ void initstfinvengine(struct CTriples triples, * \param parameters * Parameters to select one of the engines as well as to control the engines * are passed in a character sequence. - * See also \ref main_subsec_parameters + * See also \ref page_eu_subsec_parameters */ void initstfinvenginewithpairs(struct CTriples triples, struct CWaveform stf, @@ -278,12 +276,26 @@ void runstfinvengine(); */ void freestfinvengine(); -/*! \brief Print online help to stdout +/*! \brief List procedures (engines) on stdout + * + * \ingroup cinterface + */ +void printengines(); + +/*! \brief Print usage summary to stdout * * \ingroup cinterface */ void printhelp(); +/*! \brief Print detailed description for engine "id" to stdout + * + * \param id character string selecting a specific engine + * + * \ingroup cinterface + */ +void printusage(char* id); + #ifdef __cplusplus } // extern "C" #endif diff --git a/contrib/stfinv/stfinvany.cc b/contrib/stfinv/stfinvany.cc index 6dccb46aa5573c5a13a24bf00cafd6d2f4892f49..427137a07e7ec1c57c95a1149be9f6f2d16b4417 100644 --- a/contrib/stfinv/stfinvany.cc +++ b/contrib/stfinv/stfinvany.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvany.cc 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -32,20 +31,24 @@ * - 06/05/2011 V1.0 Thomas Forbriger * - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 04/10/2011 V1.2 renamed Fourier domain least squares engine + * - 14/10/2015 V1.3 new end-user usage functions * * ============================================================================ */ #define STFINV_STFINVANY_CC_VERSION \ - "STFINV_STFINVANY_CC V1.1" -#define STFINV_STFINVANY_CC_CVSID \ - "$Id: stfinvany.cc 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINVANY_CC V1.3" #include #include #include #include #include +#include +#include +#include +#include #include +#include namespace stfinv { @@ -80,16 +83,16 @@ namespace stfinv { std::string id=stfinv::tools::clipstring(para, ":"); if (id == std::string(stfinv::STFEngineIdentity::ID)) { - STFINV_assert(pairs.size()==0, - "ERROR: engine does not support additional time series pairs"); Mengine=new stfinv::STFEngineIdentity(triples, stf, para); } + /* else if (id == std::string(stfinv::STFEngineFixedWavelet::ID)) { STFINV_assert(pairs.size()==0, "ERROR: engine does not support additional time series pairs"); Mengine=new stfinv::STFEngineFixedWavelet(triples, stf, para); } + */ else if ((id == std::string(stfinv::STFEngineFDLeastSquares::ID)) || (id == std::string("fbd"))) { @@ -128,82 +131,74 @@ namespace stfinv { /*----------------------------------------------------------------------*/ - void STFEngine::help(std::ostream& os) + void STFEngine::engines(std::ostream& os) { - os << "Currently the following engines are available:" << std::endl; - os << "---------------------------------------------" << std::endl; - os << std::endl; - const int width1=10; - /*----------------------------------------------------------------------*/ - os.width(width1); - os << STFEngineIdentity::ID; - os.width(0); - os << ": " << STFEngineIdentity::description << std::endl; - /*----------------------------------------------------------------------*/ - os.width(width1); - os << STFEngineFixedWavelet::ID; - os.width(0); - os << ": " << STFEngineFixedWavelet::description << std::endl; - /*----------------------------------------------------------------------*/ - os.width(width1); - os << STFEngineFDLeastSquares::ID; - os.width(0); - os << ": " << STFEngineFDLeastSquares::description << std::endl; + os << "Available procedures:" << std::endl; + os << "---------------------" << std::endl; + tools::report_engine(os); + // tools::report_engine(os); + tools::report_engine(os); } // void STFEngine::help(std::ostream& os=std::cout) - /*======================================================================*/ + /*----------------------------------------------------------------------*/ - void help(std::ostream& os) + void STFEngine::help(std::ostream& os) { - os << "Details descriptions of available engines:" << std::endl; - os << "------------------------------------------" << std::endl; + os << stfinv_summary_usage; os << std::endl; - STFEngineIdentity::classhelp(os); + STFEngine::engines(os); os << std::endl; - STFEngineFixedWavelet::classhelp(os); + STFEngineIdentity::classhelp(os); os << std::endl; STFEngineFDLeastSquares::classhelp(os); + os << std::endl; + STFFourierDomainEngine::classhelp(os); + os << std::endl; + STFBaseEngine::classhelp(os); + os << std::endl; + os << stfinvany_summary_usage; + } // void STFEngine::help(std::ostream& os=std::cout) - // parameter strings - os << "\n"; - os << "How to construct parameter strings" << std::endl; - os << "----------------------------------" << std::endl; - os << "A specific engine is selected by passing a parameter string.\n" - << "This parameter string may further contain parameters to control\n" - << "the execution mode of the engine.\n"; - - os << "The parameter string starts with an ID-sequence identifying\n" - << "the desired engine. See the list below for available engines.\n" - << "In the parameter string the ID-sequence is terminated by a\n" - << "colon (:).\n"; - - os << "After selecting the desired engine, the interface function\n" - << "strips of the ID-sequence as well as the colon from the\n" - << "parameter string and initializes the engine and passes the\n" - << "remainder of the parameter string to the engine. This\n" - << "remainder may consist of several control parameters being\n" - << "separated by colons (:). Each control parameter may just be\n" - << "a flag (switch to turn an option on) or may come along with\n" - << "a parameter value. The value of the parameter is separated\n" - << "by an equal sign (=).\n"; - - os << "\n"; - os << "Examples:\n"; - os << "- To select Fourier domain least squares and shift\n" - << " the returned source correction filter wavelet by 0.4s and\n" - << " switch on verbose mode, pass the following parameter string:\n"; - os << " fdlsq:tshift=0.4:verbose\n"; - os << "- To select the identity engine and to switch on debug level 4:\n"; - os << " ident:DEBUG=4\n"; - os << "- To select Fourier domain least squares, apply offset\n" - << " dependent weights and use a power of two to speed up the FFT:\n"; - os << " fdlsq:pow2:exp=1.4\n"; + /*----------------------------------------------------------------------*/ + void STFEngine::usage(const std::string& id, std::ostream& os) + { + os << stfinv_description_usage; + os << std::endl; + if (id == std::string(stfinv::STFEngineIdentity::ID)) + { + stfinv::STFEngineIdentity::classusage(os); + } + else if ((id == std::string(stfinv::STFEngineFDLeastSquares::ID))) + { + stfinv::STFEngineFDLeastSquares::classusage(os); + } + else + { + std::cerr << "ERROR: engine ID " << id << " is unkown!" << std::endl; + STFINV_abort("aborting since engine ID is not recognized"); + } os << std::endl; + os << stfinvany_description_usage; + } // void STFEngine::help(std::ostream& os=std::cout) + + /*======================================================================*/ + + void engines(std::ostream& os) + { + STFEngine::engines(os); + } // void engines(std::ostream& os) + void help(std::ostream& os) + { STFEngine::help(os); } // void help(std::ostream& os=std::cout) + void usage(const std::string& id, std::ostream& os) + { + STFEngine::usage(id, os); + } // void usage(const std::string& id, std::ostream& os) + } // namespace stfinv /* ----- END OF stfinvany.cc ----- */ diff --git a/contrib/stfinv/stfinvany.h b/contrib/stfinv/stfinvany.h index 28fd9c8049532a019dc1cd08c1c2162a804cf107..a81efeec872d57068c8fe797b40909953c261d45 100644 --- a/contrib/stfinv/stfinvany.h +++ b/contrib/stfinv/stfinvany.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvany.h 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -31,6 +30,7 @@ * REVISIONS and CHANGES * - 06/05/2011 V1.0 Thomas Forbriger * - 30/09/2011 V1.1 implemented handling of additional time series pairs + * - 14/10/2015 V1.2 new end-user usage functions * * ============================================================================ */ @@ -39,9 +39,7 @@ #ifndef STFINV_STFINVANY_H_VERSION #define STFINV_STFINVANY_H_VERSION \ - "STFINV_STFINVANY_H V1.1" -#define STFINV_STFINVANY_H_CVSID \ - "$Id: stfinvany.h 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINVANY_H V1.2" #include @@ -55,6 +53,9 @@ namespace stfinv { * abstract base class stfinv::STFBaseEngine except that the first prefix * (up to the first colon) in the parameter string is understood to identify * the selected engine. + * + * It serves as a kind of handle to provide user selectable engines to + * application programs. */ class STFEngine { public: @@ -74,7 +75,7 @@ namespace stfinv { * \param parameters * Parameters to select one of the engines as well as to control the * engines are passed in a character sequence. - * See also \ref main_subsec_parameters + * See also \ref page_eu_subsec_parameters */ STFEngine(const stfinv::Tvectoroftriples& triples, const stfinv::Waveform& stf, @@ -107,7 +108,7 @@ namespace stfinv { * \param parameters * Parameters to select one of the engines as well as to control the * engines are passed in a character sequence. - * See also \ref main_subsec_parameters + * See also \ref page_eu_subsec_parameters */ STFEngine(const stfinv::Tvectoroftriples& triples, const stfinv::Waveform& stf, @@ -119,8 +120,16 @@ namespace stfinv { stfinv::STFBaseEngine& STFBaseEngine() { return (*Mengine); } //! \brief Start engine and return source correction filter. stfinv::Waveform run() { return(Mengine->run()); } - //! \brief List engines currently recognized + //! \brief List procedures (engines) currently recognized + static void engines(std::ostream& os=std::cout); + //! \brief List engines currently recognized and print summary static void help(std::ostream& os=std::cout); + /*! \brief Print detailed usage description. + * + * \param id ID of procedure (engine) to be described. + * \param os stream to send output to + */ + static void usage(const std::string& id, std::ostream& os=std::cout); private: //! \brief initialize engine. void initialize(const stfinv::Tvectoroftriples& triples, @@ -133,11 +142,27 @@ namespace stfinv { /*----------------------------------------------------------------------*/ - /*! print online help of the whole implemented system of engines + /*! print list available procedures (engines) + * \ingroup cxxinterface + * + * Just delegates to STFEngine::engines() + */ + void engines(std::ostream& os=std::cout); + + /*! print print usage summary * \ingroup cxxinterface + * + * Just delegates to STFEngine::help() */ void help(std::ostream& os=std::cout); + /*! print print detailed description for selected engine + * \ingroup cxxinterface + * + * Just delegates to STFEngine::usage() + */ + void usage(const std::string& id, std::ostream& os=std::cout); + } // namespace stfinv #endif // STFINV_STFINVANY_H_VERSION (includeguard) diff --git a/contrib/stfinv/stfinvbase.cc b/contrib/stfinv/stfinvbase.cc index ae98740c84d7011c7c6fe549a3e6a63f459ebdd3..46c2eccc685dff2d6d2c9efa6ce7b5b59751de68 100644 --- a/contrib/stfinv/stfinvbase.cc +++ b/contrib/stfinv/stfinvbase.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvbase.cc 4161 2011-10-01 08:00:43Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -31,21 +30,26 @@ * REVISIONS and CHANGES * - 06/05/2011 V1.0 Thomas Forbriger * - 30/09/2011 V1.1 implemented handling of additional time series pairs + * - 14/10/2015 V1.2 new end-user usage functions * * ============================================================================ */ #define STFINV_STFINVBASE_CC_VERSION \ - "STFINV_STFINVBASE_CC V1.1" -#define STFINV_STFINVBASE_CC_CVSID \ - "$Id: stfinvbase.cc 4161 2011-10-01 08:00:43Z tforb $" + "STFINV_STFINVBASE_CC V1.2" #include #include #include +#include +#include #include namespace stfinv { + /*! + * Constructor stores all references to time series data passed by the + * caller. + */ STFBaseEngine::STFBaseEngine(const stfinv::Tvectoroftriples& triples, const stfinv::Waveform& stf, const stfinv::Tvectorofpairs& pairs, @@ -58,6 +62,10 @@ namespace stfinv { /*----------------------------------------------------------------------*/ + /*! + * Constructor stores all references to time series data passed by the + * caller. + */ STFBaseEngine::STFBaseEngine(const stfinv::Tvectoroftriples& triples, const stfinv::Waveform& stf, const std::string& parameters) @@ -69,6 +77,17 @@ namespace stfinv { /*----------------------------------------------------------------------*/ + /*! + * -# The STFBaseEngine::initialize() function parses the parameter string. + * Parsed values are stored in Mparamap. + * -# Extract settings for parameters: + * - DEBUG: set debug output level + * - verbose: activate verbose output + * - exp: set power-law exponent and store weights in member data Mweights + * -# Check consistency of data + * -# Align index ranges of aff::Series objects such that the first element + * (sample) has index zero + */ void STFBaseEngine::initialize(const std::string& parameters) { this->parseparameters(parameters); @@ -130,6 +149,13 @@ namespace stfinv { /*----------------------------------------------------------------------*/ + /*! + * Check consistency of time series data passed to the STFBaseEngine + * with respect to + * -# number of samples + * -# sampling interval + * + */ void STFBaseEngine::checkconsistency() const { const unsigned int& n=Mstf.sampling.n; @@ -186,18 +212,32 @@ namespace stfinv { void STFBaseEngine::classhelp(std::ostream& os) { - os << "Options and parameters in common for all engines:\n" - << "verbose produce verbose output (if implemented)\n" - << "DEBUG=l produce debug output with level l\n" - << "exp=k apply offset dependent weights to signals\n" - << "If implemented in the engine in use then setting the parameter\n" - << "exp=k will give a weight factor of ((r/1m)**k) to each signal\n" - << "in order to compensate the decrease in signal energy." - << std::endl; + os << stfinvbase_summary_usage; } // void STFBaseEngine::classhelp(std::ostream& os) /*----------------------------------------------------------------------*/ + void STFBaseEngine::usage(std::ostream& os) const + { + STFBaseEngine::classusage(os); + } // void STFBaseEngine::usage(std::ostream& os) const + + /*----------------------------------------------------------------------*/ + + void STFBaseEngine::classusage(std::ostream& os) + { + os << stfinvbase_description_usage; + } // void STFBaseEngine::classusage(std::ostream& os) + + /*----------------------------------------------------------------------*/ + + /*! + * Pass the parameter string (as usually passed along the chain of + * constructors to the constructor and initialize() function of + * STFBaseEngine). + * The values are stored in the member data + * STFBaseEngine::Mparamap + */ void STFBaseEngine::parseparameters(std::string parameters) { while (parameters.length()>0) diff --git a/contrib/stfinv/stfinvbase.h b/contrib/stfinv/stfinvbase.h index 6d5375d1ed5409f7567e7fa962057e58c38d01d2..89f1ff58a83fb84413d3c936c54c9f22463c0d60 100644 --- a/contrib/stfinv/stfinvbase.h +++ b/contrib/stfinv/stfinvbase.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvbase.h 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -31,6 +30,7 @@ * REVISIONS and CHANGES * - 06/05/2011 V1.0 Thomas Forbriger * - 30/09/2011 V1.1 implemented handling of additional time series pairs + * - 14/10/2015 V1.2 new end-user usage functions * * ============================================================================ */ @@ -39,9 +39,7 @@ #ifndef STFINV_STFINVBASE_H_VERSION #define STFINV_STFINVBASE_H_VERSION \ - "STFINV_STFINVBASE_H V1.1" -#define STFINV_STFINVBASE_H_CVSID \ - "$Id: stfinvbase.h 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINVBASE_H V1.2" #include #include @@ -185,8 +183,23 @@ namespace stfinv { * See STFBaseEngine::parameter() and STFBaseEngine::parameterisset() * for a description on how parameters are handled within engine classes. * + * \par Data + * - recordings are understood as recorded waveforms. + * The number of available traces is returned by nreceivers() + * - synthetics are understood as synthetic waveforms generated with a + * generic source time function. + * For each trace of recordings there must be a matching trace of + * synthetics and vice versa. + * - convolvedsynthetics are produced from synthetics as a result of the + * application of the source wavelet correction filter. + * - series are additional synthetic time series, not used to construct the + * source-wavelet correction filter. The number of additional series + * traces is returned by npairs(). + * - convolvedseries are produced from series as a result of the + * application of the source wavelet correction filter. + * * \sa - * \ref sec_page_design_initialization + * \ref page_i_subsec_design_initialization * * \todo * The base class should provide a "log to file" option such that applied @@ -215,7 +228,7 @@ namespace stfinv { virtual ~STFBaseEngine() { } /*! \name Basic interface for users - * \sa \ref main_sec_users + * \sa \ref page_users */ //@{ //! \brief Start engine and return reference to source correction filter. @@ -226,10 +239,14 @@ namespace stfinv { } //! \brief print online help virtual void help(std::ostream& os=std::cout) const; + //! \brief print detailed description + virtual void usage(std::ostream& os=std::cout) const; //! \brief return name of engine virtual const char* name() const; //! \brief print online help static void classhelp(std::ostream& os=std::cout); + //! \brief print detailed description + static void classusage(std::ostream& os=std::cout); //@} /*! \name Shape query functions @@ -285,6 +302,9 @@ namespace stfinv { //! \brief return weight for signal at receiver i double weight(const unsigned int& i) const { return(Mweights(i)); } + //! \brief return weights array + aff::Series weights() const + { return(Mweights); } //@} private: @@ -293,7 +313,7 @@ namespace stfinv { //@{ //! \brief initialize base class void initialize(const std::string& parameters); - //! \brief parse parameters in Mparameters + //! \brief parse parameters and store them in Mparamap void parseparameters(std::string parameters); //! \brief Check consistency of data members. void checkconsistency() const; diff --git a/contrib/stfinv/stfinvfdleastsquares.cc b/contrib/stfinv/stfinvfdleastsquares.cc index 418ac2e9ac26147f92570cdb0095500f8cfd360c..e8c16d35cb3c4a4bf02614522988a34f6a550c8f 100644 --- a/contrib/stfinv/stfinvfdleastsquares.cc +++ b/contrib/stfinv/stfinvfdleastsquares.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvfdleastsquares.cc 4164 2011-10-04 09:00:57Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -31,18 +30,20 @@ * REVISIONS and CHANGES * - 06/05/2011 V1.0 Thomas Forbriger * - 04/10/2011 V1.1 renamed engine + * - 14/10/2015 V1.2 new end-user usage functions * * ============================================================================ */ #define STFINV_STFINVFDLEASTSQUARES_CC_VERSION \ - "STFINV_STFINVFDLEASTSQUARES_CC V1.1" -#define STFINV_STFINVFDLEASTSQUARES_CC_CVSID \ - "$Id: stfinvfdleastsquares.cc 4164 2011-10-04 09:00:57Z tforb $" + "STFINV_STFINVFDLEASTSQUARES_CC V1.2" #include #include #include +#include +#include #include +#include namespace stfinv { @@ -60,6 +61,13 @@ namespace stfinv { /*----------------------------------------------------------------------*/ + void STFEngineFDLeastSquares::usage(std::ostream& os) const + { + STFEngineFDLeastSquares::classusage(os); + } // void STFEngineFDLeastSquares::usage(std::ostream& os) const + + /*----------------------------------------------------------------------*/ + const char* STFEngineFDLeastSquares::name() const { return("STFEngineFDLeastSquares"); @@ -82,21 +90,24 @@ namespace stfinv { void STFEngineFDLeastSquares::classhelp(std::ostream& os) { - os << "class STFEngineFDLeastSquares (" - << STFEngineFDLeastSquares::ID << ")\n"; - os << STFEngineFDLeastSquares::description << "\n" << std::endl; - os << "This engine calculates a least squares fit in the Fourier\n" - << "domain. A waterlevel as a fraction of the signal energy of the\n" - << "input synthetics is applied. If per receiver scaling is\n" - << "selected, the receivers will be weighted in the deconvolution.\n"; - os << "Options and parameters:\n" - << "waterlevel=l waterlevel to be applied for regularization." - << std::endl; - Tbase::classhelp(os); + os << stfinvfdleastsquares_summary_usage; + os << std::endl; + stfinv::tools::report_engine_ID(os); } // void STFEngineFDLeastSquares::classhelp(std::ostream& os) /*----------------------------------------------------------------------*/ + void STFEngineFDLeastSquares::classusage(std::ostream& os) + { + os << stfinvfdleastsquares_description_usage; + os << std::endl; + Tbase::classusage(os); + os << std::endl; + stfinv::tools::report_engine_ID(os); + } // void STFEngineFDLeastSquares::classusage(std::ostream& os) + + /*----------------------------------------------------------------------*/ + void STFEngineFDLeastSquares::exec() { // read signals and calculate FFT diff --git a/contrib/stfinv/stfinvfdleastsquares.h b/contrib/stfinv/stfinvfdleastsquares.h index 1c27256929364c457d5d2bf954fb123c8b393464..ab7a00bbf4fb0f51ba503c3d27729518d8487c08 100644 --- a/contrib/stfinv/stfinvfdleastsquares.h +++ b/contrib/stfinv/stfinvfdleastsquares.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvfdleastsquares.h 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -32,6 +31,7 @@ * - 06/05/2011 V1.0 Thomas Forbriger * - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 04/10/2011 V1.2 renamed engine + * - 14/10/2015 V1.3 new end-user usage functions * * ============================================================================ */ @@ -40,9 +40,7 @@ #ifndef STFINV_STFINVFDLEASTSQUARES_H_VERSION #define STFINV_STFINVFDLEASTSQUARES_H_VERSION \ - "STFINV_STFINVFDLEASTSQUARES_H V1.2" -#define STFINV_STFINVFDLEASTSQUARES_H_CVSID \ - "$Id: stfinvfdleastsquares.h 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINVFDLEASTSQUARES_H V1.3" #include @@ -249,6 +247,10 @@ namespace stfinv { virtual void help(std::ostream& os=std::cout) const; //! \brief print online help static void classhelp(std::ostream& os=std::cout); + //! \brief print detailed description + virtual void usage(std::ostream& os=std::cout) const; + //! \brief print detailed description + static void classusage(std::ostream& os=std::cout); //! \brief return name of engine virtual const char* name() const; private: diff --git a/contrib/stfinv/stfinvfinitecausal.cc b/contrib/stfinv/stfinvfinitecausal.cc new file mode 100644 index 0000000000000000000000000000000000000000..d6ba68aaf4a727d6ce404b5ee61b11dd0ae4d77c --- /dev/null +++ b/contrib/stfinv/stfinvfinitecausal.cc @@ -0,0 +1,30 @@ +/*! \file stfinvfinitecausal.cc + * \brief finite and causal stf by time-domain convolution (implementation) + * + * ---------------------------------------------------------------------------- + * + * $Id: $ + * \author Thomas Forbriger + * \date 15/02/2014 + * + * finite and causal stf by time-domain convolution (implementation) + * + * Copyright (c) 2014 by Thomas Forbriger (BFO Schiltach) + * + * REVISIONS and CHANGES + * - 15/02/2014 V1.0 Thomas Forbriger + * + * ============================================================================ + */ +#define STFINV_STFINVFINITECAUSAL_CC_VERSION \ + "STFINV_STFINVFINITECAUSAL_CC V1.0 " +#define STFINV_STFINVFINITECAUSAL_CC_CVSID \ + "$Id: $" + +#include + +namespace stfinv { + +} + +/* ----- END OF stfinvfinitecausal.cc ----- */ diff --git a/contrib/stfinv/stfinvfinitecausal.h b/contrib/stfinv/stfinvfinitecausal.h new file mode 100644 index 0000000000000000000000000000000000000000..b45d3ce60a72eacbbe3d18f8c627420fe11ecd3e --- /dev/null +++ b/contrib/stfinv/stfinvfinitecausal.h @@ -0,0 +1,141 @@ +/*! \file stfinvfinitecausal.h + * \brief finite and causal stf by time-domain convolution (prototypes) + * + * ---------------------------------------------------------------------------- + * + * $Id: $ + * \author Thomas Forbriger + * \date 15/02/2014 + * + * finite and causal stf by time-domain convolution (prototypes) + * + * Copyright (c) 2014 by Thomas Forbriger (BFO Schiltach) + * + * REVISIONS and CHANGES + * - 15/02/2014 V1.0 Thomas Forbriger + * + * ============================================================================ + */ + +// include guard +#ifndef STFINV_STFINVFINITECAUSAL_H_VERSION + +#define STFINV_STFINVFINITECAUSAL_H_VERSION \ + "STFINV_STFINVFINITECAUSAL_H V1.0 " +#define STFINV_STFINVFINITECAUSAL_H_CVSID \ + "$Id: $" + +#include + +namespace stfinv { + + /*! \brief Engine to find a finite, causal source time-history in time domain + * \ingroup engines + * + * \par Concept behin this engine + * + * - \f$d_l\f$: data samples + * - \f$s_l\f$: raw synthetics + * - \f$q_l\f$: source time-history to be derived + * - \f$s^c_l=\sum\limits_k s_{(l-k)} q_k\f$: convolved synthetics + * - \f$E=\sum\limits_l (d_l-s^c_l)^2\f$: misfit to be minized + * + * \f[ + * \frac{\partial E}{\partial q_j} + * =\frac{\partial}{\partial q_j} + * \left(\sum\limits_l + * \left(d_l-\sum\limits_k s_{(l-k)} q_k\right)^2\right) + * = + * \sum\limits_l + * \frac{\partial}{\partial q_j} + * \left(d_l-\sum\limits_k s_{(l-k)} q_k\right)^2 + * = + * -2 \sum\limits_l + * s_{(l-j)} + * \left(d_l-\sum\limits_k s_{(l-k)} q_k\right) + * = + * -2 \sum\limits_l + * s_{(l-j)} d_l + * +2 \sum\limits_l + * s_{(l-j)} \sum\limits_k s_{(l-k)} q_k + * \f] + * + * Least-squares condition: + * \f[ + * \frac{\partial E}{\partial q_j}\stackrel{!}{=}0,\quad \forall j + * \f] + * \f[ + * \sum\limits_l s_{(l-j)} \sum\limits_k s_{(l-k)} q_k + * = + * \sum\limits_l s_{(l-j)} d_l ,\quad \forall j + * \f] + * + * System of linear equations: + * \f[ + * \sum\limits_k + * \underbrace{\left(\sum\limits_l s_{(l-j)} s_{(l-k)}\right)}_{=M_{jk}} + * q_k = + * \underbrace{\sum\limits_l s_{(l-j)} d_l}_{=r_j} + * \f] + * + * Next: + * - index range is defined on base of index range for data and desired + * finite length of source time-history + * - additional traces are to be added by adding further terms to the misfit + * function, which results in further terms in the system of linear + * equations. + * These terms should be given appropriate weights + * - data should be normalized, such that a misfit of 1 is meaningful; + * this is easily done, by scaling all seismograms samples with the same + * factor (data as well as synthetics) + * - an additional constraint could be applied to the \f$q_l\f$ by adding a + * term \f$\sum\limits_l\left(Q_l q_l\right)^2\f$ to the msifit \f$E\f$; + * this will result in a simple additional term on the left-hand-side of + * the system of linear equations; + * a reasonable weight must be given to this term + * + * \todo + * STFEngineTDCausalConvolution is a rudiment to be filled with reasonable + * code. To date the source code file is used to develop the theory. + */ + class STFEngineFiniteCausal: public stfinv::STFBaseEngine { + public: + //! \brief typedef to refer to base class + typedef stfinv::STFBaseEngine Tbase; + //! \brief ID used to select thsi engine + static const char* const ID; + //! \brief short description of this engine + static const char* const description; + /*! \brief Constructor. + */ + STFEngineFiniteCausal(const stfinv::Tvectoroftriples& triples, + const stfinv::Waveform& stf, + const std::string& parameters) + : Tbase(triples, stf, parameters), + Mscaleenergy(false) + { this->initialize(); } + //! \brief abstract base requires virtual destructor + virtual ~STFEngineFiniteCausal() { } + //! \brief Start engine + virtual void exec(); + //! \brief print online help + virtual void help(std::ostream& os=std::cout) const; + //! \brief print online help + static void classhelp(std::ostream& os=std::cout); + //! \brief return name of engine + virtual const char* name() const; + private: + //! \brief initialize work space + void initialize(); + + // member data + private: + //! \brief scale energy + bool Mscaleenergy; + }; // class STFEngineFiniteCausal + +} + +#endif // STFINV_STFINVFINITECAUSAL_H_VERSION (includeguard) + +/* ----- END OF stfinvfinitecausal.h ----- */ diff --git a/contrib/stfinv/stfinvfixedstf.cc b/contrib/stfinv/stfinvfixedstf.cc index d18e7746bf3c137a6caeb239401e87ba9930a51b..c56d126c33eba5f7fabe5ac9010017dbf7d38d66 100644 --- a/contrib/stfinv/stfinvfixedstf.cc +++ b/contrib/stfinv/stfinvfixedstf.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvfixedstf.cc 3986 2011-05-29 16:01:09Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -34,9 +33,7 @@ * ============================================================================ */ #define STFINV_STFINVFIXEDSTF_CC_VERSION \ - "STFINV_STFINVFIXEDSTF_CC V1.0 " -#define STFINV_STFINVFIXEDSTF_CC_CVSID \ - "$Id: stfinvfixedstf.cc 3986 2011-05-29 16:01:09Z tforb $" + "STFINV_STFINVFIXEDSTF_CC V1.0" #include diff --git a/contrib/stfinv/stfinvfixedstf.h b/contrib/stfinv/stfinvfixedstf.h index 09dccc327525eec080f5324ed0e3dd2c6ae0cb8d..3f529e38f428406e0bf6f99b26e04360e1dc6487 100644 --- a/contrib/stfinv/stfinvfixedstf.h +++ b/contrib/stfinv/stfinvfixedstf.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvfixedstf.h 3985 2011-05-29 15:43:24Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -38,9 +37,7 @@ #ifndef STFINV_STFINVFIXEDSTF_H_VERSION #define STFINV_STFINVFIXEDSTF_H_VERSION \ - "STFINV_STFINVFIXEDSTF_H V1.0 " -#define STFINV_STFINVFIXEDSTF_H_CVSID \ - "$Id: stfinvfixedstf.h 3985 2011-05-29 15:43:24Z tforb $" + "STFINV_STFINVFIXEDSTF_H V1.0" #include diff --git a/contrib/stfinv/stfinvfourier.cc b/contrib/stfinv/stfinvfourier.cc index 637c01e446aae491c01bda424902a66ef83c1ef4..823fdfa148ee5f91ab4c85edab5a3fb62685ae3e 100644 --- a/contrib/stfinv/stfinvfourier.cc +++ b/contrib/stfinv/stfinvfourier.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvfourier.cc 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 08/05/2011 * @@ -32,16 +31,17 @@ * - 08/05/2011 V1.0 Thomas Forbriger * - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 04/10/2011 V1.2 correction in debug message + * - 14/10/2015 V1.3 new end-user usage functions * * ============================================================================ */ #define STFINV_STFINVFOURIER_CC_VERSION \ - "STFINV_STFINVFOURIER_CC V1.2" -#define STFINV_STFINVFOURIER_CC_CVSID \ - "$Id: stfinvfourier.cc 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINVFOURIER_CC V1.3" #include #include +#include +#include #include #include #include @@ -103,6 +103,13 @@ namespace stfinv { STFFourierDomainEngine::classhelp(os); } // void STFFourierDomainEngine::help(std::ostream& os) const + /*----------------------------------------------------------------------*/ + + void STFFourierDomainEngine::usage(std::ostream& os) const + { + STFFourierDomainEngine::classusage(os); + } // void STFFourierDomainEngine::usage(std::ostream& os) const + /*----------------------------------------------------------------------*/ @@ -110,6 +117,7 @@ namespace stfinv { { return("STFFourierDomainEngine"); } // const char const* STFFourierDomainEngine::name() const + /*----------------------------------------------------------------------*/ /*! \brief online help text giving information on options @@ -119,23 +127,25 @@ namespace stfinv { */ void STFFourierDomainEngine::classhelp(std::ostream& os) { - os << "Options and parameters in common for Fourier engines:\n" - << "fpad=f padding factor (default: 1.5)\n" - << "fpow2 use power of two\n" - << "fdiv=d use integer multiple of d\n" - << "tshift=d delay source correction filter wavelet by \"d\"\n" - << " seconds in order to expose acausal parts\n" - << "These options define the number of samples N used for the FFT.\n" - << "This should be larger than the number of samples M in the\n" - << "original series to avoid wrap-around. N=M*f at least. If fpow2\n" - << "is set, N will be the next power of 2 larger than M*f. Else if\n" - << "fdiv is set, N will be the next integer multiple of d larger\n" - << "than M*f." << std::endl; - Tbase::classhelp(os); + os << stfinvfourier_summary_usage; } // void STFFourierDomainEngine::classhelp(std::ostream& os) /*----------------------------------------------------------------------*/ + /*! \brief online help text giving information on options + * + * This must be kept synchronous with the options used by + * STFFourierDomainEngine::initialize() + */ + void STFFourierDomainEngine::classusage(std::ostream& os) + { + os << stfinvfourier_description_usage; + os << std::endl; + Tbase::classusage(os); + } // void STFFourierDomainEngine::classusage(std::ostream& os) + + /*----------------------------------------------------------------------*/ + /*! \brief Create FFT engines * * \par Number of samples diff --git a/contrib/stfinv/stfinvfourier.h b/contrib/stfinv/stfinvfourier.h index 6ca4ffd1be087b94b487e760b3c401076797f3f7..099937236d3767142e147c4e2fd34f59501631e9 100644 --- a/contrib/stfinv/stfinvfourier.h +++ b/contrib/stfinv/stfinvfourier.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvfourier.h 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 08/05/2011 * @@ -30,6 +29,7 @@ * REVISIONS and CHANGES * - 08/05/2011 V1.0 Thomas Forbriger * - 30/09/2011 V1.1 implemented handling of additional time series pairs + * - 14/10/2015 V1.2 new end-user usage functions * * ============================================================================ */ @@ -38,9 +38,7 @@ #ifndef STFINV_STFINVFOURIER_H_VERSION #define STFINV_STFINVFOURIER_H_VERSION \ - "STFINV_STFINVFOURIER_H V1.1" -#define STFINV_STFINVFOURIER_H_CVSID \ - "$Id: stfinvfourier.h 4968 2013-02-01 13:58:05Z lrehor $" + "STFINV_STFINVFOURIER_H V1.2" #include #include @@ -114,6 +112,10 @@ namespace stfinv { virtual void help(std::ostream& os=std::cout) const; //! \brief print online help static void classhelp(std::ostream& os=std::cout); + //! \brief print detailed description + virtual void usage(std::ostream& os=std::cout) const; + //! \brief print detailed description + static void classusage(std::ostream& os=std::cout); //! \brief return name of engine virtual const char* name() const; protected: diff --git a/contrib/stfinv/stfinvidentity.cc b/contrib/stfinv/stfinvidentity.cc index 38ffd6a9032d7698260244503684d7786dc2ee0e..e9ce7b5bed3c3afe1148ac71e1a4e5ac10a86dcc 100644 --- a/contrib/stfinv/stfinvidentity.cc +++ b/contrib/stfinv/stfinvidentity.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvidentity.cc 3986 2011-05-29 16:01:09Z tforb $ * \author Thomas Forbriger * \date 07/05/2011 * @@ -29,23 +28,31 @@ * * * REVISIONS and CHANGES - * - 07/05/2011 V1.0 Thomas Forbriger + * - 07/05/2011 V1.0 Thomas Forbriger (thof) + * - 21/02/2014 V1.1 implemented scaling to average weighted energy + * - 14/10/2015 V1.2 new end-user usage functions + * - 19/10/2015 V1.3 weight factor is defined in terms amplitude; apply + * square of weight to signal energy * * ============================================================================ */ #define STFINV_STFINVIDENTITY_CC_VERSION \ - "STFINV_STFINVIDENTITY_CC V1.0 " -#define STFINV_STFINVIDENTITY_CC_CVSID \ - "$Id: stfinvidentity.cc 3986 2011-05-29 16:01:09Z tforb $" + "STFINV_STFINVIDENTITY_CC V1.3" #include +#include +#include +#include +#include +#include +#include namespace stfinv { const char* const STFEngineIdentity::ID="ident"; const char* const STFEngineIdentity::description - ="identity: just apply a scalar factor"; + ="scale with amplitude factor"; /*----------------------------------------------------------------------*/ @@ -56,6 +63,13 @@ namespace stfinv { /*----------------------------------------------------------------------*/ + void STFEngineIdentity::usage(std::ostream& os) const + { + STFEngineIdentity::classusage(os); + } // void STFEngineIdentity::usage(std::ostream& os) const + + /*----------------------------------------------------------------------*/ + const char* STFEngineIdentity::name() const { return("STFEngineIdentity"); @@ -73,16 +87,42 @@ namespace stfinv { void STFEngineIdentity::exec() { - STFINV_assert(!Mscaleenergy, - "ERROR: energy scaling not yet implemented"); + // effective amplitude factor + double fac=1.; + + // scale to reproduce average energy if requested + if (Mscaleenergy) + { + double recording_sqrsum=0.;; + double synthetic_sqrsum=0.;; + for (unsigned int i=0; inreceivers(); ++i) + { + synthetic_sqrsum + += aff::func::sqrsum(this->synthetic(i)) + * this->weight(i) * this->weight(i); + recording_sqrsum + += aff::func::sqrsum(this->recording(i)) + * this->weight(i) * this->weight(i); + fac = std::sqrt(recording_sqrsum/synthetic_sqrsum); + } + } // if (Mscaleenergy) + Tseries stf=this->stf(); stf=0.; - stf(0)=1.; + stf(0)=fac/this->dt(); for (unsigned int i=0; inreceivers(); ++i) { Tseries::Tcoc synthetic=this->synthetic(i); Tseries convolvedsynthetic=this->convolvedsynthetic(i); convolvedsynthetic.copyin(synthetic); + if (Mscaleenergy) { convolvedsynthetic *= fac; } + } + for (unsigned int i=0; inpairs(); ++i) + { + Tseries::Tcoc series=this->series(i); + Tseries convolvedseries=this->convolvedseries(i); + convolvedseries.copyin(series); + if (Mscaleenergy) { convolvedseries *= fac; } } } // void STFEngineIdentity::exec() @@ -90,19 +130,22 @@ namespace stfinv { void STFEngineIdentity::classhelp(std::ostream& os) { - os << "class STFEngineIdentity (" - << STFEngineIdentity::ID << ")\n"; - os << STFEngineIdentity::description << "\n" << std::endl; - os << "This engine convolves the synthetic data with a discrete delta\n" - << "pulse so to speak. Optionally the delta-peak ist scale such that\n" - << "the convolved synthetics will be of equal scaled energy as the\n" - << "recordings.\n"; - os << "Options and parameters in common for Fourier engines:\n" - << "scaleenergy if flag is set: scale energy" - << std::endl; - Tbase::classhelp(os); + os << stfinvidentity_summary_usage; + os << std::endl; + stfinv::tools::report_engine_ID(os); } // void STFEngineIdentity::classhelp(std::ostream& os) + /*----------------------------------------------------------------------*/ + + void STFEngineIdentity::classusage(std::ostream& os) + { + os << stfinvidentity_description_usage; + os << std::endl; + Tbase::classusage(os); + os << std::endl; + stfinv::tools::report_engine_ID(os); + } // void STFEngineIdentity::classusage(std::ostream& os) + } // namespace stfinv /* ----- END OF stfinvidentity.cc ----- */ diff --git a/contrib/stfinv/stfinvidentity.h b/contrib/stfinv/stfinvidentity.h index 4df3b3bc0cca04b6525eea2038685522db13a59a..ca888a5cc8e39ee29fce868c04d1d6bd5ac28f62 100644 --- a/contrib/stfinv/stfinvidentity.h +++ b/contrib/stfinv/stfinvidentity.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvidentity.h 3986 2011-05-29 16:01:09Z tforb $ * \author Thomas Forbriger * \date 07/05/2011 * @@ -30,6 +29,7 @@ * * REVISIONS and CHANGES * - 07/05/2011 V1.0 Thomas Forbriger + * - 14/10/2015 V1.1 new end-user usage functions * * ============================================================================ */ @@ -38,9 +38,7 @@ #ifndef STFINV_STFINVIDENTITY_H_VERSION #define STFINV_STFINVIDENTITY_H_VERSION \ - "STFINV_STFINVIDENTITY_H V1.0 " -#define STFINV_STFINVIDENTITY_H_CVSID \ - "$Id: stfinvidentity.h 3986 2011-05-29 16:01:09Z tforb $" + "STFINV_STFINVIDENTITY_H V1.1" #include @@ -71,6 +69,15 @@ namespace stfinv { : Tbase(triples, stf, parameters), Mscaleenergy(false) { this->initialize(); } + /*! \brief Constructor. + */ + STFEngineIdentity(const stfinv::Tvectoroftriples& triples, + const stfinv::Waveform& stf, + const stfinv::Tvectorofpairs& pairs, + const std::string& parameters) + : Tbase(triples, stf, pairs, parameters), + Mscaleenergy(false) + { this->initialize(); } //! \brief abstract base requires virtual destructor virtual ~STFEngineIdentity() { } //! \brief Start engine @@ -79,6 +86,10 @@ namespace stfinv { virtual void help(std::ostream& os=std::cout) const; //! \brief print online help static void classhelp(std::ostream& os=std::cout); + //! \brief print detailed description + virtual void usage(std::ostream& os=std::cout) const; + //! \brief print detailed description + static void classusage(std::ostream& os=std::cout); //! \brief return name of engine virtual const char* name() const; private: diff --git a/contrib/stfinv/stfinvnormalize.cc b/contrib/stfinv/stfinvnormalize.cc index 7b10b0ac0d24417eebde9f0e78d956bbeda68224..8457d0acd6416f15e3c048c016bef210bc27daf2 100644 --- a/contrib/stfinv/stfinvnormalize.cc +++ b/contrib/stfinv/stfinvnormalize.cc @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvnormalize.cc 4164 2011-10-04 09:00:57Z tforb $ * \author Thomas Forbriger * \date 08/05/2011 * @@ -35,10 +34,11 @@ */ #define STFINV_STFINVNORMALIZE_CC_VERSION \ "STFINV_STFINVNORMALIZE_CC V1.0" -#define STFINV_STFINVNORMALIZE_CC_CVSID \ - "$Id: stfinvnormalize.cc 4164 2011-10-04 09:00:57Z tforb $" #include +#include +#include +#include namespace stfinv { @@ -65,14 +65,70 @@ namespace stfinv { void STFEngineNormalize::initialize() { - STFINV_illegal; + // scale energy + std::istringstream is (this->parameter("waterlevel","1.e-3")); + is >> Mwaterlevel; + STFINV_debug(Mdebug&1, "STFEngineNormalize::initialize()", + "Mwaterlevel=" << Mwaterlevel); + STFINV_assert(Mwaterlevel > 0, + "ERROR: parameter for option \"waterlevel\" not larger than 0"); } // void STFEngineNormalize::initialize() /*----------------------------------------------------------------------*/ void STFEngineNormalize::exec() { - STFINV_illegal; + // read signals and calculate FFT + this->fftinput(); + + // cycle through frequencies + // calculate weighted energy of all synthetic traces + Tseries syntheticenergy(0,this->nfreq()-1); + syntheticenergy=0.; + double totalsyntheticenergy=0.; + for (unsigned int i=0; infreq(); ++i) + { + TAspectrum syntheticref=this->syntheticcoeff(i); + for (unsigned int j=0; jnreceivers(); ++j) + { + syntheticenergy(i) += this->weight(j)*this->weight(j) + *std::norm(syntheticref(j)); + } + totalsyntheticenergy += syntheticenergy(i); + } + + // calculate waterlevel + double waterlevel=Mwaterlevel*totalsyntheticenergy/this->nfreq(); + + double weightsum=aff::func::sqrsum(this->weights()); + + for (unsigned int i=0; infreq(); ++i) + { + double recordingenergy=0.; + TAspectrum recordingref=this->recordingcoeff(i); + TAspectrum syntheticref=this->syntheticcoeff(i); + for (unsigned int j=0; jnreceivers(); ++j) + { + recordingenergy += this->weight(j)*this->weight(j) + *std::norm(recordingref(j)); + } + + double modulus + =std::sqrt(recordingenergy/(syntheticenergy(i)+waterlevel)); + + double phase = 0.; + for (unsigned int j=0; jnreceivers(); ++j) + { + phase += this->weight(j)* + (std::arg(recordingref(j))-std::arg(syntheticref(j))); + } + phase /= weightsum; + + this->stfcoeff(i)=std::polar(modulus, phase); + } // for (unsigned int i=0; infreq(); ++i) + + // provide results to user + this->fftoutput(); } // void STFEngineNormalize::exec() /*----------------------------------------------------------------------*/ @@ -82,8 +138,13 @@ namespace stfinv { os << "class STFEngineNormalize (" << STFEngineNormalize::ID << ")\n"; os << STFEngineNormalize::description << "\n" << std::endl; - os << "Options and parameters in common for Fourier engines:\n" - << "NOT YET IMPLEMENTED" + STFINV_illegal; + os << "DESCRIBE HERE\n" + << "A waterlevel as a fraction of the signal energy of the\n" + << "input synthetics is applied. If per receiver scaling is\n" + << "selected, the receivers will be weighted in the deconvolution.\n"; + os << "Options and parameters:\n" + << "waterlevel=l waterlevel to be applied for regularization." << std::endl; Tbase::classhelp(os); } // void STFEngineNormalize::classhelp(std::ostream& os) diff --git a/contrib/stfinv/stfinvnormalize.h b/contrib/stfinv/stfinvnormalize.h index b268b3a250feb0e604ccfbcc544b3dbfbde5727b..4077b433c1f8c8d37cd46a72a430f60fcda21836 100644 --- a/contrib/stfinv/stfinvnormalize.h +++ b/contrib/stfinv/stfinvnormalize.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: stfinvnormalize.h 4968 2013-02-01 13:58:05Z lrehor $ * \author Thomas Forbriger * \date 08/05/2011 * @@ -40,8 +39,6 @@ #define STFINV_STFINVNORMALIZE_H_VERSION \ "STFINV_STFINVNORMALIZE_H V1.1" -#define STFINV_STFINVNORMALIZE_H_CVSID \ - "$Id: stfinvnormalize.h 4968 2013-02-01 13:58:05Z lrehor $" #include @@ -70,6 +67,7 @@ namespace stfinv { * \f$f_l\f$ and receiver \f$k\f$ at offset \f$r_k\f$ and * - \f$s_{lk}\f$ is the Fourier coefficient of the corresponding * synthetics. + * * Then we seek a source correction filter with Fourier coefficients * \f$q_l\f$ such that * \f[ @@ -85,6 +83,45 @@ namespace stfinv { * \sum\limits_{k}\Im(\ln(s_{lk}\,q_l)) * \quad\forall\, l. * \f] + * + * Actually we will apply weights \f$w_k\f$ to data from different offsets + * \f$r_k\f$ such that + * \f[ + * \sum\limits_{k}\left|w_k\,d_{lk}\right|^2 + * = + * \sum\limits_{k}\left|w_k\,s_{lk}\,q_l\right|^2 + * \quad\forall\, l + * \f] + * and + * \f[ + * \sum\limits_{k}w_k\,\Im(\ln(d_{lk})) + * = + * \sum\limits_{k}w_k\,\Im(\ln(s_{lk}\,q_l)) + * \quad\forall\, l. + * \f] + * Additionally we will apply a waterlevel \f$\epsilon^2\f$, such that + * Fourier coefficients for which the average weighted energy of the + * synthetics is smaller than a fraction \f$\epsilon^2\f$ of the total + * average energy of the synthetics, will be damped. + * + * These conditions are satisfied by + * \f[ + * q_l=A_l\,e^{i\Phi_{l}} + * \f] + * with + * \f[ + * A_l=\sqrt{\frac{\sum\limits_{k}\left|w_k\,d_{lk}\right|^2}{ + * \sum\limits_{k}\left|w_k\,s_{lk}\right|^{2} + * + + * \frac{\epsilon^2}{N_{f}}\,\sum\limits_{k}\sum\limits_{l=0}^{N_{f}-1} + * \left|w_k\,s_{lk}\right|^2}} + * \f] + * and + * \f[ + * \Phi_{l}=\frac{\sum\limits_{k}w_{k}\left( + * \Im\left(\ln(d_{lk})\right)-\Im\left(\ln(s_{lk})\right) + * \right)}{\sum\limits_k w_{k}} + * \f] */ class STFEngineNormalize: public stfinv::STFFourierDomainEngine { public: @@ -117,6 +154,8 @@ namespace stfinv { // member data private: + //! \brief waterlevel + double Mwaterlevel; }; // class STFEngineNormalize } // namespace stfinv diff --git a/contrib/stfinv/test_libstfinv/README b/contrib/stfinv/test_libstfinv/README index a4ea8f1c1477917732193c85578a033f3810a5c8..8df795573becc3eb5cff46f5d7d920c0a583ae13 100644 --- a/contrib/stfinv/test_libstfinv/README +++ b/contrib/stfinv/test_libstfinv/README @@ -67,9 +67,5 @@ Information concerning copyright and license: along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - - - -P.S.: Please have a look at trunk/src/ts/wf/testcases/Makefile.soutifu to find +P.S.: Please have a look at src/ts/wf/testcases/Makefile.soutifu to find some rules to create test data diff --git a/contrib/stfinv/test_libstfinv/src/Makefile b/contrib/stfinv/test_libstfinv/src/Makefile index 5b5b56044c4e20414b904f0c46e78f204ba4ef2c..5fecfa7cf3dcf1716df13afb2fdb6fa42812dd81 100644 --- a/contrib/stfinv/test_libstfinv/src/Makefile +++ b/contrib/stfinv/test_libstfinv/src/Makefile @@ -24,6 +24,9 @@ #-------------------------------------------------------- # edit here: +CONTRIBDIR=../../.. +include $(CONTRIBDIR)/Makefile_var + CC=gcc diff --git a/contrib/stfinv/test_libstfinv_withpairs/src/Makefile b/contrib/stfinv/test_libstfinv_withpairs/src/Makefile index f07f35754fd0b42b8d2cd0cf35bd021aec065108..5fecfa7cf3dcf1716df13afb2fdb6fa42812dd81 100644 --- a/contrib/stfinv/test_libstfinv_withpairs/src/Makefile +++ b/contrib/stfinv/test_libstfinv_withpairs/src/Makefile @@ -1,8 +1,32 @@ # Makefile for Test_libstfinv +# +# Copyright (c) 2011 by Thomas Bohlen (KIT Karlsruhe) and Lisa Rehor (KIT Karlsruhe) +# +# This file was copied from the DENISE code and adjusted for its use +# in this test programme. +# +# ---- +# DENISE 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. +# +# DENISE 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 +# ---- #-------------------------------------------------------- # edit here: +CONTRIBDIR=../../.. +include $(CONTRIBDIR)/Makefile_var + CC=gcc diff --git a/contrib/stfinv/test_libstfinv_withpairs/src/Test_libstfinv.c b/contrib/stfinv/test_libstfinv_withpairs/src/Test_libstfinv.c index f62c2256563e644cda99d50d8a4efa043cf2f325..8bfef714c5678e13a3965ca2126e11f10b8dcebb 100644 --- a/contrib/stfinv/test_libstfinv_withpairs/src/Test_libstfinv.c +++ b/contrib/stfinv/test_libstfinv_withpairs/src/Test_libstfinv.c @@ -1,7 +1,22 @@ /*------------------------------------------------------------------------ * Test_libstfinv.c * - * Copyright (c) 2011 by Lisa Rehor (KIT Karlsruhe) + * Copyright (c) 2011 by Lisa Rehor (KIT Karlsruhe) and Martin Schaefer (KIT Karlsruhe) + * + * ---- + * 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 * ---------------------------------------------------------------------*/ @@ -171,7 +186,7 @@ for(tracl1=0;tracl1 + #ifndef SEGY_H #define SEGY_H -#define SU_NFLTS 32768 /* Arbitrary limit on data array size */ +#define SU_NFLTS 65535 /* Arbitrary limit on data array size */ +/* #define SU_NFLTS 32767 Arbitrary limit on data array size */ /* TYPEDEFS */ -#ifdef _CRAY typedef struct { /* segy - trace identification header */ - signed tracl :32; /* trace sequence number within line */ - - signed tracr :32; /* trace sequence number within reel */ - - signed fldr :32; /* field record number */ - - signed tracf :32; /* trace number within field record */ + int tracl; /* Trace sequence number within line + --numbers continue to increase if the + same line continues across multiple + SEG Y files. + byte# 1-4 + */ + + int tracr; /* Trace sequence number within SEG Y file + ---each file starts with trace sequence + one + byte# 5-8 + */ + + int fldr; /* Original field record number + byte# 9-12 + */ - signed ep :32; /* energy source point number */ + int tracf; /* Trace number within original field record + byte# 13-16 + */ - signed cdp :32; /* CDP ensemble number */ + int ep; /* energy source point number + ---Used when more than one record occurs + at the same effective surface location. + byte# 17-20 + */ - signed cdpt :32; /* trace number within CDP ensemble */ + int cdp; /* Ensemble number (i.e. CDP, CMP, CRP,...) + byte# 21-24 + */ - signed trid :16; /* trace identification code: - 1 = seismic data - 2 = dead - 3 = dummy - 4 = time break - 5 = uphole - 6 = sweep - 7 = timing - 8 = water break - 9---, N = optional use (N = 32,767) + int cdpt; /* trace number within the ensemble + ---each ensemble starts with trace number one. + byte# 25-28 + */ + + short trid; /* trace identification code: + -1 = Other + 0 = Unknown + 1 = Seismic data + 2 = Dead + 3 = Dummy + 4 = Time break + 5 = Uphole + 6 = Sweep + 7 = Timing + 8 = Water break + 9 = Near-field gun signature + 10 = Far-field gun signature + 11 = Seismic pressure sensor + 12 = Multicomponent seismic sensor + - Vertical component + 13 = Multicomponent seismic sensor + - Cross-line component + 14 = Multicomponent seismic sensor + - in-line component + 15 = Rotated multicomponent seismic sensor + - Vertical component + 16 = Rotated multicomponent seismic sensor + - Transverse component + 17 = Rotated multicomponent seismic sensor + - Radial component + 18 = Vibrator reaction mass + 19 = Vibrator baseplate + 20 = Vibrator estimated ground force + 21 = Vibrator reference + 22 = Time-velocity pairs + 23 ... N = optional use + (maximum N = 32,767) Following are CWP id flags: - 9 = autocorrelation - - 10 = Fourier transformed - no packing + 109 = autocorrelation + 110 = Fourier transformed - no packing xr[0],xi[0], ..., xr[N-1],xi[N-1] - - 11 = Fourier transformed - unpacked Nyquist + 111 = Fourier transformed - unpacked Nyquist xr[0],xi[0],...,xr[N/2],xi[N/2] - - 12 = Fourier transformed - packed Nyquist + 112 = Fourier transformed - packed Nyquist even N: xr[0],xr[N/2],xr[1],xi[1], ..., xr[N/2 -1],xi[N/2 -1] @@ -75,726 +124,556 @@ typedef struct { /* segy - trace identification header */ xr[0],xr[(N-1)/2],xr[1],xi[1], ..., xr[(N-1)/2 -1],xi[(N-1)/2 -1],xi[(N-1)/2] (note the exceptional second & last entries) - - 13 = Complex signal in the time domain + 113 = Complex signal in the time domain xr[0],xi[0], ..., xr[N-1],xi[N-1] - - 14 = Fourier transformed - amplitude/phase + 114 = Fourier transformed - amplitude/phase a[0],p[0], ..., a[N-1],p[N-1] - - 15 = Complex time signal - amplitude/phase + 115 = Complex time signal - amplitude/phase a[0],p[0], ..., a[N-1],p[N-1] - - 16 = Real part of complex trace from 0 to Nyquist - - 17 = Imag part of complex trace from 0 to Nyquist - - 18 = Amplitude of complex trace from 0 to Nyquist - - 19 = Phase of complex trace from 0 to Nyquist - - 21 = Wavenumber time domain (k-t) - - 22 = Wavenumber frequency (k-omega) - - 23 = Envelope of the complex time trace - - 24 = Phase of the complex time trace - - 25 = Frequency of the complex time trace - - 30 = Depth-Range (z-x) traces - - 101 = Seismic data packed to bytes (by supack1) - - 102 = Seismic data packed to 2 bytes (by supack2) + 116 = Real part of complex trace from 0 to Nyquist + 117 = Imag part of complex trace from 0 to Nyquist + 118 = Amplitude of complex trace from 0 to Nyquist + 119 = Phase of complex trace from 0 to Nyquist + 121 = Wavenumber time domain (k-t) + 122 = Wavenumber frequency (k-omega) + 123 = Envelope of the complex time trace + 124 = Phase of the complex time trace + 125 = Frequency of the complex time trace + 130 = Depth-Range (z-x) traces + 201 = Seismic data packed to bytes (by supack1) + 202 = Seismic data packed to 2 bytes (by supack2) + byte# 29-30 */ - signed nvs :16; /* number of vertically summed traces (see vscode - in bhed structure) */ - - signed nhs :16; /* number of horizontally summed traces (see vscode - in bhed structure) */ - - signed duse :16; /* data use: - 1 = production - 2 = test */ - - signed offset :32; /* distance from source point to receiver - group (negative if opposite to direction - in which the line was shot) */ - - signed gelev :32; /* receiver group elevation from sea level - (above sea level is positive) */ - - signed selev :32; /* source elevation from sea level - (above sea level is positive) */ - - signed sdepth :32; /* source depth (positive) */ - - signed gdel :32; /* datum elevation at receiver group */ - - signed sdel :32; /* datum elevation at source */ - - signed swdep :32; /* water depth at source */ + short nvs; /* Number of vertically summed traces yielding + this trace. (1 is one trace, + 2 is two summed traces, etc.) + byte# 31-32 + */ + + short nhs; /* Number of horizontally summed traces yielding + this trace. (1 is one trace + 2 is two summed traces, etc.) + byte# 33-34 + */ + + short duse; /* Data use: + 1 = Production + 2 = Test + byte# 35-36 + */ + + int offset; /* Distance from the center of the source point + to the center of the receiver group + (negative if opposite to direction in which + the line was shot). + byte# 37-40 + */ + + int gelev; /* Receiver group elevation from sea level + (all elevations above the Vertical datum are + positive and below are negative). + byte# 41-44 + */ + + int selev; /* Surface elevation at source. + byte# 45-48 + */ + + int sdepth; /* Source depth below surface (a positive number). + byte# 49-52 + */ + + int gdel; /* Datum elevation at receiver group. + byte# 53-56 + */ - signed gwdep :32; /* water depth at receiver group */ + int sdel; /* Datum elevation at source. + byte# 57-60 + */ - signed scalel :16; /* scale factor for previous 7 entries - with value plus or minus 10 to the - power 0, 1, 2, 3, or 4 (if positive, - multiply, if negative divide) */ + int swdep; /* Water depth at source. + byte# 61-64 + */ - signed scalco :16; /* scale factor for next 4 entries - with value plus or minus 10 to the - power 0, 1, 2, 3, or 4 (if positive, - multiply, if negative divide) */ + int gwdep; /* Water depth at receiver group. + byte# 65-68 + */ - signed sx :32; /* X source coordinate */ + short scalel; /* Scalar to be applied to the previous 7 entries + to give the real value. + Scalar = 1, +10, +100, +1000, +10000. + If positive, scalar is used as a multiplier, + if negative, scalar is used as a divisor. + byte# 69-70 + */ + + short scalco; /* Scalar to be applied to the next 4 entries + to give the real value. + Scalar = 1, +10, +100, +1000, +10000. + If positive, scalar is used as a multiplier, + if negative, scalar is used as a divisor. + byte# 71-72 + */ + + int sx; /* Source coordinate - X + byte# 73-76 + */ - signed sy :32; /* Y source coordinate */ + int sy; /* Source coordinate - Y + byte# 77-80 + */ - signed gx :32; /* X group coordinate */ + int gx; /* Group coordinate - X + byte# 81-84 + */ - signed gy :32; /* Y group coordinate */ + int gy; /* Group coordinate - Y + byte# 85-88 + */ - signed counit :16; /* coordinate units code: - for previous four entries - 1 = length (meters or feet) - 2 = seconds of arc (in this case, the - X values are longitude and the Y values - are latitude, a positive value designates - the number of seconds east of Greenwich - or north of the equator */ + short counit; /* Coordinate units: (for previous 4 entries and + for the 7 entries before scalel) + 1 = Length (meters or feet) + 2 = Seconds of arc + 3 = Decimal degrees + 4 = Degrees, minutes, seconds (DMS) + + In case 2, the X values are longitude and + the Y values are latitude, a positive value designates + the number of seconds east of Greenwich + or north of the equator + + In case 4, to encode +-DDDMMSS + counit = +-DDD*10^4 + MM*10^2 + SS, + with scalco = 1. To encode +-DDDMMSS.ss + counit = +-DDD*10^6 + MM*10^4 + SS*10^2 + with scalco = -100. + byte# 89-90 + */ - signed wevel :16; /* weathering velocity */ + short wevel; /* Weathering velocity. + byte# 91-92 + */ - signed swevel :16; /* subweathering velocity */ + short swevel; /* Subweathering velocity. + byte# 93-94 + */ - signed sut :16; /* uphole time at source */ + short sut; /* Uphole time at source in milliseconds. + byte# 95-96 + */ - signed gut :16; /* uphole time at receiver group */ + short gut; /* Uphole time at receiver group in milliseconds. + byte# 97-98 + */ - signed sstat :16; /* source static correction */ + short sstat; /* Source static correction in milliseconds. + byte# 99-100 + */ - signed gstat :16; /* group static correction */ + short gstat; /* Group static correction in milliseconds. + byte# 101-102 + */ - signed tstat :16; /* total static applied */ + short tstat; /* Total static applied in milliseconds. + (Zero if no static has been applied.) + byte# 103-104 + */ - signed laga :16; /* lag time A, time in ms between end of 240- + short laga; /* Lag time A, time in ms between end of 240- byte trace identification header and time break, positive if time break occurs after end of header, time break is defined as the initiation pulse which maybe recorded on an auxiliary trace or as otherwise - specified by the recording system */ + specified by the recording system + byte# 105-106 + */ - signed lagb :16; /* lag time B, time in ms between the time break + short lagb; /* lag time B, time in ms between the time break and the initiation time of the energy source, - may be positive or negative */ + may be positive or negative + byte# 107-108 + */ - signed delrt :16; /* delay recording time, time in ms between + short delrt; /* delay recording time, time in ms between initiation time of energy source and time when recording of data samples begins (for deep water work if recording does not - start at zero time) */ + start at zero time) + byte# 109-110 + */ - signed muts :16; /* mute time--start */ + short muts; /* mute time--start + byte# 111-112 + */ - signed mute :16; /* mute time--end */ + short mute; /* mute time--end + byte# 113-114 + */ - unsigned ns :16; /* number of samples in this trace */ + unsigned short ns; /* number of samples in this trace + byte# 115-116 + */ - unsigned dt :16; /* sample interval; in micro-seconds */ + unsigned short dt; /* sample interval; in micro-seconds + byte# 117-118 + */ - signed gain :16; /* gain type of field instruments code: + short gain; /* gain type of field instruments code: 1 = fixed 2 = binary 3 = floating point - 4 ---- N = optional use */ + 4 ---- N = optional use + byte# 119-120 + */ - signed igc :16; /* instrument gain constant */ + short igc; /* instrument gain constant + byte# 121-122 + */ - signed igi :16; /* instrument early or initial gain */ + short igi; /* instrument early or initial gain + byte# 123-124 + */ - signed corr :16; /* correlated: + short corr; /* correlated: 1 = no - 2 = yes */ + 2 = yes + byte# 125-126 + */ - signed sfs :16; /* sweep frequency at start */ + short sfs; /* sweep frequency at start + byte# 127-128 + */ - signed sfe :16; /* sweep frequency at end */ + short sfe; /* sweep frequency at end + byte# 129-130 + */ - signed slen :16; /* sweep length in ms */ + short slen; /* sweep length in ms + byte# 131-132 + */ - signed styp :16; /* sweep type code: + short styp; /* sweep type code: 1 = linear 2 = cos-squared - 3 = other */ + 3 = other + byte# 133-134 + */ - signed stas :16; /* sweep trace length at start in ms */ + short stas; /* sweep trace length at start in ms + byte# 135-136 + */ - signed stae :16; /* sweep trace length at end in ms */ + short stae; /* sweep trace length at end in ms + byte# 137-138 + */ - signed tatyp :16; /* taper type: 1=linear, 2=cos^2, 3=other */ + short tatyp; /* taper type: 1=linear, 2=cos^2, 3=other + byte# 139-140 + */ - signed afilf :16; /* alias filter frequency if used */ + short afilf; /* alias filter frequency if used + byte# 141-142 + */ - signed afils :16; /* alias filter slope */ + short afils; /* alias filter slope + byte# 143-144 + */ - signed nofilf :16; /* notch filter frequency if used */ + short nofilf; /* notch filter frequency if used + byte# 145-146 + */ - signed nofils :16; /* notch filter slope */ + short nofils; /* notch filter slope + byte# 147-148 + */ - signed lcf :16; /* low cut frequency if used */ + short lcf; /* low cut frequency if used + byte# 149-150 + */ - signed hcf :16; /* high cut frequncy if used */ + short hcf; /* high cut frequncy if used + byte# 151-152 + */ - signed lcs :16; /* low cut slope */ + short lcs; /* low cut slope + byte# 153-154 + */ - signed hcs :16; /* high cut slope */ + short hcs; /* high cut slope + byte# 155-156 + */ - signed year :16; /* year data recorded */ + short year; /* year data recorded + byte# 157-158 + */ - signed day :16; /* day of year */ + short day; /* day of year + byte# 159-160 + */ - signed hour :16; /* hour of day (24 hour clock) */ + short hour; /* hour of day (24 hour clock) + byte# 161-162 + */ - signed minute :16; /* minute of hour */ + short minute; /* minute of hour + byte# 163-164 + */ - signed sec :16; /* second of minute */ + short sec; /* second of minute + byte# 165-166 + */ - signed timbas :16; /* time basis code: + short timbas; /* time basis code: 1 = local 2 = GMT - 3 = other */ + 3 = other + byte# 167-168 + */ - signed trwf :16; /* trace weighting factor, defined as 1/2^N - volts for the least sigificant bit */ + short trwf; /* trace weighting factor, defined as 1/2^N + volts for the least sigificant bit + byte# 169-170 + */ - signed grnors :16; /* geophone group number of roll switch - position one */ + short grnors; /* geophone group number of roll switch + position one + byte# 171-172 + */ - signed grnofr :16; /* geophone group number of trace one within - original field record */ + short grnofr; /* geophone group number of trace one within + original field record + byte# 173-174 + */ - signed grnlof :16; /* geophone group number of last trace within - original field record */ + short grnlof; /* geophone group number of last trace within + original field record + byte# 175-176 + */ - signed gaps :16; /* gap size (total number of groups dropped) */ + short gaps; /* gap size (total number of groups dropped) + byte# 177-178 + */ - signed otrav :16; /* overtravel taper code: + short otrav; /* overtravel taper code: 1 = down (or behind) - 2 = up (or ahead) */ + 2 = up (or ahead) + byte# 179-180 + */ - /* local assignments */ +#ifdef SLTSU_SEGY_H /* begin Unocal SU segy.h differences */ -/* signed pad :32; */ /* double word alignment for Cray 64-bit floats */ - float d1; /* sample spacing for non-seismic data */ + /* cwp local assignments */ + float d1; /* sample spacing for non-seismic data + byte# 181-184 + */ - float f1; /* first sample location for non-seismic data */ + float f1; /* first sample location for non-seismic data + byte# 185-188 + */ - float d2; /* sample spacing between traces */ + float d2; /* sample spacing between traces + byte# 189-192 + */ - float f2; /* first trace location */ + float f2; /* first trace location + byte# 193-196 + */ float ungpow; /* negative of power used for dynamic - range compression */ + range compression + byte# 197-200 + */ float unscale; /* reciprocal of scaling factor to normalize - range */ - signed ntr :32; /* number of traces */ - - signed mark :16; /* mark selected traces */ - - signed unass :16; /* unassigned values */ - - float data[SU_NFLTS]; - -} segy; - - -typedef struct { /* bhed - binary header */ - - int jobid :32; /* job identification number */ - - int lino :32; /* line number (only one line per reel) */ - - int reno :32; /* reel number */ - - short ntrpr :16; /* number of data traces per record */ - - short nart :16; /* number of auxiliary traces per record */ - - short hdt :16; /* sample interval in micro secs for this reel */ - - short dto :16; /* same for original field recording */ - - short hns :16; /* number of samples per trace for this reel */ - - short nso :16; /* same for original field recording */ - - short format :16; /* data sample format code: - 1 = floating point (4 bytes) - 2 = fixed point (4 bytes) - 3 = fixed point (2 bytes) - 4 = fixed point w/gain code (4 bytes) */ - - short fold :16; /* CDP fold expected per CDP ensemble */ - - short tsort :16; /* trace sorting code: - 1 = as recorded (no sorting) - 2 = CDP ensemble - 3 = single fold continuous profile - 4 = horizontally stacked */ - - short vscode :16; /* vertical sum code: - 1 = no sum - 2 = two sum ... - N = N sum (N = 32,767) */ - - short hsfs :16; /* sweep frequency at start */ - - short hsfe :16; /* sweep frequency at end */ - - short hslen :16; /* sweep length (ms) */ - - short hstyp :16; /* sweep type code: - 1 = linear - 2 = parabolic - 3 = exponential - 4 = other */ - - short schn :16; /* trace number of sweep channel */ - - short hstas :16; /* sweep trace taper length at start if - tapered (the taper starts at zero time - and is effective for this length) */ - - short hstae :16; /* sweep trace taper length at end (the ending - taper starts at sweep length minus the taper - length at end) */ - - short htatyp :16; /* sweep trace taper type code: - 1 = linear - 2 = cos-squared - 3 = other */ - - short hcorr :16; /* correlated data traces code: - 1 = no - 2 = yes */ - - short bgrcv :16; /* binary gain recovered code: - 1 = yes - 2 = no */ - - short rcvm :16; /* amplitude recovery method code: - 1 = none - 2 = spherical divergence - 3 = AGC - 4 = other */ - - short mfeet :16; /* measurement system code: - 1 = meters - 2 = feet */ - - short polyt :16; /* impulse signal polarity code: - 1 = increase in pressure or upward - geophone case movement gives - negative number on tape - 2 = increase in pressure or upward - geophone case movement gives - positive number on tape */ - - short vpol :16; /* vibratory polarity code: - code seismic signal lags pilot by - 1 337.5 to 22.5 degrees - 2 22.5 to 67.5 degrees - 3 67.5 to 112.5 degrees - 4 112.5 to 157.5 degrees - 5 157.5 to 202.5 degrees - 6 202.5 to 247.5 degrees - 7 247.5 to 292.5 degrees - 8 293.5 to 337.5 degrees */ - - signed pad :32; /* double word alignment pad */ - - double hunass[21]; /* unassigned, double is portable! */ - -} bhed; - -#else /* bit fields may not be portable! */ - -typedef struct { /* segy - trace identification header */ - - int tracl ; /* trace sequence number within line */ - - int tracr ; /* trace sequence number within reel */ - - int fldr ; /* field record number */ - - int tracf ; /* trace number within field record */ - - int ep ; /* energy source point number */ - - int cdp ; /* CDP ensemble number */ - - int cdpt ; /* trace number within CDP ensemble */ - - short trid ; /* trace identification code: - 1 = seismic data - 2 = dead - 3 = dummy - 4 = time break - 5 = uphole - 6 = sweep - 7 = timing - 8 = water break - 9---, N = optional use (N = 32,767) - - Following are CWP id flags: - - 9 = autocorrelation - - 10 = Fourier transformed - no packing - xr[0],xi[0], ..., xr[N-1],xi[N-1] - - 11 = Fourier transformed - unpacked Nyquist - xr[0],xi[0],...,xr[N/2],xi[N/2] - - 12 = Fourier transformed - packed Nyquist - even N: - xr[0],xr[N/2],xr[1],xi[1], ..., - xr[N/2 -1],xi[N/2 -1] - (note the exceptional second entry) - odd N: - xr[0],xr[(N-1)/2],xr[1],xi[1], ..., - xr[(N-1)/2 -1],xi[(N-1)/2 -1],xi[(N-1)/2] - (note the exceptional second & last entries) - - 13 = Complex signal in the time domain - xr[0],xi[0], ..., xr[N-1],xi[N-1] - - 14 = Fourier transformed - amplitude/phase - a[0],p[0], ..., a[N-1],p[N-1] - - 15 = Complex time signal - amplitude/phase - a[0],p[0], ..., a[N-1],p[N-1] - - 16 = Real part of complex trace from 0 to Nyquist - - 17 = Imag part of complex trace from 0 to Nyquist - - 18 = Amplitude of complex trace from 0 to Nyquist - - 19 = Phase of complex trace from 0 to Nyquist - - 21 = Wavenumber time domain (k-t) - - 22 = Wavenumber frequency (k-omega) - - 23 = Envelope of the complex time trace - - 24 = Phase of the complex time trace - - 25 = Frequency of the complex time trace - - 30 = Depth-Range (z-x) traces - - 101 = Seismic data packed to bytes (by supack1) - - 102 = Seismic data packed to 2 bytes (by supack2) + range + byte# 201-204 */ - short nvs ; /* number of vertically summed traces (see vscode - in bhed structure) */ - - short nhs ; /* number of horizontally summed traces (see vscode - in bhed structure) */ - - short duse ; /* data use: - 1 = production - 2 = test */ - - int offset ; /* distance from source point to receiver - group (negative if opposite to direction - in which the line was shot) */ - - int gelev ; /* receiver group elevation from sea level - (above sea level is positive) */ - - int selev ; /* source elevation from sea level - (above sea level is positive) */ - - int sdepth ; /* source depth (positive) */ - - int gdel ; /* datum elevation at receiver group */ - - int sdel ; /* datum elevation at source */ - - int swdep ; /* water depth at source */ - - int gwdep ; /* water depth at receiver group */ - - short scalel ; /* scale factor for previous 7 entries - with value plus or minus 10 to the - power 0, 1, 2, 3, or 4 (if positive, - multiply, if negative divide) */ - - short scalco ; /* scale factor for next 4 entries - with value plus or minus 10 to the - power 0, 1, 2, 3, or 4 (if positive, - multiply, if negative divide) */ - - int sx ; /* X source coordinate */ - - int sy ; /* Y source coordinate */ - - int gx ; /* X group coordinate */ - - int gy ; /* Y group coordinate */ - - short counit ; /* coordinate units code: - for previous four entries - 1 = length (meters or feet) - 2 = seconds of arc (in this case, the - X values are longitude and the Y values - are latitude, a positive value designates - the number of seconds east of Greenwich - or north of the equator */ - - short wevel ; /* weathering velocity */ - - short swevel ; /* subweathering velocity */ - - short sut ; /* uphole time at source */ - - short gut ; /* uphole time at receiver group */ - - short sstat ; /* source static correction */ - - short gstat ; /* group static correction */ - - short tstat ; /* total static applied */ - - short laga ; /* lag time A, time in ms between end of 240- - byte trace identification header and time - break, positive if time break occurs after - end of header, time break is defined as - the initiation pulse which maybe recorded - on an auxiliary trace or as otherwise - specified by the recording system */ - - short lagb ; /* lag time B, time in ms between the time break - and the initiation time of the energy source, - may be positive or negative */ - - short delrt ; /* delay recording time, time in ms between - initiation time of energy source and time - when recording of data samples begins - (for deep water work if recording does not - start at zero time) */ - - short muts ; /* mute time--start */ - - short mute ; /* mute time--end */ - - unsigned short ns ; /* number of samples in this trace */ - - unsigned short dt ; /* sample interval; in micro-seconds */ - - short gain ; /* gain type of field instruments code: - 1 = fixed - 2 = binary - 3 = floating point - 4 ---- N = optional use */ - - short igc ; /* instrument gain constant */ - - short igi ; /* instrument early or initial gain */ - - short corr ; /* correlated: - 1 = no - 2 = yes */ - - short sfs ; /* sweep frequency at start */ - - short sfe ; /* sweep frequency at end */ - - short slen ; /* sweep length in ms */ - - short styp ; /* sweep type code: - 1 = linear - 2 = cos-squared - 3 = other */ - - short stas ; /* sweep trace length at start in ms */ - - short stae ; /* sweep trace length at end in ms */ - - short tatyp ; /* taper type: 1=linear, 2=cos^2, 3=other */ - - short afilf ; /* alias filter frequency if used */ - - short afils ; /* alias filter slope */ - - short nofilf ; /* notch filter frequency if used */ - - short nofils ; /* notch filter slope */ - - short lcf ; /* low cut frequency if used */ - - short hcf ; /* high cut frequncy if used */ - - short lcs ; /* low cut slope */ - - short hcs ; /* high cut slope */ - - short year ; /* year data recorded */ - - short day ; /* day of year */ + short mark; /* mark selected traces + byte# 205-206 + */ - short hour ; /* hour of day (24 hour clock) */ + /* SLTSU local assignments */ + short mutb; /* mute time at bottom (start time) + bottom mute ends at last sample + byte# 207-208 + */ + float dz; /* depth sampling interval in (m or ft) + if =0.0, input are time samples + byte# 209-212 + */ - short minute ; /* minute of hour */ + float fz; /* depth of first sample in (m or ft) + byte# 213-116 + */ - short sec ; /* second of minute */ + short n2; /* number of traces per cdp or per shot + byte# 217-218 + */ - short timbas ; /* time basis code: - 1 = local - 2 = GMT - 3 = other */ + short shortpad; /* alignment padding + byte# 219-220 + */ - short trwf ; /* trace weighting factor, defined as 1/2^N - volts for the least sigificant bit */ + int ntr; /* number of traces + byte# 221-224 + */ - short grnors ; /* geophone group number of roll switch - position one */ + /* SLTSU local assignments end */ - short grnofr ; /* geophone group number of trace one within - original field record */ + short unass[8]; /* unassigned + byte# 225-240 + */ - short grnlof ; /* geophone group number of last trace within - original field record */ +#else - short gaps ; /* gap size (total number of groups dropped) */ + /* cwp local assignments */ + float d1; /* sample spacing for non-seismic data + byte# 181-184 + */ - short otrav ; /* overtravel taper code: - 1 = down (or behind) - 2 = up (or ahead) */ + float f1; /* first sample location for non-seismic data + byte# 185-188 + */ - /* local assignments */ + float d2; /* sample spacing between traces + byte# 189-192 + */ - float d1; /* sample spacing for non-seismic data */ + float f2; /* first trace location + byte# 193-196 + */ - float f1; /* first sample location for non-seismic data */ + float ungpow; /* negative of power used for dynamic + range compression + byte# 197-200 + */ - float d2; /* sample spacing between traces */ + float unscale; /* reciprocal of scaling factor to normalize + range + byte# 201-204 + */ - float f2; /* first trace location */ + int ntr; /* number of traces + byte# 205-208 + */ - float ungpow; /* negative of power used for dynamic - range compression */ + short mark; /* mark selected traces + byte# 209-210 + */ - float unscale; /* reciprocal of scaling factor to normalize - range */ - int ntr ; /* number of traces */ + short shortpad; /* alignment padding + byte# 211-212 + */ - short mark ; /* mark selected traces */ - short unass[15]; /* unassigned values */ + short unass[14]; /* unassigned--NOTE: last entry causes + a break in the word alignment, if we REALLY + want to maintain 240 bytes, the following + entry should be an odd number of short/UINT2 + OR do the insertion above the "mark" keyword + entry + byte# 213-240 + */ +#endif - float data[SU_NFLTS]; + float data[SU_NFLTS]; } segy; typedef struct { /* bhed - binary header */ - int jobid ; /* job identification number */ + int jobid; /* job identification number */ - int lino ; /* line number (only one line per reel) */ + int lino; /* line number (only one line per reel) */ - int reno ; /* reel number */ + int reno; /* reel number */ - short ntrpr ; /* number of data traces per record */ + short ntrpr; /* number of data traces per record */ - short nart ; /* number of auxiliary traces per record */ + short nart; /* number of auxiliary traces per record */ - short hdt ; /* sample interval in micro secs for this reel */ + unsigned short hdt; /* sample interval in micro secs for this reel */ - short dto ; /* same for original field recording */ + unsigned short dto; /* same for original field recording */ - short hns ; /* number of samples per trace for this reel */ + unsigned short hns; /* number of samples per trace for this reel */ - short nso ; /* same for original field recording */ + unsigned short nso; /* same for original field recording */ - short format ; /* data sample format code: - 1 = floating point (4 bytes) - 2 = fixed point (4 bytes) - 3 = fixed point (2 bytes) - 4 = fixed point w/gain code (4 bytes) */ + short format; /* data sample format code: + 1 = floating point, 4 byte (32 bits) + 2 = fixed point, 4 byte (32 bits) + 3 = fixed point, 2 byte (16 bits) + 4 = fixed point w/gain code, 4 byte (32 bits) + 5 = IEEE floating point, 4 byte (32 bits) + 8 = two's complement integer, 1 byte (8 bits) + */ - short fold ; /* CDP fold expected per CDP ensemble */ + short fold; /* CDP fold expected per CDP ensemble */ - short tsort ; /* trace sorting code: + short tsort; /* trace sorting code: 1 = as recorded (no sorting) 2 = CDP ensemble 3 = single fold continuous profile 4 = horizontally stacked */ - short vscode ; /* vertical sum code: + short vscode; /* vertical sum code: 1 = no sum 2 = two sum ... N = N sum (N = 32,767) */ - short hsfs ; /* sweep frequency at start */ + short hsfs; /* sweep frequency at start */ - short hsfe ; /* sweep frequency at end */ + short hsfe; /* sweep frequency at end */ - short hslen ; /* sweep length (ms) */ + short hslen; /* sweep length (ms) */ - short hstyp ; /* sweep type code: + short hstyp; /* sweep type code: 1 = linear 2 = parabolic 3 = exponential 4 = other */ - short schn ; /* trace number of sweep channel */ + short schn; /* trace number of sweep channel */ - short hstas ; /* sweep trace taper length at start if + short hstas; /* sweep trace taper length at start if tapered (the taper starts at zero time and is effective for this length) */ - short hstae ; /* sweep trace taper length at end (the ending + short hstae; /* sweep trace taper length at end (the ending taper starts at sweep length minus the taper length at end) */ - short htatyp ; /* sweep trace taper type code: + short htatyp; /* sweep trace taper type code: 1 = linear 2 = cos-squared 3 = other */ - short hcorr ; /* correlated data traces code: + short hcorr; /* correlated data traces code: 1 = no 2 = yes */ - short bgrcv ; /* binary gain recovered code: + short bgrcv; /* binary gain recovered code: 1 = yes 2 = no */ - short rcvm ; /* amplitude recovery method code: + short rcvm; /* amplitude recovery method code: 1 = none 2 = spherical divergence 3 = AGC 4 = other */ - short mfeet ; /* measurement system code: + short mfeet; /* measurement system code: 1 = meters 2 = feet */ - short polyt ; /* impulse signal polarity code: + short polyt; /* impulse signal polarity code: 1 = increase in pressure or upward geophone case movement gives negative number on tape @@ -802,7 +681,7 @@ typedef struct { /* bhed - binary header */ geophone case movement gives positive number on tape */ - short vpol ; /* vibratory polarity code: + short vpol; /* vibratory polarity code: code seismic signal lags pilot by 1 337.5 to 22.5 degrees 2 22.5 to 67.5 degrees @@ -813,26 +692,22 @@ typedef struct { /* bhed - binary header */ 7 247.5 to 292.5 degrees 8 293.5 to 337.5 degrees */ - char pad[4] ; /* double word alignment pad */ - - int hunass[42]; /* unassigned */ + short hunass[170]; /* unassigned */ } bhed; -#endif /* end of ifdef CRAY, the bit fields are not portable */ - /* DEFINES */ #define gettr(x) fgettr(stdin, (x)) #define vgettr(x) fvgettr(stdin, (x)) #define puttr(x) fputtr(stdout, (x)) +#define vputtr(x) fvputtr(stdout, (x)) #define gettra(x, y) fgettra(stdin, (x), (y)) -/* The following refer to the trid field in segy.h */ -/* CHARPACK represents byte packed seismic data from supack1 */ -#define CHARPACK 101 -/* SHORTPACK represents 2 byte packed seismic data from supack2 */ -#define SHORTPACK 102 +/* TOTHER represents "other" */ +#define TOTHER -1 +/* TUNK represents time traces of an unknown type */ +#define TUNK 0 /* TREAL represents real time traces */ #define TREAL 1 /* TDEAD represents dead time traces */ @@ -849,54 +724,116 @@ typedef struct { /* bhed - binary header */ #define TIMING 7 /* WBREAK represents timing traces */ #define WBREAK 8 - +/* NFGUNSIG represents near field gun signature */ +#define NFGUNSIG 9 +/* FFGUNSIG represents far field gun signature */ +#define FFGUNSIG 10 +/* SPSENSOR represents seismic pressure sensor */ +#define SPSENSOR 11 +/* TVERT represents multicomponent seismic sensor + - vertical component */ +#define TVERT 12 +/* TXLIN represents multicomponent seismic sensor + - cross-line component */ +#define TXLIN 13 +/* TINLIN represents multicomponent seismic sensor + - in-line component */ +#define TINLIN 14 +/* ROTVERT represents rotated multicomponent seismic sensor + - vertical component */ +#define ROTVERT 15 +/* TTRANS represents rotated multicomponent seismic sensor + - transverse component */ +#define TTRANS 16 +/* TRADIAL represents rotated multicomponent seismic sensor + - radial component */ +#define TRADIAL 17 +/* VRMASS represents vibrator reaction mass */ +#define VRMASS 18 +/* VBASS represents vibrator baseplate */ +#define VBASS 19 +/* VEGF represents vibrator estimated ground force */ +#define VEGF 20 +/* VREF represents vibrator reference */ +#define VREF 21 + +/*** CWP trid assignments ***/ +/* ACOR represents autocorrelation */ +#define ACOR 109 +/* FCMPLX represents fourier transformed - no packing + xr[0],xi[0], ..., xr[N-1],xi[N-1] */ +#define FCMPLX 110 +/* FUNPACKNYQ represents fourier transformed - unpacked Nyquist + xr[0],xi[0],...,xr[N/2],xi[N/2] */ +#define FUNPACKNYQ 111 +/* FTPACK represents fourier transformed - packed Nyquist + even N: xr[0],xr[N/2],xr[1],xi[1], ..., + xr[N/2 -1],xi[N/2 -1] + (note the exceptional second entry) + odd N: + xr[0],xr[(N-1)/2],xr[1],xi[1], ..., + xr[(N-1)/2 -1],xi[(N-1)/2 -1],xi[(N-1)/2] + (note the exceptional second & last entries) +*/ +#define FTPACK 112 /* TCMPLX represents complex time traces */ -#define TCMPLX 13 -/* TAMPH represents time domain data in amplitude/phase form */ -#define TAMPH 15 -/* FPACK represents packed frequency domain data */ -#define FPACK 12 -/* FUNPACKNYQ represents complex frequency domain data */ -#define FUNPACKNYQ 11 -/* FCMPLX represents complex frequency domain data */ -#define FCMPLX 10 +#define TCMPLX 113 /* FAMPH represents freq domain data in amplitude/phase form */ -#define FAMPH 14 +#define FAMPH 114 +/* TAMPH represents time domain data in amplitude/phase form */ +#define TAMPH 115 /* REALPART represents the real part of a trace to Nyquist */ -#define REALPART 16 -/* IMAGPART represents the imaginary part of a trace to Nyquist */ -#define IMAGPART 17 +#define REALPART 116 +/* IMAGPART represents the real part of a trace to Nyquist */ +#define IMAGPART 117 /* AMPLITUDE represents the amplitude of a trace to Nyquist */ -#define AMPLITUDE 18 +#define AMPLITUDE 118 /* PHASE represents the phase of a trace to Nyquist */ -#define PHASE 19 +#define PHASE 119 /* KT represents wavenumber-time domain data */ -#define KT 21 +#define KT 121 /* KOMEGA represents wavenumber-frequency domain data */ -#define KOMEGA 22 +#define KOMEGA 122 /* ENVELOPE represents the envelope of the complex time trace */ -#define ENVELOPE 23 +#define ENVELOPE 123 /* INSTPHASE represents the phase of the complex time trace */ -#define INSTPHASE 24 +#define INSTPHASE 124 /* INSTFREQ represents the frequency of the complex time trace */ -#define INSTFREQ 25 +#define INSTFREQ 125 /* DEPTH represents traces in depth-range (z-x) */ -#define TRID_DEPTH 30 +#define TRID_DEPTH 130 +/* 3C data... v,h1,h2=(11,12,13)+32 so a bitmask will convert */ +/* between conventions */ +/* CHARPACK represents byte packed seismic data from supack1 */ +#define CHARPACK 201 +/* SHORTPACK represents 2 byte packed seismic data from supack2 */ +#define SHORTPACK 202 -#define ISSEISMIC(id) ( (id)==0 || (id)==TREAL || (id)==TDEAD || (id)==TDUMMY ) + +#define ISSEISMIC(id) (( (id)==TUNK || (id)==TREAL || (id)==TDEAD || (id)==TDUMMY || (id)==TBREAK || (id)==UPHOLE || (id)==SWEEP || (id)==TIMING || (id)==WBREAK || (id)==NFGUNSIG || (id)==FFGUNSIG || (id)==SPSENSOR || (id)==TVERT || (id)==TXLIN || (id)==TINLIN || (id)==ROTVERT || (id)==TTRANS || (id)==TRADIAL || (id)==ACOR ) ? cwp_true : cwp_false ) /* FUNCTION PROTOTYPES */ #ifdef __cplusplus /* if C++, specify external linkage to C functions */ extern "C" { #endif +/* get trace and put trace */ int fgettr(FILE *fp, segy *tp); int fvgettr(FILE *fp, segy *tp); void fputtr(FILE *fp, segy *tp); +void fvputtr(FILE *fp, segy *tp); int fgettra(FILE *fp, segy *tp, int itr); +/* get gather and put gather */ +/*segy **fget_gather(FILE *fp, cwp_String *key,cwp_String *type,Value *n_val, + int *nt,int *ntr, float *dt,int *first); +segy **get_gather(cwp_String *key, cwp_String *type, Value *n_val, + int *nt, int *ntr, float *dt, int *first); +segy **fput_gather(FILE *fp, segy **rec,int *nt, int *ntr); +segy **put_gather(segy **rec,int *nt, int *ntr);*/ + /* hdrpkge */ -/* void gethval(const segy *tp, int index, Value *valp); +/*void gethval(const segy *tp, int index, Value *valp); void puthval(segy *tp, int index, Value *valp); void getbhval(const bhed *bhp, int index, Value *valp); void putbhval(bhed *bhp, int index, Value *valp); @@ -907,7 +844,7 @@ char *getkey(const int index); int getindex(const char *key); void swaphval(segy *tp, int index); void swapbhval(bhed *bhp, int index); -void printheader(const segy *tp); */ +void printheader(const segy *tp);*/ void tabplot(segy *tp, int itmin, int itmax); diff --git a/contrib/stfinv/tests/onlinehelp.cc b/contrib/stfinv/tests/onlinehelp.cc deleted file mode 100644 index 487e583aa096af67d7215d63732b1de6915dfbcb..0000000000000000000000000000000000000000 --- a/contrib/stfinv/tests/onlinehelp.cc +++ /dev/null @@ -1,121 +0,0 @@ -/*! \file onlinehelp.cc - * \brief print online help - * - * ---------------------------------------------------------------------------- - * - * $Id: onlinehelp.cc 3924 2011-05-09 14:52:03Z tforb $ - * \author Thomas Forbriger - * \date 09/05/2011 - * - * print online help - * - * 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 - * - 09/05/2011 V1.0 Thomas Forbriger - * - * ============================================================================ - */ -#define ONLINEHELP_VERSION \ - "ONLINEHELP V1.0 print online help" -#define ONLINEHELP_CVSID \ - "$Id: onlinehelp.cc 3924 2011-05-09 14:52:03Z tforb $" - -#include -#include -#include - -using std::cout; -using std::cerr; -using std::endl; - -int main(int iargc, char* argv[]) -{ - - // define usage information - char usage_text[]= - { - ONLINEHELP_VERSION "\n" - "usage: onlinehelp" "\n" - " or: onlinehelp --help|-h" "\n" - }; - - // define full help text - char help_text[]= - { - ONLINEHELP_CVSID - }; - - // define commandline options - using namespace tfxx::cmdline; - static Declare options[]= - { - // 0: print help - {"help",arg_no,"-"}, - // 1: verbose mode - {"v",arg_no,"-"}, - {NULL} - }; - - // no arguments? print usage... - if (iargc<2) - { - cerr << usage_text << endl; - stfinv::STFEngine::help(cerr); - exit(0); - } - - // collect options from commandline - Commandline cmdline(iargc, argv, options); - - // help requested? print full help text... - if (cmdline.optset(0)) - { - cerr << usage_text << endl; - cerr << help_text << endl; - stfinv::STFEngine::help(cerr); - stfinv::help(cerr); - exit(0); - } - - // dummy operation: print option settings - for (int iopt=0; iopt<2; iopt++) - { - cout << "option: '" << options[iopt].opt_string << "'" << endl; - if (cmdline.optset(iopt)) { cout << " option was set"; } - else { cout << "option was not set"; } - cout << endl; - cout << " argument (string): '" << cmdline.string_arg(iopt) << "'" << endl; - cout << " argument (int): '" << cmdline.int_arg(iopt) << "'" << endl; - cout << " argument (long): '" << cmdline.long_arg(iopt) << "'" << endl; - cout << " argument (float): '" << cmdline.float_arg(iopt) << "'" << endl; - cout << " argument (double): '" << cmdline.double_arg(iopt) << "'" << endl; - cout << " argument (bool): '"; - if (cmdline.bool_arg(iopt)) - { cout << "true"; } else { cout << "false"; } - cout << "'" << endl; - } - while (cmdline.extra()) { cout << cmdline.next() << endl; } - - // dummy operation: print rest of command line - while (cmdline.extra()) { cout << cmdline.next() << endl; } -} - -/* ----- END OF onlinehelp.cc ----- */ diff --git a/contrib/stfinv/tests/tooltest.cc b/contrib/stfinv/tests/tooltest.cc deleted file mode 100644 index cf3879d5c4907a85b919c8b642ff85778202d615..0000000000000000000000000000000000000000 --- a/contrib/stfinv/tests/tooltest.cc +++ /dev/null @@ -1,176 +0,0 @@ -/*! \file tooltest.cc - * \brief test internal tools - * - * ---------------------------------------------------------------------------- - * - * $Id: tooltest.cc 3924 2011-05-09 14:52:03Z tforb $ - * \author Thomas Forbriger - * \date 07/05/2011 - * - * test internal tools - * - * 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 - * - 07/05/2011 V1.0 Thomas Forbriger - * - * ============================================================================ - */ -#define TOOLTEST_VERSION \ - "TOOLTEST V1.0 test internal tools" -#define TOOLTEST_CVSID \ - "$Id: tooltest.cc 3924 2011-05-09 14:52:03Z tforb $" - -#include -#include -#include -#include - -using std::cout; -using std::cerr; -using std::endl; - -/*----------------------------------------------------------------------*/ - -struct Options { - bool testclip, verbose, testmap; - std::string clipstring, mapstring; -}; // struct Options - -/*----------------------------------------------------------------------*/ - -int main(int iargc, char* argv[]) -{ - - // define usage information - char usage_text[]= - { - TOOLTEST_VERSION "\n" - "usage: tooltest [-clip string] [-map string]" "\n" - " or: tooltest --help|-h" "\n" - }; - - // define full help text - char help_text[]= - { - TOOLTEST_CVSID - }; - - // define commandline options - using namespace tfxx::cmdline; - static Declare options[]= - { - // 0: print help - {"help",arg_no,"-"}, - // 1: verbose mode - {"v",arg_no,"-"}, - // 2: verbose mode - {"clip",arg_yes,"-"}, - // 3: verbose mode - {"map",arg_yes,"-"}, - {NULL} - }; - - // no arguments? print usage... - if (iargc<2) - { - cerr << usage_text << endl; - exit(0); - } - - // collect options from commandline - Commandline cmdline(iargc, argv, options); - - // help requested? print full help text... - if (cmdline.optset(0)) - { - cerr << usage_text << endl; - cerr << help_text << endl; - exit(0); - } - - Options opt; - opt.verbose=cmdline.optset(1); - opt.testclip=cmdline.optset(2); - opt.clipstring=cmdline.string_arg(2); - opt.testmap=cmdline.optset(3); - opt.mapstring=cmdline.string_arg(3); - - // dummy operation: print rest of command line - if (opt.verbose) - { - cout << "part of command line which was not parsed:" << endl; - } - while (cmdline.extra()) { cout << cmdline.next() << endl; } - - /*----------------------------------------------------------------------*/ - - if (opt.testclip) - { - if (opt.verbose) - { - cout << endl; - cout << "Test stfinv::tools::clipstring with default delimiter" - << endl; - } - std::string s=opt.clipstring; - cout << "remainder is: " << s << endl; - while (s.length()>0) - { - cout << "stripped off: " << stfinv::tools::clipstring(s) << endl; - cout << "remainder is: " << s << endl; - } - std::string delim="++"; - if (opt.verbose) - { - cout << endl; - cout << "Test stfinv::tools::clipstring with delimiter " - << delim << endl; - } - s=opt.clipstring; - cout << "remainder is: " << s << endl; - while (s.length()>0) - { - cout << "stripped off: " << stfinv::tools::clipstring(s,delim) << endl; - cout << "remainder is: " << s << endl; - } - } // if (opt.testclip) - - /*----------------------------------------------------------------------*/ - - if (opt.testmap) - { - if (opt.verbose) - { - cout << endl; - cout << "Test stfinv::tools::makeparamap with default delimiter" - << endl; - } - stfinv::tools::Tparamap paramap=stfinv::tools::makeparamap(opt.mapstring); - - std::string liststring=paramap["list"]; - std::replace(liststring.begin(), liststring.end(),',',' '); - cout << liststring << endl; - - } // if (opt.testmap) - -} - -/* ----- END OF tooltest.cc ----- */ diff --git a/contrib/stfinv/tools.cc b/contrib/stfinv/tools.cc index 741e88e8ecbc3bf8c7d40aa1687fdf5ea05d60e0..049ac8f2f7e5e1dd8d0ced2c63964dac0ab5bf2e 100644 --- a/contrib/stfinv/tools.cc +++ b/contrib/stfinv/tools.cc @@ -4,7 +4,6 @@ * \ingroup tools * ---------------------------------------------------------------------------- * - * $Id: tools.cc 4027 2011-06-24 17:27:50Z tforb $ * \author Thomas Forbriger * \date 28/05/2011 * @@ -35,9 +34,7 @@ * ============================================================================ */ #define STFINV_TOOLS_CC_VERSION \ - "STFINV_TOOLS_CC V1.0 " -#define STFINV_TOOLS_CC_CVSID \ - "$Id: tools.cc 4027 2011-06-24 17:27:50Z tforb $" + "STFINV_TOOLS_CC V1.0" #include #include diff --git a/contrib/stfinv/tools.h b/contrib/stfinv/tools.h index 82fcfffecc9fcc819a4ccf36fd4eda17c4d885cc..44d9994605b70c9c64a2d16ad0c07cca0b4b91ae 100644 --- a/contrib/stfinv/tools.h +++ b/contrib/stfinv/tools.h @@ -4,7 +4,6 @@ * \ingroup tools * ---------------------------------------------------------------------------- * - * $Id: tools.h 4027 2011-06-24 17:27:50Z tforb $ * \author Thomas Forbriger * \date 28/05/2011 * @@ -31,6 +30,7 @@ * * REVISIONS and CHANGES * - 28/05/2011 V1.0 Thomas Forbriger + * - 15/10/2015 V1.1 new report function (report_engine) * * ============================================================================ */ @@ -39,9 +39,9 @@ #ifndef STFINV_TOOLS_H_VERSION #define STFINV_TOOLS_H_VERSION \ - "STFINV_TOOLS_H V1.0 " -#define STFINV_TOOLS_H_CVSID \ - "$Id: tools.h 4027 2011-06-24 17:27:50Z tforb $" + "STFINV_TOOLS_H V1.1" + +#include namespace stfinv { @@ -56,6 +56,38 @@ namespace stfinv { * \p eps */ bool sameineps(const double &a, const double& b, const double& eps=1.e-8); + +/* ---------------------------------------------------------------------- */ + + /*! \brief report engine identifier + * \ingroup tools + * \param C class to report ID and oneline description + * \param os output stream to send output to + */ + template + void report_engine(std::ostream& os) + { + os << " ID: "; + os.width(10); + os.setf(std::ios_base::left); + os << C::ID; + os.width(0); + os << " (" << C::description << ")" << std::endl; + } // void report_engine(std::ostream& os) + +/* ---------------------------------------------------------------------- */ + + /*! \brief report engine identifier with heading + * \ingroup tools + * \param C class to report ID and oneline description + * \param os output stream to send output to + */ + template + void report_engine_ID(std::ostream& os) + { + os << "Identifier to selected this procedure:" << std::endl; + report_engine(os); + } // void report_engine_ID(std::ostream& os) } // namespace tools diff --git a/contrib/stfinv/usage/stfinv_description_usage.txt b/contrib/stfinv/usage/stfinv_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..70aa147307393ae5853ce23a765ea226d487a48e --- /dev/null +++ b/contrib/stfinv/usage/stfinv_description_usage.txt @@ -0,0 +1,24 @@ +# this is +# ---------------------------------------------------------------------------- +# +STFINV -- create and apply a source wavelet correction filter +============================================================= + +Different methods are provided for the derivation of source wavelet correction +filters in approaches to full waveform inversion. Given a set of recorded data +and a set of synthetic data (typically, but not necessarilly the expected +impulse response of the subsurface) a source wavelet correction filter is +obtained by application of a user-selectable optimization citerion. The +synthetic waveforms are convolved with this filter wavelet and the convolved +synthetics as well as the wavelet itself are returned to the user. + +The effective time history of the seismic source used in field recordings is +not well known in most cases. This applies in particular to transient sources +(like explosives or hammer blows). The so-called 'source-time-function' might +even vary from shot to shot. For this reason it is not possible to use an +appropriate source-time-function in the initial simulation of synthetic data +in an approach of full-waveform inversion. However, after synthetic data have +been calculated using a generic source-time-function, a correction filter can +be constructed such that an improved source-time-function will reduce the +misfit to the recorded data. +# ----- END OF usage/stfinv_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinv_summary_usage.txt b/contrib/stfinv/usage/stfinv_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..00d0684cf52ed9d70cb251424339c2f8b2ad6608 --- /dev/null +++ b/contrib/stfinv/usage/stfinv_summary_usage.txt @@ -0,0 +1,11 @@ +# this is +# ---------------------------------------------------------------------------- +# +STFINV -- create and apply a source wavelet correction filter +============================================================= + +Purpose +------- +Create and apply a source wavelet correction filter for full-waveform +inversion of field data. +# ----- END OF usage/stfinv_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvany_description_usage.txt b/contrib/stfinv/usage/stfinvany_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..23a9739f95f6c101f6e027dfbf4a15a066aff0b2 --- /dev/null +++ b/contrib/stfinv/usage/stfinvany_description_usage.txt @@ -0,0 +1,33 @@ +# this is +# ---------------------------------------------------------------------------- +# This file should address the selection of the different procedures. The +# overall concept of the library is explained in the base class. +How to control the procedure +---------------------------- +A specific procedure is selected by passing a parameter string. This string +may further contain parameters to control the way the procedure will be +applied. + +The parameter string starts with an ID-sequence identifying the desired +procedure. See the list available procedures for ID strings. In the parameter +string the ID-sequence is terminated by a colon (:). + +After selecting the desired procedure, the interface function strips off the +ID-sequence as well as the first colon from the parameter string. The +remainder may consist of several control parameters being separated by colons +(:). Each control parameter may just be a flag (switch to turn on an option) +or may come along with a parameter value. The value is separated from the +parameter by an equal sign (=). + +Examples: +- To select Fourier domain least squares and shift the returned source + correction filter wavelet by 0.4s and switch on verbose mode, pass the + following parameter string: + fdlsq:tshift=0.4:verbose +- To select the identity procedure and switch on debug level 4: + ident:DEBUG=4 +- To select Fourier domain least squares, apply offset dependent weights and + use a power of two to speed up the FFT: + fdlsq:pow2:exp=1.4 +# +# ----- END OF stfinvany_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvany_summary_usage.txt b/contrib/stfinv/usage/stfinvany_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..445536bad1c5051870b1c8e99ed187fe593b507d --- /dev/null +++ b/contrib/stfinv/usage/stfinvany_summary_usage.txt @@ -0,0 +1,11 @@ +# this is +# ---------------------------------------------------------------------------- +# +How to control the procedure +---------------------------- +Procedures can be selected by passing the procedures ID together with options +an parameters controlling the algorithm used. + +Syntax of parameter string: + ID:option:option=value:option=value +# ----- END OF stfinvany_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvbase_description_usage.txt b/contrib/stfinv/usage/stfinvbase_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4c040f815bc6eab0ffe4619f4e66a140dd44209 --- /dev/null +++ b/contrib/stfinv/usage/stfinvbase_description_usage.txt @@ -0,0 +1,18 @@ +# this is +# ---------------------------------------------------------------------------- +# Common control parameters +# ------------------------- +Options and parameters in common for all procedures: + verbose produce verbose output (if implemented) + DEBUG=l produce debug output with level l + exp=k apply offset dependent weights to signals + +Due to the amplitude decay with offset to the source signals from receivers at +larger offset would contribute less to the optimization criterion for which +the source wavelet correction filter is constructed. The option exp provides +means to add a weight factor ((r/1m)**k) to each signal, where r is the +receiver to source offset. This is used to compensate the decrease in signal +amplitude. If the energy in the original signal decays with ((-r/1m)**(2*k)) +all traces will contribute at a similar level to the derived correction filter +after application of the weight factors. +# ----- END OF stfinvbase_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvbase_summary_usage.txt b/contrib/stfinv/usage/stfinvbase_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..cae002c49513d41873c278c2d8f539a2371e4c36 --- /dev/null +++ b/contrib/stfinv/usage/stfinvbase_summary_usage.txt @@ -0,0 +1,10 @@ +# this is +# ---------------------------------------------------------------------------- +# +Common control parameters +------------------------- +Options and parameters in common for all procedures: + verbose produce verbose output (if implemented) + DEBUG=l produce debug output with level l + exp=k apply offset dependent weights to signals +# ----- END OF stfinvbase_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfdleastsquares_description_usage.txt b/contrib/stfinv/usage/stfinvfdleastsquares_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..093018e6c8688774a361d670751ab657a4d6d228 --- /dev/null +++ b/contrib/stfinv/usage/stfinvfdleastsquares_description_usage.txt @@ -0,0 +1,38 @@ +# this is +# ---------------------------------------------------------------------------- +# +Procedure: Least squares in the frequency domain +------------------------------------------------ +This procedure calculates a least squares fit in the Fourier domain, which +equals a waterlevel-deconvolution. A waterlevel as a fraction of the signal +energy of the input synthetics is applied. If selected, offset dependent +weights will be applied to the signals from different receivers. + +Options and parameters: + waterlevel=l waterlevel to be applied for regularization. + +The procedure is implemented in the Fourier domain. Fourier coefficients for +the correction filter are constructed such that the residual between Fourier +coefficients of recorded signals and Fourier coefficients of synthetic signals +after application of the correction filter are minimized in a least-squares +sense. The least-squares solution is subject to a damping constraint. If the +weighted power spectral density of the synthetics at a given frequency drops +below the l-th fraction (waterlevel parameter) of the average (over all +frequencies) power spectral density, the filter coefficients are damped +(artificially made smaller) by the damping constraint (i.e. waterlevel as seen +from the perspective of deconvolution). + +Start with l=0.01 as a reasonable initial value for the waterlevel. The best +fitting waterlevel must be searched by trial and error and depends of signal +noise and on how well the synthetics describe the actually observed wave +propagtion. + +The theory behind the Fourier domain least squares procedure is outlined by +Lisa Groos (2013, Appendix F, page 146). She also describes a way to find an +approrpiate waterlevel by application of the L-curve criterion (Groos, 2013, +Appendix G, page 148). + +Lisa Groos. 2013. 2D full waveform inversion of shallow seismic Rayleigh waves. + Dissertation, Karlsruhe Institute of Technology. + http://nbn-resolving.org/urn:nbn:de:swb:90-373206 +# ----- END OF stfinvfdleastsquares_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfdleastsquares_summary_usage.txt b/contrib/stfinv/usage/stfinvfdleastsquares_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0e40de0e32f0835580580a3ce0cf8feb5a6bf19 --- /dev/null +++ b/contrib/stfinv/usage/stfinvfdleastsquares_summary_usage.txt @@ -0,0 +1,11 @@ +# this is +# ---------------------------------------------------------------------------- +# +Procedure: Least squares in the frequency domain +------------------------------------------------ +Find optimal correction filter by waterlevel-deconvolution in the Fourier +domain (i.e. least squares with regularization). + +Options and parameters: + waterlevel=l waterlevel to be applied for regularization. +# ----- END OF stfinvfdleastsquares_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfinitecausal_description_usage.txt b/contrib/stfinv/usage/stfinvfinitecausal_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..6072a5ad7a5dbb4f66cfeea3db50b8ad36189952 --- /dev/null +++ b/contrib/stfinv/usage/stfinvfinitecausal_description_usage.txt @@ -0,0 +1,31 @@ +# source code text file +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2015 by Thomas Forbriger (BFO Schiltach) +# +# end-user usage description: Finite causal engine +# +# +# ---- +# 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, see . +# ---- +# +# REVISIONS and CHANGES +# 05/10/2015 V1.0 Thomas Forbriger +# +# ============================================================================ +# +NO YET IMPLEMENTED! +# ----- END OF stfinvfinitecausal_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfinitecausal_summary_usage.txt b/contrib/stfinv/usage/stfinvfinitecausal_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a483fbf1481ae9cf81fae6bebcd265975f95213 --- /dev/null +++ b/contrib/stfinv/usage/stfinvfinitecausal_summary_usage.txt @@ -0,0 +1,31 @@ +# source code text file +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2015 by Thomas Forbriger (BFO Schiltach) +# +# end-user usage summary: Finite causal engine +# +# +# ---- +# 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, see . +# ---- +# +# REVISIONS and CHANGES +# 05/10/2015 V1.0 Thomas Forbriger +# +# ============================================================================ +# +NO YET IMPLEMENTED! +# ----- END OF stfinvfinitecausal_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfixedstf_description_usage.txt b/contrib/stfinv/usage/stfinvfixedstf_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cf6f4a4f945ec27f0408d1ae1de8ebe6dee65d0 --- /dev/null +++ b/contrib/stfinv/usage/stfinvfixedstf_description_usage.txt @@ -0,0 +1,31 @@ +# source code text file +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2015 by Thomas Forbriger (BFO Schiltach) +# +# end-user usage description: Engine to provide a fixed wavelet +# +# +# ---- +# 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, see . +# ---- +# +# REVISIONS and CHANGES +# 05/10/2015 V1.0 Thomas Forbriger +# +# ============================================================================ +# +NO YET IMPLEMENTED! +# ----- END OF stfinvfixedstf_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfixedstf_summary_usage.txt b/contrib/stfinv/usage/stfinvfixedstf_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..50ec35e357e6e5c4b8596cefc84d3d8271cdb07b --- /dev/null +++ b/contrib/stfinv/usage/stfinvfixedstf_summary_usage.txt @@ -0,0 +1,31 @@ +# source code text file +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2015 by Thomas Forbriger (BFO Schiltach) +# +# end-user usage summary: Engine to provide a fixed wavelet +# +# +# ---- +# 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, see . +# ---- +# +# REVISIONS and CHANGES +# 05/10/2015 V1.0 Thomas Forbriger +# +# ============================================================================ +# +NO YET IMPLEMENTED! +# ----- END OF stfinvfixedstf_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfourier_description_usage.txt b/contrib/stfinv/usage/stfinvfourier_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ce270083c1d473f7a0dbd891e1a67b4379f003e --- /dev/null +++ b/contrib/stfinv/usage/stfinvfourier_description_usage.txt @@ -0,0 +1,25 @@ +# this is +# ---------------------------------------------------------------------------- +# +# Procedures in the Fourier domain +# -------------------------------- +Options and parameters in common for procedures in the Fourier domain: + fpow2 use power of two for number of coefficients + fdiv=d use integer multiple of d for number of coefficients + fpad=f padding factor + tshift=d delay source correction filter wavelet by d (in seconds) + in order to expose acausal components + +These options define the number of samples N used for the FFT (Fast Fourier +Transform). This number N should be larger than the number of samples M in the +original input time series to avoid wrap-around. If fpow2 is set, N will be +the next power of 2 larger than M*f. Else if fdiv is set, N will be the next +integer multiple of d larger than M*f. + +The derived correction filter in some cases can contain acausal components. +This means that the impulse response is non-zero for negative time values. +Since by definition, the impulse response is output for the time interval of +the input data, these acausal components can remain unnoticed. The option +tshift can be used to shift the impulse response as obtained by inverse FFT in +order to expose acausal components. +# ----- END OF stfinvfourier_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvfourier_summary_usage.txt b/contrib/stfinv/usage/stfinvfourier_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..54fb07d1ed36cfabbd12c8e6d24ebb73b357dcac --- /dev/null +++ b/contrib/stfinv/usage/stfinvfourier_summary_usage.txt @@ -0,0 +1,11 @@ +# this is +# ---------------------------------------------------------------------------- +# +Procedures in the Fourier domain +-------------------------------- +Options and parameters in common for procedures in the Fourier domain: + fpow2 use power of two for number of coefficients + fdiv=d use integer multiple of d for number of coefficients + fpad=f padding factor + tshift=d delay source correction filter wavelet by d (in seconds) +# ----- END OF stfinvfourier_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvidentity_description_usage.txt b/contrib/stfinv/usage/stfinvidentity_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd39df9079db6e96054b8dfe73c463c85d52603a --- /dev/null +++ b/contrib/stfinv/usage/stfinvidentity_description_usage.txt @@ -0,0 +1,15 @@ +# this is +# ---------------------------------------------------------------------------- +# +Procedure: Scale with amplitude factor +-------------------------------------- +This procedure does not modify the waveform of the synthetic data. It +convolves the signales with a discrete delta pulse so to speak. Optionally the +synthetics are scaled with an amplitude factor such that the weighted average +signal energy of all traces in the scaled synthetics equals that of the +recordings. Offset dependent weights are applied in this case. The +appropriately scaled discrete delta pulse is returned as correction filter. + +Options and parameters: + scaleenergy if flag is set: scale energy +# ----- END OF stfinvidentity_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvidentity_summary_usage.txt b/contrib/stfinv/usage/stfinvidentity_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..756d999c3e28f7024aa7a1d7926609e1e44d8428 --- /dev/null +++ b/contrib/stfinv/usage/stfinvidentity_summary_usage.txt @@ -0,0 +1,10 @@ +# this is +# ---------------------------------------------------------------------------- +# +Procedure: Scale with amplitude factor +-------------------------------------- +Scale signals by a scalar factor (i.e. keep signal shape). + +Options and parameters: + scaleenergy if flag is set: scale energy +# ----- END OF stfinvidentity_summary_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvnormalize_description_usage.txt b/contrib/stfinv/usage/stfinvnormalize_description_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..5db488407952797611cce3255a64500001b8571d --- /dev/null +++ b/contrib/stfinv/usage/stfinvnormalize_description_usage.txt @@ -0,0 +1,31 @@ +# source code text file +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2015 by Thomas Forbriger (BFO Schiltach) +# +# end-user usage description: Fourier expansion normalization engine +# +# +# ---- +# 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, see . +# ---- +# +# REVISIONS and CHANGES +# 05/10/2015 V1.0 Thomas Forbriger +# +# ============================================================================ +# +NO YET IMPLEMENTED! +# ----- END OF stfinvnormalize_description_usage.txt ----- diff --git a/contrib/stfinv/usage/stfinvnormalize_summary_usage.txt b/contrib/stfinv/usage/stfinvnormalize_summary_usage.txt new file mode 100644 index 0000000000000000000000000000000000000000..10d743a50116db3706b1eb792149e8cb3fed4d9b --- /dev/null +++ b/contrib/stfinv/usage/stfinvnormalize_summary_usage.txt @@ -0,0 +1,31 @@ +# source code text file +# this is +# ---------------------------------------------------------------------------- +# +# Copyright (c) 2015 by Thomas Forbriger (BFO Schiltach) +# +# end-user usage summary: Fourier expansion normalization engine +# +# +# ---- +# 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, see . +# ---- +# +# REVISIONS and CHANGES +# 05/10/2015 V1.0 Thomas Forbriger +# +# ============================================================================ +# +NO YET IMPLEMENTED! +# ----- END OF stfinvnormalize_summary_usage.txt ----- diff --git a/contrib/stfinv/waveformheader.h b/contrib/stfinv/waveformheader.h index 7a964094843768a2f662134a82444695dd543bac..91417535bd41be6bd3f864ce36dd5de60153cc07 100644 --- a/contrib/stfinv/waveformheader.h +++ b/contrib/stfinv/waveformheader.h @@ -3,7 +3,6 @@ * * ---------------------------------------------------------------------------- * - * $Id: waveformheader.h 4023 2011-06-24 14:18:04Z tforb $ * \author Thomas Forbriger * \date 06/05/2011 * @@ -38,9 +37,7 @@ #ifndef STFINV_WAVEFORMHEADER_H_VERSION #define STFINV_WAVEFORMHEADER_H_VERSION \ - "STFINV_WAVEFORMHEADER_H V1.0 " -#define STFINV_WAVEFORMHEADER_H_CVSID \ - "$Id: waveformheader.h 4023 2011-06-24 14:18:04Z tforb $" + "STFINV_WAVEFORMHEADER_H V1.0" #ifdef __cplusplus extern "C" {