XdmfHeavyDataController.cpp 2.99 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1 2 3 4
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
Andrew J. Burns (Cont's avatar
Andrew J. Burns (Cont committed
5
/*  Id : XdmfHeavyDataController.cpp                                         */
Kenneth Leiter's avatar
Kenneth Leiter committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*                                                                           */
/*  Author:                                                                  */
/*     Kenneth Leiter                                                        */
/*     kenneth.leiter@arl.army.mil                                           */
/*     US Army Research Laboratory                                           */
/*     Aberdeen Proving Ground, MD                                           */
/*                                                                           */
/*     Copyright @ 2011 US Army Research Laboratory                          */
/*     All Rights Reserved                                                   */
/*     See Copyright.txt for details                                         */
/*                                                                           */
/*     This software is distributed WITHOUT ANY WARRANTY; without            */
/*     even the implied warranty of MERCHANTABILITY or FITNESS               */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice             */
/*     for more information.                                                 */
/*                                                                           */
/*****************************************************************************/
23

24 25
#include <functional>
#include <numeric>
26
#include "XdmfArrayType.hpp"
27
#include "XdmfError.hpp"
28 29 30
#include "XdmfHeavyDataController.hpp"
#include "XdmfSystemUtils.hpp"

31
XdmfHeavyDataController::XdmfHeavyDataController(const std::string & filePath,
32 33
                                                 const shared_ptr<const XdmfArrayType> & type,
                                                 const std::vector<unsigned int> & dimensions) :
34
  mDimensions(dimensions),
35
  mFilePath(filePath),
36
  mArrayStartOffset(0),
37
  mType(type)
38 39 40 41 42 43 44
{
}

XdmfHeavyDataController::~XdmfHeavyDataController()
{
}

45 46
unsigned int
XdmfHeavyDataController::getArrayOffset() const
47
{
48
  return mArrayStartOffset;
49 50
}

51
std::vector<unsigned int> 
52
XdmfHeavyDataController::getDimensions() const
53
{
54
  return mDimensions;
55 56
}

57 58
std::string
XdmfHeavyDataController::getFilePath() const
59
{
60
  return mFilePath;
61 62
}

63 64
unsigned int
XdmfHeavyDataController::getSize() const
65
{
66 67 68
  return std::accumulate(mDimensions.begin(),
                         mDimensions.end(),
                         1,
69
                         std::multiplies<unsigned int>());
70 71
}

72
shared_ptr<const XdmfArrayType>
73
XdmfHeavyDataController::getType() const
74
{
75
  return mType;
76
}
77 78 79 80 81 82

void
XdmfHeavyDataController::setArrayOffset(unsigned int newOffset)
{
  mArrayStartOffset = newOffset;
}