DAColoring.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
5 
6  Description:
7  Compute the coloring for Jacobian matrices using the parallel
8  distance 2 method
9 
10 \*---------------------------------------------------------------------------*/
11 
12 #ifndef DAColoring_H
13 #define DAColoring_H
14 
15 #include "fvOptions.H"
16 #include "surfaceFields.H"
17 #include "DAOption.H"
18 #include "DAUtility.H"
19 #include "DAStateInfo.H"
20 #include "DAModel.H"
21 #include "DAIndex.H"
22 
23 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
24 
25 namespace Foam
26 {
27 
28 /*---------------------------------------------------------------------------*\
29  Class DAColoring Declaration
30 \*---------------------------------------------------------------------------*/
31 
33 {
34 
35 private:
37  DAColoring(const DAColoring&);
38 
40  void operator=(const DAColoring&);
41 
42 protected:
43 
45  const fvMesh& mesh_;
46 
49 
51  const DAIndex& daIndex_;
52 
53 public:
55  DAColoring(
56  const fvMesh& mesh,
57  const DAOption& daOption,
58  const DAModel& daModel,
59  const DAIndex& daIndex);
60 
62  virtual ~DAColoring()
63  {
64  }
65 
66  // Members
68  void getMatNonZeros(
69  const Mat conMat,
70  label& maxCols,
71  scalar& allNonZeros) const;
72 
74  label find_index(
75  const label target,
76  const label start,
77  const label size,
78  const label* valArray) const;
79 
81  void coloringComplete(
82  const Vec colors,
83  label& colorCounter,
84  label& notColored) const;
85 
87  void parallelD2Coloring(
88  const Mat conMat,
89  Vec colors,
90  label& nColors) const;
91 
93  void validateColoring(
94  Mat conMat,
95  Vec colors) const;
96 };
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 } // End namespace Foam
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 #endif
105 
106 // ************************************************************************* //
DAOption.H
Foam::DAColoring::~DAColoring
virtual ~DAColoring()
Destructor.
Definition: DAColoring.H:62
Foam::DAColoring::daIndex_
const DAIndex & daIndex_
DAIndex object.
Definition: DAColoring.H:51
DAIndex.H
Foam::DAColoring::daOption_
const DAOption & daOption_
DAOption object.
Definition: DAColoring.H:48
Foam::DAColoring::find_index
label find_index(const label target, const label start, const label size, const label *valArray) const
find the index of a prescribed value in an array
Definition: DAColoring.C:844
Foam::DAOption
Definition: DAOption.H:29
Foam::DAColoring::mesh_
const fvMesh & mesh_
fvMesh object
Definition: DAColoring.H:45
DAUtility.H
daOption
DAOption daOption(mesh, pyOptions_)
Foam::DAColoring::validateColoring
void validateColoring(Mat conMat, Vec colors) const
validate if there is coloring conflict
Definition: DAColoring.C:931
Foam::DAColoring::parallelD2Coloring
void parallelD2Coloring(const Mat conMat, Vec colors, label &nColors) const
a parallel distance-2 graph coloring function
Definition: DAColoring.C:32
Foam::DAColoring::getMatNonZeros
void getMatNonZeros(const Mat conMat, label &maxCols, scalar &allNonZeros) const
number of non-zero elements in a matrix
Definition: DAColoring.C:786
Foam::DAColoring::coloringComplete
void coloringComplete(const Vec colors, label &colorCounter, label &notColored) const
check if there is non-colored columns
Definition: DAColoring.C:881
DAModel.H
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAIndex
Definition: DAIndex.H:32
Foam::DAModel
Definition: DAModel.H:59
Foam::DAColoring
Definition: DAColoring.H:32
Foam
Definition: multiFreqScalarFvPatchField.C:144
DAStateInfo.H
daModel
DAModel daModel(mesh, daOption)
daIndex
DAIndex daIndex(mesh, daOption, daModel)