Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
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"
46#include "Teuchos_ParameterList.hpp"
49#include "EpetraExt_MultiComm.h"
50#include "Epetra_BlockMap.h"
51#include "Epetra_CrsGraph.h"
52
53namespace Stokhos {
54
56 public:
57
60 const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& basis,
61 const Teuchos::RCP<const Stokhos::Sparse3Tensor<int,double> >& Cijk,
62 const Teuchos::RCP<const EpetraExt::MultiComm>& globalMultiComm,
63 int k_begin = 0, int k_end = -1);
64
67 const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& basis,
68 const Teuchos::RCP<const Stokhos::Sparse3Tensor<int,double> >& Cijk,
69 const Teuchos::RCP<const EpetraExt::MultiComm>& globalMultiComm,
70 const Teuchos::RCP<const Epetra_BlockMap>& stoch_row_map,
71 const Teuchos::RCP<const Stokhos::Sparse3Tensor<int,double> >& Cijk_parallel = Teuchos::null,
72 int k_begin = 0, int k_end = -1);
73
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
115 Teuchos::RCP<const EpetraExt::MultiComm>
116 getMultiComm() const { return globalMultiComm; }
117
119 Teuchos::RCP<const Epetra_Comm>
120 getStochasticComm() const { return stoch_comm; }
121
123 Teuchos::RCP<const Epetra_BlockMap>
125
127 Teuchos::RCP<const Epetra_BlockMap>
129
131 Teuchos::RCP<const Stokhos::Sparse3Tensor<int,double> >
132 getCijk() const { return Cijk; }
133
135 Teuchos::RCP<const Stokhos::Sparse3Tensor<int,double> >
136 getParallelCijk() const { return Cijk_parallel; }
137
139 Teuchos::RCP<const Epetra_CrsGraph>
140 getStochasticGraph() const { return stoch_graph; }
141
142 protected:
143
145
147 Teuchos::RCP<Cijk_type> buildParallelCijk() const;
148
149 protected:
150
152 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > basis;
153
155 Teuchos::RCP<const Cijk_type> Cijk;
156
158 Teuchos::RCP<const EpetraExt::MultiComm> globalMultiComm;
159
162
165
167 int k_end;
168
170 Teuchos::RCP<const Epetra_Comm> stoch_comm;
171
174
176 Teuchos::RCP<const Epetra_BlockMap> stoch_row_map;
177
179 Teuchos::RCP<const Epetra_BlockMap> stoch_col_map;
180
182 Teuchos::RCP<const Cijk_type> Cijk_parallel;
183
185 Teuchos::RCP<const Epetra_CrsGraph> stoch_graph;
186
187 }; // class EpetraSparse3Tensor
188
189} // namespace Stokhos
190
191#endif // STOKHOS_EPETRA_SPARSE_3_TENSOR_HPP
Stokhos::Sparse3Tensor< int, double > Cijk_type
Teuchos::RCP< const Epetra_CrsGraph > stoch_graph
Stochastic operator graph.
void transformToLocal()
Transform Cijk to local i and j indices.
Teuchos::RCP< const Stokhos::Sparse3Tensor< int, double > > getCijk() const
Get Cijk.
int GRID(int lrid) const
Return global row id for given local row id.
Teuchos::RCP< const Stokhos::Sparse3Tensor< int, double > > getParallelCijk() const
Get parallel Cijk.
void rebalance(Teuchos::ParameterList &isorropia_params)
Rebalance maps and graph using Isorropia.
Teuchos::RCP< const Epetra_Comm > getStochasticComm() const
Get stochastic comm.
int numMyCols() const
Return number of columns on this processor.
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 numMyRows() const
Return number of rows on this processor.
Teuchos::RCP< const Epetra_BlockMap > getStochasticColMap() const
Get stochastic column map.
Teuchos::RCP< const EpetraExt::MultiComm > getMultiComm() const
Get global comm.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > basis
Basis.
bool isStochasticParallel() const
Return whether stochastic blocks are parallel distributed.
Teuchos::RCP< const Epetra_BlockMap > getStochasticRowMap() const
Get stochastic row map.
int num_global_stoch_blocks
Number of global stochastic blocks.
bool myGCID(int gcid) const
Return true if global column id is on processor.
Teuchos::RCP< const Cijk_type > Cijk_parallel
Cijk tensor parallel over i.
Teuchos::RCP< const Epetra_BlockMap > stoch_row_map
Stochastic row-map.
Teuchos::RCP< const EpetraExt::MultiComm > globalMultiComm
Multi-comm.
int getKEnd() const
Return k_end index.
int getKBegin() const
Return k_begin index.
Teuchos::RCP< const Epetra_CrsGraph > getStochasticGraph() const
Get stochastic graph.
Teuchos::RCP< const Cijk_type > Cijk
Triple product.
Teuchos::RCP< const Epetra_BlockMap > stoch_col_map
Stochastic col-map.
bool is_parallel
Whether stochastic blocks are parallel.
Teuchos::RCP< const Epetra_Comm > stoch_comm
Stochastic comm.
int GCID(int lcid) const
Return global column id for given local column id.
Abstract base class for multivariate orthogonal polynomials.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
Top-level namespace for Stokhos classes and functions.