triSurfPoints.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh 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.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "triSurfPoints.H"
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
36 :
37  points_(),
38  pointSubsets_()
39 {}
40 
42 :
43  points_(points),
44  pointSubsets_()
45 {}
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Destructor
50 {}
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
55 {
56  label id = pointSubsetIndex(subsetName);
57  if( id >= 0 )
58  {
59  Warning << "Point subset " << subsetName << " already exists!" << endl;
60  return id;
61  }
62 
63  id = 0;
65  id = Foam::max(id, it.key()+1);
66 
67  pointSubsets_.insert
68  (
69  id,
71  );
72 
73  return id;
74 }
75 
77 {
78  if( pointSubsets_.find(subsetID) == pointSubsets_.end() )
79  return;
80 
81  pointSubsets_.erase(subsetID);
82 }
83 
85 {
87  if( it == pointSubsets_.end() )
88  {
89  Warning << "Subset " << subsetID << " is not a point subset" << endl;
90  return word();
91  }
92 
93  return it().name();
94 }
95 
96 label triSurfPoints::pointSubsetIndex(const word& subsetName) const
97 {
99  {
100  if( it().name() == subsetName )
101  return it.key();
102  }
103 
104  return -1;
105 }
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 } // End namespace Foam
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::triSurfPoints::pointSubsetName
word pointSubsetName(const label) const
Definition: triSurfPoints.C:84
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::triSurfPoints::triSurfPoints
triSurfPoints()
Null constructor.
Definition: triSurfPoints.C:35
Foam::Warning
messageStream Warning
Foam::HashTable::const_iterator
An STL-conforming const_iterator.
Definition: HashTable.H:470
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: PrimitivePatchTemplate.H:68
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::triSurfPoints::addPointSubset
label addPointSubset(const word &)
point subsets
Definition: triSurfPoints.C:54
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::meshSubset
Definition: meshSubset.H:55
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
triSurfPoints.H
Foam::triSurfPoints::removePointSubset
void removePointSubset(const label)
Definition: triSurfPoints.C:76
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::triSurfPoints::pointSubsets_
Map< meshSubset > pointSubsets_
map of point subsets
Definition: triSurfPoints.H:58
Foam::meshSubset::POINTSUBSET
@ POINTSUBSET
Definition: meshSubset.H:77
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::triSurfPoints::pointSubsetIndex
label pointSubsetIndex(const word &) const
Definition: triSurfPoints.C:96
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::triSurfPoints::~triSurfPoints
~triSurfPoints()
Definition: triSurfPoints.C:49