EpetraExt  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EpetraExt_BTF_LinearProblem.h
Go to the documentation of this file.
1 //@HEADER
2 // ***********************************************************************
3 //
4 // EpetraExt: Epetra Extended - Linear Algebra Services Package
5 // Copyright (2011) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
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 Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 
42 #ifndef EpetraExt_LINEARPROBLEM_BTF_H
43 #define EpetraExt_LINEARPROBLEM_BTF_H
44 
45 #include <EpetraExt_Transform.h>
46 
47 #include <vector>
48 #include <map>
49 #include <set>
50 
52 class Epetra_VbrMatrix;
53 class Epetra_MultiVector;
54 class Epetra_Vector;
55 class Epetra_CrsMatrix;
56 class Epetra_CrsGraph;
57 class Epetra_Map;
58 class Epetra_BlockMap;
60 
61 namespace EpetraExt {
62 
63 class LinearProblem_BTF : public SameTypeTransform<Epetra_LinearProblem> {
64 
65  public:
66 
68 
69  LinearProblem_BTF( double thres = 0.0,
70  int verbose = 0 )
71  : NewMap_(0),
72  NewMatrix_(0),
73  NewGraph_(0),
74  NewLHS_(0),
75  NewRHS_(0),
76  NewProblem_(0),
77  OrigGraph_(0),
78  OrigMatrix_(0),
79  OrigRHS_(0),
80  OrigLHS_(0),
81  OrigProblem_(0),
82  threshold_(thres),
83  verbose_(verbose),
84  changedLP_(false)
85  {}
86 
88 
89  bool fwd();
90  bool rvs();
91 
92  bool changedLP() { return changedLP_; }
93 
94  private:
95 
96  void deleteNewObjs_();
97 
98  Epetra_BlockMap * NewMap_;
99 
100  Epetra_LinearProblem * NewProblem_;
101 
102  Epetra_VbrMatrix * NewMatrix_;
103  Epetra_CrsGraph * NewGraph_;
104 
105  Epetra_MultiVector * NewLHS_;
106  Epetra_MultiVector * NewRHS_;
107 
108  Epetra_Map * OrigRowMap_;
109  Epetra_Map * OrigColMap_;
110  Epetra_LinearProblem * OrigProblem_;
111  Epetra_CrsGraph * OrigGraph_;
112  Epetra_CrsMatrix * OrigMatrix_;
113  Epetra_MultiVector * OrigLHS_;
114  Epetra_MultiVector * OrigRHS_;
115 
116  std::vector<int> OldGlobalElements_;
117 
118  std::vector< std::set<int> > ZeroElements_;
119 
120  std::vector< std::vector<Epetra_SerialDenseMatrix*> > Blocks_;
121  std::vector<int> BlockDim_;
122  std::vector<int> BlockCnt_;
123  std::map<int,int> BlockRowMap_;
124  std::map<int,int> SubBlockRowMap_;
125  std::map<int,int> BlockColMap_;
126  std::map<int,int> SubBlockColMap_;
127 
128  std::vector< std::vector<int> > NewBlockRows_;
129 
130  const double threshold_;
131  const int verbose_;
132 
133  bool changedLP_;
134 };
135 
136 } //namespace EpetraExt
137 
138 #endif //EpetraExt_LINEARPROBLEM_BTF_H
bool fwd()
Forward transfer of data from orig object input in the operator() method call to the new object creat...
NewTypeRef operator()(OriginalTypeRef orig)
Analysis of transform operation on original object and construction of new object.
bool rvs()
Reverse transfer of data from new object created in the operator() method call to the orig object inp...
LinearProblem_BTF(double thres=0.0, int verbose=0)