FreeFOAM The Cross-Platform CFD Toolkit
wedgePointPatchField.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "wedgePointPatchField.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
36 template<class Type>
38 (
39  const pointPatch& p,
41 )
42 :
44 {}
45 
46 
47 template<class Type>
49 (
50  const pointPatch& p,
52  const dictionary& dict
53 )
54 :
55  pointPatchField<Type>(p, iF, dict)
56 {
57  if (!isType<wedgePointPatch>(p))
58  {
60  (
61  "wedgePointPatchField<Type>::wedgePointPatchField\n"
62  "(\n"
63  " const pointPatch& p,\n"
64  " const Field<Type>& field,\n"
65  " const dictionary& dict\n"
66  ")\n",
67  dict
68  ) << "patch " << this->patch().index() << " not wedge type. "
69  << "Patch type = " << p.type()
70  << exit(FatalIOError);
71  }
72 }
73 
74 
75 template<class Type>
77 (
78  const wedgePointPatchField<Type>& ptf,
79  const pointPatch& p,
82 )
83 :
85 {
86  if (!isType<wedgePointPatch>(this->patch()))
87  {
89  (
90  "wedgePointPatchField<Type>::wedgePointPatchField\n"
91  "(\n"
92  " const wedgePointPatchField<Type>& ptf,\n"
93  " const pointPatch& p,\n"
94  " const DimensionedField<Type, pointMesh>& iF,\n"
95  " const pointPatchFieldMapper& mapper\n"
96  ")\n"
97  ) << "Field type does not correspond to patch type for patch "
98  << this->patch().index() << "." << endl
99  << "Field type: " << typeName << endl
100  << "Patch type: " << this->patch().type()
101  << exit(FatalError);
102  }
103 }
104 
105 
106 template<class Type>
108 (
109  const wedgePointPatchField<Type>& ptf,
111 )
112 :
113  pointPatchField<Type>(ptf, iF)
114 {}
115 
116 
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 
119 template<class Type>
121 {
122  // In order to ensure that the wedge patch is always flat, take the
123  // normal vector from the first point
124  const vector& nHat = this->patch().pointNormals()[0];
125 
126  tmp<Field<Type> > tvalues =
127  transform(I - nHat*nHat, this->patchInternalField());
128 
129  // Get internal field to insert values into
130  Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
131 
132  setInInternalField(iF, tvalues());
133 }
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace Foam
139 
140 // ************************ vim: set sw=4 sts=4 et: ************************ //