Debian Codegraph @

packages/rol/adapters/epetra/src/sol/ROL_StdEpetraBatchManager.hpp

raw
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 ROL_STDEPETRABATCHMANAGER_HPP
11 #define ROL_STDEPETRABATCHMANAGER_HPP
12
13 #include "ROL_EpetraBatchManager.hpp"
14 #include "ROL_StdVector.hpp"
15
16 namespace ROL {
17
18 template<class Real>
19 class StdEpetraBatchManager : public EpetraBatchManager<Real> {
20 public:
21 StdEpetraBatchManager(ROL::Ptr<Epetra_Comm> &comm)
22 : EpetraBatchManager<Real>(comm) {}
23
24 using EpetraBatchManager<Real>::sumAll;
25
26 void sumAll(Vector<Real> &input, Vector<Real> &output) {
27 ROL::Ptr<std::vector<Real> > input_ptr
28 = dynamic_cast<StdVector<Real>&>(input).getVector();
29 ROL::Ptr<std::vector<Real> > output_ptr
30 = dynamic_cast<StdVector<Real>&>(output).getVector();
31 int dim_i = static_cast<int>(input_ptr->size());
32 int dim_o = static_cast<int>(output_ptr->size());
33 ROL_TEST_FOR_EXCEPTION(dim_i != dim_o, std::invalid_argument,
34 ">>> (ROL::StdEpetraBatchManager::SumAll): Dimension mismatch!");
35 EpetraBatchManager<Real>::sumAll(&input_ptr->front(),
36 &output_ptr->front(),
37 dim_i);
38 }
39 };
40
41 }
42
43 #endif