Skip to content

Commit

Permalink
Merge pull request #3185 from JasonRuonanWang/datatype
Browse files Browse the repository at this point in the history
removed VariableBase::GetShape
  • Loading branch information
JasonRuonanWang authored Apr 29, 2022
2 parents 359d454 + d276755 commit 7bfdd1d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 25 deletions.
16 changes: 1 addition & 15 deletions bindings/CXX11/adios2/cxx11/VariableNT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,7 @@ adios2::ShapeID VariableNT::ShapeID() const
Dims VariableNT::Shape(const size_t step) const
{
helper::CheckForNullptr(m_Variable, "in call to VariableNT::Shape");
auto type = m_Variable->m_Type;
#define declare_type(T) \
if (type == helper::GetDataType<T>()) \
{ \
return reinterpret_cast<core::Variable<T> *>(m_Variable)->Shape(step); \
}
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type
else if (type == DataType::Struct)
{
return reinterpret_cast<core::VariableStruct *>(m_Variable)->m_Shape;
}
helper::Throw<std::runtime_error>("bindings::CXX11", "VariableNT", "Shape",
"invalid data type " + ToString(type));
return Dims();
return m_Variable->Shape(step);
}

Dims VariableNT::Start() const
Expand Down
2 changes: 0 additions & 2 deletions source/adios2/core/VariableBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,6 @@ void VariableBase::CheckRandomAccess(const size_t step,
}
}

Dims VariableBase::GetShape(const size_t step) const { return Shape(step); }

Dims VariableBase::Shape(const size_t step) const
{
CheckRandomAccess(step, "Shape");
Expand Down
1 change: 0 additions & 1 deletion source/adios2/core/VariableBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ class VariableBase
void CheckRandomAccessConflict(const std::string hint) const;

Dims Shape(const size_t step = adios2::EngineCurrentStep) const;
Dims GetShape(const size_t step = adios2::EngineCurrentStep) const;

/**
* Get info for attributes associated with this variable. Attribute name
Expand Down
14 changes: 7 additions & 7 deletions source/utils/adios_reorganize/Reorganize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ Reorganize::Decompose(int numproc, int rank, VarInfo &vi,
return writesize;
}

size_t ndim = vi.v->GetShape().size();
size_t ndim = vi.v->Shape().size();

/* Scalars */
if (ndim == 0)
Expand Down Expand Up @@ -462,12 +462,12 @@ Reorganize::Decompose(int numproc, int rank, VarInfo &vi,
}
else
{
count = vi.v->GetShape()[i] / np[i];
count = vi.v->Shape()[i] / np[i];
start = count * pos[i];
if (pos[i] == np[i] - 1)
{
// last one in the dimension may need to read more than the rest
count = vi.v->GetShape()[i] - count * (np[i] - 1);
count = vi.v->Shape()[i] - count * (np[i] - 1);
}
}
vi.start.push_back(start);
Expand Down Expand Up @@ -532,15 +532,15 @@ int Reorganize::ProcessMetadata(core::Engine &rStream, core::IO &io,
{
std::cout << " " << ToString(type) << " " << name;
}
// if (variable->GetShape().size() > 0)
// if (variable->Shape().size() > 0)
if (variable->m_ShapeID == adios2::ShapeID::GlobalArray)
{
if (!m_Rank)
{
std::cout << "[" << variable->GetShape()[0];
for (size_t j = 1; j < variable->GetShape().size(); j++)
std::cout << "[" << variable->Shape()[0];
for (size_t j = 1; j < variable->Shape().size(); j++)
{
std::cout << ", " << variable->GetShape()[j];
std::cout << ", " << variable->Shape()[j];
}
std::cout << "]" << std::endl;
}
Expand Down

0 comments on commit 7bfdd1d

Please sign in to comment.