ROL
Loading...
Searching...
No Matches
ROL_Projection_Partitioned.hpp
Go to the documentation of this file.
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_PROJECTION_PARTITIONED_H
11#define ROL_PROJECTION_PARTITIONED_H
12
14#include <iostream>
15
16namespace ROL {
17
18template<typename Real>
19class Projection_Partitioned : public Projection<Real> {
20private:
21 std::vector<Ptr<Projection<Real>>> pvec_;
22
23public:
24 Projection_Partitioned(const std::vector<Ptr<Projection<Real>>> &pvec)
25 : pvec_(pvec)
26 {}
27
28
29 virtual void project(Vector<Real> &x, std::ostream &stream = std::cout) {
31 for (unsigned i = 0; i < pvec_.size(); ++i) pvec_[i]->project(*xpv.get(i),stream);
32 }
33
34 virtual void applyJacobian(Vector<Real> &v, const Vector<Real> &x) {
35 PartitionedVector<Real> &vpv = dynamic_cast<PartitionedVector<Real>&>(v);
36 const PartitionedVector<Real> &xpv = dynamic_cast<const PartitionedVector<Real>&>(x);
37 for (unsigned i = 0; i < pvec_.size(); ++i)
38 pvec_[i]->applyJacobian(*vpv.get(i),*xpv.get(i));
39 }
40
41}; // class Projection_Partitioned
42
43} // namespace ROL
44
45#endif
Defines the linear algebra of vector space on a generic partitioned vector.
ROL::Ptr< const Vector< Real > > get(size_type i) const
virtual void project(Vector< Real > &x, std::ostream &stream=std::cout)
std::vector< Ptr< Projection< Real > > > pvec_
Projection_Partitioned(const std::vector< Ptr< Projection< Real > > > &pvec)
virtual void applyJacobian(Vector< Real > &v, const Vector< Real > &x)
Defines the linear algebra or vector space interface.