Skip to content

Commit

Permalink
more clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
guj committed Sep 19, 2023
1 parent 3672875 commit e33429c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
8 changes: 7 additions & 1 deletion bindings/CXX11/adios2/cxx11/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ QueryWorker::QueryWorker(const std::string &configFile, adios2::Engine &reader)
delete m;
}

void QueryWorker::GetResultCoverage(adios2::Box<adios2::Dims> &outputSelection,
void QueryWorker::GetResultCoverage(std::vector<adios2::Box<adios2::Dims>> &touched_blocks)
{
adios2::Box<adios2::Dims> empty;
GetResultCoverage(empty, touched_blocks);
}

void QueryWorker::GetResultCoverage(const adios2::Box<adios2::Dims> &outputSelection,
std::vector<adios2::Box<adios2::Dims>> &touched_blocks)
{
if (m_Worker)
Expand Down
8 changes: 7 additions & 1 deletion bindings/CXX11/adios2/cxx11/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ class Worker;
class QueryWorker
{
public:
// configFile has query, can be either xml or json
QueryWorker(const std::string &configFile, adios2::Engine &engine);

void GetResultCoverage(adios2::Box<adios2::Dims> &,
// touched_blocks is a list of regions specified by (start, count),
// that contains data that satisfies the query file
void GetResultCoverage(std::vector<adios2::Box<adios2::Dims>> &touched_blocks);

// supply output bound for the results
void GetResultCoverage(const adios2::Box<adios2::Dims> &,
std::vector<adios2::Box<adios2::Dims>> &touched_blocks);

private:
Expand Down
3 changes: 1 addition & 2 deletions bindings/Python/py11Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ Query::operator bool() const noexcept { return (m_QueryWorker == nullptr) ? fals

std::vector<Box<Dims>> Query::GetResult()
{
// std::cout<<"Do something"<<std::endl;
adios2::Box<adios2::Dims> empty; // look into all data
std::vector<Box<Dims>> touched_blocks;
adios2::Box<adios2::Dims> empty;
m_QueryWorker->GetResultCoverage(empty, touched_blocks);
return touched_blocks;
}
Expand Down
2 changes: 0 additions & 2 deletions bindings/Python/py11Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class Query
explicit operator bool() const noexcept;

std::vector<Box<Dims>> GetResult();
// const Box< Dims > & refinedSelectionIfAny,
// std::vector< Box< Dims > > &touched_blocks

private:
Query(adios2::query::Worker *qw);
Expand Down
3 changes: 1 addition & 2 deletions examples/query/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ void queryWithStreaming(adios2::IO &queryIO, std::string &dataFileName, std::str
while (reader.BeginStep() == adios2::StepStatus::OK)
{
adios2::QueryWorker w = adios2::QueryWorker(queryFile, reader);
adios2::Box<adios2::Dims> empty;
w.GetResultCoverage(empty, touched_blocks);
w.GetResultCoverage(touched_blocks);

std::cout << " ... now can read out touched blocks ... size=" << touched_blocks.size()
<< std::endl;
Expand Down
8 changes: 3 additions & 5 deletions testing/adios2/performance/query/TestBPQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ void BPQueryTest::QueryIntVar(const std::string &fname, adios2::ADIOS &adios,
{
adios2::QueryWorker w = adios2::QueryWorker(queryFile, bpReader);
std::vector<adios2::Box<adios2::Dims>> touched_blocks;
adios2::Box<adios2::Dims> empty;
w.GetResultCoverage(empty, touched_blocks);
w.GetResultCoverage(touched_blocks);
ASSERT_EQ(touched_blocks.size(), rr[bpReader.CurrentStep()]);
bpReader.EndStep();
}
Expand Down Expand Up @@ -143,8 +142,7 @@ void BPQueryTest::QueryDoubleVar(const std::string &fname, adios2::ADIOS &adios,
{
adios2::QueryWorker w = adios2::QueryWorker(queryFile, bpReader);
std::vector<adios2::Box<adios2::Dims>> touched_blocks;
adios2::Box<adios2::Dims> empty;
w.GetResultCoverage(empty, touched_blocks);
w.GetResultCoverage(touched_blocks);
ASSERT_EQ(touched_blocks.size(), rr[bpReader.CurrentStep()]);
bpReader.EndStep();
}
Expand Down Expand Up @@ -263,7 +261,7 @@ TEST_F(BPQueryTest, BP4)
std::string engineName = "BP4";
// Each process would write a 1x8 array and all processes would
// form a mpiSize * Nx 1D array
const std::string fname(engineName + "4Query1D.bp");
const std::string fname(engineName + "Query1D.bp");

#if ADIOS2_USE_MPI
adios2::ADIOS adios(MPI_COMM_WORLD);
Expand Down

0 comments on commit e33429c

Please sign in to comment.