This example show how to access Struct data in FasTensor .
#include <iostream>
#include <stdarg.h>
#include <vector>
#include <stdlib.h>
using namespace std;
{
double d1;
float f1;
int i1;
double d2;
double d3;
};
{
int i;
float f;
double d_ave;
};
{
ovds.
d_ave = (iStencil(0).d1 + iStencil(0).d2 + iStencil(0).d3) / 3.0;
oStencil = ovds;
return oStencil;
}
int main(
int argc,
char *argv[])
{
std::vector<int> chunk_size = {4};
std::vector<int> overlap_size = {0};
Array<InputStruct> *A = new Array<InputStruct>("EP_HDF5:./test-data/cmpd.h5:/DS1", chunk_size, overlap_size);
std::cout << A->GetValue(0, 0) << "\n";
Array<OutputStruct> *B = new Array<OutputStruct>();
B->PushBackAttribute<int>("EP_HDF5:./test-data/cmpd-output.h5:/i");
B->PushBackAttribute<float>("EP_HDF5:./test-data/cmpd-output.h5:/f");
B->PushBackAttribute<double>("EP_HDF5:./test-data/cmpd-output.h5:/ave");
B->PrintEndpointInfo();
delete A;
delete B;
return 0;
}
Definition: ft_stencil.h:100
#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_cmpd.cpp:133
Stencil< OutputStruct > udf_vds(const Stencil< InputStruct > &iStencil)
Definition: ft_example_cmpd.cpp:120
#define AU_UDT_INIT(A)
Definition: ft_type.h:255
Definition: ft_array.h:113
Definition: ft_example_cmpd.cpp:112
int i
Definition: ft_example_cmpd.cpp:114
double d_ave
Definition: ft_example_cmpd.cpp:116
float f
Definition: ft_example_cmpd.cpp:115