BUG: PointEdgeWave : n cyclics bool instead of label
[OpenFOAM-1.6.x.git] / src / topoChangerFvMesh / rawTopoChangerFvMesh / rawTopoChangerFvMeshTemplates.C
blob0be03061863430d44565d4abe6ad5b4f8adb2b9a
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 "rawTopoChangerFvMesh.H"
28 #include "Time.H"
30 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
32 template<class Type, template<class> class PatchField, class GeoMesh>
33 void Foam::rawTopoChangerFvMesh::setUnmappedValues
35     GeometricField<Type, PatchField, GeoMesh>& fld,
36     const PackedList<1>& mappedFace,
37     const GeometricField<Type, PatchField, GeoMesh>& baseFld
40     //Pout<< "Checking field " << fld.name() << endl;
42     forAll(fld.boundaryField(), patchI)
43     {
44         PatchField<Type>& fvp = const_cast<PatchField<Type>&>
45         (
46             fld.boundaryField()[patchI]
47         );
49         label start = fvp.patch().patch().start();
50         forAll(fvp, i)
51         {
52             if (!mappedFace[start+i])
53             {
54                 //Pout<< "** Resetting unassigned value on patch "
55                 //    << fvp.patch().name()
56                 //    << " localface:" << i
57                 //    << " to:" << baseFld.boundaryField()[patchI][i] << endl;
58                 fvp[i] = baseFld.boundaryField()[patchI][i];
59             }
60         }
61     }
65 template<class Type, template<class> class PatchField, class GeoMesh>
66 void Foam::rawTopoChangerFvMesh::zeroUnmappedValues
68     const PackedList<1>& mappedFace
69 ) const
71     typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
73     const wordList fldNames(names(FieldType::typeName));
75     forAll(fldNames, i)
76     {
77         //Pout<< "Checking field " << fldNames[i] << endl;
79         FieldType& fld = const_cast<FieldType&>
80         (
81             lookupObject<FieldType>(fldNames[i])
82         );
84         setUnmappedValues
85         (
86             fld,
87             mappedFace,
88             FieldType
89             (
90                 IOobject
91                 (
92                     "zero",
93                     time().timeName(),
94                     *this,
95                     IOobject::NO_READ,
96                     IOobject::NO_WRITE,
97                     false
98                 ),
99                 *this,
100                 dimensioned<Type>("0", fld.dimensions(), pTraits<Type>::zero)
101             )
102         );
103     }
107 // ************************************************************************* //