cellSetSampledSet.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) 2020 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 "cellSetSampledSet.H"
27 #include "cellSet.H"
28 #include "polyMesh.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace sampledSets
36 {
37  defineTypeNameAndDebug(cellSetSampledSet, 0);
38  addToRunTimeSelectionTable(sampledSet, cellSetSampledSet, word);
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
45 void Foam::sampledSets::cellSetSampledSet::genSamples()
46 {
47  const labelList cells(cellSet(mesh(), setName_).toc());
48 
49  setSamples
50  (
51  List<point>(IndirectList<point>(mesh().cellCentres(), cells)),
52  cells,
53  labelList(cells.size(), -1),
54  labelList(cells.size(), 0),
55  scalarList(identity(cells.size()))
56  );
57 }
58 
59 
60 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
61 
63 (
64  const word& name,
65  const polyMesh& mesh,
66  const meshSearch& searchEngine,
67  const dictionary& dict
68 )
69 :
70  sampledSet(name, mesh, searchEngine, dict),
71  setName_(dict.lookup("set"))
72 {
73  genSamples();
74 
75  if (debug)
76  {
77  write(Info);
78  }
79 }
80 
81 
82 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
83 
85 {}
86 
87 
88 // ************************************************************************* //
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
Definition: meshSearch.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
cellSetSampledSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Macros for easy insertion into run-time selection tables.
dynamicFvMesh & mesh
const cellShapeList & cells
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:61
A class for handling words, derived from string.
Definition: word.H:59
List< scalar > scalarList
A List of scalars.
Definition: scalarList.H:50
List< label > labelList
A List of labels.
Definition: labelList.H:56
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
virtual bool write()
Sample and write.
Definition: sampledSets.C:228
messageStream Info
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
defineTypeNameAndDebug(arcUniform, 0)
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844