1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "fluentDataConverter.H"
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 Foam::fluentDataConverter::fluentDataConverter
33 const SLList<label>& fieldID,
34 const SLList<label>& zoneID,
35 const SLList<label>& firstID,
36 const SLList<label>& lastID,
37 const SLPtrList<FieldField<Field, scalar> >& zoneData
46 mesh.time().constant(),
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 Foam::tmp<Foam::volScalarField> Foam::fluentDataConverter::convertField
65 const word& fieldName,
66 const label unitNumber,
67 const dimensionedScalar& defaultValue
71 Info << "Creating field " << fieldName << " for unit "<< unitNumber << endl;
73 tmp<volScalarField> tresult
80 mesh_.time().timeName(),
89 volScalarField& result = tresult();
91 SLList<label>::const_iterator fieldIDIter = fieldID_.begin();
92 SLList<label>::const_iterator zoneIDIter = zoneID_.begin();
93 SLList<label>::const_iterator firstIDIter = firstID_.begin();
94 SLList<label>::const_iterator lastIDIter = lastID_.begin();
95 SLPtrList<FieldField<Field, scalar> >::const_iterator zoneDataIter =
101 fieldIDIter != fieldID_.end();
110 // Look for field index
111 if (fieldIDIter() == unitNumber)
113 Info<< "Found field ID for zone " << zoneIDIter();
115 word patchName = zoneToPatchName_[zoneIDIter()];
120 patchName == "unknown"
121 && zoneDataIter()[0].size() == mesh_.nCells()
124 Info<< " internal cell zone. Size = "
125 << mesh_.nCells() << endl;
126 result.internalField() = zoneDataIter()[0];
130 label patchID = mesh_.boundaryMesh().findPatchID(patchName);
134 Info<< " and patch " << patchName
135 << " with id " << patchID << endl;
137 result.boundaryField()[patchID] == zoneDataIter()[0];
141 Info<< " and patch not found" << endl;
151 // ************************************************************************* //