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

new hacks compile

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


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1145
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 5ab71e17
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.13 2002-11-29 13:44:54 forbrig Exp $
# $Id: Makefile,v 1.14 2002-11-29 18:41:16 forbrig Exp $
#
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
#
......@@ -27,7 +27,7 @@
HEADERS=$(shell find . -name \*.h)
SRC=misc/fortranio.cc misc/commandline.cc misc/ioswap.cc misc/error.cc \
misc/blitzfortranio.cc
misc/blitzfortranio.cc hacks/hack_blitztogrepg.cc
TESTS=$(wildcard tests/*.cc)
FTESTS=$(wildcard tests/*.f)
README=$(shell find . -name README) README.xtra
......@@ -51,7 +51,7 @@ REMCMMNT=remcmmnt
FLAGS=
CXXFLAGS=-fhonor-std -Wall $(FLAGS)
CXXFLAGS=-Wall $(FLAGS) -pedantic
CXXFLAGS=$(FLAGS)
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS) -I$(BLITZINCLUDE)
......@@ -98,7 +98,7 @@ libtfxx.a: $(SRC:.cc=.o)
#----------------------------------------------------------------------
# comment stripping
%.hd: %.h; echo $(patsubst misc/%,%,$<.strip): $< > $@
%.hd: %.h; echo $(notdir $<.strip): $< > $@
-include $(patsubst %.h,%.hd,$(HEADERS))
......
This is a legacy version of the repository. It may be incomplete as well as
inconsistent. See README.history for details. For the old stock of the
repository copyright and licence conditions apply as specified for versions
commited after 2015-03-01. Use recent versions as a base for new development.
The legacy version is only stored to keep a record of history.
/*! \file hack_blitztogrepg.cc
* \brief a quick hack to create a grepg file from any 2D blitz array (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: hack_blitztogrepg.cc,v 1.1 2002-11-29 18:41:16 forbrig Exp $
* \author Thomas Forbriger
* \date 29/11/2002
*
* a quick hack to create a grepg file from any 2D blitz array (implementation)
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 29/11/2002 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define TF_HACK_BLITZTOGREPG_CC_VERSION \
"TF_HACK_BLITZTOGREPG_CC V1.0 "
#define TF_HACK_BLITZTOGREPG_CC_CVSID \
"$Id: hack_blitztogrepg.cc,v 1.1 2002-11-29 18:41:16 forbrig Exp $"
#include <fstream>
#include <tfxx/misc.h>
#include <tfxx/fortranio.h>
#include <tfxx/complexio.h>
#include <tfxx/blitzutil.h>
#include <tfxx/hack_blitztogrepg.h>
namespace tfxx {
namespace hacks {
//! create grepg file from complex array
void write_grepg_c(const blitz::Array<std::complex<float>, 2>& array,
const char* filename,
const double& dx=1., const double& dy=1.)
{
std::ofstream os(filename);
tfxx::ioswap::file_magic_write(os, "1234", true);
tfxx::fortranio::FortranBinOutput fos(os);
int nom=array.extent(blitz::firstDim);
int fom=array.lbound(blitz::firstDim);
int nslo=array.extent(blitz::secondDim);
int fslo=array.lbound(blitz::secondDim);
fos << nom << nslo;
fos.end_block();
for (int i=0; i<nom; i++) { fos << float((i+fom)*dx); }
for (int i=0; i<nslo; i++) { fos << float((i+fslo)*dy); }
fos.end_block();
for (int i=0; i<nslo; i++)
{
for (int j=0; j<nom; j++)
{
fos << array(j,i);
}
}
fos.end_block();
}
/*----------------------------------------------------------------------*/
//! create grepg file from float array
void write_grepg_f(const blitz::Array<float, 2>& array,
const char* filename,
const double& dx=1., const double& dy=1.)
{
// create intermediate complex data
blitz::Array<std::complex<float>, 2> tmp(blitz::fortranArray);
tfxx::blitzutil::setToSameDomain(tmp, array.domain());
tmp=blitz::cast<std::complex<float> >(array);
write_grepg_c(tmp, filename, dx, dy);
}
} // namespace hacks
} // namespace tfxx
/* ----- END OF hack_blitztogrepg.cc ----- */
/*! \file hack_blitztogrepg.h
* \brief a quick hack to create a grepg file from any 2D blitz array (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: hack_blitztogrepg.h,v 1.1 2002-11-29 18:41:16 forbrig Exp $
* \author Thomas Forbriger
* \date 29/11/2002
*
* a quick hack to create a grepg file from any 2D blitz array (prototypes)
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 29/11/2002 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TF_HACK_BLITZTOGREPG_H_VERSION
#define TF_HACK_BLITZTOGREPG_H_VERSION \
"TF_HACK_BLITZTOGREPG_H V1.0 "
#define TF_HACK_BLITZTOGREPG_H_CVSID \
"$Id: hack_blitztogrepg.h,v 1.1 2002-11-29 18:41:16 forbrig Exp $"
#include<blitz/array.h>
namespace tfxx {
namespace hacks {
/*! \brief create grepg file from complex array
*
* \param array 2D complex float blitz array
* \param filename name of file to write to
* \param dx x-sampling to simulate
* \param dy y-sampling to simulate
*/
void write_grepg_c(const blitz::Array<std::complex<float>, 2>& array,
const char* filename,
const double& dx=1., const double& dy=1.);
/*! \brief create grepg file from float array
*
* \param array 2D float blitz array
* \param filename name of file to write to
* \param dx x-sampling to simulate
* \param dy y-sampling to simulate
*/
void write_grepg_f(const blitz::Array<float, 2>& array,
const char* filename,
const double& dx=1., const double& dy=1.);
} // namespace hacks
} // namespace tfxx
#endif // TF_HACK_BLITZTOGREPG_H_VERSION (includeguard)
/* ----- END OF hack_blitztogrepg.h ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: blitzutil.h,v 1.3 2002-11-29 16:10:25 forbrig Exp $
* $Id: blitzutil.h,v 1.4 2002-11-29 18:41:16 forbrig Exp $
* \author Thomas Forbriger
* \date 27/11/2002
*
......@@ -23,8 +23,9 @@
#define TF_BLITZUTIL_H_VERSION \
"TF_BLITZUTIL_H V1.0 "
#define TF_BLITZUTIL_H_CVSID \
"$Id: blitzutil.h,v 1.3 2002-11-29 16:10:25 forbrig Exp $"
"$Id: blitzutil.h,v 1.4 2002-11-29 18:41:16 forbrig Exp $"
#include<blitz/array.h>
#include<tfxx/error.h>
namespace tfxx {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment