Debian Codegraph @

packages/nox/test/epetra/MultiPhysics/OffBlock_Manager.H

raw
1 // @HEADER
2 // *****************************************************************************
3 // NOX: An Object-Oriented Nonlinear Solver Package
4 //
5 // Copyright 2002 NTESS and the NOX contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #ifndef _NOX_OFFBLOCK_MANAGER_H
11 #define _NOX_OFFBLOCK_MANAGER_H
12
13
14 #include "NOX.H"
15 // Currently, this class can only be used with builds which include EpetraExt !!
16 #ifdef HAVE_NOX_EPETRAEXT
17
18 #include "NOX_Epetra.H"
19
20 #include "Problem_Interface.H"
21 #include "Problem_Manager.H"
22 #include "GenericEpetraProblem.H"
23
24 #ifdef HAVE_NOX_EPETRAEXT // Use epetraext package in Trilinos
25 #include "EpetraExt_MapColoring.h"
26 #include "EpetraExt_MapColoringIndex.h"
27 #endif
28
29 #include <vector>
30
31 class OffBlock_Manager : GenericEpetraProblem
32 {
33
34 friend class Problem_Manager;
35
36 public:
37
38 enum VectorType { SOLUTION, GROUP_F };
39
40 static int idToFind;
41
42 // Constructor
43 OffBlock_Manager(Problem_Manager& problemMan_, Epetra_CrsGraph& graph_,
44 int probEqId, int probVarsId);
45
46 // Destructor
47 virtual ~OffBlock_Manager()
48 { };
49
50 // Return the underlying Group
51 Teuchos::RCP<NOX::Epetra::Group> getGroup();
52
53 // Return the underlying CrsMatrix
54 Epetra_CrsMatrix& getMatrix();
55
56 // Return the rowMapVec
57 Teuchos::RCP<Epetra_Vector> getRowMapVec() const;
58
59 // Return the problemEqId
60 int getProblemEqId() const;
61
62 // Return the problemVarId
63 int getProblemVarId() const;
64
65 // Convert block indices to composite indices
66 void convertBlockRowIndicesToComposite( int numIndices, int * block, int * composite);
67 void convertBlockColIndicesToComposite( int numIndices, int * block, int * composite);
68
69
70 // These allow inheritance from GenericEpetraProblem base class
71
72 bool evaluate(NOX::Epetra::Interface::Required::FillType type,
73 const Epetra_Vector *solnVector,
74 Epetra_Vector *rhsVector);
75
76 // A helper needed to set a target for a predicate
77 void setIDtoFind( int id )
78 { idToFind = id; }
79
80 // And here is the predicate
81 bool isMember()
82 { return problemVarId == idToFind; }
83
84 private:
85
86 // Creates the extra objects needed to fill off-diagoanl blocks using FD
87 void createFDobjects( bool useColoring = false );
88
89 // Creates a graph with indices shifted as needed for coloring
90 Epetra_CrsGraph & createBlockGraphFromComposite(Epetra_CrsGraph &);
91
92 private:
93
94 int problemEqId; // Problem Id of off-diagonal block equations
95 int problemVarId; // Problem Id of off-diagonal block variables
96
97 Teuchos::RCP<Problem_Interface> offBlockInterface; // A problem interface to
98 // this off-block problem manager.
99
100 // These allow off-diagonal block contributions representing
101 // inter-problem coupling computed via FDC
102 Teuchos::RCP<Epetra_Map> blockRowMap ;
103 Teuchos::RCP<Epetra_Map> blockColMap ;
104 Teuchos::RCP<Epetra_Vector> rowMapVec ;
105 Teuchos::RCP<Epetra_CrsGraph> graph ;
106 Teuchos::RCP<NOX::Epetra::Vector> noxVec ;
107 Teuchos::RCP<EpetraExt::CrsGraph_MapColoring> mapColoring ;
108 Teuchos::RCP<Epetra_MapColoring> colorMap ;
109 Teuchos::RCP<EpetraExt::CrsGraph_MapColoringIndex> colorMapIndex ;
110 Teuchos::RCP<vector<Epetra_IntVector> > columnSet ;
111 Teuchos::RCP<NOX::Epetra::FiniteDifference> matrixOperator ;
112 Teuchos::RCP<NOX::Epetra::LinearSystemAztecOO> linearSystem ;
113 Teuchos::RCP<NOX::Epetra::Group> group ;
114
115 // These are needed to shift indices for coloring and
116 // block-based condition number estimates
117 map< int, int > rowBlockToComposite;
118 map< int, int > rowCompositeToBlock;
119 map< int, int > colBlockToComposite;
120 map< int, int > colCompositeToBlock;
121
122 };
123
124 #endif
125
126 #endif