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

working versions

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: 1154
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent be8399d0
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: hack_blitztogrepg.h,v 1.2 2002-12-02 21:54:49 forbrig Exp $
* $Id: hack_blitztogrepg.h,v 1.3 2002-12-03 21:10:35 forbrig Exp $
* \author Thomas Forbriger
* \date 29/11/2002
*
......@@ -13,6 +13,7 @@
*
* REVISIONS and CHANGES
* - 29/11/2002 V1.0 Thomas Forbriger
* - 03/12/2002 V1.1 provides any-type output
*
* ============================================================================
*/
......@@ -21,9 +22,9 @@
#ifndef TF_HACK_BLITZTOGREPG_H_VERSION
#define TF_HACK_BLITZTOGREPG_H_VERSION \
"TF_HACK_BLITZTOGREPG_H V1.0 "
"TF_HACK_BLITZTOGREPG_H V1.1"
#define TF_HACK_BLITZTOGREPG_H_CVSID \
"$Id: hack_blitztogrepg.h,v 1.2 2002-12-02 21:54:49 forbrig Exp $"
"$Id: hack_blitztogrepg.h,v 1.3 2002-12-03 21:10:35 forbrig Exp $"
#include<complex>
#include<blitz/array.h>
......@@ -55,18 +56,19 @@ void write_grepg_f(const blitz::Array<float, 2>& array,
/*! \brief create grepg file from 2D array of any type
*
* \param array 2D float blitz array
* \param any 2D blitz array
* \param filename name of file to write to
* \param dx x-sampling to simulate
* \param dy y-sampling to simulate
*/
template<class T>
void write_grepg_f(const blitz::Array<T, 2>& array,
const char* filename,
const double& dx=1., const double& dy=1.)
void write_grepg(const blitz::Array<T, 2>& array,
const char* filename,
const double& dx=1., const double& dy=1.)
{
blitz::Array<std::complex<float>, 2>
carray(blitz::cast<std::complex<float> >(array));
carray(array.lbound(), array.shape(), blitz::fortranArray);
carray=blitz::cast<std::complex<float> >(array);
write_grepg_c(carray, filename, dx, dy);
}
......
/*! \file hack_blitztotable.h
* \brief dump 1D blitz array to a table (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: hack_blitztotable.h,v 1.1 2002-12-03 21:10:35 forbrig Exp $
* \author Thomas Forbriger
* \date 03/12/2002
*
* dump 1D blitz array to a table (prototypes)
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 03/12/2002 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TF_HACK_BLITZTOTABLE_H_VERSION
#define TF_HACK_BLITZTOTABLE_H_VERSION \
"TF_HACK_BLITZTOTABLE_H V1.0 "
#define TF_HACK_BLITZTOTABLE_H_CVSID \
"$Id: hack_blitztotable.h,v 1.1 2002-12-03 21:10:35 forbrig Exp $"
#include<fstream>
#include<cmath>
#include<blitz/array.h>
namespace tfxx {
namespace hacks {
/*! \brief create grepg file from complex array
*
* \param any 1D blitz array
* \param filename name of file to write to
* \param dx x-sampling to simulate
*/
template<class T>
void write_blitztable(const blitz::Array<T, 1>& array,
const char* filename,
const double& dx=1.)
{
std::ofstream os(filename);
for (int i=array.lbound(blitz::firstDim);
i<=array.ubound(blitz::secondDim); i++)
{
os << dx*(i-1) << " "
<< array(i) << " "
<< std::abs(array(i)) << std::endl;
}
}
} // namespace hacks
} // namespace tfxx
#endif // TF_HACK_BLITZTOTABLE_H_VERSION (includeguard)
/* ----- END OF hack_blitztotable.h ----- */
Markdown is supported
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