rawTopoChangerFvMeshTemplates.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29#include "Time.H"
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32
33template<class Type, template<class> class PatchField, class GeoMesh>
34void Foam::rawTopoChangerFvMesh::setUnmappedValues
35(
36 GeometricField<Type, PatchField, GeoMesh>& fld,
37 const bitSet& mappedFace,
38 const GeometricField<Type, PatchField, GeoMesh>& baseFld
39)
40{
41 //Pout<< "Checking field " << fld.name() << endl;
42
43 forAll(fld.boundaryField(), patchi)
44 {
45 PatchField<Type>& fvp = const_cast<PatchField<Type>&>
46 (
47 fld.boundaryField()[patchi]
48 );
49
50 const label start = fvp.patch().start();
51 forAll(fvp, i)
52 {
53 if (!mappedFace[start+i])
54 {
55 //Pout<< "** Resetting unassigned value on patch "
56 // << fvp.patch().name()
57 // << " localface:" << i
58 // << " to:" << baseFld.boundaryField()[patchi][i] << endl;
59 fvp[i] = baseFld.boundaryField()[patchi][i];
60 }
61 }
62 }
63}
64
65
66template<class Type, template<class> class PatchField, class GeoMesh>
67void Foam::rawTopoChangerFvMesh::zeroUnmappedValues
68(
69 const bitSet& mappedFace
70) const
71{
72 typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
73
74 const wordList fldNames(names(FieldType::typeName));
75
76 forAll(fldNames, i)
77 {
78 //Pout<< "Checking field " << fldNames[i] << endl;
79
80 FieldType& fld = lookupObjectRef<FieldType>(fldNames[i]);
81
82 setUnmappedValues
83 (
84 fld,
85 mappedFace,
86 FieldType
87 (
88 IOobject
89 (
90 "zero",
91 time().timeName(),
92 *this,
95 false
96 ),
97 *this,
98 dimensioned<Type>(fld.dimensions(), Zero)
99 )
100 );
101 }
102}
103
104
105// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
word timeName
Definition: getTimeIndex.H:3
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List< word > wordList
A List of words.
Definition: fileName.H:63
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333