wedgeFaPatch.C
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) 2016-2017 Wikki Ltd
9 Copyright (C) 2021-2022 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
27\*---------------------------------------------------------------------------*/
28
29#include "wedgeFaPatch.H"
31#include "faBoundaryMesh.H"
32#include "wedgePolyPatch.H"
33#include "polyMesh.H"
34#include "faMesh.H"
35
36// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37
38namespace Foam
39{
42}
43
44// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
45
46void Foam::wedgeFaPatch::findAxisPoint() const
47{
48 // Find axis point
49
50 const labelList& ptLabels = pointLabels();
51
52 const labelListList& ptEdges = pointEdges();
53
55
56 const scalarField& magL = magEdgeLengths();
57
58 forAll(ptEdges, pointI)
59 {
60 if (ptEdges[pointI].size() == 1)
61 {
62 scalar r = mag((I-axis()*axis())&points[ptLabels[pointI]]);
63
64 if (r < magL[ptEdges[pointI][0]])
65 {
66 axisPoint_ = ptLabels[pointI];
67 break;
68 }
69 }
70 }
71
72 axisPointChecked_ = true;
73}
74
75
76// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
77
79(
80 const word& name,
81 const dictionary& dict,
82 const label index,
83 const faBoundaryMesh& bm,
84 const word& patchType
85)
86:
87 faPatch(name, dict, index, bm, patchType),
88 wedgePolyPatchPtr_(nullptr),
89 axisPoint_(-1),
90 axisPointChecked_(false)
91{
92 if (ngbPolyPatchIndex() < 0)
93 {
95 << "Neighbour polyPatch index is not specified for faPatch "
96 << this->name() << exit(FatalError);
97 }
98
99 const auto* wedgePtr = isA<wedgePolyPatch>
100 (
101 bm.mesh()().boundaryMesh()[ngbPolyPatchIndex()]
102 );
103
104 if (wedgePtr)
105 {
106 wedgePolyPatchPtr_ = wedgePtr;
107 }
108 else
109 {
111 << "Neighbour polyPatch is not of type "
113 << exit(FatalError);
114 }
115}
116
117
118// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Finite area boundary mesh.
const faMesh & mesh() const noexcept
Return the mesh reference.
const pointField & points() const
Return local points.
Definition: faMeshI.H:86
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
virtual label size() const
Patch size is the number of edge labels.
Definition: faPatch.H:311
const labelListList & pointEdges() const
Return patch point-edge addressing.
Definition: faPatch.C:284
const labelList & pointLabels() const
Return patch point labels.
Definition: faPatch.C:273
const scalarField & magEdgeLengths() const
Return edge length magnitudes.
Definition: faPatch.C:455
label ngbPolyPatchIndex() const noexcept
The neighbour polyPatch index.
Definition: faPatch.H:293
const faBoundaryMesh & boundaryMesh() const noexcept
Return boundaryMesh reference.
Definition: faPatch.C:191
const word & name() const noexcept
The patch name.
Wedge front and back plane patch.
Definition: wedgeFaPatch.H:59
const vector & axis() const
Return axis of the wedge.
Definition: wedgeFaPatch.H:99
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
const pointField & points
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
static const Identity< scalar > I
Definition: Identity.H:94
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
Field< vector > vectorField
Specialisation of Field<T> for vector.
error FatalError
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
static const char *const typeName
The type name used in ensight case files.