1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
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.
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
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/>.
26 \*---------------------------------------------------------------------------*/
28 #include "triSurfFacets.H"
29 #include "pointIOField.H"
30 #include "IOobjectList.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 triSurfFacets::triSurfFacets()
45 triSurfFacets::triSurfFacets(const LongList<labelledTri>& triangles)
47 triangles_(triangles),
51 forAll(triangles_, triI)
52 triangles_[triI].region() = 0;
54 patches_[0].name() = "patch";
57 triSurfFacets::triSurfFacets
59 const LongList<labelledTri>& triangles,
60 const geometricSurfacePatchList& patches
63 triangles_(triangles),
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 triSurfFacets::~triSurfFacets()
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 label triSurfFacets::addFacetSubset(const word& subsetName)
77 label id = facetSubsetIndex(subsetName);
80 Warning << "Point subset " << subsetName << " already exists!" << endl;
85 forAllConstIter(Map<meshSubset>, facetSubsets_, it)
86 id = Foam::max(id, it.key()+1);
91 meshSubset(subsetName, meshSubset::FACESUBSET)
97 void triSurfFacets::removeFacetSubset(const label subsetID)
99 if( facetSubsets_.find(subsetID) == facetSubsets_.end() )
102 facetSubsets_.erase(subsetID);
105 word triSurfFacets::facetSubsetName(const label subsetID) const
107 Map<meshSubset>::const_iterator it = facetSubsets_.find(subsetID);
108 if( it == facetSubsets_.end() )
110 Warning << "Subset " << subsetID << " is not a facet subset" << endl;
117 label triSurfFacets::facetSubsetIndex(const word& subsetName) const
119 forAllConstIter(Map<meshSubset>, facetSubsets_, it)
121 if( it().name() == subsetName )
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 } // End namespace Foam
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //