distributedTriSurfaceTemplates.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-2026 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 
26 #include "distributedTriSurface.H"
27 #include "distributionMap.H"
28 
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
30 
31 //template<class Type>
32 //void Foam::distributedTriSurface::getField
33 //(
34 // const word& fieldName,
35 // const List<pointIndexHit>& info,
36 // List<Type>& values
37 //) const
38 //{
39 // // Get query data (= local index of triangle)
40 // // ~~~~~~~~~~~~~~
41 //
42 // labelList triangleIndex(info.size());
43 // autoPtr<distributionMap> mapPtr
44 // (
45 // calcLocalQueries
46 // (
47 // info,
48 // triangleIndex
49 // )
50 // );
51 // const distributionMap& map = mapPtr();
52 //
53 //
54 // // Do my tests
55 // // ~~~~~~~~~~~
56 //
57 // const IOField<Type>& fld = lookupObject<IOField<Type>>
58 // (
59 // fieldName
60 // );
61 // const Foam::triSurface& s = static_cast<const Foam::triSurface&>(*this);
62 //
63 // values.setSize(triangleIndex.size());
64 //
65 // forAll(triangleIndex, i)
66 // {
67 // label triI = triangleIndex[i];
68 // values[i] = fld[triI];
69 // }
70 //
71 //
72 // // Send back results
73 // // ~~~~~~~~~~~~~~~~~
74 //
75 // map.reverseDistribute(info.size(), values);
76 //}
77 
78 
79 template<class Type>
80 void Foam::searchableSurfaces::distributedTriSurface::distributeFields
81 (
82  const distributionMap& map
83 )
84 {
85  HashTable<IOField<Type>*> fields
86  (
87  objectRegistry::lookupClass<IOField<Type>>()
88  );
89 
90  for
91  (
92  typename HashTable<IOField<Type>*>::iterator fieldIter =
93  fields.begin();
94  fieldIter != fields.end();
95  ++fieldIter
96  )
97  {
98  IOField<Type>& field = *fieldIter();
99 
100  label oldSize = field.size();
101 
102  map.distribute(field);
103 
104  if (debug)
105  {
106  Info<< "Mapped " << field.typeName << ' ' << field.name()
107  << " from size " << oldSize << " to size " << field.size()
108  << endl;
109  }
110  }
111 }
112 
113 
114 // ************************************************************************* //
friend class iterator
Declare friendship with the iterator.
Definition: HashTable.H:194
HashTable(const label size=128)
Construct given initial table size.
Definition: HashTable.C:36
HashTable< const Type * > lookupClass(const bool strict=false) const
Lookup and return all objects of the given Type.
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:234
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info