Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address various codacy issues #503

Merged
merged 2 commits into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions examples/experimental/multistep/reader_stepping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@
#endif
int main(int argc, char *argv[])
{
int rank = 0, nproc = 1;
int rank = 0;
#ifdef ADIOS2_HAVE_MPI
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
#endif
const bool adiosDebug = true;

#ifdef ADIOS2_HAVE_MPI
adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON);
adios2::ADIOS adios(MPI_COMM_WORLD, adiosDebug);
#else
adios2::ADIOS adios(adios2::DebugON);
adios2::ADIOS adios(adiosDebug);
#endif

// Info variables from the file
Expand Down
4 changes: 1 addition & 3 deletions examples/hello/sstReader/helloSstReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ void UserCallBack(const void *data, std::string doid, std::string var,
int main(int argc, char *argv[])
{
// Application variable
int rank, size;
int rank;

#ifdef ADIOS2_HAVE_MPI
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
#else
rank = 0;
size = 1;
#endif

int timeout = 5;
Expand Down
1 change: 0 additions & 1 deletion source/adios2/engine/dataman/DataManWriter.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ void DataManWriter::PutSyncCommonBP(Variable<T> &variable, const T *values)
// Close buffer here?
m_BP3Serializer.CloseStream(m_IO);
auto &buffer = m_BP3Serializer.m_Data.m_Buffer;
auto &position = m_BP3Serializer.m_Data.m_Position;

m_DataMan->WriteWAN(buffer);

Expand Down
6 changes: 2 additions & 4 deletions source/adios2/engine/hdf5/HDF5ReaderP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,14 @@ void HDF5ReaderP::Init()

m_H5File.Init(m_Name, m_MPIComm, false);

int ts = m_H5File.GetNumAdiosSteps();
/*
//
int ts = m_H5File.GetNumAdiosSteps();

if (ts == 0)
{
throw std::runtime_error("This h5 file is NOT written by ADIOS2");
}
*/
/*
*/
if (!m_InStreamMode)
{
m_H5File.ReadAllVariables(m_IO);
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/operator/compress/CompressSZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ size_t CompressSZ::Compress(const void *dataIn, const Dims &dimensions,
int use_configfile = 0;
int use_zchecker = 0;
std::string sz_configfile = "sz.config";
std::string zc_configfile = "zc.config";
// std::string zc_configfile = "zc.config";

std::cout << "debugMode:" << this->m_DebugMode << std::endl;

Expand Down
2 changes: 0 additions & 2 deletions source/adios2/toolkit/format/bp3/BP3Deserializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ void BP3Deserializer::DefineAttributeInIO(const ElementIndexHeader &header,
const std::vector<char> &buffer,
size_t position) const
{
const size_t initialPosition = position;

const Characteristics<T> characteristics =
ReadElementIndexCharacteristics<T>(
buffer, position, static_cast<DataTypes>(header.DataType));
Expand Down
2 changes: 1 addition & 1 deletion testing/adios2/engine/bp/TestBPWriteRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8)
// ADIOS2 write, ADIOS2 read
TEST_F(BPWriteReadTest, DISABLED_ADIOS2BPWriteADIOS2BPRead1D8)
{
std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8.bp";
// std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8.bp";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}
Expand Down
2 changes: 1 addition & 1 deletion testing/adios2/engine/bp/TestBPWriteReadstdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8stdio)
// ADIOS2 write, ADIOS2 read
TEST_F(BPWriteReadTest, DISABLED_ADIOS2BPWriteADIOS2BPRead1D8stdio)
{
std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8stdio.bp";
// std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8stdio.bp";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}
Expand Down
12 changes: 6 additions & 6 deletions testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,15 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read1D8)
// ADIOS2 write, ADIOS2 read
TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read1D8)
{
std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read1D8.h5";
// std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read1D8.h5";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}

// Native HDF5 write, ADIOS2 read
TEST_F(HDF5WriteReadTest, DISABLED_HDF5WriteADIOS2HDF5Read1D8)
{
std::string fname = "HDF5WriteADIOS2HDF5Read1D8.h5";
// std::string fname = "HDF5WriteADIOS2HDF5Read1D8.h5";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}
Expand Down Expand Up @@ -725,15 +725,15 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D2x4)
// ADIOS2 write, ADIOS2 read
TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read2D2x4)
{
std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D2x4Test.h5";
// std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D2x4Test.h5";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}

// Native HDF5 write, ADIOS2 read
TEST_F(HDF5WriteReadTest, DISABLED_HDF5WriteADIOS2HDF5Read2D2x4)
{
std::string fname = "HDF5WriteADIOS2HDF5Read2D2x4Test.h5";
// std::string fname = "HDF5WriteADIOS2HDF5Read2D2x4Test.h5";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}
Expand Down Expand Up @@ -999,15 +999,15 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D4x2)
// ADIOS2 write, ADIOS2 read
TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read2D4x2)
{
std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D4x2Test.h5";
// std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D4x2Test.h5";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}

// Native HDF5 write, ADIOS2 read
TEST_F(HDF5WriteReadTest, DISABLED_HDF5WriteADIOS2HDF5Read2D4x2)
{
std::string fname = "HDF5WriteADIOS2HDF5Read2D4x2Test.h5";
// std::string fname = "HDF5WriteADIOS2HDF5Read2D4x2Test.h5";

ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented";
}
Expand Down
15 changes: 8 additions & 7 deletions testing/adios2/transform/TestBZip2Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class ADIOSBZip2Wrapper : public ::testing::Test
TEST_F(ADIOSBZip2Wrapper, UInt100)
{
/** Application variable uints from 0 to 1000 */
std::vector<unsigned int> myUInts(100);
std::vector<uint32_t> myUInts(100);
std::iota(myUInts.begin(), myUInts.end(), 0.f);
const std::size_t Nx = myUInts.size();
const std::size_t inputBytes = Nx * sizeof(unsigned int);
const std::size_t inputBytes = Nx * sizeof(uint32_t);

// Define ADIOS variable
auto &var_UInt = io.DefineVariable<unsigned int>("myUInts", {}, {}, {Nx},
adios2::ConstantDims);
auto &var_UInt = io.DefineVariable<uint32_t>("myUInts", {}, {}, {Nx},
adios2::ConstantDims);

// Verify the return type is as expected
::testing::StaticAssertTypeEq<decltype(var_UInt),
adios2::Variable<unsigned int> &>();
adios2::Variable<uint32_t> &>();

// Define bzip2 transform
adios2::Operator &adiosBZip2 =
Expand All @@ -53,10 +53,11 @@ TEST_F(ADIOSBZip2Wrapper, UInt100)
compressedBuffer.resize(compressedSize);

// Allocate original data size
std::vector<unsigned int> decompressedBuffer(Nx);
std::vector<uint32_t> decompressedBuffer(Nx);
size_t decompressedSize = adiosBZip2.Decompress(
compressedBuffer.data(), compressedSize, decompressedBuffer.data(),
decompressedBuffer.size() * sizeof(unsigned int));
decompressedBuffer.size() * sizeof(uint32_t));
ASSERT_EQ(decompressedSize, inputBytes);

// testing data recovery
for (size_t i = 0; i < Nx; ++i)
Expand Down