Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_EpetraSparse3Tensor.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stokhos Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef STOKHOS_EPETRA_SPARSE_3_TENSOR_HPP
43 #define STOKHOS_EPETRA_SPARSE_3_TENSOR_HPP
44 
45 #include "Teuchos_RCP.hpp"
49 #include "EpetraExt_MultiComm.h"
50 #include "Epetra_BlockMap.h"
51 #include "Epetra_CrsGraph.h"
52 
53 namespace Stokhos {
54 
56  public:
57 
63  int k_begin = 0, int k_end = -1);
64 
69  const Teuchos::RCP<const EpetraExt::MultiComm>& globalMultiComm,
72  int k_begin = 0, int k_end = -1);
73 
75  EpetraSparse3Tensor(const EpetraSparse3Tensor& epetraCijk,
76  int k_begin_ = 0, int k_end_ = -1);
77 
80 
82  void rebalance(Teuchos::ParameterList& isorropia_params);
83 
85  void transformToLocal();
86 
88  int getKBegin() const { return k_begin; }
89 
91  int getKEnd() const { return k_end; }
92 
94  bool isStochasticParallel() const { return is_parallel; }
95 
97  int GRID(int lrid) const { return stoch_row_map->GID(lrid); }
98 
100  int GCID(int lcid) const { return stoch_col_map->GID(lcid); }
101 
103  bool myGRID(int grid) const { return stoch_row_map->MyGID(grid); }
104 
106  bool myGCID(int gcid) const { return stoch_col_map->MyGID(gcid); }
107 
109  int numMyRows() const { return stoch_row_map->NumMyElements(); }
110 
112  int numMyCols() const { return stoch_col_map->NumMyElements(); }
113 
116  getMultiComm() const { return globalMultiComm; }
117 
120  getStochasticComm() const { return stoch_comm; }
121 
124  getStochasticRowMap() const { return stoch_row_map; }
125 
128  getStochasticColMap() const { return stoch_col_map; }
129 
132  getCijk() const { return Cijk; }
133 
136  getParallelCijk() const { return Cijk_parallel; }
137 
140  getStochasticGraph() const { return stoch_graph; }
141 
142  protected:
143 
145 
148 
149  protected:
150 
153 
156 
159 
162 
164  int k_begin;
165 
167  int k_end;
168 
171 
174 
177 
180 
183 
186 
187  }; // class EpetraSparse3Tensor
188 
189 } // namespace Stokhos
190 
191 #endif // STOKHOS_EPETRA_SPARSE_3_TENSOR_HPP
Teuchos::RCP< const Epetra_CrsGraph > stoch_graph
Stochastic operator graph.
int getKBegin() const
Return k_begin index.
int GRID(int lrid) const
Return global row id for given local row id.
Teuchos::RCP< const Epetra_BlockMap > getStochasticColMap() const
Get stochastic column map.
void transformToLocal()
Transform Cijk to local i and j indices.
Teuchos::RCP< const Epetra_CrsGraph > getStochasticGraph() const
Get stochastic graph.
int getKEnd() const
Return k_end index.
Teuchos::RCP< const Epetra_BlockMap > stoch_col_map
Stochastic col-map.
bool isStochasticParallel() const
Return whether stochastic blocks are parallel distributed.
EpetraSparse3Tensor(const Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > &basis, const Teuchos::RCP< const Stokhos::Sparse3Tensor< int, double > > &Cijk, const Teuchos::RCP< const EpetraExt::MultiComm > &globalMultiComm, int k_begin=0, int k_end=-1)
Constructor from a full Cijk.
int NumMyElements() const
Teuchos::RCP< const Epetra_BlockMap > getStochasticRowMap() const
Get stochastic row map.
int GID(int LID) const
Teuchos::RCP< const Stokhos::Sparse3Tensor< int, double > > getCijk() const
Get Cijk.
Teuchos::RCP< const Cijk_type > Cijk
Triple product.
Teuchos::RCP< const EpetraExt::MultiComm > globalMultiComm
Multi-comm.
Teuchos::RCP< const Cijk_type > Cijk_parallel
Cijk tensor parallel over i.
Teuchos::RCP< const EpetraExt::MultiComm > getMultiComm() const
Get global comm.
bool MyGID(int GID_in) const
bool myGCID(int gcid) const
Return true if global column id is on processor.
Teuchos::RCP< const Epetra_BlockMap > stoch_row_map
Stochastic row-map.
void rebalance(Teuchos::ParameterList &isorropia_params)
Rebalance maps and graph using Isorropia.
Teuchos::RCP< const Stokhos::Sparse3Tensor< int, double > > getParallelCijk() const
Get parallel Cijk.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > basis
Basis.
int numMyRows() const
Return number of rows on this processor.
Teuchos::RCP< const Epetra_Comm > getStochasticComm() const
Get stochastic comm.
Teuchos::RCP< const Epetra_Comm > stoch_comm
Stochastic comm.
bool myGRID(int grid) const
Return true if global row id is on processor.
Teuchos::RCP< Cijk_type > buildParallelCijk() const
Build parallel Cijk tensor from a parallel row map.
int num_global_stoch_blocks
Number of global stochastic blocks.
Stokhos::Sparse3Tensor< int, double > Cijk_type
int GCID(int lcid) const
Return global column id for given local column id.
int numMyCols() const
Return number of columns on this processor.
bool is_parallel
Whether stochastic blocks are parallel.