MPLICface.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::MPLICface
26 
27 Description
28  Class that deals with cutting faces based on face point values and target
29  value.
30 
31 SourceFiles
32  MPLICface.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef MPLICface_H
37 #define MPLICface_H
38 
39 #include "face.H"
40 #include "pointField.H"
41 #include "DynamicList.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class MPLICface Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class MPLICface
53 {
54  // Private Member variables
55 
56  //- Store all the cut points
57  DynamicList<point> cutPoints_;
58 
59  //- Store points of sub face
60  DynamicList<point> subPoints_;
61 
62  //- Labels of cut edges
63  DynamicList<label> cutEdges_;
64 
65  //- Store velocity point values
66  DynamicList<vector> subPointsU_;
67 
68  //- Keep truck of face orientation
69  bool flipped_;
70 
71  //- Select unweighted interpolation if true
72  // velocity flux corrected if false
73  const bool unweighted_;
74 
75 
76  public:
77 
78  // Constructors
79 
80  //- Construct empty
81  MPLICface(const bool unweighted = true);
82 
83  // - Destructor
84  ~MPLICface()
85  {}
86 
87 
88  // Member functions
89 
90  //- Function to cut for multi cut
91  // Returns:
92  // - 0: no cut
93  // - 1: cut
95  (
96  const labelList& f,
97  const labelList& faceEdges,
98  const pointField& points,
99  const boolList& isEdgeCutOld,
100  boolList& isEdgeCut,
101  label& faceEdgei,
102  const UList<scalar>& pointsAlpha,
103  const UList<vector>& pointsU,
104  const label facei,
105  const scalar target,
106  const bool ow
107  );
108 
109  //- Cut the face and return the type of cut
110  // Returns:
111  // - -1: multi cut
112  // - 0: no cut
113  // - +1: single cut
114  label cutFace
115  (
116  const UList<label>& f,
117  const UList<point>& points,
118  const UList<scalar>& pointsAlpha,
119  const UList<vector>& pointsU,
120  const scalar target,
121  const bool ow
122  );
123 
124  //- Calculate and return alphaPhiU
125  inline scalar alphaPhiU() const;
126 
127  //- Calculate and return alphaPhiU
128  template<class VectorList, class PointList>
129  inline scalar alphaPhiU
130  (
131  const VectorList& pointsU,
132  const PointList& points
133  ) const;
134 
135  //- Calculate and return alphaPhiU
136  template<class VectorList, class PointList>
137  inline scalar alphaPhiU
138  (
139  const VectorList& pointsU,
140  const PointList& points,
141  const labelList& f
142  ) const;
143 
144  //- Access to cut points
145  inline const DynamicList<point>& cutPoints() const;
146 
147  //- Access to submerged face points
148  inline const DynamicList<point>& subPoints() const;
149 
150  //- Access to cut edges
151  inline const DynamicList<label>& cutEdges() const;
152 
153  //- Return subface surface area vector
154  inline const vector Sf() const;
155 
156  //- Return subface centre
157  inline const vector Cf(const vector& area) const;
158 
159  //- Return interpolated U values
160  inline const DynamicList<vector>& U() const;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #include "MPLICfaceI.H"
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
const vector Sf() const
Return subface surface area vector.
Definition: MPLICfaceI.H:115
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const vector Cf(const vector &area) const
Return subface centre.
Definition: MPLICfaceI.H:122
const DynamicList< point > & cutPoints() const
Access to cut points.
Definition: MPLICfaceI.H:96
const DynamicList< label > & cutEdges() const
Access to cut edges.
Definition: MPLICfaceI.H:109
Class that deals with cutting faces based on face point values and target value.
Definition: MPLICface.H:51
MPLICface(const bool unweighted=true)
Construct empty.
Definition: MPLICface.C:31
const pointField & points
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
labelList f(nPoints)
const DynamicList< vector > & U() const
Return interpolated U values.
label cutFace(const labelList &f, const labelList &faceEdges, const pointField &points, const boolList &isEdgeCutOld, boolList &isEdgeCut, label &faceEdgei, const UList< scalar > &pointsAlpha, const UList< vector > &pointsU, const label facei, const scalar target, const bool ow)
Function to cut for multi cut.
Definition: MPLICface.C:40
const DynamicList< point > & subPoints() const
Access to submerged face points.
Definition: MPLICfaceI.H:103
scalar alphaPhiU() const
Calculate and return alphaPhiU.
Definition: MPLICfaceI.H:30
Namespace for OpenFOAM.