Skip to content
Snippets Groups Projects
SelectionBoundingBox.cpp 1.29 KiB
Newer Older
/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * SelectionBoundingBox.cpp
 *
 *  Created on: May 17, 2017
 *      Author: Norbert Podhorszki pnorbert@ornl.gov
 *              William F Godoy godoywf@ornl.gov
 *
 */

#include "SelectionBoundingBox.h"

/// \cond EXCLUDE_FROM_DOXYGEN
#include <stdexcept>
/// \endcond

#include "adios2/helper/adiosFunctions.h" //Uint64VectorToSizetVector

namespace adios2
{

SelectionBoundingBox::SelectionBoundingBox(const Dims start, const Dims count,
                                           const bool debugMode)
: Selection(SelectionType::BoundingBox, debugMode), m_Start(start),
  m_Count(count)
{
William F Godoy's avatar
William F Godoy committed
    if (m_DebugMode)
    {
        CheckBoundingBox();
    }
William F Godoy's avatar
William F Godoy committed
void SelectionBoundingBox::CheckBoundingBox() const
William F Godoy's avatar
William F Godoy committed
    auto lf_Throw = [](const std::string &message) {
        throw std::invalid_argument(
            "ERROR: " + message +
            ", in call to SelectionBoundingBox constructor\n");
    };
William F Godoy's avatar
William F Godoy committed
    if (m_Start.size() != m_Count.size())
    {
        lf_Throw("start and count must have the same size");
    }
William F Godoy's avatar
William F Godoy committed
    if (m_Start.empty())
    {
        lf_Throw("start is empty");
    }
William F Godoy's avatar
William F Godoy committed
    if (m_Count.empty())
    {
        lf_Throw("count is empty");
    }
}

} // end namespace adios