DAColoring.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
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:
44  const fvMesh& mesh_;
45 
48 
50  const DAIndex& daIndex_;
51 
52 public:
54  DAColoring(
55  const fvMesh& mesh,
56  const DAOption& daOption,
57  const DAModel& daModel,
58  const DAIndex& daIndex);
59 
61  virtual ~DAColoring()
62  {
63  }
64 
65  // Members
67  void getMatNonZeros(
68  const Mat conMat,
69  label& maxCols,
70  scalar& allNonZeros) const;
71 
73  label find_index(
74  const label target,
75  const label start,
76  const label size,
77  const label* valArray) const;
78 
80  void coloringComplete(
81  const Vec colors,
82  label& colorCounter,
83  label& notColored) const;
84 
86  void parallelD2Coloring(
87  const Mat conMat,
88  Vec colors,
89  label& nColors) const;
90 
92  void validateColoring(
93  Mat conMat,
94  Vec colors) const;
95 };
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 } // End namespace Foam
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 #endif
104 
105 // ************************************************************************* //
DAOption.H
Foam::DAColoring::~DAColoring
virtual ~DAColoring()
Destructor.
Definition: DAColoring.H:61
Foam::DAColoring::daIndex_
const DAIndex & daIndex_
DAIndex object.
Definition: DAColoring.H:50
DAIndex.H
Foam::DAColoring::daOption_
const DAOption & daOption_
DAOption object.
Definition: DAColoring.H:47
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:44
DAUtility.H
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:57
Foam::DAColoring
Definition: DAColoring.H:32
Foam
Definition: checkGeometry.C:32
DAStateInfo.H