| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Rapid Optimization Library (ROL) Package |
| 4 |
// |
| 5 |
// Copyright 2014 NTESS and the ROL contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef ROLSTDTEUCHOSBATCHMANAGER_HPP |
| 11 |
#define ROLSTDTEUCHOSBATCHMANAGER_HPP |
| 12 |
|
| 13 |
#include "ROL_TeuchosBatchManager.hpp" |
| 14 |
#include "ROL_StdVector.hpp" |
| 15 |
|
| 16 |
namespace ROL { |
| 17 |
|
| 18 |
template<class Real, class Ordinal> |
| 19 |
class StdTeuchosBatchManager : public TeuchosBatchManager<Real,Ordinal> { |
| 20 |
public: |
| 21 |
StdTeuchosBatchManager(const ROL::Ptr<const Teuchos::Comm<int>> &comm) |
| 22 |
: TeuchosBatchManager<Real,Ordinal>(comm) {} |
| 23 |
|
| 24 |
using TeuchosBatchManager<Real,Ordinal>::sumAll; |
| 25 |
void sumAll(Vector<Real> &input, Vector<Real> &output) { |
| 26 |
std::vector<Real> &idata = *dynamic_cast<StdVector<Real>&>(input).getVector(); |
| 27 |
std::vector<Real> &odata = *dynamic_cast<StdVector<Real>&>(output).getVector(); |
| 28 |
int size = idata.size(); |
| 29 |
ROL_TEST_FOR_EXCEPTION(size != static_cast<int>(odata.size()), std::invalid_argument, |
| 30 |
">>> (ROL::StdTeuchosBatchManager::SumAll): Dimension mismatch!"); |
| 31 |
TeuchosBatchManager<Real,Ordinal>::sumAll(&idata[0],&odata[0],size); |
| 32 |
} |
| 33 |
}; |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
#endif |