distributedTriSurfaceMeshTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
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 
27 #include "triSurfaceFields.H"
28 #include "mapDistribute.H"
29 
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 
32 //template<class Type>
33 //void Foam::distributedTriSurfaceMesh::getField
34 //(
35 // const word& fieldName,
36 // const List<pointIndexHit>& info,
37 // List<Type>& values
38 //) const
39 //{
40 // typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField;
41 //
42 //
43 // // Get query data (= local index of triangle)
44 // // ~~~~~~~~~~~~~~
45 //
46 // labelList triangleIndex(info.size());
47 // autoPtr<mapDistribute> mapPtr
48 // (
49 // calcLocalQueries
50 // (
51 // info,
52 // triangleIndex
53 // )
54 // );
55 // const mapDistribute& map = mapPtr();
56 //
57 //
58 // // Do my tests
59 // // ~~~~~~~~~~~
60 //
61 // const DimensionedSurfField& fld = lookupObject<DimensionedSurfField>
62 // (
63 // fieldName
64 // );
65 // const triSurface& s = static_cast<const triSurface&>(*this);
66 //
67 // values.setSize(triangleIndex.size());
68 //
69 // forAll(triangleIndex, i)
70 // {
71 // label triI = triangleIndex[i];
72 // values[i] = fld[triI];
73 // }
74 //
75 //
76 // // Send back results
77 // // ~~~~~~~~~~~~~~~~~
78 //
79 // map.reverseDistribute(info.size(), values);
80 //}
81 
82 
83 template<class Type>
84 void Foam::distributedTriSurfaceMesh::distributeFields
85 (
86  const mapDistribute& map
87 )
88 {
89  typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField;
90 
91  HashTable<DimensionedSurfField*> fields
92  (
93  objectRegistry::lookupClass<DimensionedSurfField>()
94  );
95 
96  for
97  (
99  fields.begin();
100  fieldIter != fields.end();
101  ++fieldIter
102  )
103  {
104  DimensionedSurfField& field = *fieldIter();
105 
106  label oldSize = field.size();
107 
108  map.distribute(field);
109 
110  if (debug)
111  {
112  Info<< "Mapped " << field.typeName << ' ' << field.name()
113  << " from size " << oldSize << " to size " << field.size()
114  << endl;
115  }
116  }
117 }
118 
119 
120 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Fields for triSurface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Info<< "Calculating turbulent flame speed field St\"<< endl;volScalarField St(IOobject("St", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:228
messageStream Info
friend class iterator
Declare friendship with the iterator.
Definition: HashTable.H:194