Renamed and cleaned foam-extend
[foam-extend-3.0.git] / src / meshTools / directMapped / directMappedPolyPatch / directMappedPolyPatch.C
blob03e601a39710882df5c2d0ffbab4c34725deb1e3
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
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 \*---------------------------------------------------------------------------*/
26 #include "directMappedPolyPatch.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "Time.H"
29 #include "polyMesh.H"
30 #include "polyBoundaryMesh.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
36     defineTypeNameAndDebug(directMappedPolyPatch, 0);
38     addToRunTimeSelectionTable(polyPatch, directMappedPolyPatch, word);
39     addToRunTimeSelectionTable(polyPatch, directMappedPolyPatch, dictionary);
43 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
45 Foam::directMappedPolyPatch::directMappedPolyPatch
47     const word& name,
48     const label size,
49     const label start,
50     const label index,
51     const polyBoundaryMesh& bm
54     polyPatch(name, size, start, index, bm),
55     directMappedPatchBase(static_cast<const polyPatch&>(*this))
59 Foam::directMappedPolyPatch::directMappedPolyPatch
61     const word& name,
62     const label size,
63     const label start,
64     const label index,
65     const word& sampleRegion,
66     const directMappedPatchBase::sampleMode mode,
67     const word& samplePatch,
68     const vectorField& offset,
69     const polyBoundaryMesh& bm
72     polyPatch(name, size, start, index, bm),
73     directMappedPatchBase
74     (
75         static_cast<const polyPatch&>(*this),
76         sampleRegion,
77         mode,
78         samplePatch,
79         offset
80     )
84 Foam::directMappedPolyPatch::directMappedPolyPatch
86     const word& name,
87     const label size,
88     const label start,
89     const label index,
90     const word& sampleRegion,
91     const directMappedPatchBase::sampleMode mode,
92     const word& samplePatch,
93     const vector& offset,
94     const polyBoundaryMesh& bm
97     polyPatch(name, size, start, index, bm),
98     directMappedPatchBase
99     (
100         static_cast<const polyPatch&>(*this),
101         sampleRegion,
102         mode,
103         samplePatch,
104         offset
105     )
109 Foam::directMappedPolyPatch::directMappedPolyPatch
111     const word& name,
112     const dictionary& dict,
113     const label index,
114     const polyBoundaryMesh& bm
117     polyPatch(name, dict, index, bm),
118     directMappedPatchBase(*this, dict)
122 Foam::directMappedPolyPatch::directMappedPolyPatch
124     const directMappedPolyPatch& pp,
125     const polyBoundaryMesh& bm
128     polyPatch(pp, bm),
129     directMappedPatchBase(*this, pp)
133 Foam::directMappedPolyPatch::directMappedPolyPatch
135     const directMappedPolyPatch& pp,
136     const polyBoundaryMesh& bm,
137     const label index,
138     const label newSize,
139     const label newStart
142     polyPatch(pp, bm, index, newSize, newStart),
143     directMappedPatchBase(*this, pp)
147 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
149 Foam::directMappedPolyPatch::~directMappedPolyPatch()
151     directMappedPatchBase::clearOut();
155 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
157 //- Initialise the calculation of the patch geometry
158 void Foam::directMappedPolyPatch::initGeometry()
160     polyPatch::initGeometry();
163 //- Calculate the patch geometry
164 void Foam::directMappedPolyPatch::calcGeometry()
166     polyPatch::calcGeometry();
169 //- Initialise the patches for moving points
170 void Foam::directMappedPolyPatch::initMovePoints(const pointField& p)
172     polyPatch::initMovePoints(p);
174     // Force recalculation of mapping with new point position
175     // Note: this uses parallel communications.  HJ, 13/Mar/2012
176     directMappedPatchBase::clearOut();
177     directMappedPatchBase::map();
180 //- Correct patches after moving points
181 void Foam::directMappedPolyPatch::movePoints(const pointField& p)
183     polyPatch::movePoints(p);
186 //- Initialise the update of the patch topology
187 void Foam::directMappedPolyPatch::initUpdateMesh()
189     polyPatch::initUpdateMesh();
191     // Force recalculation of mapping with new point position
192     // Note: this uses parallel communications.  HJ, 13/Mar/2012
193     directMappedPatchBase::clearOut();
195     // Only carry out mapping if the sampled region has been created already
196     // DC, 04/Nov/2013
197     if (boundaryMesh().mesh().time().found(sampleRegion()))
198     {
199         directMappedPatchBase::map();
200     }
203 //- Update of the patch topology
204 void Foam::directMappedPolyPatch::updateMesh()
206     polyPatch::updateMesh();
210 void Foam::directMappedPolyPatch::write(Ostream& os) const
212     polyPatch::write(os);
213     directMappedPatchBase::write(os);
217 // ************************************************************************* //