This example show how to access ADIOS data in FastTensor.
#include <iostream>
#include <stdarg.h>
#include <vector>
#include <stdlib.h>
using namespace std;
int main(
int argc,
char *argv[])
{
std::vector<unsigned long long> A_size = {8, 8};
Array<float> *A = new Array<float>("EP_ADIOS:./test-data/adios_test.bp:testv", A_size);
std::cout << "Set value, via (...) operator: \n";
for (int i = 0; i < A_size[0]; i++)
{
for (int j = 0; j < A_size[1]; j++)
{
A->SetValue(i + j + 0.001, i, j);
}
}
std::cout << " ... done \n\n";
std::cout << "Read all cells, via GetValue() method: \n";
for (int i = 0; i < A_size[0]; i++)
{
for (int j = 0; j < A_size[1]; j++)
{
std::cout << A->GetValue(i, j) << " , ";
}
std::cout << "\n";
}
std::cout << " ... done \n\n";
std::vector<unsigned long long> start = {0, 0};
std::vector<unsigned long long> end = {5, 5};
std::vector<float> datav(6 * 6);
A->ReadEndpoint(start, end, static_cast<void *>(datav.data()));
std::cout << "Read vector of cells [0,0]-[5,5], via ReadEndpoint() method: \n";
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 6; j++)
{
std::cout << datav[i * 6 + j] << ", ";
}
std::cout << " \n";
}
std::cout << " \n";
delete A;
return 0;
}
#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_adios.cpp:100
Definition: ft_array.h:113