Bugfix: added mapping methods to point patch vector fields that have pointField ...
[foam-extend-4.0.git] / src / dynamicMesh / meshMotion / fvMotionSolver / pointPatchFields / derived / surfaceSlipDisplacement / surfaceSlipDisplacementPointPatchVectorField.H
blobbe550418024daca894cfc3a31525a407f6d0f424
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     4.0
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::surfaceSlipDisplacementPointPatchVectorField
27 Description
28     Displacement follows a triSurface. Use in a displacement fvMotionSolver.
29     Following is either
30     - NEAREST : nearest
31     - POINTNORMAL : intersection with point normal
32     - FIXEDNORMAL : intersection with fixed vector
34     Optionally (intersection only) removes a component ("wedgePlane") to
35     stay in 2D.
37     Needs:
38     - projectSurfaces : names of triSurfaceMeshes (in constant/triSurface)
39     - followMode : see above
40     - projectDirection : if followMode = fixedNormal
41     - wedgePlane : -1 or component to knock out of intersection normal
42     - frozenPointsZone : empty or name of pointZone containing points
43                          that do not move
45 SourceFiles
46     surfaceSlipDisplacementPointPatchVectorField.C
48 \*---------------------------------------------------------------------------*/
50 #ifndef surfaceSlipDisplacementPointPatchVectorField_H
51 #define surfaceSlipDisplacementPointPatchVectorField_H
53 #include "pointPatchFields.H"
54 #include "searchableSurfaces.H"
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 namespace Foam
61 /*---------------------------------------------------------------------------*\
62           Class surfaceSlipDisplacementPointPatchVectorField Declaration
63 \*---------------------------------------------------------------------------*/
65 class surfaceSlipDisplacementPointPatchVectorField
67     public pointPatchVectorField
70 public:
72     // Public data types
74         enum followMode
75         {
76             NEAREST,
77             POINTNORMAL,
78             FIXEDNORMAL
79         };
81 private:
83     // Private data
85         //- follow mode names
86         static const NamedEnum<followMode, 3> followModeNames_;
88         //- names of surfaces
89         const dictionary surfacesDict_;
91         //- How to follow/project onto surface
92         const followMode projectMode_;
94         //- direction to project
95         const vector projectDir_;
97         //- plane for 2D wedge case or -1.
98         const label wedgePlane_;
100         //- pointZone with frozen points
101         const word frozenPointsZone_;
103         //- Demand driven: surface to follow
104         mutable autoPtr<searchableSurfaces> surfacesPtr_;
107     // Private Member Functions
109         //- Disallow default bitwise assignment
110         void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
113 public:
115     //- Runtime type information
116     TypeName("surfaceSlipDisplacement");
119     // Constructors
121         //- Construct from patch and internal field
122         surfaceSlipDisplacementPointPatchVectorField
123         (
124             const pointPatch&,
125             const DimensionedField<vector, pointMesh>&
126         );
128         //- Construct from patch, internal field and dictionary
129         surfaceSlipDisplacementPointPatchVectorField
130         (
131             const pointPatch&,
132             const DimensionedField<vector, pointMesh>&,
133             const dictionary&
134         );
136         //- Construct by mapping given patchField<vector> onto a new patch
137         surfaceSlipDisplacementPointPatchVectorField
138         (
139             const surfaceSlipDisplacementPointPatchVectorField&,
140             const pointPatch&,
141             const DimensionedField<vector, pointMesh>&,
142             const PointPatchFieldMapper&
143         );
145         //- Construct as copy
146         surfaceSlipDisplacementPointPatchVectorField
147         (
148             const surfaceSlipDisplacementPointPatchVectorField&
149         );
151         //- Construct and return a clone
152         virtual autoPtr<pointPatchVectorField> clone() const
153         {
154             return autoPtr<pointPatchVectorField>
155             (
156                 new surfaceSlipDisplacementPointPatchVectorField
157                 (
158                     *this
159                 )
160             );
161         }
163         //- Construct as copy setting internal field reference
164         surfaceSlipDisplacementPointPatchVectorField
165         (
166             const surfaceSlipDisplacementPointPatchVectorField&,
167             const DimensionedField<vector, pointMesh>&
168         );
170         //- Construct and return a clone setting internal field reference
171         virtual autoPtr<pointPatchVectorField> clone
172         (
173             const DimensionedField<vector, pointMesh>& iF
174         ) const
175         {
176             return autoPtr<pointPatchVectorField>
177             (
178                 new surfaceSlipDisplacementPointPatchVectorField
179                 (
180                     *this,
181                     iF
182                 )
183             );
184         }
186     // Member Functions
188         //- Surfaces to follow
189         const dictionary& surfacesDict() const
190         {
191             return surfacesDict_;
192         }
194         //- Surface to follow. Demand loads surfaceNames.
195         const searchableSurfaces& surfaces() const;
197         //- Mode of projection/following
198         followMode projectMode() const
199         {
200             return projectMode_;
201         }
203         //- Direction to project back onto surface
204         const vector& projectDir() const
205         {
206             return projectDir_;
207         }
209         //- Normal of wedgeplane (0, 1, 2) or -1. Note: should be obtained
210         //  from twoDPointCorrector.
211         label wedgePlane() const
212         {
213             return wedgePlane_;
214         }
216         //- Zone containing frozen points
217         const word& frozenPointsZone() const
218         {
219             return frozenPointsZone_;
220         }
222         //- Update the patch field
223         virtual void evaluate
224         (
225             const Pstream::commsTypes commsType=Pstream::blocking
226         );
228         //- Write
229         virtual void write(Ostream&) const;
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 } // End namespace Foam
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 #endif
241 // ************************************************************************* //