initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / fields / pointPatchFields / constraint / wedge / wedgePointPatchField.C
blob74ca185e006f15daf16a3b5fe9bcb4f2d732aafd
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 \*---------------------------------------------------------------------------*/
27 #include "wedgePointPatchField.H"
28 #include "transformField.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
37 template<class Type>
38 wedgePointPatchField<Type>::wedgePointPatchField
40     const pointPatch& p,
41     const DimensionedField<Type, pointMesh>& iF
44     pointPatchField<Type>(p, iF)
48 template<class Type>
49 wedgePointPatchField<Type>::wedgePointPatchField
51     const pointPatch& p,
52     const DimensionedField<Type, pointMesh>& iF,
53     const dictionary& dict
56     pointPatchField<Type>(p, iF, dict)
58     if (!isType<wedgePointPatch>(p))
59     {
60         FatalIOErrorIn
61         (
62             "wedgePointPatchField<Type>::wedgePointPatchField\n"
63             "(\n"
64             "    const pointPatch& p,\n"
65             "    const Field<Type>& field,\n"
66             "    const dictionary& dict\n"
67             ")\n",
68             dict
69         )   << "patch " << this->patch().index() << " not wedge type. "
70             << "Patch type = " << p.type()
71             << exit(FatalIOError);
72     }
76 template<class Type>
77 wedgePointPatchField<Type>::wedgePointPatchField
79     const wedgePointPatchField<Type>& ptf,
80     const pointPatch& p,
81     const DimensionedField<Type, pointMesh>& iF,
82     const pointPatchFieldMapper&
85     pointPatchField<Type>(p, iF)
87     if (!isType<wedgePointPatch>(this->patch()))
88     {
89         FatalErrorIn
90         (
91             "wedgePointPatchField<Type>::wedgePointPatchField\n"
92             "(\n"
93             "    const wedgePointPatchField<Type>& ptf,\n"
94             "    const pointPatch& p,\n"
95             "    const DimensionedField<Type, pointMesh>& iF,\n"
96             "    const pointPatchFieldMapper& mapper\n"
97             ")\n"
98         )   << "Field type does not correspond to patch type for patch "
99             << this->patch().index() << "." << endl
100             << "Field type: " << typeName << endl
101             << "Patch type: " << this->patch().type()
102             << exit(FatalError);
103     }
107 template<class Type>
108 wedgePointPatchField<Type>::wedgePointPatchField
110     const wedgePointPatchField<Type>& ptf,
111     const DimensionedField<Type, pointMesh>& iF
114     pointPatchField<Type>(ptf, iF)
118 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
120 template<class Type>
121 void wedgePointPatchField<Type>::evaluate(const Pstream::commsTypes)
123     // In order to ensure that the wedge patch is always flat, take the
124     // normal vector from the first point
125     const vector& nHat = this->patch().pointNormals()[0];
127     tmp<Field<Type> > tvalues =
128         transform(I - nHat*nHat, this->patchInternalField());
130     // Get internal field to insert values into
131     Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
133     setInInternalField(iF, tvalues());
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 } // End namespace Foam
141 // ************************************************************************* //