cellLooper.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::cellLooper
29
30Description
31 Abstract base class. Concrete implementations know how to cut a cell
32 (i.e. determine a loop around the circumference).
33
34 Loop around the cell is given as the vertices to be cut and edges to
35 be cut (and a weight between 0 and 1 giving where the cut is to be
36 made). Main routine is 'cut' which gets called for every cell and
37 gets the current cut situation and expects to return a loop on the
38 cell circumference.
39
40 Calling function needs to determine whether cellLooper is compatible with
41 existing set of cuts.
42
43 Also contains various utility functions which implementations might want to
44 use.
45
46SourceFiles
47 cellLooper.C
48
49\*---------------------------------------------------------------------------*/
50
51#ifndef cellLooper_H
52#define cellLooper_H
53
54#include "edgeVertex.H"
55#include "vector.H"
56#include "boolList.H"
57#include "scalarField.H"
58#include "DynamicList.H"
59
60// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62namespace Foam
63{
64
65// Forward Declarations
66class polyMesh;
67class plane;
68
69/*---------------------------------------------------------------------------*\
70 Class cellLooper Declaration
71\*---------------------------------------------------------------------------*/
73class cellLooper
74:
75 public edgeVertex
76{
77protected:
78
79 // Protected Member Functions
80
81 //- Get faces (on cell) connected to vertI which are not using edgeI
83 (
84 const label celli,
85 const label edgeI,
86 const label vertI
87 ) const;
88
89 //- Get first edge connected to vertI and on facei
91 (
92 const label facei,
93 const label vertI
94 ) const;
95
96 //- Get edges (on cell) connected to vertI which are not on facei
98 (
99 const label celli,
100 const label facei,
101 const label vertI
102 ) const;
103
104 //- Return edge from cellEdges that is most perpendicular
105 // to refinement direction.
106 label getMisAlignedEdge(const vector& refDir, const label celli) const;
107
108
109 //- No copy construct
110 cellLooper(const cellLooper&) = delete;
111
112 //- No copy assignment
113 void operator=(const cellLooper&) = delete;
114
115
116public:
117
118 //- Runtime type information
119 TypeName("cellLooper");
120
121
122 // Declare run-time constructor selection table
123
124 // For the direct constructor
126 (
127 autoPtr,
129 word,
130 (
131 const polyMesh& mesh
132 ),
133 (mesh)
134 );
135
136
137 // Constructors
138
139 //- Construct from mesh
140 explicit cellLooper(const polyMesh& mesh);
141
142 //- Clone
144 {
146 return nullptr;
147 }
148
149
150 // Selectors
151
152 //- Return a reference to the selected cellLooper
154 (
155 const word& type,
156 const polyMesh& mesh
157 );
158
159
160 //- Destructor
161 virtual ~cellLooper() = default;
162
163
164 // Member Functions
165
166 //- Create cut along circumference of celli. Gets current mesh cuts
167 // vertIsCut, edgeIsCut, edgeWeight).
168 // Cut along circumference is expressed as cellVertCut,
169 // cellEdgeToWeight. Returns true if successful. Still might not
170 // be compatible with existing cuts but this should be handled by
171 // caller).
172 virtual bool cut
173 (
174 const vector& refDir,
175 const label celli,
176 const boolList& vertIsCut,
177 const boolList& edgeIsCut,
178 const scalarField& edgeWeight,
179
180 labelList& loop,
181 scalarField& loopWeights
182 ) const = 0;
183
184 //- Same but now also base point of cut provided (instead of always
185 // cell centre)
186 virtual bool cut
187 (
188 const plane& cutPlane,
189 const label celli,
190 const boolList& vertIsCut,
191 const boolList& edgeIsCut,
192 const scalarField& edgeWeight,
193
194 labelList& loop,
195 scalarField& loopWeights
196 ) const = 0;
197};
198
199
200// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201
202} // End namespace Foam
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206#endif
207
208// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Definition: cellLooper.H:75
cellLooper(const cellLooper &)=delete
No copy construct.
virtual ~cellLooper()=default
Destructor.
labelList getVertEdgesNonFace(const label celli, const label facei, const label vertI) const
Get edges (on cell) connected to vertI which are not on facei.
Definition: cellLooper.C:135
autoPtr< cellLooper > clone() const
Clone.
Definition: cellLooper.H:142
label getMisAlignedEdge(const vector &refDir, const label celli) const
Return edge from cellEdges that is most perpendicular.
Definition: cellLooper.C:169
static autoPtr< cellLooper > New(const word &type, const polyMesh &mesh)
Return a reference to the selected cellLooper.
Definition: cellLooper.C:46
void operator=(const cellLooper &)=delete
No copy assignment.
declareRunTimeSelectionTable(autoPtr, cellLooper, word,(const polyMesh &mesh),(mesh))
label getFirstVertEdge(const label facei, const label vertI) const
Get first edge connected to vertI and on facei.
Definition: cellLooper.C:106
labelList getVertFacesNonEdge(const label celli, const label edgeI, const label vertI) const
Get faces (on cell) connected to vertI which are not using edgeI.
Definition: cellLooper.C:70
TypeName("cellLooper")
Runtime type information.
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Definition: edgeVertex.H:56
const polyMesh & mesh() const
Definition: edgeVertex.H:101
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition: plane.H:95
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73