Skip to content

Commit

Permalink
Merge pull request #2889 from JasonRuonanWang/operator
Browse files Browse the repository at this point in the history
cleaned up BPOperation classes
  • Loading branch information
JasonRuonanWang authored Sep 29, 2021
2 parents 192ba48 + eec7fd5 commit 523b403
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 508 deletions.
34 changes: 3 additions & 31 deletions source/adios2/toolkit/format/bp/bpOperation/BPOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,18 @@ namespace format
{

#define declare_type(T) \
void BPOperation::SetData( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
BufferSTL &bufferSTL) const noexcept \
{ \
} \
\
void BPOperation::SetMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
} \
\
void BPOperation::UpdateMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
}

ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

#define declare_type(T) \
\
template void BPOperation::SetDataDefault( \
template void BPOperation::SetData( \
const core::Variable<T> &, const typename core::Variable<T>::BPInfo &, \
const typename core::Variable<T>::Operation &, BufferSTL &bufferSTL) \
const noexcept; \
\
template void BPOperation::SetMetadataDefault( \
template void BPOperation::SetMetadata( \
const core::Variable<T> &, const typename core::Variable<T>::BPInfo &, \
const typename core::Variable<T>::Operation &, std::vector<char> &) \
const noexcept; \
\
template void BPOperation::UpdateMetadataDefault( \
template void BPOperation::UpdateMetadata( \
const core::Variable<T> &, const typename core::Variable<T>::BPInfo &, \
const typename core::Variable<T>::Operation &, std::vector<char> &) \
const noexcept;
Expand Down
55 changes: 15 additions & 40 deletions source/adios2/toolkit/format/bp/bpOperation/BPOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,6 @@ class BPOperation
BPOperation() = default;
virtual ~BPOperation() = default;

#define declare_type(T) \
virtual void SetData( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
BufferSTL &bufferSTL) const noexcept; \
\
virtual void SetMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept; \
\
virtual void UpdateMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept;

ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

/**
* Deserializes metadata in the form of parameters
* @param buffer contains serialized metadata buffer
Expand All @@ -64,41 +42,38 @@ class BPOperation
const helper::BlockOperationInfo &blockOperationInfo,
char *dataOutput) const = 0;

protected:
template <class T>
void SetDataDefault(const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
BufferSTL &bufferSTL) const noexcept;
void SetData(const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
BufferSTL &bufferSTL) const noexcept;

template <class T>
void
SetMetadataDefault(const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
std::vector<char> &buffer) const noexcept;
void SetMetadata(const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
std::vector<char> &buffer) const noexcept;

template <class T>
void UpdateMetadataDefault(
const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
std::vector<char> &buffer) const noexcept;
void UpdateMetadata(const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
std::vector<char> &buffer) const noexcept;
};

#define declare_type(T) \
\
extern template void BPOperation::SetDataDefault( \
extern template void BPOperation::SetData( \
const core::Variable<T> &, const typename core::Variable<T>::BPInfo &, \
const typename core::Variable<T>::Operation &, BufferSTL &bufferSTL) \
const noexcept; \
\
extern template void BPOperation::SetMetadataDefault( \
extern template void BPOperation::SetMetadata( \
const core::Variable<T> &, const typename core::Variable<T>::BPInfo &, \
const typename core::Variable<T>::Operation &, std::vector<char> &) \
const noexcept; \
\
extern template void BPOperation::UpdateMetadataDefault( \
extern template void BPOperation::UpdateMetadata( \
const core::Variable<T> &, const typename core::Variable<T>::BPInfo &, \
const typename core::Variable<T>::Operation &, std::vector<char> &) \
const noexcept;
Expand Down
6 changes: 3 additions & 3 deletions source/adios2/toolkit/format/bp/bpOperation/BPOperation.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace format
// DEFAULTS only saves input and output payload sizes in metadata
// PROTECTED
template <class T>
void BPOperation::SetDataDefault(
void BPOperation::SetData(
const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
Expand All @@ -43,7 +43,7 @@ void BPOperation::SetDataDefault(
}

template <class T>
void BPOperation::SetMetadataDefault(
void BPOperation::SetMetadata(
const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
Expand All @@ -65,7 +65,7 @@ void BPOperation::SetMetadataDefault(
}

template <class T>
void BPOperation::UpdateMetadataDefault(
void BPOperation::UpdateMetadata(
const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const typename core::Variable<T>::Operation &operation,
Expand Down
31 changes: 0 additions & 31 deletions source/adios2/toolkit/format/bp/bpOperation/compress/BPBZIP2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,6 @@ namespace adios2
namespace format
{

#define declare_type(T) \
void BPBZIP2::SetData( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
BufferSTL &bufferSTL) const noexcept \
{ \
SetDataDefault(variable, blockInfo, operation, bufferSTL); \
} \
\
void BPBZIP2::SetMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
SetMetadataDefault(variable, blockInfo, operation, buffer); \
} \
\
void BPBZIP2::UpdateMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
UpdateMetadataDefault(variable, blockInfo, operation, buffer); \
}

ADIOS2_FOREACH_PRIMITIVE_STDTYPE_1ARG(declare_type)
#undef declare_type

void BPBZIP2::GetMetadata(const std::vector<char> &buffer, Params &info) const
noexcept
{
Expand Down
20 changes: 0 additions & 20 deletions source/adios2/toolkit/format/bp/bpOperation/compress/BPBZIP2.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,6 @@ class BPBZIP2 : public BPOperation
using BPOperation::SetData;
using BPOperation::SetMetadata;
using BPOperation::UpdateMetadata;
// using override due to PGI compiler warnings
#define declare_type(T) \
void SetData(const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
BufferSTL &bufferSTL) const noexcept override; \
\
void SetMetadata(const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept override; \
\
void UpdateMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept override;

ADIOS2_FOREACH_PRIMITIVE_STDTYPE_1ARG(declare_type)
#undef declare_type

void GetMetadata(const std::vector<char> &buffer, Params &info) const
noexcept final;
Expand Down
31 changes: 0 additions & 31 deletions source/adios2/toolkit/format/bp/bpOperation/compress/BPBlosc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,6 @@ namespace adios2
namespace format
{

#define declare_type(T) \
void BPBlosc::SetData( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
BufferSTL &bufferSTL) const noexcept \
{ \
SetDataDefault(variable, blockInfo, operation, bufferSTL); \
} \
\
void BPBlosc::SetMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
SetMetadataDefault(variable, blockInfo, operation, buffer); \
} \
\
void BPBlosc::UpdateMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
UpdateMetadataDefault(variable, blockInfo, operation, buffer); \
}

ADIOS2_FOREACH_PRIMITIVE_STDTYPE_1ARG(declare_type)
#undef declare_type

void BPBlosc::GetMetadata(const std::vector<char> &buffer, Params &info) const
noexcept
{
Expand Down
19 changes: 0 additions & 19 deletions source/adios2/toolkit/format/bp/bpOperation/compress/BPBlosc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,6 @@ class BPBlosc : public BPOperation
using BPOperation::SetData;
using BPOperation::SetMetadata;
using BPOperation::UpdateMetadata;
#define declare_type(T) \
void SetData(const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
BufferSTL &bufferSTL) const noexcept override; \
\
void SetMetadata(const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept override; \
\
void UpdateMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept override;

ADIOS2_FOREACH_PRIMITIVE_STDTYPE_1ARG(declare_type)
#undef declare_type

void GetMetadata(const std::vector<char> &buffer, Params &info) const
noexcept final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,6 @@ namespace adios2
namespace format
{

#define declare_type(T) \
void BPLIBPRESSIO::SetData( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
BufferSTL &bufferSTL) const noexcept \
{ \
SetDataDefault(variable, blockInfo, operation, bufferSTL); \
} \
\
void BPLIBPRESSIO::SetMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
SetMetadataDefault(variable, blockInfo, operation, buffer); \
} \
\
void BPLIBPRESSIO::UpdateMetadata( \
const core::Variable<T> &variable, \
const typename core::Variable<T>::BPInfo &blockInfo, \
const typename core::Variable<T>::Operation &operation, \
std::vector<char> &buffer) const noexcept \
{ \
UpdateMetadataDefault(variable, blockInfo, operation, buffer); \
}

ADIOS2_FOREACH_LIBPRESSIO_TYPE_1ARG(declare_type)
#undef declare_type

void BPLIBPRESSIO::GetMetadata(const std::vector<char> &buffer,
Params &info) const noexcept
{
Expand Down
Loading

0 comments on commit 523b403

Please sign in to comment.