Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_ProductContainer.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef STOKHOS_PRODUCT_CONTAINER_HPP
11 #define STOKHOS_PRODUCT_CONTAINER_HPP
12 
13 #include <iostream>
14 #include "Teuchos_RCP.hpp"
15 #include "Teuchos_Array.hpp"
16 #include "Epetra_BlockMap.h"
17 
18 namespace Stokhos {
19 
21  template <typename coeff_type> class ProductContainerTraits {};
22 
28  template <typename coeff_type>
30  public:
31 
34 
37 
40 
42 
47 
52 
59  const typename traits_type::cloner_type& cloner);
60 
62 
66 
68  virtual ~ProductContainer();
69 
71 
75 
77 
81 
83 
87  const typename traits_type::cloner_type& cloner);
88 
90 
94 
96 
99  void reserve(ordinal_type sz);
100 
102  ordinal_type size() const;
103 
106 
109  getCoefficients() const;
110 
113  getCoefficients();
114 
118 
121  getCoeffPtr(ordinal_type i) const;
122 
125 
127  coeff_type& operator[](ordinal_type i);
128 
130  const coeff_type& operator[](ordinal_type i) const;
131 
133  void init(const value_type& val);
134 
136  bool myGID(int i) const;
137 
139  std::ostream& print(std::ostream& os) const;
140 
141  protected:
142 
145 
148 
149  }; // class ProductContainer
150 
151  template <typename coeff_type>
152  std::ostream& operator << (std::ostream& os,
153  const ProductContainer<coeff_type>& vec) {
154  return vec.print(os);
155  }
156 
157 } // end namespace Stokhos
158 
159 // include template definitions
161 
162 #endif // STOKHOS_PRODUCT_VECTOR_HPP
Teuchos::RCP< const Epetra_BlockMap > map() const
Return container map.
void setCoeffPtr(ordinal_type i, const Teuchos::RCP< coeff_type > &c)
Set coefficient i to c.
bool myGID(int i) const
Return whether global index i resides on this processor.
ProductContainer & operator=(const ProductContainer &)
Assignment.
void init(const value_type &val)
Initialize coefficients.
coeff_type & operator[](ordinal_type i)
Array access.
Cloner for Epetra_Vector coefficients.
Stokhos::ProductContainerTraits< coeff_type > traits_type
Typename of traits.
Base traits definition for ProductContainer.
Teuchos::RCP< const Epetra_BlockMap > map_
Container map.
const Teuchos::Array< Teuchos::RCP< coeff_type > > & getCoefficients() const
Return array of coefficients.
void reset(const Teuchos::RCP< const Epetra_BlockMap > &map)
Resize to new map map.
std::ostream & operator<<(std::ostream &os, const ProductContainer< coeff_type > &vec)
Teuchos::Array< Teuchos::RCP< coeff_type > > coeff_
Array of polynomial coefficients.
Teuchos::RCP< coeff_type > getCoeffPtr(ordinal_type i)
Return ref-count pointer to coefficient i.
A product (in the mathematical sense) container class whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
traits_type::ordinal_type ordinal_type
Typename of ordinals.
expr val()
std::ostream & print(std::ostream &os) const
Print polynomial.
traits_type::value_type value_type
Typename of values.
void reserve(ordinal_type sz)
Reserve space for a size sz container.
ordinal_type size() const
Return size.
void resize(const Teuchos::RCP< const Epetra_BlockMap > &map)
Resize to map map.