intersection with triangle plane for miss
[OpenFOAM-1.5.x.git] / src / finiteVolume / fvMesh / wallDist / wallDistData.C
blobc7b9debba84da83fd0b276a311103f490bc77cb7
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 "wallDistData.H"
28 #include "patchDataWave.H"
29 #include "wallPolyPatch.H"
30 #include "emptyFvPatchFields.H"
32 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
34 // Construct from components
35 template<class TransferType>
36 Foam::wallDistData<TransferType>::wallDistData
38     const Foam::fvMesh& mesh,
39     GeometricField<Type, fvPatchField, volMesh>& field,
40     const bool correctWalls
43     volScalarField
44     (
45         IOobject
46         (
47             "y",
48             mesh.time().timeName(),
49             mesh
50         ),
51         mesh,
52         dimensionedScalar("y", dimLength, GREAT)
53     ),
54     cellDistFuncs(mesh),
55     field_(field),
56     correctWalls_(correctWalls),
57     nUnset_(0)
59     correct();
63 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
65 template<class TransferType>
66 Foam::wallDistData<TransferType>::~wallDistData()
70 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
72 // Correct for mesh geom/topo changes
73 template<class TransferType>
74 void Foam::wallDistData<TransferType>::correct()
76     const polyMesh& mesh = cellDistFuncs::mesh();
78     //
79     // Fill data on wall patches with initial values
80     //
82     // Get patchids of walls
83     labelHashSet wallPatchIDs(getPatchIDs(wallPolyPatch::typeName));
85     // Collect pointers to data on patches
86     List<Field<Type>*> patchData(mesh.boundaryMesh().size());
88     forAll(field_.boundaryField(), patchI)
89     {
90         patchData[patchI] = &(field_.boundaryField()[patchI]);
91     }
93     // Do mesh wave
94     patchDataWave<TransferType> wave
95     (
96         mesh,
97         wallPatchIDs,
98         patchData,
99         correctWalls_
100     );
102     // Transfer cell values from wave into *this and field_
103     transfer(wave.distance());
105     field_.transfer(wave.cellData());
107     // Transfer values on patches into boundaryField of *this and field_
108     forAll(boundaryField(), patchI)
109     {
110         scalarField& waveFld = wave.patchDistance()[patchI];
112         if (boundaryField()[patchI].type() != emptyFvPatchScalarField::typeName)
113         {
114             boundaryField()[patchI].transfer(waveFld);
116             Field<Type>& wavePatchData = wave.patchData()[patchI];
118             field_.boundaryField()[patchI].transfer(wavePatchData);
119         }
120     }
122     // Transfer number of unset values
123     nUnset_ = wave.nUnset();
127 // ************************************************************************* //