This example show how to output a vector in FasTensor .
#include <iostream>
#include <stdarg.h>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include "au.h"
#include "DasLib.h"
using namespace std;
#define LTS 14999
#define CHS 201
{
std::vector<double> ts(
LTS);
for (
int i = 0; i <
LTS; i++)
{
ts[i] = iStencil(0, i);
}
double median = DasLib::Median(ts);
for (
int i = 0; i <
LTS; i++)
{
ts[i] = ts[i] - median;
}
std::vector<double> ts_sub;
std::vector<double> semblance_denom(LTS_new);
std::vector<std::complex> coherency;
for (int i = 0; i < LTS_new; i++)
{
semblance_denom[i] = ts_sub[i] * ts_sub[i];
}
coherency = instanPhaseEstimator(ts_sub);
int temp_index;
std::vector<unsigned long long> temp_coord = iStencil.
GetCoordinate();
temp_index = temp_coord[0];
for (
int i = 0; i <
LTS; i++)
{
H->SetValue(
H->GetValue(temp_index, i) + ts[i], temp_index, i);
}
return 0;
}
int main(
int argc,
char *argv[])
{
std::vector<int> chunk_size = {201, 14999};
std::vector<int> overlap_size = {0, 0};
H =
new Array<double>(
"EP_MEMORY",
H_size);
Array<double> *A = new Array<double>("EP_DIR:EP_HDF5:/Users/dbin/work/arrayudf-git-svn-test-on-bitbucket/examples/das/stacking_files/xcorr_examples_h5:/xcoor", chunk_size, overlap_size);
std::vector<int> skip_size = {1, 14999};
A->EnableApplyStride(skip_size);
H->Nonvolatile(
"EP_HDF5:/Users/dbin/work/arrayudf-git-svn-test-on-bitbucket/examples/das/stacking_files/xcorr_examples_h5_stack.h5:/xcoorstack");
delete A;
return 0;
}
Definition: ft_stencil.h:100
std::vector< unsigned long long > GetCoordinate() const
return the global coodinate of the current Stencil
Definition: ft_stencil.h:1028
#define AU_Init(argc, argv)
Definition: ft.h:112
#define AU_Finalize()
Definition: ft.h:113
int main(int argc, char *argv[])
Definition: ft_example_stack.cpp:168
double t_start
Definition: ft_example_stack.cpp:116
Array< double > * H
Definition: ft_example_stack.cpp:119
#define CHS
Definition: ft_example_stack.cpp:114
double t_end
Definition: ft_example_stack.cpp:116
double sample_rate
Definition: ft_example_stack.cpp:116
std::vector< unsigned long long > H_size
Definition: ft_example_stack.cpp:118
Stencil< double > stack_udf(const Stencil< double > &iStencil)
Definition: ft_example_stack.cpp:122
Array< double > semblanceSum_denom
Definition: ft_example_stack.cpp:120
#define LTS
Example to sum each row of A (8 x 8) Store result in H (8 x 2) H[0,0] = sum (A[0,0],...
Definition: ft_example_stack.cpp:113
#define AU_SUM
Definition: ft_merge.h:92
Definition: ft_array.h:113