1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 //- Interpolate point field
35 coupleMap::pointInterpolate
37 const Map<label>& mPointMap,
38 const Map<label>& sPointMap,
39 const Field<Type>& pf,
43 const Map<label>& pointMap = entityMap(coupleMap::POINT);
45 if (pf.size() != pointMap.size())
49 "coupleMap::pointInterpolate"
50 "(const Field<Type> pf)"
51 ) << "given field does not correspond to patch. Patch size: "
52 << pointMap.size() << " field size: " << pf.size()
56 tmp<Field<Type> > tresult
65 Field<Type>& result = tresult();
69 forAllConstIter(Map<label>, pointMap, pIter)
71 result[mPointMap[pIter.key()]] = pf[sPointMap[pIter()]];
76 forAllConstIter(Map<label>, pointMap, pIter)
78 result[sPointMap[pIter()]] = pf[mPointMap[pIter.key()]];
88 coupleMap::pointInterpolate
90 const Map<label>& mPointMap,
91 const Map<label>& sPointMap,
92 const tmp<Field<Type> >& tpf,
96 tmp<Field<Type> > tint =
98 pointInterpolate<Type>(mPointMap, sPointMap, tpf(), reverse)
105 //- Interpolate point field
108 coupleMap::faceInterpolate
112 const Field<Type>& pf,
116 const Map<label>& faceMap = entityMap(coupleMap::FACE);
118 if (pf.size() != faceMap.size())
122 "coupleMap::faceInterpolate"
123 "(const Field<Type> pf)"
124 ) << "given field does not correspond to patch. Patch size: "
125 << faceMap.size() << " field size: " << pf.size()
126 << abort(FatalError);
129 tmp<Field<Type> > tresult
138 Field<Type>& result = tresult();
142 forAllConstIter(Map<label>, faceMap, fIter)
144 result[fIter.key() - mStart] = pf[fIter() - sStart];
149 forAllConstIter(Map<label>, faceMap, fIter)
151 result[fIter() - sStart] = pf[fIter.key() - mStart];
161 coupleMap::faceInterpolate
165 const tmp<Field<Type> >& tpf,
169 tmp<Field<Type> > tint =
171 faceInterpolate<Type>(mStart, sStart, tpf(), reverse)
178 inline label& coupleMap::patchIndex() const
184 inline label coupleMap::masterIndex() const
190 inline label coupleMap::slaveIndex() const
196 inline bool coupleMap::isTwoDMesh() const
202 inline bool coupleMap::isLocal() const
208 inline bool coupleMap::isProcessor() const
214 inline bool coupleMap::isSend() const
220 inline bool coupleMap::isRecv() const
226 inline FixedList<label,10>& coupleMap::nEntities() const
232 inline label& coupleMap::nEntities(const label eType) const
234 return nEntities_[eType];
238 inline Map<label>& coupleMap::entityMap(const label eType) const
240 return entityMap_[eType];
244 inline Map<label>& coupleMap::reverseEntityMap(const label eType) const
246 return reverseEntityMap_[eType];
250 inline FixedList<labelList,12>& coupleMap::entityBuffer() const
252 return entityBuffer_;
256 inline labelList& coupleMap::entityBuffer(const label eType) const
258 return entityBuffer_[eType];
262 inline labelList& coupleMap::entityIndices() const
264 return entityIndices_;
268 inline List<coupleMap::opType>& coupleMap::entityOperations() const
270 return entityOperations_;
274 inline pointField& coupleMap::moveNewPoints() const
276 return moveNewPoints_;
280 inline pointField& coupleMap::moveOldPoints() const
282 return moveOldPoints_;
286 } // End namespace Foam
288 // ************************************************************************* //