distributedTriSurfaceMeshTemplates.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-2013 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 #include "triSurfaceFields.H"
31 #include "mapDistribute.H"
32 
33 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34 
35 //template<class Type>
36 //void Foam::distributedTriSurfaceMesh::getField
37 //(
38 // const word& fieldName,
39 // const List<pointIndexHit>& info,
40 // List<Type>& values
41 //) const
42 //{
43 // typedef DimensionedField<Type, triSurfaceGeoMesh> fieldType;
44 //
45 // // Get query data (= local index of triangle)
46 // // ~~~~~~~~~~~~~~
47 //
48 // labelList triangleIndex(info.size());
49 // autoPtr<mapDistribute> mapPtr
50 // (
51 // calcLocalQueries
52 // (
53 // info,
54 // triangleIndex
55 // )
56 // );
57 // const mapDistribute& map = mapPtr();
58 //
59 //
60 // // Do my tests
61 // // ~~~~~~~~~~~
62 //
63 // const auto& fld = lookupObject<fieldType>(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> fieldType;
90 
91  HashTable<fieldType*> fields
92  (
93  objectRegistry::lookupClass<fieldType>()
94  );
95 
96  forAllIters(fields, fieldIter)
97  {
98  fieldType& field = *fieldIter();
99 
100  const label oldSize = field.size();
101 
102  map.distribute(field);
103 
104  DebugInfo
105  << "Mapped " << field.typeName << ' ' << field.name()
106  << " from size " << oldSize << " to size " << field.size() << endl;
107  }
108 }
109 
110 
111 // ************************************************************************* //
distributedTriSurfaceMesh.H
triSurfaceFields.H
Fields for triSurface.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
field
rDeltaTY field()
forAllIters
#define forAllIters(container, iter)
Iterate across all elements in the container object.
Definition: stdFoam.H:223
DebugInfo
#define DebugInfo
Report an information message using Foam::Info.
Definition: messageStream.H:382
mapDistribute.H
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97