| 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 ROLSINGLETONTEUCHOSBATCHMANAGER_HPP |
| 11 |
#define ROLSINGLETONTEUCHOSBATCHMANAGER_HPP |
| 12 |
|
| 13 |
#include "ROL_TeuchosBatchManager.hpp" |
| 14 |
#include "ROL_SingletonVector.hpp" |
| 15 |
|
| 16 |
namespace ROL { |
| 17 |
|
| 18 |
template<class Real, class Ordinal> |
| 19 |
class SingletonTeuchosBatchManager : public TeuchosBatchManager<Real,Ordinal> { |
| 20 |
public: |
| 21 |
SingletonTeuchosBatchManager(const ROL::Ptr<const Teuchos::Comm<int> > &comm) |
| 22 |
: TeuchosBatchManager<Real,Ordinal>(comm) {} |
| 23 |
|
| 24 |
using TeuchosBatchManager<Real,Ordinal>::sumAll; |
| 25 |
|
| 26 |
void sumAll(Vector<Real> &input, Vector<Real> &output) { |
| 27 |
Real inval = dynamic_cast<SingletonVector<Real>&>(input).getValue(); |
| 28 |
Real outval(0); |
| 29 |
TeuchosBatchManager<Real,Ordinal>::sumAll(&inval,&outval,1); |
| 30 |
dynamic_cast<SingletonVector<Real>&>(output).setValue(outval); |
| 31 |
} |
| 32 |
}; |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
#endif |